Commit Graph

447 Commits

Author SHA1 Message Date
Stefan Farfeleder
613100918d Include a couple of headers to ensure consistency between the prototype and
the function definition.
2005-09-12 19:52:42 +00:00
Stefan Farfeleder
2ba64027bc Move the declaration of __cleanup to libc_private.h as it is used in both
stdio/ and stdlib/.  Don't define __cleanup twice.
2005-09-12 13:46:32 +00:00
Joe Marcus Clarke
a617a18a23 Fix ptsname(3) by converting it to use devname(3) to obtain the name of
a tty device instead of the legacy minor number approach.  This is known to
fix gnome-vfs' sftp module as well as kio_sftp and kdesu on -CURRENT.

Thanks to scottl for the snprintf() approach idea.

Reviewed by:	phk
Tested by:	pav
		mich
Approved by:	re (scottl)
2005-07-07 17:48:40 +00:00
Brian Feldman
91320d17cc Do not require the pty(4) majors to be anything in particular. 2005-03-04 20:23:32 +00:00
Xin LI
2dcb9ce484 Remove the check about whether MALLOC_EXTRA_SANITY is defined,
surrounding the undef'ing it.  It does not seem necessary to
undef some symbol that is not exist, and gcc does not complain
about whether a symbol is exist before #undef'ing it out.

Spotted by:	mingyanguo via ChinaUnix.net forum
Reviewed by:	phk
2005-02-27 17:16:16 +00:00
Andrey A. Chernov
d308373710 Especially mention that setting errno to EINVAL in "no conversion" case
is not portable.

Asked by:       joerg
2005-01-22 18:02:58 +00:00
Andrey A. Chernov
db0e25eeb9 Whitespace/style tweaking of prev. commit.
Noted by:       bde
2005-01-21 13:31:02 +00:00
Andrey A. Chernov
2571c7f720 POSIX says that 0[xX] prefix is _optional_ even in base 16 case, make it
really so.

"If the value of base is 16, the characters 0x or 0X may optionally
precede the sequence of letters and digits, following the sign if
present."

Found by:       joerg
2005-01-21 00:42:13 +00:00
Ruslan Ermilov
24a0682c64 Sort sections. 2005-01-20 09:17:07 +00:00
Ruslan Ermilov
629a7369d7 Markup fixes. 2005-01-14 21:07:56 +00:00
Brian Somers
41843e7135 Fix some signed/unsigned comparisons. Fix prototypes while I'm here.
PR:		28890
Submitted by:	matthias.andree at web dot de
MFC after:	7 days
2005-01-12 03:39:34 +00:00
Warner Losh
dfcc91e219 sranddev() is not magic pixie dust. While it gives a good random
seed, the random number generator rand(3) still sucks and is unlikely
sufficient for crypto use.  Correct what appears to be a cut and paste
error from the srandomdev() man page.

Submitted by: Ben Mesander
2004-11-10 17:25:49 +00:00
Alfred Perlstein
65da79c4be Reword recent addition about memory moving.
Requested by: keramida

Bump .Dd

Requested by: ru
2004-08-19 16:34:31 +00:00
Alfred Perlstein
09a12d75cf Clarify that realloc and reallocf may move the memory allocation. 2004-08-18 21:13:15 +00:00
Warner Losh
d68c1e59a8 Use #include <unistd.h> rather than the explicit externs in the
example.  The externs haven't been needed in about 10 years, so
there's no reason to have them other than for hysterical raisins.  And
the California Rasins haven't been around for a long time...
2004-07-31 01:00:50 +00:00
Ruslan Ermilov
2410103c1d mdoc(7) fixes. 2004-07-07 19:57:16 +00:00
Hiten Pandya
af73aa7cce Move the return value information about the getenv(3) library function
under the RETURN VALUES section so it is consistent with others.

Cleanup the return value text for getenv(3) a little while I am here.

PR:     	docs/58033
MFC after:	3 days
2004-07-06 23:21:36 +00:00
Andrey A. Chernov
42aeacc4d4 Keep it sync with OpenBSD:
An optional argument cannot start with '-', even if permutation is
disabled.

Obtained from: OpenBSD getopt_long.c v1.17
2004-07-06 13:58:45 +00:00
Ruslan Ermilov
1c85060a13 Sort SEE ALSO references (in dictionary order, ignoring case). 2004-07-04 20:55:50 +00:00
Stefan Farfeleder
5908d366fb Consistently use __inline instead of __inline__ as the former is an empty macro
in <sys/cdefs.h> for compilers without support for inline.
2004-07-04 16:11:03 +00:00
Ruslan Ermilov
30950a21e1 Eliminate double whitespace. 2004-07-03 22:30:10 +00:00
Ruslan Ermilov
1a0a934547 Mechanically kill hard sentence breaks. 2004-07-02 23:52:20 +00:00
Olivier Houchard
57734c02cd Define malloc_pageshift and malloc_minsize for arm. 2004-05-14 11:50:51 +00:00
Ruslan Ermilov
cb30b9c545 Link radixsort(3) to sradixsort(3), make the latter appear in
the whatis(1) output.
2004-05-12 08:13:40 +00:00
Andrey A. Chernov
f853699a55 Simplify one condition in prev. commit:
short_too already assumes FLAG_LONGONLY
2004-04-01 22:32:28 +00:00
Andrey A. Chernov
ed4fbbd5e3 Fix parsing of ambiguous options, whole loop must be processed 2004-04-01 22:09:07 +00:00
Poul-Henning Kamp
7594cde032 Rearrange (centralize) initialization of mallocs internals to always be
done before the first call, even if this is a malloc(0) call.

PR:	62859
2004-03-07 20:41:27 +00:00
Andrey A. Chernov
05cfdd0995 Merge some fixes from NetBSD's getopt.3 v1.31:
cleanup, add more sections, better explanation, declaration
2004-03-06 17:09:10 +00:00
Andrey A. Chernov
9109761318 Merge some fixes from NetBSD's getopt.c v1.26:
cleanups, handling 'ls -l-', handling '--*'

Note this is in the same time back out of our v1.3
"Don't print an error message if the bad option is '?'"
because it directly violates POSIX.
2004-03-06 17:05:45 +00:00
Andrey A. Chernov
64f37911f8 Fix typo, was 'W'; instead of `W;' 2004-03-06 14:47:49 +00:00
Andrey A. Chernov
3700175bf1 Make GNU-compatible following case:
single '-' in command line and '-' (non-first) in options
2004-03-06 14:24:10 +00:00
Andrey A. Chernov
8848539902 Make return code in noarg case GNU-compatible 2004-03-03 08:29:00 +00:00
Andrey A. Chernov
9f06a99edd Be more GNU-compatible in diagnostics 2004-03-03 03:05:21 +00:00
Andrey A. Chernov
f2fd86b76e Improve GNU compatibility in several places, use internal GNU_COMPATIBLE
define for it.
Don't catch POSIXLY_CORRECT env. into static variable, it can be changed
on the fly by program.
Use P1003.2 standartized illoptchar[]
2004-03-01 17:57:05 +00:00
Andrey A. Chernov
2298a6e766 Comment out things related to getopt() replacement we not use 2004-03-01 10:59:23 +00:00
Andrey A. Chernov
8a4dd785c0 Change "-"-started options when POSIX_CORRECTLY is set handling
in favour of GNU instead of NetBSD, because configure's use us and
expect GNU.
2004-03-01 10:12:45 +00:00
Andrey A. Chernov
ee43cb7a22 Change "-"-started options when POSIX_CORRECTLY is set handling
in favour of GNU instead of NetBSD, because configure's use us and
expect GNU.
2004-03-01 10:03:34 +00:00
Andrey A. Chernov
829a229d88 Add getopt_long_only() from OpenBSD and other OpenBSD cleanups
PR:             63173
Submitted by:   Marius Strobl <marius@alchemy.franken.de>
2004-02-24 08:07:26 +00:00
Andrey A. Chernov
75207c7a43 Add optarg, optind, opterr, optopt, optreset to SYNOPSYS 2004-02-23 05:07:11 +00:00
Andrey A. Chernov
60fb481f43 POSIX clearly states that getsubopt() should be declared in <stdlib.h>
not in <unistd.h>
2004-02-23 03:32:10 +00:00
Andrey A. Chernov
f0d82b33be Remove unneccessary <unistd.h> 2004-02-23 03:30:02 +00:00
Poul-Henning Kamp
1b105d0c6e Remove the triplicity in the public functions by vectoring them all
through a realloc like function.

Make the malloc_active variable a local static to this new function.

Don't warn about recursion more than once per base call.

constify malloc_func.
2004-02-21 09:14:38 +00:00
Poul-Henning Kamp
1044082184 Move the check for sensitive processes to the point where the exception
has been hit, this makes it cover more cases.

Call the message function directly rather than fiddle with flag-saving
when we find an unknown character in our options.

The 'A' flag should not trigger on legal out of memory conditions.
2004-02-21 08:55:38 +00:00
Ruslan Ermilov
f3b6219857 Unbreak the upgrade path from 4.9 after removal of GNU getopt and
<gnuregex.h>.
2004-02-20 11:55:14 +00:00
Colin Percival
d623b765cf style cleanup: Remove duplicate $FreeBSD$ tags.
These files had tags after the copyright notice,
inside the comment block (incorrect, removed),
and outside the comment block (correct).

Approved by:	rwatson (mentor)
2004-02-10 20:42:33 +00:00
David Schultz
307649e2f3 Use 'uint32_t' instead of 'long' when a 32-bit integer is intended.
This results in no functional change, aside from fixing a data
corruption bug on LP64 platforms.  The code here could still use a
significant amount of cleanup.

PR:		56502
Submitted by:	hrs (earlier version)
2004-01-20 03:02:18 +00:00
Alexander Kabaev
50bcce79ff Implement __cxa_atexit/__cxa_finalize as specified by the cross-vendor
ó++ ABI document at http://www.codesourcery.com/cxx-abi/abi.html#dso-dtor

The ABI was initially defined for ia64, but GCC3 and Intel compilers
have adopted it on other platforms.

This is the patch from PR bin/59552 with a number of changes by
me.

PR:		bin/59552
Submitted by:	Bradley T Hughes (bhughes at trolltech dot com)
2003-12-19 17:11:21 +00:00
Alexander Kabaev
61cf73b3eb Implement __cxa_atexit/__cxa_finalize as specified by the cross-vendor
C++ ABI document at http://www.codesourcery.com/cxx-abi/abi.html#dso-dtor

The ABI was initially defined for ia64, but GCC3 and Intel compilers
have adopted it on other platforms.

This is the patch from PR bin/59552 with a number of changes by
me.

PR:		bin/59552
Submitted by:	Bradley T Hughes (bhughes at trolltech dot com)
2003-12-19 17:11:20 +00:00
Marcel Moolenaar
fd7707aa50 Do not adjust to the pagesize at runtime. Besides for the one-time
initialization overhead, there's a problem in that we never call
imalloc() and thus malloc_init() for zero-sized allocations. As a
result, malloc(0) returns NULL when it's the first or only malloc in
the program. Any non-zero allocation will initialize the malloc code
with the side-effect that subsequent zero-sized allocations return a
non-NULL pointer. This is because the pointer we return for zero-
sized allocations is calculated from malloc_pageshift, which needs
to be initialized at runtime on ia64.

The result of the inconsistent behaviour described above is that
configure scripts failed the test for a GNU compatible malloc. This
resulted in a lot of broken ports.

Other, even simpler, solutions were possible as well:
1.  initialize malloc_pageshift with some non-zero value (say 13 for
    8KB pages) and keep the runtime adjustment.
2.  Stop using malloc_pageshift to calculate ZEROSIZEPTR.

Removal of the runtime adjustment was chosen because then ia64 is the
same as any other platform. It is not to say that using a page size
obtained at runtime is bad per se. It's that there's currently a high
level of gratuity for its existence and the moment it causes problems
is the moment you need to get rid of it. Hence, it's not unthinkable
that this commit is (partially) reverted some time in the future when
we do have a good reason for it and a good way to achieve it.

Approved by: re@ (rwatson)
Reported by: kris (portmgr@) -- may the ports be with you
2003-11-28 18:03:22 +00:00
Tim Kientzle
669073a7e6 Improve the performance of radixsort() when
sorting strings with common prefixes by noting
when all the strings land in just one bin.

Testing shows significant speedups (on the order of
30%) on strings with common prefixes and no slowdowns on any
of my test cases.

Submitted by: Markus Bjartveit Kruger <markusk@pvv.ntnu.no>
PR: 58860
Approved by: gordon (mentor)
2003-11-11 04:59:23 +00:00