Commit Graph

8411 Commits

Author SHA1 Message Date
jruoho 6f013d76df Fix SYNOPSIS, add CAVEATS. 2010-12-19 08:21:36 +00:00
christos 3a693ad8ca PR/44248: Antti Kantee: Fix multi-threaded localtime hang. 2010-12-17 23:11:57 +00:00
njoly 9f266c104e Fix cross-reference, dir(5) -> dirent(3). 2010-12-17 19:20:42 +00:00
wiz db9d3e0efd Sort ERRORS. Fix a typo. Readd macro usage lost in previous.
Remove trailing whitespace.
2010-12-17 01:30:50 +00:00
wiz a5f2300ef5 Sort SEE ALSO, add a serial comma. 2010-12-17 01:30:14 +00:00
wiz 72b0a97144 Use more markup. 2010-12-17 01:29:45 +00:00
joerg c4120e324e Replace use of errlist with a single concatenated version and an offset
array. This requires less storage and avoids one runtime relocation per
errno value.
2010-12-16 22:52:32 +00:00
christos d6bc393ba9 it is getname not time. 2010-12-16 22:18:37 +00:00
christos 84df4ad5ec add the 3 missing man pages. 2010-12-16 21:53:56 +00:00
christos 5a87b22ec6 Provide a re-entrant and thread-safe set of timezone API's that
don't require locking and can operate on user-specified timezones
as opposed to having to alter the environment to change a timezone.
This work was presented to the tzcode folks and it was generally
accepted, but there seems to be a lot of inertia.
2010-12-16 18:36:47 +00:00
jruoho 595da22eed Reference __builtin_object_size(3) and attribute(3) with each other. 2010-12-16 17:50:39 +00:00
wiz 3d3c5d42cb Observe the following spelling:
- wide character (noun)
- wide-character (adjective)

Inspired by jmc@OpenBSD.
2010-12-16 17:42:25 +00:00
jruoho 9f95187844 .Fn, offset indent, complete reference. 2010-12-16 12:08:16 +00:00
jruoho fe6e1d361b Fix the references and -offset indent. 2010-12-16 11:57:20 +00:00
jruoho c1a91d0bee Use .Fn. 2010-12-16 11:49:35 +00:00
jruoho 91e230c6b8 Fix xref; module(4) -> module(7). 2010-12-14 16:23:59 +00:00
jruoho 5c1bce6b00 Reference strsuftoll(3) and orders(7) with each other. 2010-12-14 13:00:34 +00:00
joerg 674a655551 Prefix ctype bitmask macros with _CTYPE 2010-12-14 02:28:57 +00:00
pooka 0c0346ae48 Don't __weak_alias non-existent symbols. Apparently the alpha
compiler doesn't like it.
2010-12-13 23:10:12 +00:00
pooka 5f35396ed8 last of the RUMP_ACTION syscall swappers 2010-12-13 21:07:54 +00:00
pooka 2f36209c20 Mirror sysctlgetmibinfo RUMP_ACTION change. 2010-12-13 14:17:11 +00:00
jruoho 05a9f55544 Xref module(4). 2010-12-13 10:07:46 +00:00
joerg 230ccda64c Don't bother with SCCS or the other RCSID conditionals. 2010-12-12 22:34:44 +00:00
christos b3ddcb3ea2 errlist.c is automatically generated now. 2010-12-12 20:22:48 +00:00
christos 5eeef29dbe remove comment 2010-12-12 20:16:09 +00:00
christos 91083d6e86 Automatically generate the error list. 2010-12-12 20:08:27 +00:00
tsutsui be1c859466 We can't assume syscall retains t0, unless it's documented as ABI. 2010-12-12 09:03:06 +00:00
tsutsui f3f411dad2 brk(2) should update __curbrk, not __minbrk or garbage. 2010-12-12 09:00:37 +00:00
joerg cb6cc2679c Wrap sys_errlist constants in a macro to make it easier to extract
the strings reliably with sed/awk.
2010-12-09 21:27:31 +00:00
njoly 5db815a78e Convert a few macros to Vt (variable type). 2010-12-09 09:22:31 +00:00
christos 75a9445418 use %option noinput 2010-12-08 03:19:19 +00:00
joerg 3b7d8067b3 Don't redeclare __isthreaded. 2010-12-08 02:07:03 +00:00
joerg 6ab2cfd0b3 Use __isthreaded from reentrant.h and don't redeclare it. 2010-12-08 02:06:38 +00:00
joerg 7a8f98483f input() is not used, so don't provide it. 2010-12-08 02:05:39 +00:00
joerg e325eedcc1 Remove tautology. 2010-12-07 22:01:45 +00:00
joerg aaf356760f Mark function as static and give it an explicit return type. 2010-12-07 22:01:22 +00:00
joerg cb63bb73c3 Don't use argument as direct format string. 2010-12-07 20:10:53 +00:00
jruoho b4ba5c1508 Xref glob(7). 2010-11-30 21:03:07 +00:00
tnozaki 96bcb898d4 variable must to be nul terminated before "CODESET=foo".
ISO2022 module doesn't understand this and may fail setlocale(3).
2010-11-30 15:25:05 +00:00
wiz cb676ec98b Remove superfluous comma. 2010-11-28 01:28:21 +00:00
jnemeth 22405528a4 Rename the autoloaded property list from <module>.prop to <module>.plist
as discussed on tech-kern.
2010-11-28 00:26:38 +00:00
christos 5fe11453fa fix lint warning. 2010-11-27 21:22:11 +00:00
christos d5ea004dc7 Implement VIS_NOESCAPE and VIS_HTTP1866. 2010-11-27 19:44:21 +00:00
christos b77d89c7da ansify 2010-11-27 18:33:54 +00:00
dholland 6e4e77d46e No file system I know of reports directory sizes that are multiples of
sizeof(struct dirent) except by accident. So, sync with reality. Brought
to my attention by Taylor R Campbell in chat.
2010-11-25 20:53:23 +00:00
christos 05f534f3c7 PR/44132: Wolfgang Stukenbrock: libc/rpc may overwrite not-allocated memory
Return XPRT_DIED when realloc fails for lack of a better error.
2010-11-23 14:02:01 +00:00
christos b0f3f04a67 PR/44113: Nicolas Joly: printf(3) should ignore zero padding for nan/inf 2010-11-19 00:44:18 +00:00
tron 4a3a313897 Include "namespace.h" to get namespace protection. 2010-11-17 13:25:53 +00:00
tron aacd5349be Provide proper namespace protection for rbtree(3) because it is now
used by "libc" internally.
2010-11-17 13:19:32 +00:00
tron d0e6f50de3 Implement mark & sweep garbage collection as suggested by Enami Tsugutomo
on "current-users" mailing list. Garbage collection is performed if:
1.) We previously allocated memory for the environment array which
    is no longer used because the application overwrote "environ".
2.) We find a non-NULL pointer in the allocated environment array after
    the end of the environment. This happens if the applications attempts
    to clear the environment with something like "environ[0] = NULL;".
2010-11-16 17:23:10 +00:00
enami 4f54ea7667 Fix typos in comment. 2010-11-16 03:02:20 +00:00
tron 2f85740ecc 1.) Rename internal function __findvar() to __findenvvar().
2.) Add a wrapper function __findenv() which implements the previous
    *internal* interface. It turns out that ld.elf_so(1) and pthread(3)
    both use it.

Stripping e.g. "LD_LIBRARY_PATH" from the environment while running
setuid binaries works again now.
2010-11-14 22:04:36 +00:00
tron 268c79e4cc Set errno to ENOENT if we reject the environment variable name in
getenv_r() instead of leaving it unchanged.
2010-11-14 20:37:02 +00:00
tron fbf4aa1699 Improve and simplify implementation of *env(3) functions:
- Use RB tree to keep track of memory allocated via setenv(3) as
  suggested by Enami Tsugutomo in private e-mail.
  This simplifies the code a lot as we no longer need to keep the size
  of "environ" in sync with an array of allocated environment variables.
  It also makes it possible to free environment variables in unsetenv(3)
  if something has changed the order of the "environ" array.
- Fix a bug in getenv(3) and getenv_r(3) which would return bogus
  results e.g. for " getenv("A=B") " if an environment variable "A"
  with value "B=C" exists.
- Clean up the internal functions:
  - Don't expose the read/write lock for the environment to other parts
    of "libc". Provide locking functions instead.
  - Use "bool" to report success or failure.
  - Use "ssize_t" or "size_t" instead of "int" for indexes.
  - Provide internal functions with simpler interfaces e.g. don't
    combine return values and reference arguments.
  - Don't copy "environ" into an allocated block unless we really need
    to grow it.

Code reviewed by Joerg Sonnenberger and Christos Zoulas, tested by
Joerg Sonnenberger and me. These changes also fix problems in
zsh 4.3.* and pam_ssh according to Joerg.
2010-11-14 18:11:42 +00:00
christos f214ecbad3 forgot to commit this one for two months!
add vdprintf.
2010-11-13 19:41:32 +00:00
enami 5260b632e4 Clear all entries past the NULL while scrubing environ vector. 2010-11-10 02:40:08 +00:00
enami ef075363bd Indent using tab rather than four spaces. 2010-11-10 02:33:49 +00:00
pooka 2ddc760fc7 Need getifaddrs() for the rump client since it executes sysctl(2) 2010-11-05 16:23:56 +00:00
pooka 08fc937c06 make sysctl(8) work as a rump client 2010-11-05 15:55:23 +00:00
christos ee29967bad scrub the whole array, not just the first n malloced entries. 2010-11-04 21:49:45 +00:00
plunky 5cf5f72e75 this page title is CDBW 2010-11-03 16:17:48 +00:00
christos 3954ad831d Handle the case where a program attempted to cleanup the environment by
setting *environ = NULL;
2010-11-03 15:01:07 +00:00
skrll 162991256a Spell immediately correctly. 2010-11-02 20:49:47 +00:00
enami b447d18264 - Simplify the code
- Reword the comment.
2010-11-02 03:44:05 +00:00
enami ee9d44a7c1 Double the array only when really necessary. Otherwise memory will be
exhausted if user modifies the variable envrion itself repeatedly..
2010-11-01 02:41:27 +00:00
wiz 51a05c8628 Fix a typo and remove trailing whitespace. 2010-10-27 19:18:00 +00:00
christos de19ef9132 markup improvements, document ctype_r, time_t is not a "long integer" 2010-10-27 19:16:04 +00:00
wiz 83306973da Improve wording after consultation with njoly. 2010-10-26 22:34:33 +00:00
njoly 5d63576039 Make putenv(3) fails with EINVAL for a null pointer, or for a string
that either miss or start with a `=' character.

Adjust man page and testcase accordingly.
2010-10-25 20:35:36 +00:00
wiz ecad7beb9c Bump date. 2010-10-25 07:37:11 +00:00
dholland 6d14a316d9 Mention err/warn. Note that they're generally preferred to perror().
Might want to strengthen the wording.
2010-10-24 23:10:51 +00:00
tron 1dc4fb4ea1 Double the size of the allocate environment vector when we resize it.
This should speed up extending the environment via setenv(3).
2010-10-24 17:53:27 +00:00
tron 410614d6b3 Replace _FPOS_OVERFLOW() macro with a static inline function called
__fpos_overflow() that doesn't cause any lint warnings.
2010-10-24 17:44:32 +00:00
christos 3dbfe3dd7e tell lint to shut up. 2010-10-23 14:12:50 +00:00
christos 13fa4dc134 not that it can happen, but make the test more robust. 2010-10-22 22:00:32 +00:00
christos ec053f73a0 implement EOVERFLOW 2010-10-22 21:29:45 +00:00
christos 603e33ef32 Fix return value documentation. Add EOVERFLOW for ftell, but not for fseek. 2010-10-22 21:29:31 +00:00
njoly 4c968434a3 Make setenv(3) follow the standard, by rejecting invalid strings. It
now fails with EINVAL errno when variable is NULL, empty or contains
an `=' character; or value is NULL.

Adjust the man page accordingly, and exercize them in the existing
environment testcase.
2010-10-16 11:23:41 +00:00
skrll e6cdac9c4b Implement dl_iterate_phdr.
Somewhat taken from FreeBSD. Manual page from OpenBSD.
2010-10-16 10:27:06 +00:00
enami 3cef3e6eba The was is not an argument but simply a part of sentense. 2010-10-07 00:14:14 +00:00
enami 4a94dc0b8f Avoid unnecessary malloc(). Since __findenv() kindly treats
equal sign as an end of string, we can pass the string of
form "key=value" to lookup "key".
2010-10-05 02:23:38 +00:00
tron ae557324e5 Restore binary compatibility with applications which use putenv(3)
on constant strings (e.g. postdrop(1)):
- Don't write to the environment string passed to putenv(3).
- Don't overwrite the value of an existing environment string
  unless the memory was actually allocated by setenv(3).
2010-10-02 16:56:03 +00:00
tron c3bcf19cf7 Make sure that all extra elements of the environment vector are set
to NULL. This stop su(1) from crashing.
2010-10-02 10:51:07 +00:00
tron 12c10b36d2 Remember that we didn't malloc() memory for an environment variable
if it has been set via putenv(3).
2010-10-02 10:05:55 +00:00
wiz 732dd678dd Fix a typo, remove trailing whitespace. 2010-10-01 20:57:50 +00:00
christos 7acc3301d8 make putenv POSIX compliant. 2010-10-01 20:11:32 +00:00
tron 2445ce72d2 Be slightly more careful about freeing memory allocated for environment
variables: only free memory if the current value points to the same
memory area as the allocated block. This will prevent crashes if an
application changes the order of the environment array.

Unfortunately this is still not enough to stop zsh 4.2.* from crashing.
zsh 4.3.* works fine before and after this change.
2010-09-30 12:41:33 +00:00
enami be59ef257e If new length is exactly equals to the current length,
there is nothing to do.
2010-09-29 00:44:04 +00:00
enami 248290ef3a Don't put space before close paren. 2010-09-29 00:40:17 +00:00
enami abfd061908 Add missing period at the end of sentense. 2010-09-28 00:39:56 +00:00
tnozaki 9ef74dfbcf validate flags/oflags from __sflag() befere call __sfp().
reviewed by enami-san, thanks.
2010-09-27 17:08:29 +00:00
tnozaki 6d102a3218 fix off-by-one, pointed out by enami-san, thanks! 2010-09-27 16:50:13 +00:00
yamt ab5972b02c fix rewinddir on nfs. fix PR/42879 (and probably PR/40229.) 2010-09-26 02:26:59 +00:00
christos 0588f13b3b be more conservative about allocing. 2010-09-25 19:31:51 +00:00
tron ed5e497e60 Remember the correct pointer which we will free later. 2010-09-25 19:10:37 +00:00
tron 1f5de17d4a Unlock the environment lock if __alocenv() fails. 2010-09-25 18:37:24 +00:00
tron 5cdca2e600 Remember memory used by allocated environment variables instead of
using a bitmap. This deals with the case where a variable is first
set via setenv(3) or putenv(3), then overwritten by changing
"environ" directory and afterwards overwritten with setenv(3) again.

This stops "zsh" from crashing under NetBSD-current.

Code reviewed by Christos Zoulas.
2010-09-25 18:11:40 +00:00
tron ac440cccfd Change last commit to Use "ptrdiff_t" instead of "intptr_t" because the
former is more appropriate in this case.
2010-09-25 14:00:30 +00:00
tron abf0c843b2 Add explicit cast to fix lint error on 32bit platforms. 2010-09-25 13:45:11 +00:00
wiz 14087bca56 Remove trailing whitespace, merge error sections for same error, nits. 2010-09-25 09:44:08 +00:00