Chinaunix首页 | 论坛 | 博客
  • 博客访问: 564649
  • 博文数量: 112
  • 博客积分: 5090
  • 博客等级: 大校
  • 技术积分: 1158
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-19 22:21
文章分类

全部博文(112)

文章存档

2016年(1)

2015年(1)

2012年(1)

2011年(5)

2010年(7)

2009年(6)

2008年(18)

2007年(28)

2006年(16)

2005年(29)

我的朋友

分类: LINUX

2015-07-24 11:33:50

sending the signal 0 to a given PID just checks if any process with the given PID is running and you have the permission to send a signal to it.

For more information see the following manpages:

kill(1)
$ man 1 kill ... If sig is 0, then no signal is sent, but error checking is still performed. ...
kill(2)
$ man 2 kill ... If sig is 0, then no signal is sent, but error checking is still performed; this 
can be used to check for the existence of a process ID or process group ID. ...

/>
static int
checkRunningPid(void)
{
    pid_t pid;
    debug_log = stderr;
    if (strcmp(Config.pidFilename, "none") == 0) {
    debug(0, 1) ("No pid_filename specified. Trusting you know what you are doing.\n");
    return 0;
    }
    pid = readPidFile();
    if (pid < 2)
    return 0;
    if (kill(pid, 0) < 0)
    return 0;
    debug(0, 0) ("xxxx is already running!  Process ID %ld\n", (long int) pid);
    return 1;
}


阅读(437) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~