This is pthread_socket.h in view mode; [Download] [Up]
/* * pthread_socket.h */ #ifndef _pthread_socket_ #define _pthread_socket_ #include <fcntl.h> #include <syscall.h> #include <sys/socket.h> #include <sys/socketcall.h> #include <sys/time.h> #include <sys/types.h> #include <arpa/inet.h> /* inet_addr() and friends */ #include <linux/net.h> #include <errno.h> #include <pthread.h> #undef OK #define OK ((int) 0) #undef NOTOK #define NOTOK ((int) -1) #define LOCK_ON \ { \ pthread_lock_global_np(); \ errno = 0; \ { /* syscall goes here */ #define LOCK_OFF \ } \ if( errno ) \ pthread_set_errno_np( errno ); \ pthread_unlock_global_np(); \ } #define SET_ERRNO(v) \ { \ pthread_lock_global_np(); \ errno = (v) * -1; \ pthread_unlock_global_np(); \ pthread_set_errno_np( ((v) * -1) ); \ } #define RETURN(r) \ {\ if( r < OK ) \ { \ pthread_set_errno_np( errno ); \ r = -1; \ } \ return(r); \ } #ifndef ssize_t #define ssize_t int #endif extern int sys_set_critical( void ); extern void sys_restore_critical( int ); /* * Return TRUE if the specified file descriptor is set for O_NONBLOCK. * Otherwise, a value of FALSE is returned. */ extern int nonblock_is_set( int fd ); /* * Set the input file descriptor to specify non-blocking I/O. The * original value of the file descriptor's flags are saved in the * location referenced by the saved_flags variable. */ extern int set_fd_nonblock( int fd ); /* * Set a file descriptor's flags to the values contained in the * saved flags parameter. This function is used to restore a file * descriptor's flags to their original value after having been set * to non-blocking. */ extern int clear_fd_nonblock(int fd ); #endif
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.