GRASS Programmer's Manual
6.5.svn(2014)-r66266
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
fork.c
Go to the documentation of this file.
1
#include <grass/config.h>
2
3
#include <unistd.h>
4
#include <grass/gis.h>
5
6
/*************************************************************
7
* G_fork()
8
*
9
* Issue a system fork() call and protect the child from all
10
* signals (which it does by changing the process group for the child)
11
*
12
* returns:
13
* -1 fork failed.
14
* 0 child
15
* >0 parent
16
************************************************************/
17
18
int
G_fork
(
void
)
19
{
20
#ifdef __MINGW32__
21
return
-1;
22
#else
/* __MINGW32__ */
23
int
pid;
24
25
pid = fork();
26
27
/*
28
* change the process group for the child (pid == 0)
29
* note: we use the BSD calling sequence, since
30
* it will work ok for ATT call which has no arguments
31
*/
32
if
(pid == 0)
33
#ifdef SETPGRP_VOID
34
setpgrp();
35
#else
36
setpgrp(0, getpid());
37
#endif
38
39
return
pid;
40
41
#endif
/* __MINGW32__ */
42
43
}
G_fork
int G_fork(void)
Definition:
fork.c:18
lib
gis
fork.c
Generated on Sat Jan 2 2016 01:46:47 for GRASS Programmer's Manual by
1.8.5