2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

1898. [port] sunos: non blocking i/o support. [RT #14951]

This commit is contained in:
Mark Andrews
2005-07-08 04:30:22 +00:00
parent 0bb7c66ef8
commit b2f160f266
8 changed files with 62 additions and 21 deletions

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: entropy.c,v 1.73 2005/04/29 00:23:49 marka Exp $ */
/* $Id: entropy.c,v 1.74 2005/07/08 04:30:22 marka Exp $ */
/* \file unix/entropy.c
* \brief
@@ -447,16 +447,25 @@ make_nonblock(int fd) {
int ret;
int flags;
char strbuf[ISC_STRERRORSIZE];
#ifdef USE_FIONBIO_IOCTL
int on = 1;
ret = ioctl(fd, FIONBIO, (char *)&on);
#else
flags = fcntl(fd, F_GETFL, 0);
flags |= O_NONBLOCK;
flags |= PORT_NONBLOCK;
ret = fcntl(fd, F_SETFL, flags);
#endif
if (ret == -1) {
isc__strerror(errno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__,
"fcntl(%d, F_SETFL, %d): %s",
fd, flags, strbuf);
#ifdef USE_FIONBIO_IOCTL
"ioctl(%d, FIONBIO, &on): %s", fd,
#else
"fcntl(%d, F_SETFL, %d): %s", fd, flags,
#endif
strbuf);
return (ISC_R_UNEXPECTED);
}
@@ -502,7 +511,7 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
if (is_usocket)
fd = socket(PF_UNIX, SOCK_STREAM, 0);
else
fd = open(fname, O_RDONLY | O_NONBLOCK, 0);
fd = open(fname, O_RDONLY | PORT_NONBLOCK, 0);
if (fd < 0) {
ret = isc__errno2result(errno);