10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
56812Sraf * Common Development and Distribution License (the "License").
66812Sraf * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
216812Sraf
220Sstevel@tonic-gate /*
23*13093SRoger.Faulkner@Oracle.COM * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
240Sstevel@tonic-gate */
250Sstevel@tonic-gate
266812Sraf #pragma weak _poll = poll
270Sstevel@tonic-gate
286812Sraf #include "lint.h"
290Sstevel@tonic-gate #include <sys/time.h>
300Sstevel@tonic-gate #include <sys/poll.h>
310Sstevel@tonic-gate #include "libc.h"
320Sstevel@tonic-gate
330Sstevel@tonic-gate int
ppoll(struct pollfd * _RESTRICT_KYWD fds,nfds_t nfd,const struct timespec * _RESTRICT_KYWD tsp,const sigset_t * _RESTRICT_KYWD sigmask)34*13093SRoger.Faulkner@Oracle.COM ppoll(struct pollfd *_RESTRICT_KYWD fds, nfds_t nfd,
35*13093SRoger.Faulkner@Oracle.COM const struct timespec *_RESTRICT_KYWD tsp,
36*13093SRoger.Faulkner@Oracle.COM const sigset_t *_RESTRICT_KYWD sigmask)
37*13093SRoger.Faulkner@Oracle.COM {
38*13093SRoger.Faulkner@Oracle.COM return (_pollsys(fds, nfd, tsp, sigmask));
39*13093SRoger.Faulkner@Oracle.COM }
40*13093SRoger.Faulkner@Oracle.COM
41*13093SRoger.Faulkner@Oracle.COM int
poll(struct pollfd * fds,nfds_t nfd,int timeout)420Sstevel@tonic-gate poll(struct pollfd *fds, nfds_t nfd, int timeout)
430Sstevel@tonic-gate {
440Sstevel@tonic-gate timespec_t ts;
450Sstevel@tonic-gate timespec_t *tsp;
460Sstevel@tonic-gate
470Sstevel@tonic-gate if (timeout < 0)
480Sstevel@tonic-gate tsp = NULL;
490Sstevel@tonic-gate else {
500Sstevel@tonic-gate ts.tv_sec = timeout / MILLISEC;
510Sstevel@tonic-gate ts.tv_nsec = (timeout % MILLISEC) * MICROSEC;
520Sstevel@tonic-gate tsp = &ts;
530Sstevel@tonic-gate }
540Sstevel@tonic-gate
550Sstevel@tonic-gate return (_pollsys(fds, nfd, tsp, NULL));
560Sstevel@tonic-gate }
57