equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * CDDL HEADER START |
2 * CDDL HEADER START |
3 * |
3 * |
4 * The contents of this file are subject to the terms of the |
4 * The contents of this file are subject to the terms of the |
5 * Common Development and Distribution License, Version 1.0 only |
5 * Common Development and Distribution License (the "License"). |
6 * (the "License"). You may not use this file except in compliance |
6 * You may not use this file except in compliance with the License. |
7 * with the License. |
|
8 * |
7 * |
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
10 * or http://www.opensolaris.org/os/licensing. |
9 * or http://www.opensolaris.org/os/licensing. |
11 * See the License for the specific language governing permissions |
10 * See the License for the specific language governing permissions |
12 * and limitations under the License. |
11 * and limitations under the License. |
17 * fields enclosed by brackets "[]" replaced with your own identifying |
16 * fields enclosed by brackets "[]" replaced with your own identifying |
18 * information: Portions Copyright [yyyy] [name of copyright owner] |
17 * information: Portions Copyright [yyyy] [name of copyright owner] |
19 * |
18 * |
20 * CDDL HEADER END |
19 * CDDL HEADER END |
21 */ |
20 */ |
|
21 |
22 /* |
22 /* |
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. |
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. |
24 * Use is subject to license terms. |
24 * Use is subject to license terms. |
25 */ |
25 */ |
26 |
26 |
27 #pragma ident "%Z%%M% %I% %E% SMI" |
27 #pragma ident "%Z%%M% %I% %E% SMI" |
28 |
28 |
29 /* Copyright (c) 1988 AT&T */ |
29 /* Copyright (c) 1988 AT&T */ |
30 /* All Rights Reserved */ |
30 /* All Rights Reserved */ |
31 |
|
32 |
31 |
33 /* |
32 /* |
34 * Emulation of select() system call using poll() system call. |
33 * Emulation of select() system call using poll() system call. |
35 * |
34 * |
36 * Assumptions: |
35 * Assumptions: |
295 /* check timeval validity */ |
294 /* check timeval validity */ |
296 if (tv->tv_usec < 0 || tv->tv_usec >= MICROSEC) { |
295 if (tv->tv_usec < 0 || tv->tv_usec >= MICROSEC) { |
297 errno = EINVAL; |
296 errno = EINVAL; |
298 return (-1); |
297 return (-1); |
299 } |
298 } |
300 /* Convert timeval to timespec */ |
299 /* |
|
300 * Convert timeval to timespec. |
|
301 * To preserve compatibility with past behavior, |
|
302 * when select was built upon poll(2), which has a |
|
303 * minimum non-zero timeout of 1 millisecond, force |
|
304 * a minimum non-zero timeout of 500 microseconds. |
|
305 */ |
301 ts.tv_sec = tv->tv_sec; |
306 ts.tv_sec = tv->tv_sec; |
302 ts.tv_nsec = tv->tv_usec * 1000; |
307 ts.tv_nsec = tv->tv_usec * 1000; |
|
308 if (ts.tv_nsec != 0 && ts.tv_nsec < 500000) |
|
309 ts.tv_nsec = 500000; |
303 tsp = &ts; |
310 tsp = &ts; |
304 } |
311 } |
305 |
312 |
306 return (pselect(nfds, in0, out0, ex0, tsp, NULL)); |
313 return (pselect(nfds, in0, out0, ex0, tsp, NULL)); |
307 } |
314 } |