|
PatchworkOS
dbbdc99
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 of that shell. By placing all such processes in the same group, a single "terminate" note can be sent to the entire group.
Data Structures | |
| struct | group_member_t |
| Group member structure. More... | |
| struct | group_t |
| Process group structure. More... | |
Functions | |
| uint64_t | group_member_init (group_member_t *member, group_member_t *group) |
| Initializes a group member. | |
| void | group_member_deinit (group_member_t *member) |
| Deinitializes a group member. | |
| group_t * | group_get (group_member_t *member) |
| Retrieve the group of a group member. | |
| void | group_add (group_t *group, group_member_t *member) |
| Joins a process to a specific group. | |
| void | group_remove (group_member_t *member) |
| Removes a process from its group. | |
| uint64_t | group_send_note (group_member_t *member, const char *note) |
| Sends a note to all processes in the group of the specified member. | |
| uint64_t group_member_init | ( | group_member_t * | member, |
| group_member_t * | group | ||
| ) |
Initializes a group member.
| member | The group member to initialize. |
| group | A member storing the group to add the new member to, or NULL to create a new group. |
0. On failure, ERR and errno is set to: Definition at line 42 of file group.c.
| void group_member_deinit | ( | group_member_t * | member | ) |
| group_t * group_get | ( | group_member_t * | member | ) |
Retrieve the group of a group member.
It is the responsibility of the caller to use UNREF() or UNREF_DEFER() on the returned group when it is no longer needed.
| member | The group member. |
NULL and errno is set to:EINVAL: Invalid parameters.ESRCH: The member is not part of any group. Definition at line 79 of file group.c.
| void group_add | ( | group_t * | group, |
| group_member_t * | member | ||
| ) |
Joins a process to a specific group.
If the member is already in a group it will be removed from that group first.
| group | The group to join. |
| member | The group member of the process to add to the group. |
Definition at line 98 of file group.c.
| void group_remove | ( | group_member_t * | member | ) |
Removes a process from its group.
If the group becomes empty after removing the process, it will be freed.
| member | The group member of the process to remove from its group, or NULL for no-op. |
Definition at line 120 of file group.c.
| uint64_t group_send_note | ( | group_member_t * | member, |
| const char * | note | ||
| ) |
Sends a note to all processes in the group of the specified member.
| member | The member 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 142 of file group.c.