CliXoN
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
clixon_sig.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <signal.h>
#include <syslog.h>
#include <errno.h>
#include "clixon_err.h"
#include "clixon_log.h"
#include "clixon_sig.h"

Functions

int set_signal (int signo, void(*handler)(int), void(**oldhandler)(int))
 
void clicon_signal_block (int sig)
 
void clicon_signal_unblock (int sig)
 
int pidfile_get (char *pidfile, pid_t *pid0)
 
int pidfile_zapold (pid_t pid)
 
int pidfile_write (char *pidfile)
 

Function Documentation

void clicon_signal_block ( int  sig)

Block signal.

Parameters
[in]sigSignal number to block, If 0, block all signals
void clicon_signal_unblock ( int  sig)

Unblock signal.

Parameters
[in]sigSignal number to unblock. If 0, unblock all signals
int pidfile_get ( char *  pidfile,
pid_t *  pid0 
)

Read pidfile and return pid, if any

Parameters
[in]pidfileName of pidfile
[out]pid0Process id of (eventual) existing daemon process
Return values
0OK. if pid > 0 old process exists w that pid
-1Error, and clicon_err() called
int pidfile_write ( char *  pidfile)

Write a pid-file

Parameters
[in]pidfileName of pidfile
int pidfile_zapold ( pid_t  pid)

Given a pid, kill that process

Parameters
[in]pidProcess id
Return values
0Killed OK
-1Could not kill. Maybe shouldk not belong to pidfile code,..
int set_signal ( int  signo,
void(*)(int)  handler,
void(**)(int)  oldhandler 
)

Set a signal handler.

Parameters
[in]signoSignal number
[in]handlerFunction to call when signal occurs
[out]oldhandlerPointer to old handler