Commit 2952fb9758

David CARLIER <devnexen@gmail.com>
2023-05-14 18:40:27
std.c: add rfork for freebsd
1 parent 2ce9122
Changed files (1)
lib
lib/std/c/freebsd.zig
@@ -2666,3 +2666,41 @@ pub fn IOW(op: u8, nr: u8, comptime IT: type) u32 {
 pub fn IOWR(op: u8, nr: u8, comptime IT: type) u32 {
     return ioImpl(ioctl_cmd.INOUT, op, nr, @sizeOf(IT));
 }
+
+pub const RF = struct {
+    pub const NAMEG = 1 << 0;
+    pub const ENVG = 1 << 1;
+    /// copy file descriptors table
+    pub const FDG = 1 << 2;
+    pub const NOTEG = 1 << 3;
+    /// creates a new process
+    pub const PROC = 1 << 4;
+    /// shares address space
+    pub const MEM = 1 << 5;
+    /// detaches the child
+    pub const NOWAIT = 1 << 6;
+    pub const CNAMEG = 1 << 10;
+    pub const CENVG = 1 << 11;
+    /// distinct file descriptor table
+    pub const CFDG = 1 << 12;
+    /// thread support
+    pub const THREAD = 1 << 13;
+    /// shares signal handlers
+    pub const SIGSHARE = 1 << 14;
+    /// emits SIGUSR1 on exit
+    pub const LINUXTHPN = 1 << 16;
+    /// child in stopped state
+    pub const STOPPED = 1 << 17;
+    /// use high pid id
+    pub const HIGHPID = 1 << 18;
+    /// selects signal flag for parent notification
+    pub const SIGSZMB = 1 << 19;
+    pub fn SIGNUM(f: u32) u32 {
+        return f >> 20;
+    }
+    pub fn SIGFLAGS(f: u32) u32 {
+        return f << 20;
+    }
+};
+
+pub extern "c" fn rfork(flags: c_int) c_int;