File: readdaemonpid.cc

package info (click to toggle)
stealth 3.00.00-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,380 kB
  • ctags: 371
  • sloc: cpp: 2,730; makefile: 161; sh: 98
file content (27 lines) | stat: -rw-r--r-- 481 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "ipc.ih"

// daemonPid() obtains the process-id from an existing run-file. The file must
// exist and the pid stored in the lock-file must be the process-id of an
// existing Stealth program. 

void IPC::readDaemonPid()
{
    ifstream in;

    string const &runFile = d_options.runFile();

    Exception::open(in, runFile);

    pid_t pid;

    if (not (in >> pid))
        fmsg << "daemonPid: Can't read `" << runFile << '\'' << endl;

    d_daemonPid = pid;
}