authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-16 11:08:56+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-18 07:27:23+02:00
loged9a502dffa8db45ef2f73edcbd20c52e26c548f
treef836777fda4ccc9ec39a3b6cc9247d8c5f098a2d
parentd4973c992203ed6fb761d3f3b871dd9849541b5a

std.os.linux: Fix rlimit_resource for mips64; move out of arch bits.

It is usually generic, so no point having it in arch bits.

4 files changed, 159 insertions(+), 226 deletions(-)

lib/std/os/linux.zig+159-46
...@@ -6817,53 +6817,166 @@ pub const ifreq = extern struct {...@@ -6817,53 +6817,166 @@ pub const ifreq = extern struct {
6817};6817};
68186818
6819// doc comments copied from musl6819// doc comments copied from musl
6820pub const rlimit_resource = if (native_arch.isMIPS() or native_arch.isSPARC())6820pub const rlimit_resource = if (native_arch.isMIPS()) enum(c_int) {
6821 arch_bits.rlimit_resource6821 /// Per-process CPU limit, in seconds.
6822else6822 CPU = 0,
6823 enum(c_int) {
6824 /// Per-process CPU limit, in seconds.
6825 CPU,
6826 /// Largest file that can be created, in bytes.
6827 FSIZE,
6828 /// Maximum size of data segment, in bytes.
6829 DATA,
6830 /// Maximum size of stack segment, in bytes.
6831 STACK,
6832 /// Largest core file that can be created, in bytes.
6833 CORE,
6834 /// Largest resident set size, in bytes.
6835 /// This affects swapping; processes that are exceeding their
6836 /// resident set size will be more likely to have physical memory
6837 /// taken from them.
6838 RSS,
6839 /// Number of processes.
6840 NPROC,
6841 /// Number of open files.
6842 NOFILE,
6843 /// Locked-in-memory address space.
6844 MEMLOCK,
6845 /// Address space limit.
6846 AS,
6847 /// Maximum number of file locks.
6848 LOCKS,
6849 /// Maximum number of pending signals.
6850 SIGPENDING,
6851 /// Maximum bytes in POSIX message queues.
6852 MSGQUEUE,
6853 /// Maximum nice priority allowed to raise to.
6854 /// Nice levels 19 .. -20 correspond to 0 .. 39
6855 /// values of this resource limit.
6856 NICE,
6857 /// Maximum realtime priority allowed for non-privileged
6858 /// processes.
6859 RTPRIO,
6860 /// Maximum CPU time in µs that a process scheduled under a real-time
6861 /// scheduling policy may consume without making a blocking system
6862 /// call before being forcibly descheduled.
6863 RTTIME,
68646823
6865 _,6824 /// Largest file that can be created, in bytes.
6866 };6825 FSIZE = 1,
6826
6827 /// Maximum size of data segment, in bytes.
6828 DATA = 2,
6829
6830 /// Maximum size of stack segment, in bytes.
6831 STACK = 3,
6832
6833 /// Largest core file that can be created, in bytes.
6834 CORE = 4,
6835
6836 /// Number of open files.
6837 NOFILE = 5,
6838
6839 /// Address space limit.
6840 AS = 6,
6841
6842 /// Largest resident set size, in bytes.
6843 /// This affects swapping; processes that are exceeding their
6844 /// resident set size will be more likely to have physical memory
6845 /// taken from them.
6846 RSS = 7,
6847
6848 /// Number of processes.
6849 NPROC = 8,
6850
6851 /// Locked-in-memory address space.
6852 MEMLOCK = 9,
6853
6854 /// Maximum number of file locks.
6855 LOCKS = 10,
6856
6857 /// Maximum number of pending signals.
6858 SIGPENDING = 11,
6859
6860 /// Maximum bytes in POSIX message queues.
6861 MSGQUEUE = 12,
6862
6863 /// Maximum nice priority allowed to raise to.
6864 /// Nice levels 19 .. -20 correspond to 0 .. 39
6865 /// values of this resource limit.
6866 NICE = 13,
6867
6868 /// Maximum realtime priority allowed for non-privileged
6869 /// processes.
6870 RTPRIO = 14,
6871
6872 /// Maximum CPU time in µs that a process scheduled under a real-time
6873 /// scheduling policy may consume without making a blocking system
6874 /// call before being forcibly descheduled.
6875 RTTIME = 15,
6876
6877 _,
6878} else if (native_arch.isSPARC()) enum(c_int) {
6879 /// Per-process CPU limit, in seconds.
6880 CPU = 0,
6881
6882 /// Largest file that can be created, in bytes.
6883 FSIZE = 1,
6884
6885 /// Maximum size of data segment, in bytes.
6886 DATA = 2,
6887
6888 /// Maximum size of stack segment, in bytes.
6889 STACK = 3,
6890
6891 /// Largest core file that can be created, in bytes.
6892 CORE = 4,
6893
6894 /// Largest resident set size, in bytes.
6895 /// This affects swapping; processes that are exceeding their
6896 /// resident set size will be more likely to have physical memory
6897 /// taken from them.
6898 RSS = 5,
6899
6900 /// Number of open files.
6901 NOFILE = 6,
6902
6903 /// Number of processes.
6904 NPROC = 7,
6905
6906 /// Locked-in-memory address space.
6907 MEMLOCK = 8,
6908
6909 /// Address space limit.
6910 AS = 9,
6911
6912 /// Maximum number of file locks.
6913 LOCKS = 10,
6914
6915 /// Maximum number of pending signals.
6916 SIGPENDING = 11,
6917
6918 /// Maximum bytes in POSIX message queues.
6919 MSGQUEUE = 12,
6920
6921 /// Maximum nice priority allowed to raise to.
6922 /// Nice levels 19 .. -20 correspond to 0 .. 39
6923 /// values of this resource limit.
6924 NICE = 13,
6925
6926 /// Maximum realtime priority allowed for non-privileged
6927 /// processes.
6928 RTPRIO = 14,
6929
6930 /// Maximum CPU time in µs that a process scheduled under a real-time
6931 /// scheduling policy may consume without making a blocking system
6932 /// call before being forcibly descheduled.
6933 RTTIME = 15,
6934
6935 _,
6936} else enum(c_int) {
6937 /// Per-process CPU limit, in seconds.
6938 CPU = 0,
6939 /// Largest file that can be created, in bytes.
6940 FSIZE = 1,
6941 /// Maximum size of data segment, in bytes.
6942 DATA = 2,
6943 /// Maximum size of stack segment, in bytes.
6944 STACK = 3,
6945 /// Largest core file that can be created, in bytes.
6946 CORE = 4,
6947 /// Largest resident set size, in bytes.
6948 /// This affects swapping; processes that are exceeding their
6949 /// resident set size will be more likely to have physical memory
6950 /// taken from them.
6951 RSS = 5,
6952 /// Number of processes.
6953 NPROC = 6,
6954 /// Number of open files.
6955 NOFILE = 7,
6956 /// Locked-in-memory address space.
6957 MEMLOCK = 8,
6958 /// Address space limit.
6959 AS = 9,
6960 /// Maximum number of file locks.
6961 LOCKS = 10,
6962 /// Maximum number of pending signals.
6963 SIGPENDING = 11,
6964 /// Maximum bytes in POSIX message queues.
6965 MSGQUEUE = 12,
6966 /// Maximum nice priority allowed to raise to.
6967 /// Nice levels 19 .. -20 correspond to 0 .. 39
6968 /// values of this resource limit.
6969 NICE = 13,
6970 /// Maximum realtime priority allowed for non-privileged
6971 /// processes.
6972 RTPRIO = 14,
6973 /// Maximum CPU time in µs that a process scheduled under a real-time
6974 /// scheduling policy may consume without making a blocking system
6975 /// call before being forcibly descheduled.
6976 RTTIME = 15,
6977
6978 _,
6979};
68676980
6868pub const rlim_t = u64;6981pub const rlim_t = u64;
68696982
lib/std/os/linux/mips.zig-60
...@@ -376,66 +376,6 @@ pub const timezone = extern struct {...@@ -376,66 +376,6 @@ pub const timezone = extern struct {
376376
377pub const Elf_Symndx = u32;377pub const Elf_Symndx = u32;
378378
379pub const rlimit_resource = enum(c_int) {
380 /// Per-process CPU limit, in seconds.
381 CPU,
382
383 /// Largest file that can be created, in bytes.
384 FSIZE,
385
386 /// Maximum size of data segment, in bytes.
387 DATA,
388
389 /// Maximum size of stack segment, in bytes.
390 STACK,
391
392 /// Largest core file that can be created, in bytes.
393 CORE,
394
395 /// Number of open files.
396 NOFILE,
397
398 /// Address space limit.
399 AS,
400
401 /// Largest resident set size, in bytes.
402 /// This affects swapping; processes that are exceeding their
403 /// resident set size will be more likely to have physical memory
404 /// taken from them.
405 RSS,
406
407 /// Number of processes.
408 NPROC,
409
410 /// Locked-in-memory address space.
411 MEMLOCK,
412
413 /// Maximum number of file locks.
414 LOCKS,
415
416 /// Maximum number of pending signals.
417 SIGPENDING,
418
419 /// Maximum bytes in POSIX message queues.
420 MSGQUEUE,
421
422 /// Maximum nice priority allowed to raise to.
423 /// Nice levels 19 .. -20 correspond to 0 .. 39
424 /// values of this resource limit.
425 NICE,
426
427 /// Maximum realtime priority allowed for non-privileged
428 /// processes.
429 RTPRIO,
430
431 /// Maximum CPU time in µs that a process scheduled under a real-time
432 /// scheduling policy may consume without making a blocking system
433 /// call before being forcibly descheduled.
434 RTTIME,
435
436 _,
437};
438
439/// TODO379/// TODO
440pub const ucontext_t = void;380pub const ucontext_t = void;
441381
lib/std/os/linux/mips64.zig-60
...@@ -355,66 +355,6 @@ pub const timezone = extern struct {...@@ -355,66 +355,6 @@ pub const timezone = extern struct {
355355
356pub const Elf_Symndx = u32;356pub const Elf_Symndx = u32;
357357
358pub const rlimit_resource = enum(c_int) {
359 /// Per-process CPU limit, in seconds.
360 CPU,
361
362 /// Largest file that can be created, in bytes.
363 FSIZE,
364
365 /// Maximum size of data segment, in bytes.
366 DATA,
367
368 /// Maximum size of stack segment, in bytes.
369 STACK,
370
371 /// Largest core file that can be created, in bytes.
372 CORE,
373
374 /// Number of open files.
375 NOFILE,
376
377 /// Address space limit.
378 AS,
379
380 /// Largest resident set size, in bytes.
381 /// This affects swapping; processes that are exceeding their
382 /// resident set size will be more likely to have physical memory
383 /// taken from them.
384 RSS,
385
386 /// Number of processes.
387 NPROC,
388
389 /// Locked-in-memory address space.
390 MEMLOCK,
391
392 /// Maximum number of file locks.
393 LOCKS,
394
395 /// Maximum number of pending signals.
396 SIGPENDING,
397
398 /// Maximum bytes in POSIX message queues.
399 MSGQUEUE,
400
401 /// Maximum nice priority allowed to raise to.
402 /// Nice levels 19 .. -20 correspond to 0 .. 39
403 /// values of this resource limit.
404 NICE,
405
406 /// Maximum realtime priority allowed for non-privileged
407 /// processes.
408 RTPRIO,
409
410 /// Maximum CPU time in µs that a process scheduled under a real-time
411 /// scheduling policy may consume without making a blocking system
412 /// call before being forcibly descheduled.
413 RTTIME,
414
415 _,
416};
417
418/// TODO358/// TODO
419pub const ucontext_t = void;359pub const ucontext_t = void;
420360
lib/std/os/linux/sparc64.zig-60
...@@ -448,63 +448,3 @@ pub const ucontext_t = extern struct {...@@ -448,63 +448,3 @@ pub const ucontext_t = extern struct {
448448
449/// TODO449/// TODO
450pub const getcontext = {};450pub const getcontext = {};
451
452pub const rlimit_resource = enum(c_int) {
453 /// Per-process CPU limit, in seconds.
454 CPU,
455
456 /// Largest file that can be created, in bytes.
457 FSIZE,
458
459 /// Maximum size of data segment, in bytes.
460 DATA,
461
462 /// Maximum size of stack segment, in bytes.
463 STACK,
464
465 /// Largest core file that can be created, in bytes.
466 CORE,
467
468 /// Largest resident set size, in bytes.
469 /// This affects swapping; processes that are exceeding their
470 /// resident set size will be more likely to have physical memory
471 /// taken from them.
472 RSS,
473
474 /// Number of open files.
475 NOFILE,
476
477 /// Number of processes.
478 NPROC,
479
480 /// Locked-in-memory address space.
481 MEMLOCK,
482
483 /// Address space limit.
484 AS,
485
486 /// Maximum number of file locks.
487 LOCKS,
488
489 /// Maximum number of pending signals.
490 SIGPENDING,
491
492 /// Maximum bytes in POSIX message queues.
493 MSGQUEUE,
494
495 /// Maximum nice priority allowed to raise to.
496 /// Nice levels 19 .. -20 correspond to 0 .. 39
497 /// values of this resource limit.
498 NICE,
499
500 /// Maximum realtime priority allowed for non-privileged
501 /// processes.
502 RTPRIO,
503
504 /// Maximum CPU time in µs that a process scheduled under a real-time
505 /// scheduling policy may consume without making a blocking system
506 /// call before being forcibly descheduled.
507 RTTIME,
508
509 _,
510};