X-Git-Url: https://git.saurik.com/apple/network_cmds.git/blobdiff_plain/ccaf72887e87866a51356d16a08c713bc9273c92..44d75bbf245e7a9e4b9d47cda6a7696ef781e19f:/rpc_lockd.tproj/lockd.c diff --git a/rpc_lockd.tproj/lockd.c b/rpc_lockd.tproj/lockd.c index 7bb5833..07a1c90 100644 --- a/rpc_lockd.tproj/lockd.c +++ b/rpc_lockd.tproj/lockd.c @@ -60,6 +60,7 @@ __RCSID("$NetBSD: lockd.c,v 1.7 2000/08/12 18:08:44 thorpej Exp $"); #include #include #include +#include #include #include @@ -105,6 +106,10 @@ main(argc, argv) struct sigaction sigalarm; int grace_period = 30; struct rlimit rlp; + int mib[6]; + int oldstate; + int oldsize; + int newstate; while ((ch = getopt(argc, argv, "d:g:wx:")) != (-1)) { switch (ch) { @@ -154,8 +159,21 @@ main(argc, argv) signal(SIGHUP, handle_sig_cleanup); signal(SIGQUIT, handle_sig_cleanup); + + openlog("rpc.lockd", debug_level == 99 ? LOG_PERROR : 0, LOG_DAEMON); + mib[0] = CTL_KERN; + mib[1] = KERN_PROCDELAYTERM; + + oldstate = 0; + oldsize = 4; + newstate = 1; + + if (sysctl(mib, 2, &oldstate, &oldsize, &newstate, 4) < 0) { + syslog(LOG_INFO, "cannot mark pid for delayed termination"); + } + if (claim_pid_file("/var/run/lockd.pid", 0) < 0) { syslog(LOG_ERR, "cannot claim pid file"); exit(1);