Lost in the merge

This commit is contained in:
Jarred Sumner
2024-03-15 02:55:11 +01:00
parent 8f5c4aaefd
commit 58d45da47e
3 changed files with 14 additions and 5 deletions

View File

@@ -642,6 +642,8 @@ pub const WaiterThread = if (Environment.isPosix) WaiterThreadPosix else struct
}
pub fn setShouldUseWaiterThread() void {}
pub fn reloadHandlers() void {}
};
// Machines which do not support pidfd_open (GVisor, Linux Kernel < 5.6)
@@ -830,8 +832,10 @@ const WaiterThreadPosix = struct {
_ = bun.sys.write(instance.eventfd, &one).unwrap() catch 0;
}
pub fn loop() void {
Output.Source.configureNamedThread("Waitpid");
pub fn reloadHandlers() void {
if (!should_use_waiter_thread) {
return;
}
if (comptime Environment.isLinux) {
var current_mask = std.os.empty_sigset;
@@ -841,10 +845,13 @@ const WaiterThreadPosix = struct {
.mask = current_mask,
.flags = std.os.SA.NOCLDSTOP,
};
// create a SIGCHLD handler for monitoring child processes
std.os.sigaction(std.os.SIG.CHLD, &act, null) catch {};
}
}
pub fn loop() void {
Output.Source.configureNamedThread("Waitpid");
reloadHandlers();
var this = &instance;
outer: while (true) {

View File

@@ -1,5 +1,6 @@
// when we don't want to use @cInclude, we can just stick wrapper functions here
#include "root.h"
#include <csignal>
#include <cstdint>
#if !OS(WINDOWS)
@@ -295,7 +296,7 @@ static inline void make_pos_h_l(unsigned long* pos_h, unsigned long* pos_l,
extern "C" ssize_t sys_preadv2(int fd, const struct iovec* iov, int iovcnt,
off_t offset, unsigned int flags)
{
return syscall(SYS_preadv2, fd, iov, iovcnt, offset, offset>>32, RWF_NOWAIT);
return syscall(SYS_preadv2, fd, iov, iovcnt, offset, offset >> 32, RWF_NOWAIT);
}
extern "C" ssize_t sys_pwritev2(int fd, const struct iovec* iov, int iovcnt,
off_t offset, unsigned int flags)

View File

@@ -46,7 +46,7 @@ pub fn reloadHandlers() !void {
};
try setup_sigactions(&act);
@import("root").bun.spawn.WaiterThread.reloadHandlers();
bun_ignore_sigpipe();
}
const os = std.os;
@@ -59,6 +59,7 @@ pub fn start() !void {
try setup_sigactions(&act);
bun_ignore_sigpipe();
@import("root").bun.spawn.WaiterThread.reloadHandlers();
}
extern fn bun_ignore_sigpipe() void;