From: Zoran V. <vas...@us...> - 2005-06-10 07:30:09
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13693 Modified Files: nswin32.c Log Message: Added NsRestoreSignals as no-op to make symetrical to Unix counterpart and avoid excessive ifdefs for Windows. Replaced GNU pool implementation. Index: nswin32.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/nswin32.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** nswin32.c 10 Jun 2005 07:25:03 -0000 1.2 --- nswin32.c 10 Jun 2005 07:29:51 -0000 1.3 *************** *** 312,315 **** --- 312,337 ---- /* *---------------------------------------------------------------------- + * NsRestoreSignals -- + * + * Noop to avoid ifdefs and make symetrical to Unix part + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + + void + NsRestoreSignals(void) + { + return; + } + + + /* + *---------------------------------------------------------------------- * * NsHandleSignals -- *************** *** 883,965 **** } } ! ! ! /* Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc. ! This file is part of the GNU C Library. ! ! The GNU C Library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! The GNU C Library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with the GNU C Library; see the file COPYING.LIB. If not, ! write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ! Boston, MA 02111-1307, USA. */ ! ! /* Poll the file descriptors described by the NFDS structures starting at ! FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for ! an event to occur; if TIMEOUT is -1, block until an event occurs. ! Returns the number of file descriptors with events, zero if timed out, ! or -1 for errors. */ int ! poll (fds, nfds, timeout) ! struct pollfd *fds; ! unsigned long int nfds; ! int timeout; { ! struct timeval tv, *tvp; ! fd_set rset, wset, xset; ! struct pollfd *f; ! int ready; ! int maxfd = 0; ! ! FD_ZERO (&rset); ! FD_ZERO (&wset); ! FD_ZERO (&xset); ! ! for (f = fds; f < &fds[nfds]; ++f) ! if (f->fd != -1) ! { ! if (f->events & POLLIN) ! FD_SET (f->fd, &rset); ! if (f->events & POLLOUT) ! FD_SET (f->fd, &wset); ! if (f->events & POLLPRI) ! FD_SET (f->fd, &xset); ! if (f->fd > maxfd && (f->events & (POLLIN|POLLOUT|POLLPRI))) ! maxfd = f->fd; ! } ! ! if (timeout < 0) { ! tvp = NULL; ! } else { ! tv.tv_sec = timeout / 1000; ! tv.tv_usec = (timeout % 1000) * 1000; ! tvp = &tv; ! } ! ! ready = select (maxfd + 1, &rset, &wset, &xset, tvp); ! if (ready > 0) ! for (f = fds; f < &fds[nfds]; ++f) ! { ! f->revents = 0; ! if (f->fd >= 0) ! { ! if (FD_ISSET (f->fd, &rset)) ! f->revents |= POLLIN; ! if (FD_ISSET (f->fd, &wset)) ! f->revents |= POLLOUT; ! if (FD_ISSET (f->fd, &xset)) ! f->revents |= POLLPRI; } ! } ! ! return ready; } --- 905,979 ---- } } ! /* ! * ----------------------------------------------------------------- ! * Copyright 1994 University of Washington ! * ! * Permission is hereby granted to copy this software, and to ! * use and redistribute it, except that this notice may not be ! * removed. The University of Washington does not guarantee ! * that this software is suitable for any purpose and will not ! * be held liable for any damage it may cause. ! * ----------------------------------------------------------------- ! * ! * Modified to work properly on Darwin 10.2 or less. ! * Also, heavily reformatted to be more readable. ! */ int ! poll(struct pollfd *fds, unsigned long int nfds, int timo) { ! struct timeval timeout, *toptr; ! fd_set ifds, ofds, efds; ! int i, rc, n = -1; ! ! FD_ZERO(&ifds); ! FD_ZERO(&ofds); ! FD_ZERO(&efds); ! ! for (i = 0; i < nfds; ++i) { ! if (fds[i].fd == -1) { ! continue; ! } ! if (fds[i].fd > n) { ! n = fds[i].fd; ! } ! if ((fds[i].events & POLLIN)) { ! FD_SET(fds[i].fd, &ifds); ! } ! if ((fds[i].events & POLLOUT)) { ! FD_SET(fds[i].fd, &ofds); ! } ! if ((fds[i].events & POLLPRI)) { ! FD_SET(fds[i].fd, &efds); ! } } ! if (timo < 0) { ! toptr = NULL; ! } else { ! toptr = &timeout; ! timeout.tv_sec = timo / 1000; ! timeout.tv_usec = (timo - timeout.tv_sec * 1000) * 1000; ! } ! rc = select(++n, &ifds, &ofds, &efds, toptr); ! if (rc <= 0) { ! return rc; ! } ! for (i = 0; i < nfds; ++i) { ! fds[i].revents = 0; ! if (fds[i].fd == -1) { ! continue; ! } ! if (FD_ISSET(fds[i].fd, &ifds)) { ! fds[i].revents |= POLLIN; ! } ! if (FD_ISSET(fds[i].fd, &ofds)) { ! fds[i].revents |= POLLOUT; ! } ! if (FD_ISSET(fds[i].fd, &efds)) { ! fds[i].revents |= POLLPRI; ! } ! } ! ! return rc; } + |