… | |
… | |
50 | server (int fd) |
50 | server (int fd) |
51 | : read_ev (this, &server::read_cb), |
51 | : read_ev (this, &server::read_cb), |
52 | log_cb (this, &server::log_msg), |
52 | log_cb (this, &server::log_msg), |
53 | getfd_cb (this, &server::getfd) |
53 | getfd_cb (this, &server::getfd) |
54 | { |
54 | { |
|
|
55 | this->fd = fd; |
55 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
56 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
56 | fcntl (fd, F_SETFL, 0); |
57 | fcntl (fd, F_SETFL, 0); |
57 | read_ev.start (fd, ev::READ); |
58 | read_ev.start (fd, ev::READ); |
58 | } |
59 | } |
59 | |
60 | |
… | |
… | |
270 | rxvt_log ("unable to fork daemon, aborting.\n"); |
271 | rxvt_log ("unable to fork daemon, aborting.\n"); |
271 | return EXIT_FAILURE; |
272 | return EXIT_FAILURE; |
272 | } |
273 | } |
273 | else if (pid > 0) |
274 | else if (pid > 0) |
274 | _exit (EXIT_SUCCESS); |
275 | _exit (EXIT_SUCCESS); |
275 | } |
|
|
276 | |
276 | |
|
|
277 | ev_default_fork (); |
|
|
278 | } |
|
|
279 | |
277 | ev::ev_loop (0); |
280 | ev_loop (0); |
278 | |
281 | |
279 | return EXIT_SUCCESS; |
282 | return EXIT_SUCCESS; |
280 | } |
283 | } |
281 | |
284 | |