struct procinfo { char id[20]; uint16_t id_len; uint16_t ppid; uint16_t pid; uint32_t uid; uint32_t flags; } __attribute__((packed)); size_t listprocs(struct procinfo *addr, size_t len);
This syscall writes a list of all processes available on the system to
addr
, which contains len
items.
The syscall returns the number of processes in the system in success, and
-1
in failure.
SC_LIST_PROCS
: addr
points to an array of items, and len
is the count of bytes reserved in the array. The items have the structure:
struct procinfo { char id[20]; uint16_t id_len; uint16_t ppid; uint16_t pid; uint32_t uid; uint32_t flags; } __attribute__((packed));
The total number of processes is returned, even if it doesnt fit in the passed array.
SC_LIST_MOUNTS
: addr
points to an array of items, and len
is the count of bytes reserved in the array. The items have the structure:
struct mountinfo { uint32_t fs_type; uint32_t flags; char source[20]; uint32_t source_len; char location[20]; uint32_t location_len; };
The total number of mounts is returned, even if it doesnt fit in the passed array.
SC_UNAME
: addr
points to the following structure, and len
is the length in bytes of said structure:
struct utsname { char sysname[65]; // Kernel name (e.g., "Ironclad") char nodename[65]; // Hostname of the machine. char release[65]; // Kernel release (e.g., "2.6.28") char version[65]; // Kernel release, again. char machine[65]; // Hardware identifier (e.g., "x86") };
In success, the returned value will be 0
.
SC_LIST_THREADS
: addr
points to an array of items, and len
is the count of bytes reserved in the array. The items have the structure:
struct threadinfo { uint16_t tid; int16_t niceness; uint16_t tcid; uint16_t pid; };
The total number of threads is returned, even if it doesnt fit in the passed array.
SC_LIST_CLUSTERS
: addr
points to an array of items, and
len
is the count of bytes reserved in the array. The items have the
structure:
struct tclusterinfo { uint16_t tcid; uint16_t tflags; uint16_t tquantum; };
The total number of thread clusters is returned, even if it doesnt fit in the passed array.
SC_LIST_NETINTER
: addr
points to an array of items, and
len
is the count of bytes reserved in the array. The items have the
structure:
struct netinterface { char device[64]; // null terminated. uint64_t flags; uint8_t mac_addr[6]; uint8_t ip4_addr[4]; uint8_t ip4_subnet[4]; uint8_t ip6_addr[16]; uint8_t ip6_subnet[16]; };
SC_DUMPLOGS
: addr
points to a string to store the buffer, which
is an array of 80-char long strings. len
is the length of the buffer.
The total length of the kernel buffer is returned, regardless of whether it
fits or not.
SC_LIST_FILELOCKS
: addr
points to an array of items, and
len
is the count of bytes reserved in the array. The items have the
structure:
struct flock_info { uint32_t pid; uint32_t mode; uint64_t start; uint64_t length; uint64_t dev_id; uint64_t inode; };
SC_LOADAVG
: addr
points to an array of at least 3 integers, and
len
is the count of bytes reserved in the array. The array has the
structure:
uint32_t array[3];
The values the number of threads in the system run queue averaged over various periods of time. The 3 samples correspond to the averages of 1, 5, and 15 minutes, respectively. It can be used as a measure of relative load. The values are to be divided by 100 before being used.
SC_MEMINFO
: len
is ignored and addr
points to a structure
as such:
struct mem_info { // All data is in bytes. uint64_t phys_total; // Total physical memory of the system. uint64_t phys_available; // Non-reserved memory managed by the system. uint64_t phys_free; // Free memory available to the system. uint64_t shared_usage; // Amount of shared memory in the system. uint64_t kernel_usage; // Amount of memory in use by the kernel. uint64_t table_usage; // Of the kernel, amount in use for page tables. uint64_t poison_usage; // Memory marked by the hardware as faulty. };
0
is returned on success.
SC_LIST_PCI
: addr
points to an array of items, and
len
is the count of bytes reserved in the array. The items have the
structure:
struct devinfo { uint8_t bus; uint8_t func; uint8_t slot; uint16_t device_id; uint16_t vendor_id; uint8_t rev_id; uint8_t subclass; uint8_t device_class; uint8_t prog_if; };
The syscall return the requested information on success and -1
on
failure. If the requested value can also be -1
, errno must be checked.
The errno codes set on failure are:
EINVAL
: Invalid request.