mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 13:22:07 +00:00
Lost in the merge
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user