Application groups
Application groups are used to group processes together so they can be controlled as a group.
Application groups rely on every process having its own ID, known as an "application ID". The application ID can be used for operations, such as delivering signals.
A new application group can be formed during the spawning of a process. By default, the application ID of this process matches that of its parent. If the spawn flag POSIX_SPAWN_NEWAPP is specified when the process starts, the process instead creates a new application group with the application ID matching the process ID of the new process. The use of the spawn flag is privileged, requiring that the process calling posix_spawn() has the ability PROCMGR_AID_CHILD_NEWAPP. Simply put, an adequately privileged process can create a child process where all of its descendants in addition to itself share the same application ID, making an application group. This allows for all processes in the application group to be terminated. For more information, see posix_spawn() in the C Library Reference.
The DCMD_PROC_INFO devctl() returns the application ID in a structure field.
- Using SIG_APPID with SignalKill() to send signals to the group. SignalKill() accepts SIG_APPID ORed into the signal number parameter, which sends the signal to all the processes with an application ID that matches the pid argument (see SignalKill() in the C Library Reference)
- Suspending and continuing processes using the SchedCtl() function with the SCHED_STOP_APP and SCHED_CONT_APP commands (see SchedCtl() in the C Library Reference)