]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
feat: setitimer/getitimer syscalls with repeating interval timer support
authorTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 22:45:48 +0000 (19:45 -0300)
committerTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 22:45:48 +0000 (19:45 -0300)
commitac99ae3eca705c582af11b78f7dbca89ccf942bf
treea845f0f6aaaf4dd22168fe025fd02c33c787c9ee
parentc9c0aae8d35cbe9cb25dc97fdb980257565ccfb1
feat: setitimer/getitimer syscalls with repeating interval timer support

Phase D2+D3 complete — implements POSIX interval timers.

Kernel changes:
- process.h: added alarm_interval (repeat ticks for ITIMER_REAL),
  itimer_virt_value/interval, itimer_prof_value/interval fields
- scheduler.c process_wake_check: alarm queue now auto-requeues
  repeating timers (alarm_interval != 0) on expiry; added per-tick
  ITIMER_VIRTUAL (user mode) and ITIMER_PROF (user+kernel) accounting
  that delivers SIGVTALRM/SIGPROF respectively
- syscall.c: implemented SYSCALL_SETITIMER (92) and SYSCALL_GETITIMER (93)
  supporting ITIMER_REAL, ITIMER_VIRTUAL, ITIMER_PROF; alarm() updated
  to clear alarm_interval (one-shot only) and use TICKS_PER_SEC constant
- syscall.h: added SYSCALL_SETITIMER=92, SYSCALL_GETITIMER=93

Userland:
- signal.h: added SIGVTALRM=26, SIGPROF=27
- sys/time.h: new header with struct timeval, struct itimerval,
  ITIMER_REAL/VIRTUAL/PROF defines, setitimer/getitimer prototypes
- syscall.h: added SYS_SETITIMER=92, SYS_GETITIMER=93
- unistd.c: added setitimer() and getitimer() wrappers

Timer resolution: 20ms (50Hz tick). Conversions use
USEC_PER_TICK=20000 for timeval<->ticks.

20/20 smoke tests pass.
include/process.h
include/syscall.h
src/kernel/scheduler.c
src/kernel/syscall.c
user/ulibc/include/signal.h
user/ulibc/include/sys/time.h [new file with mode: 0644]
user/ulibc/include/syscall.h
user/ulibc/src/unistd.c