|
KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Basic definitions for resource operations. More...
Go to the source code of this file.
Data Structures | |
| struct | rlimit |
| struct | rusage |
Macros | |
| #define | RLIM_INFINITY UINT_MAX |
| #define | RLIM_SAVED_MAX RLIM_INFINITY |
| #define | RLIM_SAVED_CUR RLIM_INFINITY |
Typedefs | |
| typedef unsigned int | rlim_t |
Enumerations | |
| enum | { PRIO_PROCESS , PRIO_PGRP , PRIO_USER } |
| enum | { RLIMIT_CORE , RLIMIT_CPU , RLIMIT_DATA , RLIMIT_FSIZE , RLIMIT_NOFILE , RLIMIT_STACK , RLIMIT_AS } |
| enum | { RUSAGE_SELF , RUSAGE_CHILDREN } |
Functions | |
| int | getpriority (int which, id_t who) |
| Obtain the nice value of a process, process group, or user. | |
| int | setpriority (int which, id_t who, int value) |
| Sets the nice value of a process, process group, or user. | |
| int | getrlimit (int resource, struct rlimit *rlp) |
| Gets the maximum resource consumption limits. | |
| int | setrlimit (int resource, const struct rlimit *rlp) |
| Sets the maximum resource consumption limits. | |
| int | getrusage (int who, struct rusage *r_usage) |
| Get information about cpu utilization. | |
Basic definitions for resource operations.
This file provides a basic implementation of the POSIX/XSI standard for resource operations. These are meant to be per-process, so are basically stubs for the purposes of KOS which is single-process.
| #define RLIM_INFINITY UINT_MAX |
| #define RLIM_SAVED_CUR RLIM_INFINITY |
| #define RLIM_SAVED_MAX RLIM_INFINITY |
| typedef unsigned int rlim_t |
| anonymous enum |
| int getpriority | ( | int | which, |
| id_t | who ) |
Obtain the nice value of a process, process group, or user.
In KOS we don't have a concept currently of any of these things, so this is effectively a stub that will only return a value if requested for the default/current id.
| which | Which type of ID to get the nice value of. |
| who | Only 0 is currently valid. |
| 0 | On success. |
| -1 | On error, errno will be set as appropriate. |
which was an invalid value. EINVAL - who was a value other than 0. Referenced by main().
| int getrlimit | ( | int | resource, |
| struct rlimit * | rlp ) |
Gets the maximum resource consumption limits.
Everything will return RLIM_INFINITY as we impose no such limits.
| resource | The type of resource to get the rlimit for. |
| rlp | Where to place the rlimit data. |
| 0 | On success. |
| -1 | On error, errno will be set as appropriate. |
resource was an invalid value. | int getrusage | ( | int | who, |
| struct rusage * | r_usage ) |
Get information about cpu utilization.
For the purposes of this function, KOS is treated as having a single process that all threads are running under. As such RUSAGE_SELF will return user time that is the sum of all living threads and system time that is all the rest (IRQs + dead threads). RUSAGE_CHILDREN will return zero.
| who | RUSAGE_SELF or RUSAGE_CHILDREN. |
| r_usage | rusage data to be filled. |
| 0 | On success. |
| -1 | On error, errno will be set as appropriate. |
who was an invalid value. Referenced by main().
| int setpriority | ( | int | which, |
| id_t | who, | ||
| int | value ) |
Sets the nice value of a process, process group, or user.
In KOS we don't have a concept currently of any of these things, so this is effectively a stub that will only set a value if requested for the default/current id. This also currently has no impact aside from changing the return of getpriority.
| which | Which type of ID to set the nice value of. |
| who | Only 0 is currently valid. |
| value | nice value to set. |
| 0 | On success. |
| -1 | On error, errno will be set as appropriate. |
which was an invalid value. EINVAL - who was a value other than 0. Referenced by main().
| int setrlimit | ( | int | resource, |
| const struct rlimit * | rlp ) |
Sets the maximum resource consumption limits.
Just a stub. Errors on bad input, otherwise always succeeds.
| resource | The type of resource to set the rlimit for. |
| rlp | Ignored. |
| 0 | On success. |
| -1 | On error, errno will be set as appropriate. |
resource was an invalid value.