summaryrefslogtreecommitdiff
path: root/runit/runit_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'runit/runit_lib.c')
-rw-r--r--runit/runit_lib.c70
1 files changed, 1 insertions, 69 deletions
diff --git a/runit/runit_lib.c b/runit/runit_lib.c
index 4762096b4..fcb66c3db 100644
--- a/runit/runit_lib.c
+++ b/runit/runit_lib.c
@@ -385,56 +385,9 @@ int seek_set(int fd,seek_pos pos)
385#endif 385#endif
386 386
387 387
388/*** sig_block.c ***/
389
390void sig_block(int sig)
391{
392 sigset_t ss;
393 sigemptyset(&ss);
394 sigaddset(&ss, sig);
395 sigprocmask(SIG_BLOCK, &ss, NULL);
396}
397
398void sig_unblock(int sig)
399{
400 sigset_t ss;
401 sigemptyset(&ss);
402 sigaddset(&ss, sig);
403 sigprocmask(SIG_UNBLOCK, &ss, NULL);
404}
405
406void sig_blocknone(void)
407{
408 sigset_t ss;
409 sigemptyset(&ss);
410 sigprocmask(SIG_SETMASK, &ss, NULL);
411}
412
413
414/*** sig_catch.c ***/
415
416void sig_catch(int sig,void (*f)(int))
417{
418 struct sigaction sa;
419 sa.sa_handler = f;
420 sa.sa_flags = 0;
421 sigemptyset(&sa.sa_mask);
422 sigaction(sig,&sa, NULL);
423}
424
425
426/*** sig_pause.c ***/
427
428void sig_pause(void)
429{
430 sigset_t ss;
431 sigemptyset(&ss);
432 sigsuspend(&ss);
433}
434
435
436/*** str_chr.c ***/ 388/*** str_chr.c ***/
437 389
390// strchrnul?
438unsigned str_chr(const char *s,int c) 391unsigned str_chr(const char *s,int c)
439{ 392{
440 char ch; 393 char ch;
@@ -449,24 +402,3 @@ unsigned str_chr(const char *s,int c)
449 } 402 }
450 return t - s; 403 return t - s;
451} 404}
452
453
454/*** wait_nohang.c ***/
455
456int wait_nohang(int *wstat)
457{
458 return waitpid(-1, wstat, WNOHANG);
459}
460
461
462/*** wait_pid.c ***/
463
464int wait_pid(int *wstat, int pid)
465{
466 int r;
467
468 do
469 r = waitpid(pid, wstat, 0);
470 while ((r == -1) && (errno == EINTR));
471 return r;
472}