34{
35 pid_t result;
36 const char *oomfilename;
37 sigset_t save_mask;
38
39#ifdef LINUX_PROFILE
41#endif
42
43
44
45
47
48#ifdef LINUX_PROFILE
49
50
51
52
53
54
55
56 getitimer(ITIMER_PROF, &prof_itimer);
57#endif
58
59
60
61
62
63
64
65 sigprocmask(SIG_SETMASK, &
BlockSig, &save_mask);
66 result = fork();
67 if (result == 0)
68 {
69
71#ifdef LINUX_PROFILE
72 setitimer(ITIMER_PROF, &prof_itimer, NULL);
73#endif
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91 oomfilename = getenv("PG_OOM_ADJUST_FILE");
92
93 if (oomfilename != NULL)
94 {
95
96
97
98
99 int fd = open(oomfilename, O_WRONLY, 0);
100
101
103 {
104 const char *oomvalue = getenv("PG_OOM_ADJUST_VALUE");
105 int rc;
106
107 if (oomvalue == NULL)
108 oomvalue = "0";
109
110 rc =
write(
fd, oomvalue, strlen(oomvalue));
111 (void) rc;
113 }
114 }
115
116
118 }
119 else
120 {
121
122 sigprocmask(SIG_SETMASK, &save_mask, NULL);
123 }
124
125 return result;
126}
static void const char fflush(stdout)
void pg_strong_random_init(void)
static int fd(const char *x, int i)
int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)