summaryrefslogtreecommitdiff
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* Fix a file descriptor leak in fts_child().David Schultz2009-03-041-1/+3
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=189348
* Considerably improve the wording of this man page.Bruce M Simpson2009-03-041-20/+77
| | | | Notes: svn path=/head/; revision=189336
* Update copyright.Bruce M Simpson2009-03-041-16/+13
| | | | Notes: svn path=/head/; revision=189335
* Explicitly specify bit width for on-disk data structure.Xin LI2009-03-041-17/+17
| | | | | | | Obtained from: OpenBSD Notes: svn path=/head/; revision=189330
* Sync license changes.Xin LI2009-03-042-20/+3
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=189328
* Style changes (including additional casts to shut up warnings). ThisXin LI2009-03-0415-36/+35
| | | | | | | commit does not affect MD5 of object file. Notes: svn path=/head/; revision=189327
* Rename variable 'index' to 'idx' to avoid name collision with index(3),Xin LI2009-03-037-101/+87
| | | | | | | | | | this commit does not affect any object code. Obtained from: OpenBSD Verified with: md5(1) Notes: svn path=/head/; revision=189292
* Diff reduction against OpenBSD: ANSI'fy prototypes.Xin LI2009-03-0228-485/+196
| | | | | | | | | | | (This is part of a larger changeset which is intended to reduce diff only, thus some prototypes were left intact since they will be changed in the future). Verified with: md5(1) Notes: svn path=/head/; revision=189291
* Correct types of variables used to track amount of allocated SysV sharedKonstantin Belousov2009-03-021-0/+9
| | | | | | | | | | | | | | | | | memory from int to size_t. Implement a workaround for current ABI not allowing to properly save size for and report more then 2Gb sized segment of shared memory. This makes it possible to use > 2 Gb shared memory segments on 64bit architectures. Please note the new BUGS section in shmctl(2) and UPDATING note for limitations of this temporal solution. Reviewed by: csjp Tested by: Nikolay Dzham <i levsha org ua> MFC after: 2 weeks Notes: svn path=/head/; revision=189283
* Rewrite asprintf() as a wrapper around vasprintf(), thus reducing theDavid Schultz2009-03-021-43/+22
| | | | | | | | number of functions that have an incestuous relationship with the arcane innards of stdio. Notes: svn path=/head/; revision=189271
* The argument corresponding to %zn is supposed to be an ssize_t *, notDavid Schultz2009-03-022-6/+6
| | | | | | | a size_t *, although the distinction is moot in practice. Notes: svn path=/head/; revision=189268
* Use C99-style initializers. No functional change.David Schultz2009-03-011-4/+9
| | | | | | | Reviewed by: md5(1) Notes: svn path=/head/; revision=189249
* Add a missing .El.Xin LI2009-03-011-0/+1
| | | | Notes: svn path=/head/; revision=189208
* "-isoC-99" should be spelled without 'c'.Xin LI2009-03-011-1/+1
| | | | Notes: svn path=/head/; revision=189207
* Add missing POSIX 1003.1-2008 open(2) flag; O_TTY_INIT.Ed Schouten2009-02-281-1/+15
| | | | | | | | | | On FreeBSD, this is the default behaviour. According to the spec, we may give this flag a value of zero, but I'd rather not do this. If we define it to a non-zero value, we can always change default behaviour without changing the ABI. This is very unlikely to happen, though. Notes: svn path=/head/; revision=189143
* Replace a dozen lines of code with a call to strnlen() / wcsnlen().David Schultz2009-02-282-33/+2
| | | | Notes: svn path=/head/; revision=189138
* Add restrict qualifiers.David Schultz2009-02-281-1/+1
| | | | | | | I missed this file in my previous commit. Notes: svn path=/head/; revision=189137
* - Add getdelim(), getline(), stpncpy(), strnlen(), wcsnlen(),David Schultz2009-02-2818-26/+689
| | | | | | | | | | | | | | | wcscasecmp(), and wcsncasecmp(). - Make some previously non-standard extensions visible if POSIX_VISIBLE >= 200809. - Use restrict qualifiers in stpcpy(). - Declare off_t and size_t in stdio.h. - Bump __FreeBSD_version in case the new symbols (particularly getline()) cause issues with ports. Reviewed by: standards@ Notes: svn path=/head/; revision=189136
* Add restrict qualifiers to the parameters to strlcpy() and strlcat().David Schultz2009-02-283-4/+4
| | | | | | | | The annotation mainly just serves as a hint that they're not intended for use with overlapping strings. Notes: svn path=/head/; revision=189133
* Make sure %zd treats negative arguments properly on 32-bit platforms.David Schultz2009-02-283-5/+8
| | | | | | | | | | Fix harmless but related bugs in %_$zd and %_$tu. PR: 131880 MFC after: 1 week Notes: svn path=/head/; revision=189131
* These warnings are only relevant on NetBSD it seems. They don't seemWarner Losh2009-02-192-6/+0
| | | | | | | to be relevant to FreeBSD at all. Notes: svn path=/head/; revision=188827
* These symbols don't belong here. Remove them. Since mips hasn't hadWarner Losh2009-02-191-4/+0
| | | | | | | | | a release, I think there's no impact here... Reviewed by: cognet@ Notes: svn path=/head/; revision=188823
* Properly invalidate highest pts number when calling setttyent().Ed Schouten2009-02-121-5/+4
| | | | | | | | | | | | When calling setttyent() after calling endttyent(), pts_valid will never be set to 1, because the readdir()-loop will likely never vind a pts that has a higher number than before. Simplify the code by removing pts_valid. We'll just set maxpts to -1 when we don't have a valid count yet. Notes: svn path=/head/; revision=188536
* Make ttyslot(3) work with pts(4) devices.Ed Schouten2009-02-121-6/+5
| | | | | | | | | | It seems ttyslot() calls rindex(), to strip the device name to the last slash, but this is obviously invalid. /dev/pts/0 should be stripped until pts/0. Because /etc/ttys only supports TTY names in /dev/, just strip this piece of the pathname. Notes: svn path=/head/; revision=188534
* Add two new routines: fdevname() and fdevname_r().Ed Schouten2009-02-116-20/+88
| | | | | | | | | | | | | | | | | A more elegant way of obtaining a name of a character device by its file descriptor on FreeBSD, is to use the FIODGNAME ioctl. Because a valid file descriptor implies a file descriptor is visible in /dev, it will always resolve a valid device name. I'm adding a more friendly wrapper for this ioctl, called fdevname(). It is a lot easier to use than devname() and also has better error handling. When a device name cannot be resolved, it will just return NULL instead of a generated device name that makes no sense. Discussed with: kib Notes: svn path=/head/; revision=188497
* Shutup warning for DNAME RR.Hajimu UMEMOTO2009-02-082-2/+3
| | | | | | | | | PR: bin/127591 Submitted by: "Eugene M. Kim" <20080111.freebsd.org__at__ab.ote.we.lv> MFC after: 1 week Notes: svn path=/head/; revision=188316
* Fix language on atol(3) manpage. Add a COMPATIBILITY sectionGiorgos Keramidas2009-02-081-3/+32
| | | | | | | | | | | | | stating that in FreeBSD the atol() and atoll() functions affect errno in the same way as strtol() and stroll(). PR: docs/126487 Submitted by: edwin Reviewed by: trhodes, gabor MFC after: 1 week Notes: svn path=/head/; revision=188305
* Make sure the comparison is done with an unsigned char.Warner Losh2009-02-071-1/+1
| | | | Notes: svn path=/head/; revision=188295
* Standardize the various prison_foo_ip[46] functions and prison_if toJamie Gritton2009-02-051-2/+2
| | | | | | | | | | | | | | | | | | return zero on success and an error code otherwise. The possible errors are EADDRNOTAVAIL if an address being checked for doesn't match the prison, and EAFNOSUPPORT if the prison doesn't have any addresses in that address family. For most callers of these functions, use the returned error code instead of e.g. a hard-coded EADDRNOTAVAIL or EINVAL. Always include a jailed() check in these functions, where a non-jailed cred always returns success (and makes no changes). Remove the explicit jailed() checks that preceded many of the function calls. Approved by: bz (mentor) Notes: svn path=/head/; revision=188144
* Fix the functions to match prototypes. The K&R definitions differWarner Losh2009-02-033-3/+3
| | | | | | | from the ANSI-C prototype due to the 'int promotion' rule. Notes: svn path=/head/; revision=188098
* - ANSIfy function definitionsDaniel Gerzo2009-02-0333-110/+41
| | | | | | | | | - use nul when we are looking for a terminating character where appropriate Approved by: imp Notes: svn path=/head/; revision=188080
* Provide a type for the argument.Roman Divacky2009-02-021-1/+1
| | | | | | | Approved by: kib (mentor) Notes: svn path=/head/; revision=188031
* - Remove superfluous commentGabor Kovesdan2009-01-301-2/+0
| | | | | | | | PR: docs/129400 Submitted by: Gavin Atkinson <gavin@freebsd.org> Notes: svn path=/head/; revision=187918
* Update the description of KERN_PROC.Tom Rhodes2009-01-281-5/+3
| | | | | | | | PR: 100242 Reviewed by: jhb Notes: svn path=/head/; revision=187824
* Better wording for clearing EOF indicator.Tom Rhodes2009-01-281-0/+4
| | | | | | | Submitted by: keramida and jhb Notes: svn path=/head/; revision=187823
* Remove another comment about clearing EOF indicator.Tom Rhodes2009-01-281-4/+1
| | | | | | | Noticed by: bde Notes: svn path=/head/; revision=187817
* Update the manpage to reflect r145172.David Schultz2009-01-281-2/+1
| | | | Notes: svn path=/head/; revision=187809
* Remove comment about clearerr() being the only method of clearingTom Rhodes2009-01-281-3/+1
| | | | | | | | | | | | the EOF indicator, fseek() may also be used for this. Bump document date. PR: 76333 Submitted by: Yoshihiko Sarumaru <mistral@imasy.or.jp> Notes: svn path=/head/; revision=187805
* - Fix grammar. [1]Xin LI2009-01-261-3/+3
| | | | | | | | | | | - Use the correct term 'long mode'. [2] - style(9) for return value. [3] Submitted by: Ben Kaduk <minimarmot gmail com> [1], obrien [2], scf [3] Notes: svn path=/head/; revision=187707
* Rewrite of MI strlen(3) in a way that can better utilize modern hardware byXin LI2009-01-251-15/+78
| | | | | | | | | | | | reducing branches and doing word-sized operation. The idea is taken from J.T. Conklin's x86_64 optimized version of strlen(3) for NetBSD, and reimplemented in C by me. Discussed on: -arch@ Notes: svn path=/head/; revision=187700
* Add support for multibyte thousands_sep encodings, e.g., U+066C.David Schultz2009-01-223-173/+225
| | | | | | | | | | | The integer thousands' separator code is rewritten in order to avoid having to preallocate a buffer for the largest possible digit string with the most possible instances of the longest possible multibyte thousands' separator. The new version inserts thousands' separators for integers using the same code as floating point. Notes: svn path=/head/; revision=187582
* - Add support for multibyte decimal_point encodings, e.g., U+066B.David Schultz2009-01-192-23/+49
| | | | | | | | A forthcoming gdtoa import is needed to make this fully work. - Improve the way "nan(...)" is parsed. Notes: svn path=/head/; revision=187422
* Add support for multibyte decimal_point encodings, e.g., U+066B.David Schultz2009-01-192-23/+35
| | | | Notes: svn path=/head/; revision=187421
* When f[w]printf() is called on an unbuffered file like stdout, itDavid Schultz2009-01-172-14/+23
| | | | | | | | | | | | | | | | | | | sets up a fake buffered FILE and then effectively calls itself recursively. Unfortunately, gcc doesn't know how to do tail call elimination in this case, and actually makes things worse by inlining __sbprintf(). This means that f[w]printf() to stderr was allocating about 5k of stack on 64-bit platforms, much of which was never used. I've reorganized things to eliminate the waste. In addition to saving some stack space, this improves performance in my tests by anywhere from 5% to 17% (depending on the test) when -fstack-protector is enabled. I found no statistically significant performance difference when stack protection is turned off. (The tests redirected stderr to /dev/null.) Notes: svn path=/head/; revision=187369
* Simplify printf's inlined output buffering routines. On amd64, thisDavid Schultz2009-01-171-18/+18
| | | | | | | reduces the code size by about 10% and improves performance slightly. Notes: svn path=/head/; revision=187354
* Change dstp to be const and remove bogus cast.Roman Divacky2009-01-151-2/+3
| | | | | | | | Submitted by: christoph.mallon at gmx.de Approved by: kib (mentor) Notes: svn path=/head/; revision=187312
* Introduce a local variable and use it instead of passed in parameterRoman Divacky2009-01-155-6/+16
| | | | | | | | | | | to get rid of restrict qualifier discarding. This lets libc compile cleanly in gnu99 mode. Suggested by: kib, christoph.mallon at gmx.de Approved by: kib (mentor) Notes: svn path=/head/; revision=187302
* Reduce code duplication by moving functions that are identical in bothDavid Schultz2009-01-153-427/+216
| | | | | | | | vfprintf.c and vfwprintf.c (except for char/wchar_t differences) to a common header file. Notes: svn path=/head/; revision=187284
* Convert the insidious macros that handle printf()'s buffering intoDavid Schultz2009-01-153-86/+204
| | | | | | | | | | | | | | slightly less evil inline functions, and move the buffering state into a struct. This will make it possible for helper routines to produce output for printf() directly, making it possible to untangle the code somewhat. In wprintf(), use the same buffering mechanism to reduce diffs to printf(). This has the side-effect of causing wprintf() to catch write errors that it previously ignored. Notes: svn path=/head/; revision=187277
* Document that ffsll(3) and flsll(3) functions first appeared inKonstantin Belousov2009-01-131-1/+1
| | | | | | | | | | FreeBSD 7.1 Submitted by: Jan Henrik Sylvester <me janh de> MFC after: 3 days Notes: svn path=/head/; revision=187147