Commit Graph

43 Commits

Author SHA1 Message Date
David E. O'Brien
c05ac53b8b Remove __P() usage. 2002-03-21 22:49:10 +00:00
Hajimu UMEMOTO
676e98714d - Make it possible to turn on RES_INSECURE[12] with /etc/resolv.conf.
- Don't connect datagram socket if RES_INSECURE1.
- Needed to implement IPv6 anycast UDP DNS queries as documented in
  <draft-ietf-ipngwg-dns-discovery-03.txt>.

Obtained from:	KAME
2001-12-26 21:21:10 +00:00
Jonathan Lemon
4dd2af159e Bring in fix from rev 1.32 that got lost during the conversion to kqueue.
This prevents an indefinte timeout in case the kevent call is interrupted
for some reason.

PR: 26665
MFC in: 2 weeks
2001-06-23 06:54:28 +00:00
Jonathan Lemon
079a79149a Use the new EV_SET macro to insure that all fields in struct kevent
are correctly initialized before use.  This should fix the problem
with DNS.

Pointy hat to:  me
2001-02-28 15:47:47 +00:00
Daniel Eischen
d201fe46e3 Remove _THREAD_SAFE and make libc thread-safe by default by
adding (weak definitions to) stubs for some of the pthread
functions.  If the threads library is linked in, the real
pthread functions will pulled in.

Use the following convention for system calls wrapped by the
threads library:
	__sys_foo - actual system call
	_foo - weak definition to __sys_foo
	foo - weak definition to __sys_foo

Change all libc uses of system calls wrapped by the threads
library from foo to _foo.  In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde).  All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes.  <db.h> is an exception
and shouldn't be included in between namespace.h and
un-namespace.h  namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.

Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE.  We have recursive mutexes, but would like to avoid
using them if possible.

Remove uneeded includes of <errno.h> from a few files.

Add $FreeBSD$ to a few files in order to pass commitprep.

Approved by:	-arch
2001-01-24 13:01:12 +00:00
Jason Evans
1ae8b96572 Fix pthread cancellation point propagation. 2000-10-12 04:29:44 +00:00
Paul Saab
0c893d623c Change from using poll(2) to kqueue/kevent when waiting for a DNS
response to return.  This will stop processes waiting on DNS requests
from being woken up when a select collision occurs.  This was tested
on mx1.FreeBSD.org (outgoing mail for the FreeBSD.org mailing
lists.)

Reviewed by:	jlemon, peter
2000-09-12 11:37:20 +00:00
Peter Wemm
8cae7cc3d6 Yank out the NOPOLL conditionals. libc_r no longer needs it, and this
library depends on other things that come *way* later than poll() now
(sigset size changes in particular)
2000-09-04 21:28:16 +00:00
Hajimu UMEMOTO
a40e8e8ba4 Re-commit DNS IPv6 transport support with fixes for IPv4 only
kernel and compatibility issue.

Obtained from:	KAME Project
2000-06-19 18:25:06 +00:00
Hajimu UMEMOTO
672315756a Backout my previous commit.
Cannot resolve any host on IPv4 only kernel.

Reported by:	ache
2000-06-14 20:51:55 +00:00
Hajimu UMEMOTO
7c381eb7d5 DNS IPv6 transport support.
It is nessesary for IPv6 only life.

Obtained from:	KAME
2000-06-11 15:43:34 +00:00
Jonathan Lemon
6134837824 Decrement the timeout being passed to poll() if poll was interrupted for
some reason.  This will prevent an infinite loop if (say) a sigalarm is
being scheduled at a more frequent interval than the poll timeout.

PR:	2191, 8847, 10553
2000-03-26 19:20:50 +00:00
Jason Evans
9233c4d942 Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),
just use _foo() <-- foo().  In the case of a libpthread that doesn't do
call conversion (such as linuxthreads and our upcoming libpthread), this
is adequate.  In the case of libc_r, we still need three names, which are
now _thread_sys_foo() <-- _foo() <-- foo().

Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(),
nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo().

Remove all internal libc usage of: creat(), pause(), sleep(), system(),
tcdrain(), wait(), and waitpid().

Make thread cancellation fully POSIX-compliant.

Suggested by:	deischen
2000-01-27 23:07:25 +00:00
Jason Evans
929273386f Add three-tier symbol naming in support of POSIX thread cancellation
points.  For library functions, the pattern is __sleep() <--
_libc_sleep() <-- sleep().  The arrows represent weak aliases.  For
system calls, the pattern is _read() <-- _libc_read() <-- read().
2000-01-12 09:23:48 +00:00
Peter Wemm
1ce6e9e1c5 Back out my backout, it was already posix compliant. Any new fields are
required to be "announced" by a new bit in sa_flags to indicate the
program is aware of and has taken care of them.  eg: SA_SIGINFO means
the program has used the sa_siginfo field (versus sa_handler).
1999-09-28 16:58:46 +00:00
Peter Wemm
cde8d55a02 Fix previous commit. The standards specifically say: "The structure
sigaction, used to describe an action to be taken, is defined in the
header <signal.h> to include at least the following members:"
                             ^^^^^^^^
A sigaction defined on stack with essentially random contents may have
just about anything underneath fields that the program doesn't know about.
It is not safe to delete the bzero.
1999-09-28 15:40:17 +00:00
Marcel Moolenaar
06ceca4d89 Explicitly use sigemptyset to clear a sigset_t. Explicit
initialization of sa_flags allows us to lose the bzero.
1999-09-28 13:26:11 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
John Polstra
cb690d1f0b Implement the weak aliases for private entry points in the inet_*
and res_* modules in a way that works for ELF.  I moved the aliases
out of res_stubs.c and into the individual modules where the entry
points are defined.  Weak aliases don't work in ELF unless that is
the case.  (Actually, I'm surprised it worked for a.out.)

This should fix the undefined "inet_addr" and related symbols in
various applications that fail to include <arpa/inet.h> or
<resolv.h> as they are supposed to do.
1998-09-02 00:53:17 +00:00
Peter Wemm
02a93d74e0 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.
1998-06-14 11:25:46 +00:00
Peter Wemm
14b93edab3 Update the resolver parts to bind-8.1.2 level. I have not touched the
getXXXXbyYYYY() interfaces yet.

Obtained from: diff relative to bind-8.1.2 sources
1998-06-11 09:03:02 +00:00
Peter Wemm
9e39714518 Resolve some unexpected differences when comparing with the 2.2 version.
One bug was relatively harmless (select's timeout had an uninitialized
tv_usec), the other I'm not so sure.. (neglected to catch select returns
less than zero).  Both of these were irrelevant on kernels with poll().
1998-05-02 15:51:54 +00:00
Peter Wemm
c8d2fd6da8 Update libc dns code to 4.9.7-T1B level. This involved chopping out large
chunks of res_comp.c and replacing it with chunks of bind-8.1.1's resolver
code.  (There are no interface changes though)
The other parts are better bounds checking related.
1998-05-02 13:11:02 +00:00
Peter Wemm
9e06e6da51 Some adjustments for the resolver use of poll(). For some reason I thought
an unimplemented syscall returned ENOSYS, rather than EINVAL.  I have run
statically linked code with this wrapper and it does appear to work fine
on 2.2-stable which doesn't have poll().  ktrace shows the poll syscall fail
once and the fallback to select() working.
1997-09-16 06:03:54 +00:00
Peter Wemm
535db1806c Call poll(2) from within the resolver but adapt to older kernels without it
if necessary.  This removes the need to malloc large fd_set's for selecting
on high fd's (larger than FD_SETSIZE at libc compile time).

The syscall adaptive stuff only happens on the very first call.  SIGSYS
is masked, and if the call to poll fails with ENOSYS, then we use select
for the life of the program.  If poll does not fail with ENOSYS, then we
always use poll and skip the once-off signal masking gunk.

This may be overkill, but it saved my neck a few times while working on
multiple different sets of kernel sources, some with poll, some without.
1997-09-14 09:44:34 +00:00
Peter Wemm
1e7aa4e938 replace the OpenBSD fd_set sizing code with something more efficient.
Only call malloc() if the fd is too big for the compiled in fd_set size,
and don't use calloc either.  This should reduce the impact of conflicts
with private malloc implementations etc.  When using the fd_set on the
stack, only zero what is needed rather than all 1024 bits like FD_ZERO did.
1997-06-28 04:19:52 +00:00
Peter Wemm
d2346017f0 Dynamically size fd_set in select rather than fail if too many files
are open.
Obtained from: OpenBSD; by deraadt and dm
1997-06-27 13:00:51 +00:00
Peter Wemm
6c5aff806e Merge in bind-4.9.6 resolver changes. Note that they resolve the
overflow problem differently.
1997-06-27 08:22:03 +00:00
Peter Wemm
beb9f61579 Fix problem with FD_SET* overflow reporting.. Perror() didn't have enough
args, and errno hasn't actually been set so it probably doesn't make sense
to report it via strerror().

Pointed out by: bde
1997-03-12 11:10:54 +00:00
Guido van Rooij
1ab96f9344 Check for overflow of FD_SET 1997-03-10 19:32:46 +00:00
Peter Wemm
7e546392b5 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Peter Wemm
ca785773f6 Here goes.. Bring the 4.9.5-P1 resolver into -current. This has the
DNSSEC stuff, among other things.  There are also some renamed functions,
I've left out the res_stubs.c from this commit in case cvs bombs out..
1996-12-30 13:18:48 +00:00
Peter Wemm
f991bb5181 Sigh, back out the last bright idea I had here about compiling the res_*
routines from contrib/bind directly.  There were too many problems,
including having to add -DUSE_OPTIONS_H to the entire libc source in
order for the contrib code to pick up it's options, and so on.

Instead, I've merged the changes, libc is now self contained again.
1996-08-30 21:13:42 +00:00
Peter Wemm
5ce1c533c7 Merge in bind-4.9.4-P1 resolver... 1996-08-29 20:08:19 +00:00
Jordan K. Hubbard
51295a4d3e General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>
1996-07-12 18:57:58 +00:00
Peter Wemm
ab83cd2d54 Merge the 4.9.3-rel code into the res_* parts. The gethostXXXbyYYY
parts are not quite so simple..
1996-01-07 09:15:02 +00:00
Bruce Evans
e6507d611f Fix bogus include paths, some of which stopped libresolv from compiling. 1995-08-21 09:15:40 +00:00
Peter Wemm
e5ad4f8712 Update the resolver part of libc to bind-4.9.3-beta24 level (from beta9p1)
Note that this was done by selective patching from diffs, to not conflict
with the 4.4bsd base code..  This was *not* a trivial task..  I have been
testing this code (apart from cosmetic changes) in my libc for a while now.

Obtained from: Paul Vixie <paul@vix.com>
1995-08-20 20:03:06 +00:00
Rodney W. Grimes
6c06b4e2aa Remove trailing whitespace. 1995-05-30 05:51:47 +00:00
Paul Traina
8bdba3f880 remove need for -DDEBUG from resolver code (conflict with db/hash) 1994-09-25 17:45:41 +00:00
Paul Traina
1363f04ce1 get* rework and new bind code 1994-09-25 02:12:49 +00:00
Rodney W. Grimes
58f0484fa2 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00