9fd04b0ce4
Add the owner-only AF_UNIX Reyna CLI privacy host, strict signed-app installation, and typed native routing for Calendar, Contacts, and Reminders.\n\nAdd bounded system-status paths and config-only direct local-service wrappers. Preserve MacMiniMCP pending explicit cutover approval.\n\nApple Notes is intentionally deferred: no native Notes operations, Apple Events declaration, or Automation helper are included; legacy Notes handling remains untouched.
44 lines
1.0 KiB
C
44 lines
1.0 KiB
C
#include "CSignalSupport.h"
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <signal.h>
|
|
#include <stddef.h>
|
|
|
|
static char g_socket_path[104 * 4];
|
|
static volatile sig_atomic_t g_has_path = 0;
|
|
|
|
void reyna_store_socket_path(const char *path) {
|
|
if (!path) {
|
|
g_socket_path[0] = '\0';
|
|
g_has_path = 0;
|
|
return;
|
|
}
|
|
strncpy(g_socket_path, path, sizeof(g_socket_path)-1);
|
|
g_socket_path[sizeof(g_socket_path)-1] = '\0';
|
|
g_has_path = 1;
|
|
}
|
|
|
|
void reyna_cleanup_socket_sync(void) {
|
|
if (!g_has_path) return;
|
|
if (g_socket_path[0] == '\0') return;
|
|
unlink(g_socket_path);
|
|
}
|
|
|
|
static void reyna_signal_handler(int sig) {
|
|
(void)sig;
|
|
reyna_cleanup_socket_sync();
|
|
_exit(0);
|
|
}
|
|
|
|
void reyna_install_signal_handlers(void) {
|
|
struct sigaction sa;
|
|
memset(&sa, 0, sizeof(sa));
|
|
sa.sa_handler = reyna_signal_handler;
|
|
sigemptyset(&sa.sa_mask);
|
|
sa.sa_flags = 0;
|
|
sigaction(SIGTERM, &sa, NULL);
|
|
sigaction(SIGINT, &sa, NULL);
|
|
sigaction(SIGHUP, &sa, NULL);
|
|
signal(SIGPIPE, SIG_IGN);
|
|
}
|