Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

System Information & Misc.

arch_prctl

Supported functionality in SCML:

// Get or set the FS register
arch_prctl(
    code = ARCH_GET_FS | ARCH_SET_FS,
    addr
);

Unsupported codes:

  • ARCH_GET_CPUID and ARCH_SET_CPUID
  • ARCH_GET_GS and ARCH_SET_GS

For more information, see the man page.

getrusage

Supported functionality in SCML:

// Return resource usage statistics for the calling process
getrusage(
    who = RUSAGE_SELF,
    usage
);

// Return resource usage statistics for the calling thread
getrusage(
    who = RUSAGE_THREAD,
    usage
);

Unsupported who flags:

  • RUSAGE_CHILDREN

For more information, see the man page.

getrandom

Supported functionality in SCML:

// Obtain random bytes
getrandom(
    buf, buflen,
    flags =
        // Optional flags:
        //
        // High-entropy pool
        GRND_RANDOM
);

Silently-ignored flags:

  • GRND_NONBLOCK because the underlying operation never blocks

For more information, see the man page.

reboot

Supported functionality in SCML:

reboot_magic2 = LINUX_REBOOT_MAGIC2 | LINUX_REBOOT_MAGIC2A | LINUX_REBOOT_MAGIC2B | LINUX_REBOOT_MAGIC2C;

// Stop the current system
reboot(
    magic  = LINUX_REBOOT_MAGIC1,
    magic2 = <reboot_magic2>,
    op     = LINUX_REBOOT_CMD_HALT | LINUX_REBOOT_CMD_POWER_OFF,
    arg
);

Unsupported op flags:

  • LINUX_REBOOT_CMD_CAD_OFF
  • LINUX_REBOOT_CMD_CAD_ON
  • LINUX_REBOOT_CMD_KEXEC
  • LINUX_REBOOT_CMD_RESTART
  • LINUX_REBOOT_CMD_RESTART2
  • LINUX_REBOOT_CMD_SW_SUSPEND

For more information, see the man page.

POSIX Clocks

clock_gettime

Supported functionality in SCML:

predefined_clockid = CLOCK_REALTIME | CLOCK_MONOTONIC | CLOCK_MONOTONIC_RAW |
                     CLOCK_REALTIME_COARSE | CLOCK_MONOTONIC_COARSE | CLOCK_BOOTTIME |
                     CLOCK_PROCESS_CPUTIME_ID | CLOCK_THREAD_CPUTIME_ID;

// Get the time of a clock specified by a static ID
clock_gettime(clockid = <predefined_clockid>, tp);

// Get the time of a clock specified by a dynamic ID
clock_gettime(clockid = <INTEGER>, tp);

Unsupported predefined clock IDs:

  • CLOCK_REALTIME_ALARM
  • CLOCK_BOOTTIME_ALARM
  • CLOCK_TAI

For more information, see the man page.

clock_nanosleep

Supported functionality in SCML:

// Sleep with a specified clock
clock_nanosleep(
    clockid = CLOCK_REALTIME | CLOCK_MONOTONIC | CLOCK_BOOTTIME | CLOCK_PROCESS_CPUTIME_ID,
    flags =
        // Optional flags:
        //
        // Sleep until an absolute time point
        TIMER_ABSTIME,
    t, remain
);

Unsupported clock IDs:

  • CLOCK_TAI

For more information, see the man page.