Don't compile in the use of poll() when building libc_r. This isn't
so much a "fix", rather a bandaid to buy time to fix it properly within the thread engine.
This commit is contained in:
parent
26d7294956
commit
02a93d74e0
@ -71,7 +71,7 @@
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
|
||||
static char orig_rcsid[] = "From: Id: res_send.c,v 8.20 1998/04/06 23:27:51 halley Exp $";
|
||||
static char rcsid[] = "$Id: res_send.c,v 1.22 1998/05/02 15:51:54 peter Exp $";
|
||||
static char rcsid[] = "$Id: res_send.c,v 1.23 1998/06/11 09:03:01 peter Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/*
|
||||
@ -99,8 +99,12 @@ static char rcsid[] = "$Id: res_send.c,v 1.22 1998/05/02 15:51:54 peter Exp $";
|
||||
|
||||
#include "res_config.h"
|
||||
|
||||
#ifdef NOPOLL /* libc_r doesn't wrap poll yet() */
|
||||
static int use_poll = 0;
|
||||
#else
|
||||
static int use_poll = 1; /* adapt to poll() syscall availability */
|
||||
/* 0 = not present, 1 = try it, 2 = exists */
|
||||
#endif
|
||||
|
||||
static int s = -1; /* socket used for communications */
|
||||
static int connected = 0; /* is the socket connected */
|
||||
@ -519,8 +523,10 @@ res_send(buf, buflen, ans, anssiz)
|
||||
/*
|
||||
* Use datagrams.
|
||||
*/
|
||||
#ifndef NOPOLL
|
||||
struct pollfd pfd;
|
||||
int msec;
|
||||
#endif
|
||||
struct timeval timeout;
|
||||
fd_set dsmask, *dsmaskp;
|
||||
int dsmasklen;
|
||||
@ -626,6 +632,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
/*
|
||||
* Wait for reply
|
||||
*/
|
||||
#ifndef NOPOLL
|
||||
othersyscall:
|
||||
if (use_poll) {
|
||||
msec = (_res.retrans << try) * 1000;
|
||||
@ -634,19 +641,23 @@ res_send(buf, buflen, ans, anssiz)
|
||||
if (msec <= 0)
|
||||
msec = 1000;
|
||||
} else {
|
||||
#endif
|
||||
timeout.tv_sec = (_res.retrans << try);
|
||||
if (try > 0)
|
||||
timeout.tv_sec /= _res.nscount;
|
||||
if ((long) timeout.tv_sec <= 0)
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
#ifndef NOPOLL
|
||||
}
|
||||
#endif
|
||||
wait:
|
||||
if (s < 0) {
|
||||
Perror(stderr, "s out-of-bounds", EMFILE);
|
||||
res_close();
|
||||
goto next_ns;
|
||||
}
|
||||
#ifndef NOPOLL
|
||||
if (use_poll) {
|
||||
struct sigaction sa, osa;
|
||||
int sigsys_installed = 0;
|
||||
@ -680,6 +691,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
goto next_ns;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
dsmasklen = howmany(s + 1, NFDBITS) *
|
||||
sizeof(fd_mask);
|
||||
if (dsmasklen > sizeof(fd_set)) {
|
||||
@ -704,7 +716,9 @@ res_send(buf, buflen, ans, anssiz)
|
||||
res_close();
|
||||
goto next_ns;
|
||||
}
|
||||
#ifndef NOPOLL
|
||||
}
|
||||
#endif
|
||||
|
||||
if (n == 0) {
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile,v 1.11 1998/06/09 23:25:13 jb Exp $
|
||||
# $Id: Makefile,v 1.12 1998/06/12 02:21:27 jb Exp $
|
||||
#
|
||||
# All library objects contain rcsid strings by default; they may be
|
||||
# excluded as a space-saving measure. To produce a library that does
|
||||
@ -9,7 +9,7 @@ LIB=c_r
|
||||
SHLIB_MAJOR= 3
|
||||
SHLIB_MINOR= 0
|
||||
CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS -I${.CURDIR}/../libc/include
|
||||
CFLAGS+=-DPTHREAD_KERNEL -D_THREAD_SAFE -I${.CURDIR}/uthread
|
||||
CFLAGS+=-DPTHREAD_KERNEL -D_THREAD_SAFE -DNOPOLL -I${.CURDIR}/uthread
|
||||
|
||||
# Uncomment this if you want libc_r to contain debug information for
|
||||
# thread locking.
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile,v 1.11 1998/06/09 23:25:13 jb Exp $
|
||||
# $Id: Makefile,v 1.12 1998/06/12 02:21:27 jb Exp $
|
||||
#
|
||||
# All library objects contain rcsid strings by default; they may be
|
||||
# excluded as a space-saving measure. To produce a library that does
|
||||
@ -9,7 +9,7 @@ LIB=c_r
|
||||
SHLIB_MAJOR= 3
|
||||
SHLIB_MINOR= 0
|
||||
CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS -I${.CURDIR}/../libc/include
|
||||
CFLAGS+=-DPTHREAD_KERNEL -D_THREAD_SAFE -I${.CURDIR}/uthread
|
||||
CFLAGS+=-DPTHREAD_KERNEL -D_THREAD_SAFE -DNOPOLL -I${.CURDIR}/uthread
|
||||
|
||||
# Uncomment this if you want libc_r to contain debug information for
|
||||
# thread locking.
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile,v 1.11 1998/06/09 23:25:13 jb Exp $
|
||||
# $Id: Makefile,v 1.12 1998/06/12 02:21:27 jb Exp $
|
||||
#
|
||||
# All library objects contain rcsid strings by default; they may be
|
||||
# excluded as a space-saving measure. To produce a library that does
|
||||
@ -9,7 +9,7 @@ LIB=c_r
|
||||
SHLIB_MAJOR= 3
|
||||
SHLIB_MINOR= 0
|
||||
CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS -I${.CURDIR}/../libc/include
|
||||
CFLAGS+=-DPTHREAD_KERNEL -D_THREAD_SAFE -I${.CURDIR}/uthread
|
||||
CFLAGS+=-DPTHREAD_KERNEL -D_THREAD_SAFE -DNOPOLL -I${.CURDIR}/uthread
|
||||
|
||||
# Uncomment this if you want libc_r to contain debug information for
|
||||
# thread locking.
|
||||
|
Loading…
Reference in New Issue
Block a user