mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-07 08:27:12 +00:00
Rename fabro-proctitle to fabro-proc and add safe wrappers for all process management primitives (signals, pre-exec hooks). This contains all unsafe proc code behind a safe API so downstream crates no longer need #[allow(unsafe_code)] or direct libc dependencies. New modules: signal (process_alive, sigterm, sigkill, sigterm_process_group), pre_exec (pre_exec_setsid, pre_exec_setpgid, pre_exec_pdeathsig), title (existing proctitle code). Eliminates three duplicate process_alive definitions and removes libc as a direct dep of fabro-cli and fabro-sandbox. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
16 lines
519 B
C
16 lines
519 B
C
#include <string.h>
|
|
|
|
static char *g_argv_start = 0;
|
|
static unsigned long g_argv_len = 0;
|
|
|
|
__attribute__((constructor))
|
|
static void capture_argv(int argc, char **argv, char **envp) {
|
|
(void)envp;
|
|
if (argc <= 0 || !argv || !argv[0]) return;
|
|
g_argv_start = argv[0];
|
|
char *end = argv[argc - 1] + strlen(argv[argc - 1]) + 1;
|
|
g_argv_len = (unsigned long)(end - argv[0]);
|
|
}
|
|
|
|
char *fabro_proctitle_argv_start(void) { return g_argv_start; }
|
|
unsigned long fabro_proctitle_argv_len(void) { return g_argv_len; }
|