|
PatchworkOS
966e257
A non-POSIX operating system.
|
Process groups. More...
Process groups.
Process groups allow related processes to be grouped together, enabling operations such as sending notes to all processes within a group.
As an example, if a user wishes to terminate a shell they most likely additionally want to terminate all child processes started by that shell. By placing all such processes in the same group, a single "terminate" note can be sent to the entire group, effectively terminating all related processes.
Data Structures | |
| struct | group_entry_t |
| Group entry structure. More... | |
| struct | group_t |
| Process group structure. More... | |
Functions | |
| void | group_entry_init (group_entry_t *entry) |
| Initializes a group entry. | |
| void | group_entry_deinit (group_entry_t *entry) |
| Deinitializes a group entry. | |
| uint64_t | group_add (gid_t gid, group_entry_t *entry) |
| Adds a process to a group. | |
| void | group_remove (group_entry_t *entry) |
| Removes a process from its group. | |
| gid_t | group_get_id (group_entry_t *entry) |
| Gets the ID of the group of the specified entry. | |
| uint64_t | group_send_note (group_entry_t *entry, const char *note) |
| Sends a note to all processes in the group of the specified entry. | |
| void group_entry_init | ( | group_entry_t * | entry | ) |
| void group_entry_deinit | ( | group_entry_t * | entry | ) |
| uint64_t group_add | ( | gid_t | gid, |
| group_entry_t * | entry | ||
| ) |
Adds a process to a group.
| gid | The group ID to add the process to, or GID_NONE to create a new group. |
| entry | The group entry of the process to add to the group. |
0. On failure, ERR and errno is set to:EINVAL: Invalid parameters.ENOENT: The specified group does not exist.EBUSY: The entry is already part of a group.ENOMEM: Out of memory. Definition at line 25 of file group.c.
| void group_remove | ( | group_entry_t * | entry | ) |
Removes a process from its group.
If the group becomes empty after removing the process, it will be freed.
| entry | The group entry of the process to remove from its group, or NULL for no-op. |
Definition at line 73 of file group.c.
| gid_t group_get_id | ( | group_entry_t * | entry | ) |
| uint64_t group_send_note | ( | group_entry_t * | entry, |
| const char * | note | ||
| ) |
Sends a note to all processes in the group of the specified entry.
| entry | The entry within the group to send the note to. |
| note | The note string to send. |
0. On failure, ERR and errno is set to:EINVAL: Invalid parameters.thread_send_note(). Definition at line 115 of file group.c.