Commit 74543e6c authored by Howard Chu's avatar Howard Chu
Browse files

Defined tcp_read and tcp_write. Use them in daemon.c

parent 193d30bf
......@@ -67,8 +67,13 @@
#define MAXHOSTNAMELEN 64
#endif
#define sock_errno() errno
#define sock_errstr() STRERROR(errno)
#ifdef HAVE_WINSOCK
# define tcp_close( s ) closesocket( s );
# define tcp_close( s ) closesocket( s )
# define tcp_read( s, buf, len ) recv( s, buf, len, 0 )
# define tcp_write( s, buf, len ) send( s, buf, len, 0 )
# define ioctl( s, c, a ) ioctlsocket( (s), (c), (a) )
# define ioctl_t u_long
# define AC_SOCKET_INVALID ((unsigned int) ~0)
......@@ -77,18 +82,26 @@
#define EINPROGRESS WSAEINPROGRESS
#define ETIMEDOUT WSAETIMEDOUT
#undef sock_errno
#undef sock_errstr
#define sock_errno() WSAGetLastError()
#define sock_errstr() WSAGetLastErrorString()
#elif MACOS
# define tcp_close( s ) tcpclose( s )
# define tcp_read( s, buf, len ) tcpread( s, buf, len )
# define tcp_write( s, buf, len ) tcpwrite( s, buf, len )
#elif DOS
# ifdef PCNFS
# define tcp_close( s ) close( s )
# define tcp_read( s, buf, len ) recv( s, buf, len, 0 )
# define tcp_write( s, buf, len ) send( s, buf, len, 0 )
# endif /* PCNFS */
# ifdef NCSA
# define tcp_close( s ) do { netclose( s ); netshut() } while(0)
# define tcp_read( s, buf, len ) nread( s, buf, len )
# define tcp_write( s, buf, len ) netwrite( s, buf, len )
# endif /* NCSA */
#elif HAVE_CLOSESOCKET
......@@ -96,8 +109,8 @@
#else
# define tcp_close( s ) close( s )
# define sock_errno() errno
# define sock_errstr() STRERROR(errno)
# define tcp_read( s, buf, len) read( s, buf, len )
# define tcp_write( s, buf, len) write( s, buf, len )
#endif /* MACOS */
#ifndef ioctl_t
......
......@@ -659,7 +659,7 @@ slapd_daemon_task(
if( FD_ISSET( sel_exit_fd, &readfds ) )
{
char c;
read( sel_exit_fd, &c, 1 );
tcp_read( sel_exit_fd, &c, 1 );
continue;
}
for ( l = 0; slap_listeners[l] != NULL; l++ ) {
......@@ -1102,7 +1102,7 @@ slap_set_shutdown( int sig )
}
}
#endif
write( sel_exit_fd, "0", 1 );
tcp_write( sel_exit_fd, "0", 1 );
/* reinstall self */
(void) SIGNAL( sig, slap_set_shutdown );
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment