|
xsecurelock
1.7.0
XSecureLock is an X11 screen lock utility.
|
#include <limits.h>#include <unistd.h>Go to the source code of this file.
Macros | |
| #define | WAIT_ALREADY_DEAD INT_MIN |
| #define | WAIT_NONPOSITIVE_SIGNAL (INT_MIN + 1) |
Functions | |
| void | InitWaitPgrp (void) |
| Initializes WaitPgrp. More... | |
| pid_t | ForkWithoutSigHandlers (void) |
| Fork a subprocess, but do not inherit our signal handlers. More... | |
| void | StartPgrp (void) |
| Starts a new process group. More... | |
| int | ExecvHelper (const char *path, const char *const argv[]) |
| Spawns a helper process. More... | |
| int | KillPgrp (pid_t pid, int signo) |
| Kills the given process group. More... | |
| int | WaitPgrp (const char *name, pid_t *pid, int do_block, int already_killed, int *exit_status) |
| Waits for the given process group to terminate, or checks its status. If the leader process died, kill the entire group. More... | |
| int | WaitProc (const char *name, pid_t *pid, int do_block, int already_killed, int *exit_status) |
| Waits for the given process to terminate, or checks its status. More... | |
| #define WAIT_ALREADY_DEAD INT_MIN |
| #define WAIT_NONPOSITIVE_SIGNAL (INT_MIN + 1) |
| int ExecvHelper | ( | const char * | path, |
| const char *const | argv[] | ||
| ) |
Spawns a helper process.
Works just like execv(), but if path is a relative path, it looks it up within HELPER_PATH.
If it fails, it logs a message about what it tried to execute and how it failed.
| pid_t ForkWithoutSigHandlers | ( | void | ) |
Fork a subprocess, but do not inherit our signal handlers.
Otherwise behaves exactly like fork().
| void InitWaitPgrp | ( | void | ) |
Initializes WaitPgrp.
Actually just installs an empty SIGCHLD handler so select(), sigsuspend() etc. get interrupted by the signal.
| int KillPgrp | ( | pid_t | pid, |
| int | signo | ||
| ) |
Kills the given process group.
| pid | The process group ID. |
| signo | The signal to send to the process group. |
| void StartPgrp | ( | void | ) |
Starts a new process group.
Must be called from a child process, which will become the process group leader. The process group will never die, unless killed using KillPgrp (which WaitPgrp calls implicitly when the leader process terminates).
| int WaitPgrp | ( | const char * | name, |
| pid_t * | pid, | ||
| int | do_block, | ||
| int | already_killed, | ||
| int * | exit_status | ||
| ) |
Waits for the given process group to terminate, or checks its status. If the leader process died, kill the entire group.
| name | The name of the process group for logging. |
| pid | The process group ID; it is set to zero if the process group died. |
| do_block | Whether to wait for the process group to terminate. |
| already_killed | Whether the caller already sent SIGTERM to the process group. If so, we will not log this signal as that'd be spam. |
| exit_status | Variable that receives the exit status of the leader when it terminated. Will be negative for a signal, positive for a regular exit, or one of the WAIT_* constants. |
| int WaitProc | ( | const char * | name, |
| pid_t * | pid, | ||
| int | do_block, | ||
| int | already_killed, | ||
| int * | exit_status | ||
| ) |
Waits for the given process to terminate, or checks its status.
| name | The name of the process for logging. |
| pid | The process ID; it is set to zero if the process died. |
| do_block | Whether to wait for the process to terminate. |
| already_killed | Whether the caller already sent SIGTERM to the process. If so, we will not log this signal as that'd be spam. |
| exit_status | Variable that receives the exit status of the leader when it terminated. Will be negative for a signal, positive for a regular exit, or one of the WAIT_* constants. |
1.8.14