Commit graph

4424 commits

Author SHA1 Message Date
Brian Feldman 4524204190 Fix the problems I (and others, undoubtedly) have been having for a
while with threaded software in -CURRENT acting very "weird".  It has
seemed, for example, in Mozilla that threads attempting to do host
lookups have been locking up.  That's exactly the case.

There was a race condition in the implementation of the initialization
of the mutex used to protect FILE operations, first of all: multiple
instances of FLOCKFILE() in libc could occur on the same FILE at
the same time and cause strange behavior by overwriting eachothers'
creation of the mutex and the rest of the file lock.

Secondly, it's not appropriate to test the "validity" of the file
descriptor referenced by the FILE; if the code is calling FLOCKFILE()
or FUNLOCKFILE(), it wants the FILE to be locked or unlocked, not
to be locked or unlocked on the condition that _file is >= 0.  This
also could quite easily cause leaks by failing to perform the lock or
unlock operation when it actually is needed.

Mozilla now works again on -CURRENT when linked to libc_r.so.5 and
libc.so.5.
2001-02-23 04:59:12 +00:00
Ruslan Ermilov bb1f93d519 Prepare for mdoc(7)NG. 2001-02-22 15:03:09 +00:00
Daniel C. Sobral e94b7789ae Correct the prototype for pager_output(). 2001-02-22 10:58:30 +00:00
Kris Kennaway aae101bd15 Correct comment typos 2001-02-20 10:23:10 +00:00
Peter Wemm 3d92fc05aa Place some hooks (__stdin, __stdout, __stderr) into libc for a future
ABI change.  There is some serious evilness here to work around some
gcc weaknesses.  We need to know the sizeof(FILE) manually until __sF
goes away in the next major bump.  We have the size for Alpha and i386,
missing is ia64, ppc and sparc* (and i386 with 64 bit longs).
At some point down the track we can change the stdin etc #defines to
stop hard coding the size of FILE into application binaries.

Lots of head scratching and ideas and testing by: green, imp
2001-02-20 01:56:52 +00:00
Alexey Zelkin e1467aa917 cleanup commentaries 2001-02-19 19:09:00 +00:00
Hajimu UMEMOTO 928268064f Enable AI_ADDRCONFIG as a valid flag of getaddrinfo(3). Some
applications specify AI_ADDRCONFIG and fail to run under FreeBSD.
Latest mews is known.  Now, getaddrinfo(3) behaves according to
AI_ADDRCONFIG.
2001-02-19 13:13:51 +00:00
Andrey A. Chernov c80a91609d Deal properly with "0" 2001-02-19 06:19:51 +00:00
Jeroen Ruigrok van der Werven 7c63796828 Preceed/preceeding are not english words. Use precede or preceding. 2001-02-18 10:25:42 +00:00
Kris Kennaway 07cd02bf4e Silence -Wnon-const-format 2001-02-18 04:51:47 +00:00
Kris Kennaway d7422f2f19 Back out snprintf -> sprintf change until I have time to look at it. 2001-02-18 04:07:50 +00:00
Andrey A. Chernov 8a8e51d8e8 CRNCYSTR: determine '.' too 2001-02-17 11:15:30 +00:00
Andrey A. Chernov 59dde0d08d Implement CRNCYSTR 2001-02-17 07:35:01 +00:00
Warner Losh b0f8f42120 Extra needs to be initialized for our usual pool of FILEs. This was
causing some versions of as to dump core.  This survived make
buildworld/installworld and the building gettext port afterwards.

Submitted by: <nnd@mail.nsk.ru> "N.Dudorov"
Reviewed by: "Daniel M. Eischen" <eischen@vigrid.com>
2001-02-16 21:09:49 +00:00
Warner Losh 91e1be28dc Fix the current libc breakage in current:
o Back out the __std* stuff.  Can't figure out how to do this right now,
  so we'll save it for late.
o use _up as a pointer for extra fields that we need to access.
o back out the libc major version bump.

Submitted by: green
reviewed by: peter, imp, green, obrien (to varying degrees).

We'll fix the "how do we stop encoding sizeof(FILE) in binaries" part
later.
2001-02-16 06:11:22 +00:00
Tor Egge 9f52fa8615 Don't depend on lcl_mutex being a recursive mutex.
Reviewed by:	deischen
2001-02-15 22:17:04 +00:00
Tor Egge 2ffc61ba9c Remove freelists managed by Balloc/Bfree.
Change __dtoa to not free the string it allocated the previous time it was
called.  The caller now frees the string after usage if appropiate.

PR:		15070
Reviewed by:	deischen
2001-02-15 22:12:50 +00:00
Hajimu UMEMOTO ad9fdc8f4d Correct 2nd argument of getnameinfo(3) to socklen_t.
Reviewed by:	itojun
2001-02-15 10:35:55 +00:00
Peter Wemm 813ff33601 List the SA_RESTART flag rather than burying it in another paragraph. 2001-02-14 21:46:07 +00:00
David E. O'Brien 9a5622785c Only build the compat libs appropiate for the target machine. 2001-02-14 20:49:54 +00:00
Guido van Rooij 34bdee5b4b Add include <sys/time.h> because kevent uses struct timespec 2001-02-14 08:48:35 +00:00
Peter Wemm ff9dc074b5 Commit a libc fix going by the current state of the version numbering
bikeshed in -arch.  It isn't quite over, but it has been well established
that this can be adjusted or refined.  But we do seem to have consensis
on a major bump of some sort.  After this, it should reasonably safe
to build world again.

This change is to get rid of __sF[] and use seperate __stdin/out/err
handles.  This means we can pad on extra bits onto the end of FILE
at will without going through this all over again.  __sF[] was evil
because it compiled the sizeof(FILE) into every stdio using program.

Asbestos suit on: check!
Peril sensitive sunglasses on: check!
*gulp!*
2001-02-14 05:00:20 +00:00
Andrey A. Chernov d6a3432e11 Return {YES,NO}STR from locale
Approved by:	phantom
2001-02-13 23:32:48 +00:00
Alexey Zelkin 39d2c772eb catch up to __part_load_locale() interface change 2001-02-13 15:32:21 +00:00
Alexey Zelkin fc38c1e548 add additional function parameter: bufsize_min. it's possible
to check two sizes per one function invocation now.

Suggested by: ache
2001-02-13 15:29:39 +00:00
Ruslan Ermilov 95cf33c567 mdoc(7) cleanup. 2001-02-12 15:16:24 +00:00
Ruslan Ermilov 6bf131c665 Sort PROT_* and MAP_* lists, logically and alphabetically respectively.
Suggested by:	bde

General mdoc(7) cleanup.
2001-02-12 10:14:15 +00:00
Alexey Zelkin b161fb0061 Make comparsions more clear (per style(9)) 2001-02-12 08:56:39 +00:00
Alexey Zelkin ba4a5c925a Assume that "" passed as parameter also means "no grouping"
Make comparsions more clear (per style(9))
2001-02-12 08:55:12 +00:00
Alexey Zelkin 4e86238071 Rewrite __time_load_locale() using ldpart.c::__part_load_locale()
Reviewed by:	ache
2001-02-12 08:53:33 +00:00
Alexey Zelkin 331cc8974c Use .Rv macro instead of hardcoded message 2001-02-12 08:42:56 +00:00
Ruslan Ermilov 1a0c34f25e "Cross references in the SEE ALSO section should be sorted by section
number, and then placed in alphabetical order and comma separated.",
mdoc.samples(7) said.
2001-02-12 08:30:22 +00:00
Ruslan Ermilov 9a801ec807 mmap(3) -> mmap(2). 2001-02-12 08:27:06 +00:00
Peter Wemm 56f98998e9 It sounded like a good idea at the time. The previous change breaks
FILE *buffer = stdout;
so back it out for now.
2001-02-12 03:31:23 +00:00
Peter Wemm 9b8ff47f40 Take advantage of the current libc sizeof(FILE) breakage (__sF[]) and
try a hopefully more robust stdin/stdout/stderr.  This costs an indirect
pointer fetch, but saves us from changes in 'FILE'.  The __stdin stuff
is there to not pollute application name space if the application does
not use <stdio.h> and also in case something depended on the current
behavior where stdin etc was a #define.

Reviewed by:	eischen, dillon
2001-02-12 02:50:30 +00:00
Robert Watson 4be19dddae o Fix build of libc broken in revision 1.2. offsetof() requires the
inclusion of stddef.h.

Reviewed by:	peter
2001-02-12 02:44:33 +00:00
Jake Burkholder 4c85452ba9 Catch up to new priority interface. 2001-02-12 00:21:38 +00:00
Daniel Eischen f434cd45ed Remove (int) file descriptor locking. It should be up to the
application to provide locking for I/O operations.  This doesn't
break any of my tests, but the old behavior can be restored by
compiling with _FDLOCKS_ENABLED.  This will eventually be removed
when it is obvious it does not cause any problems.

Remove most of flockfile implementation, with the exception of
flockfile_debug.

Make error messages more informational (submitted by Mike Heffner
<spock@techfour.net>, who's now known as mikeh@FreeBSD.org).
2001-02-11 22:07:32 +00:00
Daniel Eischen 29ac6bd228 libc MT-safety, part 2.
Add a lock to FILE.  flockfile and friends are now implemented
(for the most part) in libc.  flockfile_debug is implemented in
libc_r; I suppose it's about time to kill it but will do it in
a future commit.

Fix a potential deadlock in _fwalk in a threaded environment.
A file flag (__SIGN) was added to stdio.h that, when set, tells
_fwalk to ignore it in its walk.  This seemed to be needed in
refill.c because each file needs to be locked when flushing.

Add a stub for pthread_self in libc.  This is needed by flockfile
which is allowed by POSIX to be recursive.

Make fgetpos() error return value (-1) match man page.

Remove recursive calls to locked functions (stdio); I think I've
got them all, but I may have missed a couple.

A few K&R -> ANSI conversions along with removal of a few instances
of "register".

$Id$ -> $FreeBSD$ in libc/stdio/rget.c

Not objected to:	-arch, a few months ago
2001-02-11 22:06:43 +00:00
Nik Clayton 6bd7c68cf0 Mention PROT_NONE in the list of possible protections.
Pointed out by:	kris
2001-02-11 19:30:41 +00:00
Nik Clayton 59b58b1622 Include mmap(2) in the list of memory allocation functions.
Reviewed by:	hackers
2001-02-11 19:28:36 +00:00
Nik Clayton 38f2cd4aa4 .Xr to mmap. 2001-02-11 18:53:50 +00:00
Nik Clayton 3db072ec5e Note that mmap(2) can allocate memory, as well as mapping existing files,
in the .Nd.

Reviewed by:	hackers
2001-02-11 18:51:17 +00:00
Nik Clayton 480e9923d5 Add a man page for the dbm_* functions, and update the Makefile to link
it in.

Some review from -hackers (some time ago), and I think the best way to
get this improved (if it needs improving) or updating, is to bring it in.

PR:             docs/12557
Submitted by:   Tim Singletary <tsingle@triana.gsfc.nasa.gov>
2001-02-11 17:24:25 +00:00
Alexey Zelkin fc19bba6aa Don't use hardcoded struct size, use offsetof() instead (make size calculations
dynamic)
2001-02-11 15:09:31 +00:00
Alexey Zelkin 9040b756dd Don't try to convert grouping strings in case if C or POSIX locale
was explicitly specified.

Submitted by:	ache
2001-02-11 15:07:26 +00:00
Alexey Zelkin cb03ae3061 make it possible to specify grouping number from range 0..CHAR_MAX,
not only one-digit number
2001-02-10 20:22:45 +00:00
Alexey Zelkin 7d2cc62ba3 Use "namespace.h" and "un-namespace.h"
Requested by:	deischen
2001-02-10 19:57:26 +00:00
Alexey Zelkin 1bd7723d09 . Fix semantics of grouping (LC_MONETARY::mon_grouping,
LC_NUMERIC::grouping) values.
. Always set __XXX_changed flags then loading numeric & monetary locale
  categories to allow localeconv() to use C locale also.
2001-02-10 15:36:46 +00:00
Yoshihiro Takahashi 96cd764ed3 Use ${MACHINE_ARCH} instead of ${MACHINE} to support pc98. 2001-02-10 13:11:02 +00:00