b39b2b27 | 10-Mar-2009 |
Peter Avalos <pavalos@theshell.com> |
Sync gethostname() with FreeBSD:
* Change gethostname() to set errno to ENAMETOOLONG instead of ENOMEM when the buffer is not long enough to hold the current host name. POSIX does not standardize er
Sync gethostname() with FreeBSD:
* Change gethostname() to set errno to ENAMETOOLONG instead of ENOMEM when the buffer is not long enough to hold the current host name. POSIX does not standardize error returns for gethostname(), so it doesn't matter which one we use, but ENAMETOOLONG is at least a little more intuitive.
* Update prototype to match SuS (int->size_t).
show more ...
|
6a7eb1f6 | 10-Mar-2009 |
Peter Avalos <pavalos@theshell.com> |
Sync getcap() with FreeBSD:
* Expand contractions and fix sentence breaks.
* In cgetmatch(3), return -1 if a NULL or 0-length name parameter is used. This prevents lpd from hanging at boot with
Sync getcap() with FreeBSD:
* Expand contractions and fix sentence breaks.
* In cgetmatch(3), return -1 if a NULL or 0-length name parameter is used. This prevents lpd from hanging at boot with certain (legal) printcap entries.
* Sprinkle some const.
show more ...
|
59b616d3 | 27-Feb-2009 |
Peter Avalos <pavalos@theshell.com> |
Sync fts(3) with FreeBSD.
Here's some of the relevant commit logs from FreeBSD:
FTSENT now avoids the use of the struct hack, thereby allowing future extensions to the structure (e.g., for extended
Sync fts(3) with FreeBSD.
Here's some of the relevant commit logs from FreeBSD:
FTSENT now avoids the use of the struct hack, thereby allowing future extensions to the structure (e.g., for extended attributes) without rebreaking the ABI. FTSENT now contains a pointer to the parent stream, which fts_compar() can then take advantage of, avoiding the undefined behavior previously warned about. As a consequence of this change, the prototype of the comparison function passed to fts_open() has changed to reflect the required amount of constness for its use. All callers in the tree are updated to use the correct prototype.
Comparison functions can now make use of the new parent pointer to access the new stream-specific private data pointer, which is intended to assist creation of reentrant library routines which use fts(3) internally.
The FTS_NOSTAT option is an optimisation that reduces the number of stat(2) calls by keeping an eye of the number of links a directory has. It assumes that each subdirectory will have a hard link to its parent, to represent the ".." node, and stops calling stat(2) when all links are accounted for in a given directory.
This assumption is really only valid for UNIX-like filesystems: A concrete example is NTFS. The NTFS "i-node" does contain a link count, but most/all directories have a link count between 0 and 2 inclusive. The end result is that find on an NTFS volume won't actually traverse the entire hierarchy of the directories passed to it. (Those with a link count of two are not traversed at all)
The fix checks the "UFSness" of the filesystem before enabling the optimisation.
In fts_build(), if we try to chdir and fail (e.g. due to lack of search permission), try to continue in FTS_DONTCHDIR mode. Of course this won't work for long paths, but we can't descend more than one pathname component beyond the directory anyway if we lack search permission.
Our fts(3) API, as inherited from 4.4BSD, suffers from integer fields in FTS and FTSENT structs being too narrow. In addition, the narrow types creep from there into fts.c. As a result, fts(3) consumers, e.g., find(1) or rm(1), can't handle file trees an ordinary user can create, which can have security implications.
Fix a file descriptor leak.
show more ...
|
5d0641a4 | 19-Jan-2009 |
Peter Avalos <pavalos@theshell.com> |
Sync libc/stdlib with FreeBSD (ignoring jemalloc, pts, and gdtoa):
-Add a64l(), l64a(), and l64a_r() XSI extentions. These functions convert between a 32-bit integer and a radix-64 ASCII string.
-
Sync libc/stdlib with FreeBSD (ignoring jemalloc, pts, and gdtoa):
-Add a64l(), l64a(), and l64a_r() XSI extentions. These functions convert between a 32-bit integer and a radix-64 ASCII string.
-Replace some syscalls with libc version.
-Remove advertising clause.
-alloca() cannot check if the allocation is valid; mention the consequences.
-Include some verbage about not calling exit() from functions registered by atexit().
-Use pthread mutexes where possible instead of libc spinlocks.
-Significantly reduce the memory leak as noted in the BUGS section of setenv(3) by tracking the size of the memory allocated instead of using strlen() on the current value.
-Prefer setenv() instead of putenv().
-Convert *env() calls to POSIX: -unsetenv returns an int. -putenv takes a char * instead of const char *. -putenv no longer makes a copy of the input string. -errno is set appropriately. Exceptions involve bad environ variable and internal initialization code. These both set errno to EFAULT.
-Make getopt_long() more GNU compatible and sync up with OpenBSD's version.
-POSIX clearly states that getsubopt() should be declared in <stdlib.h> not in <unistd.h>
-Use size_t to avoid overflow when sorting arrays larger than 2 GB in heapsort() and qsort().
-Add new implementations of insque() and remque() which conform to IEEE Std 1003.1-2001.
-Add qsort_r() for functions that need to be reentrant.
-Improve radixsort()'s preformance when sorting strings with common prefixes.
-Use 'uint32_t' instead of 'long' when a 32-bit integer is intended in random(3).
-Rearrange <stdlib.h> in a more logical order based on visibility.
-Move getsubopt()'s prototype to <stdlib.h> (standards).
-Make an internal _getprogname() that is used only inside libc. For libc, getprogname(3) is a weak symbol in case a function of the same name is defined in userland.
show more ...
|
7d013f97 | 16-Jan-2009 |
Peter Avalos <pavalos@theshell.com> |
Remove the timezone() function.
It conflicts with an XSI extension where timezone and daylight are variables representing:
timezone: the difference, in seconds, between Coordinated Universal Time
Remove the timezone() function.
It conflicts with an XSI extension where timezone and daylight are variables representing:
timezone: the difference, in seconds, between Coordinated Universal Time (UTC) and local standard time.
daylight: set to 0 if Daylight Savings Time conversions should never be applied for the timezone in use; otherwise, non-zero.
show more ...
|