mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
Move POLL_* macros to <ac/socket.h>
This commit is contained in:
parent
22690ddd0c
commit
547ebf66c4
@ -221,6 +221,12 @@ LDAP_LUTIL_F( int ) getpeereid( int s, uid_t *, gid_t * );
|
|||||||
# ifndef INFTIM
|
# ifndef INFTIM
|
||||||
# define INFTIM (-1)
|
# define INFTIM (-1)
|
||||||
# endif
|
# endif
|
||||||
|
#undef POLL_OTHER
|
||||||
|
#define POLL_OTHER (POLLERR|POLLHUP)
|
||||||
|
#undef POLL_READ
|
||||||
|
#define POLL_READ (POLLIN|POLLPRI|POLL_OTHER)
|
||||||
|
#undef POLL_WRITE
|
||||||
|
#define POLL_WRITE (POLLOUT|POLL_OTHER)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _AC_SOCKET_H_ */
|
#endif /* _AC_SOCKET_H_ */
|
||||||
|
@ -260,7 +260,7 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
|
|||||||
if( opt_tv != NULL ) timeout = TV2MILLISEC( &tv );
|
if( opt_tv != NULL ) timeout = TV2MILLISEC( &tv );
|
||||||
|
|
||||||
fd.fd = s;
|
fd.fd = s;
|
||||||
fd.events = POLLWRITE;
|
fd.events = POLL_WRITE;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
fd.revents = 0;
|
fd.revents = 0;
|
||||||
@ -270,7 +270,7 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
|
|||||||
|
|
||||||
if( rc == AC_SOCKET_ERROR ) return rc;
|
if( rc == AC_SOCKET_ERROR ) return rc;
|
||||||
|
|
||||||
if( fd.revents & POLLWRITE ) {
|
if( fd.revents & POLL_WRITE ) {
|
||||||
if ( ldap_pvt_is_socket_ready(ld, s) == -1 ) return -1;
|
if ( ldap_pvt_is_socket_ready(ld, s) == -1 ) return -1;
|
||||||
if ( ldap_pvt_ndelay_off(ld, s) == -1 ) return -1;
|
if ( ldap_pvt_ndelay_off(ld, s) == -1 ) return -1;
|
||||||
return ( 0 );
|
return ( 0 );
|
||||||
@ -638,12 +638,6 @@ struct selectinfo {
|
|||||||
/* for UNIX poll(2) */
|
/* for UNIX poll(2) */
|
||||||
int si_maxfd;
|
int si_maxfd;
|
||||||
struct pollfd si_fds[FD_SETSIZE];
|
struct pollfd si_fds[FD_SETSIZE];
|
||||||
#undef POLLOTHER
|
|
||||||
#define POLLOTHER (POLLERR|POLLHUP)
|
|
||||||
#undef POLLREAD
|
|
||||||
#define POLLREAD (POLLIN|POLLPRI|POLLOTHER)
|
|
||||||
#undef POLLWRITE
|
|
||||||
#define POLLWRITE (POLLOUT|POLLOTHER)
|
|
||||||
#else
|
#else
|
||||||
/* for UNIX select(2) */
|
/* for UNIX select(2) */
|
||||||
fd_set si_readfds;
|
fd_set si_readfds;
|
||||||
@ -670,7 +664,7 @@ ldap_mark_select_write( LDAP *ld, Sockbuf *sb )
|
|||||||
int i;
|
int i;
|
||||||
for(i=0; i < sip->si_maxfd; i++) {
|
for(i=0; i < sip->si_maxfd; i++) {
|
||||||
if( sip->si_fds[i].fd == sd ) {
|
if( sip->si_fds[i].fd == sd ) {
|
||||||
sip->si_fds[i].events |= POLLWRITE;
|
sip->si_fds[i].events |= POLL_WRITE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( empty==-1 && sip->si_fds[i].fd == -1 ) {
|
if( empty==-1 && sip->si_fds[i].fd == -1 ) {
|
||||||
@ -687,7 +681,7 @@ ldap_mark_select_write( LDAP *ld, Sockbuf *sb )
|
|||||||
}
|
}
|
||||||
|
|
||||||
sip->si_fds[empty].fd = sd;
|
sip->si_fds[empty].fd = sd;
|
||||||
sip->si_fds[empty].events = POLLWRITE;
|
sip->si_fds[empty].events = POLL_WRITE;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* for UNIX select(2) */
|
/* for UNIX select(2) */
|
||||||
@ -715,7 +709,7 @@ ldap_mark_select_read( LDAP *ld, Sockbuf *sb )
|
|||||||
int i;
|
int i;
|
||||||
for(i=0; i < sip->si_maxfd; i++) {
|
for(i=0; i < sip->si_maxfd; i++) {
|
||||||
if( sip->si_fds[i].fd == sd ) {
|
if( sip->si_fds[i].fd == sd ) {
|
||||||
sip->si_fds[i].events |= POLLREAD;
|
sip->si_fds[i].events |= POLL_READ;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( empty==-1 && sip->si_fds[i].fd == -1 ) {
|
if( empty==-1 && sip->si_fds[i].fd == -1 ) {
|
||||||
@ -732,7 +726,7 @@ ldap_mark_select_read( LDAP *ld, Sockbuf *sb )
|
|||||||
}
|
}
|
||||||
|
|
||||||
sip->si_fds[empty].fd = sd;
|
sip->si_fds[empty].fd = sd;
|
||||||
sip->si_fds[empty].events = POLLREAD;
|
sip->si_fds[empty].events = POLL_READ;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* for UNIX select(2) */
|
/* for UNIX select(2) */
|
||||||
@ -787,7 +781,7 @@ ldap_is_write_ready( LDAP *ld, Sockbuf *sb )
|
|||||||
int i;
|
int i;
|
||||||
for(i=0; i < sip->si_maxfd; i++) {
|
for(i=0; i < sip->si_maxfd; i++) {
|
||||||
if( sip->si_fds[i].fd == sd ) {
|
if( sip->si_fds[i].fd == sd ) {
|
||||||
return sip->si_fds[i].revents & POLLWRITE;
|
return sip->si_fds[i].revents & POLL_WRITE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -816,7 +810,7 @@ ldap_is_read_ready( LDAP *ld, Sockbuf *sb )
|
|||||||
int i;
|
int i;
|
||||||
for(i=0; i < sip->si_maxfd; i++) {
|
for(i=0; i < sip->si_maxfd; i++) {
|
||||||
if( sip->si_fds[i].fd == sd ) {
|
if( sip->si_fds[i].fd == sd ) {
|
||||||
return sip->si_fds[i].revents & POLLREAD;
|
return sip->si_fds[i].revents & POLL_READ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ sendcred:
|
|||||||
if( opt_tv != NULL ) timeout = TV2MILLISEC( &tv );
|
if( opt_tv != NULL ) timeout = TV2MILLISEC( &tv );
|
||||||
|
|
||||||
fd.fd = s;
|
fd.fd = s;
|
||||||
fd.events = POLLOUT;
|
fd.events = POLL_WRITE;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
fd.revents = 0;
|
fd.revents = 0;
|
||||||
@ -233,7 +233,7 @@ sendcred:
|
|||||||
|
|
||||||
if( rc == AC_SOCKET_ERROR ) return rc;
|
if( rc == AC_SOCKET_ERROR ) return rc;
|
||||||
|
|
||||||
if( fd.revents & POLLOUT ) {
|
if( fd.revents & POLL_WRITE ) {
|
||||||
if ( ldap_pvt_is_socket_ready(ld, s) == -1 ) return -1;
|
if ( ldap_pvt_is_socket_ready(ld, s) == -1 ) return -1;
|
||||||
if ( ldap_pvt_ndelay_off(ld, s) == -1 ) return -1;
|
if ( ldap_pvt_ndelay_off(ld, s) == -1 ) return -1;
|
||||||
#ifdef DO_SENDMSG
|
#ifdef DO_SENDMSG
|
||||||
|
Loading…
Reference in New Issue
Block a user