Kernel: Process/Time Management Syscalls

From TechPubs Wiki

Revision as of 03:48, 4 January 2026 by Raion (talk | contribs) (Created page with "== Overview == IRIX has many syscalls grouped by core process identity, time management, scheduling control, profiling, and signal-related system calls in the IRIX kernel. These calls operate on vproc_t (virtual process) structures, which encapsulate state shared across threads (uthreads) in multi-threaded processes. Key areas: Time retrieval/setting UID/GID manipulation (System V and BSD semantics) Process group/session control Nice value and real-time priority adjustm...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Overview

IRIX has many syscalls grouped by core process identity, time management, scheduling control, profiling, and signal-related system calls in the IRIX kernel. These calls operate on vproc_t (virtual process) structures, which encapsulate state shared across threads (uthreads) in multi-threaded processes. Key areas:

Time retrieval/setting UID/GID manipulation (System V and BSD semantics) Process group/session control Nice value and real-time priority adjustments Profiling (clock-based, shared-library, R10000 event counters) Signal blocking/masking, pending checks, suspend, handler installation, alternate stacks Miscellaneous (pause, umask, ulimit, vhangup, sysconf)

The implementation blends System V, BSD, and POSIX behaviors, with extensions for IRIX-specific features (e.g., Frame Scheduler via schedctl).

Key Functions

Time Management

gtime: Returns current time-of-day in seconds. stime: Sets system clock. alarm: Sets interval timer on real-time clock. times: Returns process and child CPU times.

Identity Management

setuid / setreuid: Set real/effective UID. setgid / setregid: Set real/effective GID (with XPG4 variant for saved-GID semantics). getuid / getgid: Return real and effective IDs. setgroups / getgroups: Manage supplementary group list. umask: Set/get file creation mask (per-uthread, shared).

Process Group and Session

setpgrp: System V style (flag=0 returns pgid). BSDsetpgrp / BSDgetpgrp: BSD compatibility. setpgid: POSIX version. setsid: Create new session.

Scheduling and Priority

nice: Adjust nice value. schedctl: Unified interface for: Real-time fixed priority Time slice setting Nice adjustments (process, pgrp, user-wide via plistscan) CPU affinity Scheduling mode (free/gang) Frame Scheduler (FRS) operations Legacy hooks


Profiling

profil: Traditional clock-based profiling. sprofil: Shared-library profiling. evc_profil: R10000 hardware event counter profiling (per-thread counters).

Signal Handling

sigpending: Return pending signal set. sigsuspend: Atomically swap signal mask and sleep. sigprocmask: Block/unblock signals. sigaction: Install signal handler with mask/flags. sigstack / sigaltstack: Set/query alternate signal stack (with XPG4 corrected behavior).

Miscellaneous

pause: Sleep until signal. ulimit: Query/set resource limits (file size, data segment, descriptors). vhangup: Invalidate controlling terminal. sysconf: Runtime configuration values (e.g., _SC_ARG_MAX, _SC_NGROUPS_MAX).

Undocumented or IRIX-Specific Interfaces and Behaviors

vproc_t-Centric Design All process-wide operations dispatch through VPROC_ macros on curvprocp, supporting shared state across uthreads. Dual Semantics

System V (setpgrp) and BSD/POSIX (setpgid, setsid) co-exist. XPG4 variants for sigaltstack (correct stack direction) and setregid (saved-GID handling).

schedctl Extensions

Real-time fixed priorities (non-degrading). Gang scheduling modes. Full Frame Scheduler (FRS) user interface for hard real-time gangs. User-wide nice operations via process table scan.

Profiling Variants

Clock-based, shared-library, and hardware counter (R10000) profiling. Fast profiling mode.

Signal Stack Handling

Historical IRIX sigaltstack required user to account for stack growth direction; XPG4 variant fixes this.

Similarities to illumos and BSD Kernel Implementations

illumos (Solaris-derived) Strong overlap:

UID/GID, nice, alarm, times, pause, umask, ulimit nearly identical. priocntl(2) analogous to schedctl for real-time classes. Signal syscalls match POSIX. Alternate stack via sigaltstack.

Differences: No direct FRS; different real-time model. BSD (FreeBSD, etc.) Close matches:

setreuid, setregid, setpgid, setsid, nice, getpriority/setpriority. Signal interfaces standard. sysconf for configuration.

Differences: Separate syscalls instead of unified schedctl; weaker real-time support. Overall, IRIX provides a rich unified scheduling interface (schedctl) with strong real-time extensions (FRS, fixed-priority) while maintaining compatibility with both SVR4 and BSD/POSIX. For reimplementation, focus on vproc dispatch and dual semantics; FRS is IRIX-specific.