This is send.c in view mode; [Download] [Up]
#include "pthread_socket.h" #include "pthread_io_delay.h" extern void fd_init( void ); extern pthread_once_t io_initialized; static inline _syscall2(long,socketcall,int,call,unsigned long *,args); static int syscall_send(int fd, const void *msg, int len, unsigned int flags ) { unsigned long args[4]; int ret; args[0] = (unsigned long) fd; args[1] = (unsigned long) msg; args[2] = (unsigned long) len; args[3] = (unsigned long) flags; LOCK_ON ret = socketcall( SYS_SEND, args ); LOCK_OFF return( ret ); } /*-------------------------------------------------------------------------- * @@ S E N D *------------------------------------------------------------------------*/ int send( int fd, const void *msg, int len, unsigned int flags ) { int ret, err, st; st = pthread_once( &io_initialized, fd_init ); if( st != SUCCESS ) return( NOTOK ); if( nonblock_is_set( fd )) { ret = syscall_send( fd, msg, len, flags ); RETURN( ret ); } set_fd_nonblock( fd ); while( (ret = syscall_send( fd, msg, len, flags )) < OK ) { (void) pthread_get_errno_np( NULL, &err ); if( err != EWOULDBLOCK ) break; pthread_delay_np( &delay_interval ); } clear_fd_nonblock( fd ); return( ret ); }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.