mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
Defined tcp_read and tcp_write. Use them in daemon.c
This commit is contained in:
parent
193d30bf84
commit
74543e6c68
2 changed files with 18 additions and 5 deletions
|
|
@ -67,8 +67,13 @@
|
||||||
#define MAXHOSTNAMELEN 64
|
#define MAXHOSTNAMELEN 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define sock_errno() errno
|
||||||
|
#define sock_errstr() STRERROR(errno)
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK
|
#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( s, c, a ) ioctlsocket( (s), (c), (a) )
|
||||||
# define ioctl_t u_long
|
# define ioctl_t u_long
|
||||||
# define AC_SOCKET_INVALID ((unsigned int) ~0)
|
# define AC_SOCKET_INVALID ((unsigned int) ~0)
|
||||||
|
|
@ -77,18 +82,26 @@
|
||||||
#define EINPROGRESS WSAEINPROGRESS
|
#define EINPROGRESS WSAEINPROGRESS
|
||||||
#define ETIMEDOUT WSAETIMEDOUT
|
#define ETIMEDOUT WSAETIMEDOUT
|
||||||
|
|
||||||
|
#undef sock_errno
|
||||||
|
#undef sock_errstr
|
||||||
#define sock_errno() WSAGetLastError()
|
#define sock_errno() WSAGetLastError()
|
||||||
#define sock_errstr() WSAGetLastErrorString()
|
#define sock_errstr() WSAGetLastErrorString()
|
||||||
|
|
||||||
#elif MACOS
|
#elif MACOS
|
||||||
# define tcp_close( s ) tcpclose( s )
|
# 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
|
#elif DOS
|
||||||
# ifdef PCNFS
|
# ifdef PCNFS
|
||||||
# define tcp_close( s ) close( s )
|
# 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 */
|
# endif /* PCNFS */
|
||||||
# ifdef NCSA
|
# ifdef NCSA
|
||||||
# define tcp_close( s ) do { netclose( s ); netshut() } while(0)
|
# 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 */
|
# endif /* NCSA */
|
||||||
|
|
||||||
#elif HAVE_CLOSESOCKET
|
#elif HAVE_CLOSESOCKET
|
||||||
|
|
@ -96,8 +109,8 @@
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# define tcp_close( s ) close( s )
|
# define tcp_close( s ) close( s )
|
||||||
# define sock_errno() errno
|
# define tcp_read( s, buf, len) read( s, buf, len )
|
||||||
# define sock_errstr() STRERROR(errno)
|
# define tcp_write( s, buf, len) write( s, buf, len )
|
||||||
#endif /* MACOS */
|
#endif /* MACOS */
|
||||||
|
|
||||||
#ifndef ioctl_t
|
#ifndef ioctl_t
|
||||||
|
|
|
||||||
|
|
@ -659,7 +659,7 @@ slapd_daemon_task(
|
||||||
if( FD_ISSET( sel_exit_fd, &readfds ) )
|
if( FD_ISSET( sel_exit_fd, &readfds ) )
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
read( sel_exit_fd, &c, 1 );
|
tcp_read( sel_exit_fd, &c, 1 );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for ( l = 0; slap_listeners[l] != NULL; l++ ) {
|
for ( l = 0; slap_listeners[l] != NULL; l++ ) {
|
||||||
|
|
@ -1102,7 +1102,7 @@ slap_set_shutdown( int sig )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
write( sel_exit_fd, "0", 1 );
|
tcp_write( sel_exit_fd, "0", 1 );
|
||||||
/* reinstall self */
|
/* reinstall self */
|
||||||
(void) SIGNAL( sig, slap_set_shutdown );
|
(void) SIGNAL( sig, slap_set_shutdown );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue