Commit Graph

17 Commits

Author SHA1 Message Date
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
Jacques Vidrine
cb0600bd54 Fix getipnodebyname(3) bug.
Submitted by:	ume
2000-09-07 02:18:22 +00:00
Jacques Vidrine
248aee623c Add nsswitch support. By creating an /etc/nsswitch.conf file, you can
configure FreeBSD so that various databases such as passwd and group can be
looked up using flat files, NIS, or Hesiod.

= Hesiod has been added to libc (see hesiod(3)).

= A library routine for parsing nsswitch.conf and invoking callback
  functions as specified has been added to libc (see nsdispatch(3)).

= The following C library functions have been modified to use nsdispatch:
    . getgrent, getgrnam, getgrgid
    . getpwent, getpwnam, getpwuid
    . getusershell
    . getaddrinfo
    . gethostbyname, gethostbyname2, gethostbyaddr
    . getnetbyname, getnetbyaddr
    . getipnodebyname, getipnodebyaddr, getnodebyname, getnodebyaddr

= host.conf has been removed from src/etc.  rc.network has been modified
  to warn that host.conf is no longer used at boot time.  In addition, if
  there is a host.conf but no nsswitch.conf, the latter is created at boot
  time from the former.

Obtained from:	NetBSD
2000-09-06 18:16:48 +00:00
Hajimu UMEMOTO
05c36511b9 To define A RR to root (.) is valid in DNS. So, h_name = "" shouldn't
be treated as NULL.

PR:		bin/19816
Submitted by:	Bill Fenner <fenner@research.att.com>
Reviewed by:	Atsushi Onoe <onoe@sm.sony.co.jp>
2000-07-19 06:22:01 +00:00
Kris Kennaway
3f587e572f Previous commit broke the case of chained CNAME entries. Instead handle
the bogus case by being stricter about errors.

Submitted by:   itojun
Obtained from:  KAME
2000-07-03 04:43:14 +00:00
Kris Kennaway
dc578f2564 Fix a nasty bug which would leave the struct hostent incompletely filled out
when parsing certain DNS records during a reverse address resolution. Thus
when code tries to examine the returned host name, it dereferences a null
pointer :-(

Problem noticed by:	ps
2000-07-03 02:33:02 +00:00
Jake Burkholder
e39756439c Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by:		msmith and others
2000-05-26 02:09:24 +00:00
Jake Burkholder
740a1973a6 Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by:	phk
Reviewed by:	phk
Approved by:	mdodd
2000-05-23 20:41:01 +00:00
Jun-ichiro itojun Hagino
73b30f0cdf correct possible security issue(s) in name resolution, due to use of
pre-4.9.7 BIND resolver code.
ftp://ftp.kame.net/pub/mail-list/snap-users/2348 for details.

Reviewed by:	ume
2000-05-10 00:47:20 +00:00
Yoshinobu Inoue
e6f35403c1 Change getaddrinfo() resolve order
from
  all AAAA trial, then all A trial
to
  try AAAA and A for each trial

TODO: more fix for the case where IPv4 mapped IPv6 addr is disabled

Reviewed by: ume
2000-04-20 03:31:40 +00:00
Jonathan Lemon
38775c5e68 Fix uninitialized variable.
Submitted by:	tanimura
2000-03-15 15:04:54 +00:00
Jonathan Lemon
638580129d Add in IPV4 NIS support.
PR:		17290 (but not the same patch)
Approved by:	jkh
2000-03-09 22:52:30 +00:00
Yoshinobu Inoue
be26adb5b6 Let getaddrinfo() and related functions supports traditional IPv4 format
(shortend format, etc)

   Current KAME getaddrinfo() supports only d.d.d.d format IPv4
   addr. But traditionally inet_aton() and etc support other formats.
   (shortend format and octal/deciaml/hex format)
   Aboud this,
    -As far as the discussion on freebsd-current, many people
     think traditional format should also be supported by getaddrinfo().
    -X/Open spec requires getaddrinfo() also support those
     traditional IPv4 format.
    -RFC2553 say nothing about it.
    -As the result of confirmation in ietf/ipng list, there is
     no clear concensus yet, and the reply was, "RFC2553 update
     and X/Open spec will be in sync"

   So takeing these conditions into account, I think
   getaddrinfo() should also support traditional IPv4 format.

Specified by: Marc Schneiders <marc@oldserver.demon.nl>
Approved by: jkh
2000-02-10 02:59: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
Yoshinobu Inoue
3d670abcc1 added IPv6 unspecified addr check for getipnodebyaddr. 2000-01-13 05:47:11 +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
Yoshinobu Inoue
7d56d3747c Getaddrinfo(), getnameinfo(), and etc support in libc/net.
Several udp and raw apps IPv6 support.

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
1999-12-28 02:37:14 +00:00