ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/s_bsd_devpoll.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/s_bsd_devpoll.c (file contents):
Revision 2916 by michael, Sat Jan 25 21:09:18 2014 UTC vs.
Revision 6553 by michael, Sat Oct 3 16:56:22 2015 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 2001-2014 ircd-hybrid development team
4 > *  Copyright (c) 2001-2015 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 15 | Line 15
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18 < *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
18 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19   *  USA
20   */
21  
# Line 59 | Line 59 | init_netio(void)
59    {
60      ilog(LOG_TYPE_IRCD, "init_netio: Couldn't open /dev/poll - %d: %s",
61           errno, strerror(errno));
62 <    exit(115); /* Whee! */
62 >    exit(EXIT_FAILURE); /* Whee! */
63    }
64  
65    fd_open(&dpfd, fd, 0, "/dev/poll file descriptor");
# Line 94 | Line 94 | devpoll_write_update(int fd, int events)
94   * and deregister interest in a pending IO state for a given FD.
95   */
96   void
97 < comm_setselect(fde_t *F, unsigned int type, PF *handler,
97 > comm_setselect(fde_t *F, unsigned int type, void (*handler)(fde_t *, void *),
98                 void *client_data, time_t timeout)
99   {
100    int new_events;
# Line 143 | Line 143 | comm_select(void)
143    int num, i;
144    struct pollfd pollfds[128];
145    struct dvpoll dopoll;
146 <  PF *hdl;
146 >  void (*hdl)(fde_t *, void *);
147    fde_t *F;
148  
149    dopoll.dp_timeout = SELECT_DELAY;
# Line 155 | Line 155 | comm_select(void)
155  
156    if (num < 0)
157    {
158 < #ifdef HAVE_USLEEP
159 <    usleep(50000);  /* avoid 99% CPU in comm_select */
160 < #endif
158 >    const struct timespec req = { .tv_sec = 0, .tv_nsec = 50000000 };
159 >    nanosleep(&req, NULL);  /* Avoid 99% CPU in comm_select */
160      return;
161    }
162  

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)