blob: d65b765c8c42b9c6f8cdfac425a3c578d86b4041 (
plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*
* Portable process handling routines.
* $Id$
* Copyright (c) 1997 by Tycho Softworks.
* For conditions of distribution and reuse see product license.
*/
#ifndef __PROC_PROCESS_H__
#define __PROC_PROCESS_H__
#ifndef __STD_PROCESS_H__
#include <std/process.h>
#endif
/* Spawn services under UNIX fork() */
#define P_NOWAIT 0x00 /* Default, run concurrent */
#define P_WAIT 0x01 /* Wait for and return exit status */
#define P_BACKGROUND 0x02 /* Detach child from our stdio */
#define P_SESSION 0x04 /* Use setsid() on child */
#define P_OVERLAY 0x08 /* Really 'exec' called via spawn */
/* Some common/portable spawn varients and masks */
#define P_DETACH P_NOWAIT | P_SESSION | P_BACKGROUND
#define P_NOWAITO P_NOWAIT | P_SESSION
/* Daemon initialization options */
#define D_KEEPSTDIO 0 /* Daemon keeps stdio connection */
#define D_KEEPALL 1 /* Daemon keeps all open files */
#define D_KEEPNONIO 2 /* Detach from stdio, keep others open */
#define D_KEEPNONE 3 /* Deamon closes all files */
#ifdef __cplusplus
extern "C" {
#endif
/* Common process invokation services using fork() */
#ifdef __NAMESPACE
#define spawnv __NAMESPACE(spawnv)
#define spawnvp __NAMESPACE(spawnvp)
#define pdetach __NAMESPACE(pdetach)
#define priority __NAMEPSACE(priority)
#endif
int spawnv(const int P_mode, const char *path, char *const argv[]);
int spawnvp(const int P_mode, const char *path, char *const argv[]);
pid_t pdetach(const int D_flag); /* Make current process a daemon */
int priority(int pri); /* set realtime priorities */
#ifdef __cplusplus
}
#endif
#endif
|