aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/daemon.h
blob: 3ef8b9dabce9e50c35784ac29a972904506cdff3 (plain) (blame)
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
#pragma once

namespace NDaemonMaker { 
    enum ECloseDescriptors { 
        closeAll = 0, 
        closeStdIoOnly 
    }; 

    enum EStdIoDescriptors { 
        openNone = 0, 
        openDevNull, 
        openYandexStd 
    }; 
 
    enum EChDir {
        chdirNone = 0,
        chdirRoot
    };

    enum EParent {
        callExitFromParent = 0,
        returnFromParent
    };

    bool MakeMeDaemon(ECloseDescriptors cd = closeAll, EStdIoDescriptors iod = openDevNull, EChDir chd = chdirRoot, EParent parent = callExitFromParent);
    void CloseFrom(int fd);
}