… | |
… | |
222 | } |
222 | } |
223 | else |
223 | else |
224 | return err (); |
224 | return err (); |
225 | } |
225 | } |
226 | |
226 | |
227 | int opt_fork, opt_opendisplay, opt_quiet; |
|
|
228 | #if ENABLE_MLOCK |
|
|
229 | int opt_lock; |
|
|
230 | #endif |
|
|
231 | |
|
|
232 | int |
227 | int |
233 | main (int argc, const char *const *argv) |
228 | main (int argc, const char *const *argv) |
234 | { |
229 | { |
|
|
230 | int opt_fork, opt_opendisplay, opt_quiet; |
|
|
231 | #if ENABLE_MLOCK |
|
|
232 | int opt_lock; |
|
|
233 | #endif |
|
|
234 | |
235 | rxvt_init (); |
235 | rxvt_init (); |
236 | |
236 | |
237 | for (int i = 1; i < argc; i++) |
237 | for (int i = 1; i < argc; i++) |
238 | { |
238 | { |
239 | if (!strcmp (argv [i], "-f") || !strcmp (argv [i], "--fork")) |
239 | if (!strcmp (argv [i], "-f") || !strcmp (argv [i], "--fork")) |
… | |
… | |
276 | { |
276 | { |
277 | pid = fork (); |
277 | pid = fork (); |
278 | } |
278 | } |
279 | |
279 | |
280 | #if ENABLE_MLOCK |
280 | #if ENABLE_MLOCK |
281 | // Optionally preform a mlockall so this process does not get swapped out. |
281 | // Optionally perform an mlockall so this process does not get swapped out. |
282 | if (opt_lock && pid == 0) |
282 | if (opt_lock && !pid) |
283 | if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) |
283 | if (mlockall (MCL_CURRENT | MCL_FUTURE) < 0) |
284 | perror("unable to lock into ram"); |
284 | perror ("unable to lock into ram"); |
285 | #endif |
285 | #endif |
286 | |
286 | |
287 | if (opt_fork) |
287 | if (opt_fork) |
288 | { |
288 | { |
289 | if (pid < 0) |
289 | if (pid < 0) |
… | |
… | |
295 | _exit (EXIT_SUCCESS); |
295 | _exit (EXIT_SUCCESS); |
296 | |
296 | |
297 | ev_default_fork (); |
297 | ev_default_fork (); |
298 | } |
298 | } |
299 | |
299 | |
300 | ev_loop (0); |
300 | ev_run (); |
301 | |
301 | |
302 | return EXIT_SUCCESS; |
302 | return EXIT_SUCCESS; |
303 | } |
303 | } |
304 | |
304 | |