Lines 35-40
Link Here
|
35 |
|
35 |
|
36 |
#include <sys/param.h> |
36 |
#include <sys/param.h> |
37 |
#include <sys/mman.h> |
37 |
#include <sys/mman.h> |
|
|
38 |
#include <sys/rtprio.h> |
39 |
#include <sys/types.h> |
38 |
#include <sys/wait.h> |
40 |
#include <sys/wait.h> |
39 |
|
41 |
|
40 |
#include <fcntl.h> |
42 |
#include <fcntl.h> |
Lines 86-91
Link Here
|
86 |
int pfd[2] = { -1, -1 }, outfd = -1; |
88 |
int pfd[2] = { -1, -1 }, outfd = -1; |
87 |
int stdmask, logpri, logfac; |
89 |
int stdmask, logpri, logfac; |
88 |
struct pidfh *ppfh, *pfh; |
90 |
struct pidfh *ppfh, *pfh; |
|
|
91 |
struct rtprio rtp, *prtp = NULL; |
89 |
char *p; |
92 |
char *p; |
90 |
|
93 |
|
91 |
memset(&logpar, 0, sizeof(logpar)); |
94 |
memset(&logpar, 0, sizeof(logpar)); |
Lines 99-109
Link Here
|
99 |
dosyslog = 0; |
102 |
dosyslog = 0; |
100 |
outfn = NULL; |
103 |
outfn = NULL; |
101 |
title = NULL; |
104 |
title = NULL; |
102 |
while ((ch = getopt(argc, argv, "cfSp:P:ru:o:s:l:t:l:m:R:T:")) != -1) { |
105 |
while ((ch = getopt(argc, argv, "ce:i:fSp:P:ru:o:s:l:t:l:m:R:T:")) != -1) { |
103 |
switch (ch) { |
106 |
switch (ch) { |
104 |
case 'c': |
107 |
case 'c': |
105 |
nochdir = 0; |
108 |
nochdir = 0; |
106 |
break; |
109 |
break; |
|
|
110 |
case 'e': |
111 |
case 'i': |
112 |
switch (ch) { |
113 |
case 'e': |
114 |
rtp.type = RTP_PRIO_REALTIME; |
115 |
break; |
116 |
case 'i': |
117 |
rtp.type = RTP_PRIO_IDLE; |
118 |
break; |
119 |
} |
120 |
rtp.prio = strtol(optarg, &p, 10); |
121 |
if (!optarg[0] || p != optarg + strlen(optarg) || rtp.prio < 0 || rtp.prio > RTP_PRIO_MAX) |
122 |
errx(8, "unrecognized priority value"); |
123 |
prtp = &rtp; |
124 |
break; |
107 |
case 'f': |
125 |
case 'f': |
108 |
noclose = 0; |
126 |
noclose = 0; |
109 |
break; |
127 |
break; |
Lines 279-284
Link Here
|
279 |
/* Now that we are the child, write out the pid. */ |
297 |
/* Now that we are the child, write out the pid. */ |
280 |
pidfile_write(pfh); |
298 |
pidfile_write(pfh); |
281 |
|
299 |
|
|
|
300 |
/* Set child's priority if requested. */ |
301 |
if (prtp != NULL) |
302 |
if (rtprio(RTP_SET, getpid(), prtp) != 0) |
303 |
err(1, "RTP_SET"); |
304 |
|
282 |
if (user != NULL) |
305 |
if (user != NULL) |
283 |
restrict_process(user); |
306 |
restrict_process(user); |
284 |
/* |
307 |
/* |