Use pipe(2) if descriptors are selectable.

This commit is contained in:
Kurt Zeilenga 1999-08-31 17:01:10 +00:00
parent ac8b5468aa
commit 0307dd3b38
5 changed files with 610 additions and 713 deletions

1300
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -639,7 +639,7 @@ dnl hopefully we won't include too many libraries
dnl require select dnl require select
AC_CHECK_FUNC(select, :, AC_MSG_ERROR([select() required.])) AC_CHECK_FUNC(select, :, AC_MSG_ERROR([select() required.]))
AC_CHECK_FUNCS(socketpair) dnl AC_CHECK_FUNCS(socketpair)
dnl Select arg types dnl Select arg types
dnl (if this detection becomes permenent, it and the select() detection dnl (if this detection becomes permenent, it and the select() detection
@ -647,7 +647,7 @@ dnl should be done before the yielding select test)
AC_FUNC_SELECT_ARGTYPES AC_FUNC_SELECT_ARGTYPES
dnl check to see if system call automatically restart dnl check to see if system call automatically restart
AC_SYS_RESTARTABLE_SYSCALLS dnl AC_SYS_RESTARTABLE_SYSCALLS
dnl require POSIX regex dnl require POSIX regex
AC_CHECK_HEADERS( regex.h ) AC_CHECK_HEADERS( regex.h )
@ -1838,6 +1838,7 @@ AC_CHECK_FUNCS( \
memcpy \ memcpy \
memmove \ memmove \
mkstemp \ mkstemp \
pipe \
read \ read \
recv \ recv \
recvfrom \ recvfrom \

View File

@ -115,8 +115,8 @@ extern char* WSAGetErrorString LDAP_P((int));
# define tcp_read( s, buf, len) read( s, buf, len ) # define tcp_read( s, buf, len) read( s, buf, len )
# define tcp_write( s, buf, len) write( s, buf, len ) # define tcp_write( s, buf, len) write( s, buf, len )
#ifdef HAVE_PAIR #ifdef HAVE_PIPE
#define USE_PAIR HAVE_PAIR #define USE_PIPE HAVE_PIPE
#endif #endif
#endif /* MACOS */ #endif /* MACOS */

View File

@ -34,10 +34,6 @@
/* Define if you don't have vprintf but do have _doprnt. */ /* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT #undef HAVE_DOPRNT
/* Define if system calls automatically restart after interruption
by a signal. */
#undef HAVE_RESTARTABLE_SYSCALLS
/* Define if your struct stat has st_blksize. */ /* Define if your struct stat has st_blksize. */
#undef HAVE_ST_BLKSIZE #undef HAVE_ST_BLKSIZE
@ -217,6 +213,9 @@
/* Define if you have the mkstemp function. */ /* Define if you have the mkstemp function. */
#undef HAVE_MKSTEMP #undef HAVE_MKSTEMP
/* Define if you have the pipe function. */
#undef HAVE_PIPE
/* Define if you have the pthread_getconcurrency function. */ /* Define if you have the pthread_getconcurrency function. */
#undef HAVE_PTHREAD_GETCONCURRENCY #undef HAVE_PTHREAD_GETCONCURRENCY
@ -277,9 +276,6 @@
/* Define if you have the snprintf function. */ /* Define if you have the snprintf function. */
#undef HAVE_SNPRINTF #undef HAVE_SNPRINTF
/* Define if you have the socketpair function. */
#undef HAVE_SOCKETPAIR
/* Define if you have the strdup function. */ /* Define if you have the strdup function. */
#undef HAVE_STRDUP #undef HAVE_STRDUP

View File

@ -20,6 +20,9 @@
int lutil_pair( LBER_SOCKET_T sds[2] ) int lutil_pair( LBER_SOCKET_T sds[2] )
{ {
#ifdef USE_PIPE
return pipe( sds );
#else
struct sockaddr_in si; struct sockaddr_in si;
int rc, len = sizeof(si); int rc, len = sizeof(si);
LBER_SOCKET_T sd; LBER_SOCKET_T sd;
@ -53,4 +56,5 @@ int lutil_pair( LBER_SOCKET_T sds[2] )
sds[0] = sds[1] = sd; sds[0] = sds[1] = sd;
return 0; return 0;
#endif
} }