21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 /* 27 * This file contains implementations of NET_... functions. The NET_.. functions are 28 * wrappers for common file- and socket functions plus provisions for non-blocking IO. 29 * 30 * (basically, the layers remember all file descriptors waiting for a particular fd; 31 * all threads waiting on a certain fd can be woken up by sending them a signal; this 32 * is done e.g. when the fd is closed.) 33 * 34 * This was originally copied from the linux_close.c implementation. 35 * 36 * Side Note: This coding needs initialization. Under Linux this is done 37 * automatically via __attribute((constructor)), on AIX this is done manually 38 * (see aix_close_init). 39 * 40 */ 41 #include <stdio.h> 42 #include <stdlib.h> 43 #include <signal.h> 44 #include <pthread.h> 45 #include <sys/types.h> 46 #include <sys/socket.h> 47 #include <sys/time.h> 48 #include <sys/resource.h> 49 #include <sys/uio.h> 50 #include <unistd.h> 51 #include <errno.h> 52 53 #include <sys/poll.h> 54 55 /* 56 * Stack allocated by thread when doing blocking operation 57 */ 58 typedef struct threadEntry { 59 pthread_t thr; /* this thread */ 60 struct threadEntry *next; /* next thread */ | 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 /* 27 * This file contains implementations of NET_... functions. The NET_.. functions are 28 * wrappers for common file- and socket functions plus provisions for non-blocking IO. 29 * 30 * (basically, the layers remember all file descriptors waiting for a particular fd; 31 * all threads waiting on a certain fd can be woken up by sending them a signal; this 32 * is done e.g. when the fd is closed.) 33 * 34 * This was originally copied from the linux_close.c implementation. 35 * 36 * Side Note: This coding needs initialization. Under Linux this is done 37 * automatically via __attribute((constructor)), on AIX this is done manually 38 * (see aix_close_init). 39 * 40 */ 41 42 /* 43 AIX needs a workaround for I/O cancellation, see: 44 http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.basetechref/doc/basetrf1/close.htm 45 ... 46 The close subroutine is blocked until all subroutines which use the file 47 descriptor return to usr space. For example, when a thread is calling close 48 and another thread is calling select with the same file descriptor, the 49 close subroutine does not return until the select call returns. 50 ... 51 */ 52 53 #include <stdio.h> 54 #include <stdlib.h> 55 #include <signal.h> 56 #include <pthread.h> 57 #include <sys/types.h> 58 #include <sys/socket.h> 59 #include <sys/time.h> 60 #include <sys/resource.h> 61 #include <sys/uio.h> 62 #include <unistd.h> 63 #include <errno.h> 64 65 #include <sys/poll.h> 66 67 /* 68 * Stack allocated by thread when doing blocking operation 69 */ 70 typedef struct threadEntry { 71 pthread_t thr; /* this thread */ 72 struct threadEntry *next; /* next thread */ |