os/linux: fix rlimit_resource for mips/sparcv9

On MIPS and SPARC the RLIMIT kinds have different numbers than the other
architectures.
This commit is contained in:
Vincent Rischmann 2021-10-10 13:57:29 +02:00
parent 796687f156
commit 353c59e6d5
3 changed files with 166 additions and 43 deletions

View File

@ -4197,65 +4197,68 @@ pub const ifreq = extern struct {
}; };
// doc comments copied from musl // doc comments copied from musl
pub const rlimit_resource = enum(c_int) { pub const rlimit_resource = if (native_arch.isMIPS() or native_arch.isSPARC())
/// Per-process CPU limit, in seconds. arch_bits.rlimit_resource
CPU, else
enum(c_int) {
/// Per-process CPU limit, in seconds.
CPU,
/// Largest file that can be created, in bytes. /// Largest file that can be created, in bytes.
FSIZE, FSIZE,
/// Maximum size of data segment, in bytes. /// Maximum size of data segment, in bytes.
DATA, DATA,
/// Maximum size of stack segment, in bytes. /// Maximum size of stack segment, in bytes.
STACK, STACK,
/// Largest core file that can be created, in bytes. /// Largest core file that can be created, in bytes.
CORE, CORE,
/// Largest resident set size, in bytes. /// Largest resident set size, in bytes.
/// This affects swapping; processes that are exceeding their /// This affects swapping; processes that are exceeding their
/// resident set size will be more likely to have physical memory /// resident set size will be more likely to have physical memory
/// taken from them. /// taken from them.
RSS, RSS,
/// Number of processes. /// Number of processes.
NPROC, NPROC,
/// Number of open files. /// Number of open files.
NOFILE, NOFILE,
/// Locked-in-memory address space. /// Locked-in-memory address space.
MEMLOCK, MEMLOCK,
/// Address space limit. /// Address space limit.
AS, AS,
/// Maximum number of file locks. /// Maximum number of file locks.
LOCKS, LOCKS,
/// Maximum number of pending signals. /// Maximum number of pending signals.
SIGPENDING, SIGPENDING,
/// Maximum bytes in POSIX message queues. /// Maximum bytes in POSIX message queues.
MSGQUEUE, MSGQUEUE,
/// Maximum nice priority allowed to raise to. /// Maximum nice priority allowed to raise to.
/// Nice levels 19 .. -20 correspond to 0 .. 39 /// Nice levels 19 .. -20 correspond to 0 .. 39
/// values of this resource limit. /// values of this resource limit.
NICE, NICE,
/// Maximum realtime priority allowed for non-priviledged /// Maximum realtime priority allowed for non-priviledged
/// processes. /// processes.
RTPRIO, RTPRIO,
/// Maximum CPU time in µs that a process scheduled under a real-time /// Maximum CPU time in µs that a process scheduled under a real-time
/// scheduling policy may consume without making a blocking system /// scheduling policy may consume without making a blocking system
/// call before being forcibly descheduled. /// call before being forcibly descheduled.
RTTIME, RTTIME,
_, _,
}; };
pub const rlim_t = u64; pub const rlim_t = u64;

View File

@ -769,3 +769,63 @@ pub const timezone = extern struct {
}; };
pub const Elf_Symndx = u32; pub const Elf_Symndx = u32;
pub const rlimit_resource = enum(c_int) {
/// Per-process CPU limit, in seconds.
CPU,
/// Largest file that can be created, in bytes.
FSIZE,
/// Maximum size of data segment, in bytes.
DATA,
/// Maximum size of stack segment, in bytes.
STACK,
/// Largest core file that can be created, in bytes.
CORE,
/// Number of open files.
NOFILE,
/// Address space limit.
AS,
/// Largest resident set size, in bytes.
/// This affects swapping; processes that are exceeding their
/// resident set size will be more likely to have physical memory
/// taken from them.
RSS,
/// Number of processes.
NPROC,
/// Locked-in-memory address space.
MEMLOCK,
/// Maximum number of file locks.
LOCKS,
/// Maximum number of pending signals.
SIGPENDING,
/// Maximum bytes in POSIX message queues.
MSGQUEUE,
/// Maximum nice priority allowed to raise to.
/// Nice levels 19 .. -20 correspond to 0 .. 39
/// values of this resource limit.
NICE,
/// Maximum realtime priority allowed for non-priviledged
/// processes.
RTPRIO,
/// Maximum CPU time in µs that a process scheduled under a real-time
/// scheduling policy may consume without making a blocking system
/// call before being forcibly descheduled.
RTTIME,
_,
};

View File

@ -828,3 +828,63 @@ pub const ucontext_t = extern struct {
stack: stack_t, stack: stack_t,
sigmask: sigset_t, sigmask: sigset_t,
}; };
pub const rlimit_resource = enum(c_int) {
/// Per-process CPU limit, in seconds.
CPU,
/// Largest file that can be created, in bytes.
FSIZE,
/// Maximum size of data segment, in bytes.
DATA,
/// Maximum size of stack segment, in bytes.
STACK,
/// Largest core file that can be created, in bytes.
CORE,
/// Largest resident set size, in bytes.
/// This affects swapping; processes that are exceeding their
/// resident set size will be more likely to have physical memory
/// taken from them.
RSS,
/// Number of open files.
NOFILE,
/// Number of processes.
NPROC,
/// Locked-in-memory address space.
MEMLOCK,
/// Address space limit.
AS,
/// Maximum number of file locks.
LOCKS,
/// Maximum number of pending signals.
SIGPENDING,
/// Maximum bytes in POSIX message queues.
MSGQUEUE,
/// Maximum nice priority allowed to raise to.
/// Nice levels 19 .. -20 correspond to 0 .. 39
/// values of this resource limit.
NICE,
/// Maximum realtime priority allowed for non-priviledged
/// processes.
RTPRIO,
/// Maximum CPU time in µs that a process scheduled under a real-time
/// scheduling policy may consume without making a blocking system
/// call before being forcibly descheduled.
RTTIME,
_,
};