| ... | ... | @@ -202,6 +202,8 @@ pub const clock_t = isize; |
| 202 | 202 | pub const socklen_t = u32; |
| 203 | 203 | pub const suseconds_t = c_long; |
| 204 | 204 | |
| 205 | pub const id_t = i64; |
| 206 | |
| 205 | 207 | /// Renamed from `kevent` to `Kevent` to avoid conflict with function name. |
| 206 | 208 | pub const Kevent = extern struct { |
| 207 | 209 | /// Identifier for this event. |
| ... | ... | @@ -1947,3 +1949,128 @@ pub const MFD = struct { |
| 1947 | 1949 | |
| 1948 | 1950 | pub extern "c" fn memfd_create(name: [*:0]const u8, flags: c_uint) c_int; |
| 1949 | 1951 | pub extern "c" fn copy_file_range(fd_in: fd_t, off_in: ?*off_t, fd_out: fd_t, off_out: ?*off_t, len: usize, flags: u32) usize; |
| 1952 | |
| 1953 | pub const idtype_t = enum(c_int) { |
| 1954 | P_PID = 0, |
| 1955 | P_PPID = 1, |
| 1956 | P_PGID = 2, |
| 1957 | P_SID = 3, |
| 1958 | P_CID = 4, |
| 1959 | P_UID = 5, |
| 1960 | P_GID = 6, |
| 1961 | P_ALL = 7, |
| 1962 | P_LWPID = 8, |
| 1963 | P_TASKID = 9, |
| 1964 | P_PROJID = 10, |
| 1965 | P_POOLID = 11, |
| 1966 | P_JAILID = 12, |
| 1967 | P_CTID = 13, |
| 1968 | P_CPUID = 14, |
| 1969 | P_PSETID = 15, |
| 1970 | }; |
| 1971 | |
| 1972 | pub const PROC = struct { |
| 1973 | // constants for the id_t argument |
| 1974 | pub const SPROTECT: id_t = 1; |
| 1975 | pub const REAP_ACQUIRE: id_t = 2; |
| 1976 | pub const REAP_RELEASE: id_t = 3; |
| 1977 | pub const REAP_STATUS: id_t = 4; |
| 1978 | pub const REAP_GETPIDS: id_t = 5; |
| 1979 | pub const REAP_KILL: id_t = 6; |
| 1980 | pub const TRACE_CTL: id_t = 7; |
| 1981 | pub const TRACE_STATUS: id_t = 8; |
| 1982 | pub const TRACECAP_CTL = 9; |
| 1983 | pub const TRACECAP_STATUS: id_t = 10; |
| 1984 | pub const PDEATHSIG_CTL: id_t = 11; |
| 1985 | pub const PDEATHSIG_STATUS: id_t = 12; |
| 1986 | pub const ASLR_CTL: id_t = 13; |
| 1987 | pub const ASLR_STATUS: id_t = 14; |
| 1988 | pub const PROTMAX_CTL: id_t = 15; |
| 1989 | pub const PROTMAX_STATUS: id_t = 16; |
| 1990 | pub const STACKGAP_CTL: id_t = 17; |
| 1991 | pub const STACKGAP_STATUS: id_t = 18; |
| 1992 | pub const NO_NEW_PRIVS_CTL: id_t = 19; |
| 1993 | pub const NO_NEW_PRIVS_STATUS: id_t = 20; |
| 1994 | pub const WXMAP_CTL: id_t = 21; |
| 1995 | pub const WXMAP_STATUS: id_t = 22; |
| 1996 | |
| 1997 | // constants for the operations |
| 1998 | pub const TRACE_CTL_ENABLE = 1; |
| 1999 | pub const TRACE_CTL_DISABLE = 2; |
| 2000 | pub const TRACE_CTL_DISABLE_EXEC = 3; |
| 2001 | pub const TRAPCAP_CTL_ENABLE = 1; |
| 2002 | pub const TRAPCAP_CTL_DISABLE = 2; |
| 2003 | pub const ASLR_FORCE_ENABLE = 1; |
| 2004 | pub const ASLR_FORCE_DISABLE = 2; |
| 2005 | pub const ASLR_FORCE_NOFORCE = 3; |
| 2006 | pub const ASLR_FORCE_ACTIVE = 0x80000000; |
| 2007 | pub const PROTMAX_FORCE_ENABLE = 1; |
| 2008 | pub const PROTMAX_FORCE_DISABLE = 2; |
| 2009 | pub const PROTMAX_FORCE_NOFORCE = 3; |
| 2010 | pub const PROTMAX_FORCE_ACTIVE = 0x80000000; |
| 2011 | pub const STACKGAP_ENABLE = 0x0001; |
| 2012 | pub const STACKGAP_DISABLE = 0x0002; |
| 2013 | pub const STACKGAP_ENABLE_EXEC = 0x0004; |
| 2014 | pub const STACKGAP_DISABLE_EXEC = 0x0008; |
| 2015 | pub const NO_NEW_PRIVS_ENABLE = 1; |
| 2016 | pub const NO_NEW_PRIVS_DISABLE = 2; |
| 2017 | pub const WX_MAPPINGS_PERMIT = 0x0001; |
| 2018 | pub const WX_MAPPINGS_DISALLOW_EXEC = 0x0002; |
| 2019 | pub const WX_MAPPINGS_ENFORCE = 0x80000000; |
| 2020 | }; |
| 2021 | |
| 2022 | pub const PPROT = struct { |
| 2023 | pub fn OP(x: i32) i32 { |
| 2024 | return x & 0xf; |
| 2025 | } |
| 2026 | pub const SET = 1; |
| 2027 | pub const CLEAR = 2; |
| 2028 | pub fn FLAGS(x: i32) i32 { |
| 2029 | return x & !0xf; |
| 2030 | } |
| 2031 | pub const DESCEND = 0x10; |
| 2032 | pub const INHERIT = 0x20; |
| 2033 | }; |
| 2034 | |
| 2035 | pub const REAPER = struct { |
| 2036 | pub const STATUS_OWNED = 0x00000001; |
| 2037 | pub const STATUS_REALINIT = 0x00000002; |
| 2038 | pub const PIDINFO_VALID = 0x00000001; |
| 2039 | pub const PIDINFO_CHILD = 0x00000002; |
| 2040 | pub const PIDINFO_REAPER = 0x00000004; |
| 2041 | pub const KILL_CHILDREN = 0x00000001; |
| 2042 | pub const KILL_SUBTREE = 0x00000002; |
| 2043 | }; |
| 2044 | |
| 2045 | pub const procctl_reaper_status = extern struct { |
| 2046 | rs_flags: u32, |
| 2047 | rs_children: u32, |
| 2048 | rs_descendants: u32, |
| 2049 | rs_reaper: pid_t, |
| 2050 | rs_pid: pid_t, |
| 2051 | rs_pad0: [15]u32, |
| 2052 | }; |
| 2053 | |
| 2054 | pub const procctl_reaper_pidinfo = extern struct { |
| 2055 | pi_pid: pid_t, |
| 2056 | pi_subtree: pid_t, |
| 2057 | pi_flags: u32, |
| 2058 | pi_pad0: [15]u32, |
| 2059 | }; |
| 2060 | |
| 2061 | pub const procctl_reaper_pids = extern struct { |
| 2062 | rp_count: u32, |
| 2063 | rp_pad0: [15]u32, |
| 2064 | rp_pids: [*]procctl_reaper_pidinfo, |
| 2065 | }; |
| 2066 | |
| 2067 | pub const procctl_reaper_kill = extern struct { |
| 2068 | rk_sig: c_int, |
| 2069 | rk_flags: u32, |
| 2070 | rk_subtree: pid_t, |
| 2071 | rk_killed: u32, |
| 2072 | rk_fpid: pid_t, |
| 2073 | rk_pad0: [15]u32, |
| 2074 | }; |
| 2075 | |
| 2076 | pub extern "c" fn procctl(idtype: idtype_t, id: id_t, cmd: c_int, data: ?*anyopaque) c_int; |