summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* clarify the wording for 'first' and 'last'eadler2012-09-301-5/+4
| | | | | Approved by: wblock MFC after: 3 days
* libc: Use O_CLOEXEC for various internal file descriptors.jilles2012-09-2914-16/+18
| | | | | | | | | This fixes a race condition where another thread may fork() before CLOEXEC is set, unintentionally passing the descriptor to the child process. This commit only adds O_CLOEXEC flags to open() or openat() calls where no fcntl(fd, F_SETFD, FD_CLOEXEC) follows. The separate fcntl() call still leaves a race window so it should be fixed later.
* Slight stylification.des2012-09-281-18/+11
|
* libc/fts: Use O_CLOEXEC for internal file descriptors.jilles2012-09-272-10/+14
| | | | | | | | | Because fts keeps internal file descriptors open across calls, making such descriptors close-on-exec helps not only multi-threaded applications but also single-threaded applications. In particular, this prevents passing a temporary file descriptor for saving the current directory to processes created via find -exec.
* Complete revert of r239963:pfg2012-09-278-41/+19
| | | | | | | | | | | | | | | The attempt to merge changes from the linux libtirpc caused rpc.lockd to exit after startup under unclear conditions. After many hours of selective experiments and inconsistent results the conclusion is that it's better to just revert everything and restart in a future time with a much smaller subset of the changes. ____ MFC after: 3 days Reported by: David Wolfskill Tested by: David Wolfskill
* sigaction(2),sigwait(2),sigwaitinfo(2): Remove [EFAULT] error condition.jilles2012-09-273-16/+3
| | | | | | | | | | | | | | Passing an invalid pointer results in undefined behaviour. The wrappers in libthr access some of the data pointed to by the arguments in userland, so that an invalid pointer will cause a signal and not an [EFAULT] error return. Furthermore, if the [EFAULT] error occurs when the kernel is writing, it is not a proper error in the sense that the call still commits (changing the signal disposition or accepting the signal). MFC after: 1 week
* Partial revert of r239963:pfg2012-09-241-4/+0
| | | | | | | | | | | | | | | | | The following change caused rpc.lockd to exit after startup: ____ libtirpc: be sure to free cl_netid and cl_tp When creating a client with clnt_tli_create, it uses strdup to copy strings for these fields if nconf is passed in. clnt_dg_destroy frees these strings already. Make sure clnt_vc_destroy frees them in the same way. ____ MFC after: 3 days Reported by: David Wolfskill Tested by: David Wolfskill
* Remove the restrict qualifier to match function prototype.kevlo2012-09-201-1/+1
|
* strsignal(): Reindent.jilles2012-09-191-21/+21
|
* strsignal(): Do not append signal numbers to messages for known signals.jilles2012-09-191-1/+1
| | | | | Messages for known signals looked like "Terminated: 15" instead of "Terminated".
* Correct double "the the"eadler2012-09-141-1/+1
| | | | | Approved by: cperciva MFC after: 3 days
* According to a clarification at http://austingroupbugs.net/view.php?id=503emaste2012-09-122-4/+3
| | | | | | | ptsname may set errno, so avoid saving and restoring errno across the function. PR: standards/171572
* Avoid mapping ENOENT to ENOTDIR for non-existent path components.emaste2012-09-121-2/+0
| | | | | | | | | | | | | | | The ENOTDIR mapping was introduced in r235266 for kern/128933 based on an interpretation of the somewhat ambiguous language in the POSIX realpath specification. The interpretation is inconsistent with Solaris and Linux, a regression from 9.0, and does not appear to be permitted by the description of ENOTDIR: 20 ENOTDIR Not a directory. A component of the specified pathname existed, but it was not a directory, when a directory was expected. PR: standards/171577 MFC after: 3 days
* Describe in detail required conditions for receiving the SCM_CREDSglebius2012-09-121-4/+18
| | | | | control message and suggest to use LOCAL_CREDS setsockopt() for reliability.
* Add the same warning to rand48(3) as to rand(3) and random(3).des2012-09-112-5/+10
| | | | MFC after: 3 days
* libc/amd64: Do not export .cerror.jilles2012-09-0612-88/+9
| | | | | | | | | | | | | | | | | For some reason, libc exports the symbol .cerror (HIDENAME(cerror)), albeit in the FBSDprivate_1.0 version. It looks like there is no reason for this since it is not used from other libraries. Given that it cannot be accessed from C and its strange calling convention, it is rather unlikely that other things rely on it. Perhaps it is from a time when symbols could not be hidden. Most of the amd64 assembler code jumps to .cerror using the GOT. It can jump to it directly now, as in non-PIC mode. There are also some minor size optimizations to instructions but they yield virtually no benefit in the size of libc.so.7 due to padding. Reviewed by: kib
* Avoid segfault if name is invalid. Basically, onlytrhodes2012-09-061-2/+5
| | | | | | | check for CTL_USER if the sysctl fails with ENOENT. PR: 169056 Reviewed by: jhb
* libc/i386: Do not export .cerror.jilles2012-09-0511-41/+19
| | | | | | | | | | | | | | | | | | | | | | | For some reason, libc exports the symbol .cerror (HIDENAME(cerror)), albeit in the FBSDprivate_1.0 version. It looks like there is no reason for this since it is not used from other libraries. Given that it cannot be accessed from C and its strange calling convention, it is rather unlikely that other things rely on it. Perhaps it is from a time when symbols could not be hidden. Not exporting .cerror causes it to be jumped to directly instead of via the PLT. This change also takes advantage of .cerror's new status by not saving and loading %ebx before jumping to it. (Therefore, .cerror now saves and loads %ebx itself.) Where there was a conditional jump to a jump to .cerror, the conditional jump has been changed to jump to .cerror directly (many modern CPUs don't do static prediction and in any case it is not much of a benefit anyway). This change makes libc.so.7 a few kilobytes smaller. Reviewed by: kib
* When WIFCONTINUED was added, the number of "first" macros grew fromjhb2012-09-051-1/+1
| | | | | | three to four. MFC after: 1 week
* Bump dates.des2012-09-042-2/+2
| | | | Reminded by: bz@
* Add a prominent warning about these functions' unsuitability fordes2012-09-042-13/+17
| | | | cryptographic purposes, and recommend using arc4random(3) instead.
* Rework all non-contributed files that use `struct timezone'.ed2012-09-012-2/+2
| | | | | | | | | | | | | | This structure is not part of POSIX. According to POSIX, gettimeofday() has the following prototype: int gettimeofday(struct timeval *restrict tp, void *restrict tzp); Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is not used). Remove dead error handling code. Also use NULL for a nul-pointer instead of integer 0. While there, change all pieces of code that only use tv_sec to use time(3), as this provides less overhead.
* Bring some changes from Bull's NFSv4 libtirpc implementation.pfg2012-09-019-19/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We especifically ignored the glibc compatibility changes but this should help interaction with Solaris and Linux. ____ Fixed infinite loop in svc_run() author Steve Dickson Tue, 10 Jun 2008 12:35:52 -0500 (13:35 -0400) Fixed infinite loop in svc_run() ____ __rpc_taddr2uaddr_af() assumes the netbuf to always have a non-zero data. This is a bad assumption and can lead to a seg-fault. This patch adds a check for zero length and returns NULL when found. author Steve Dickson Mon, 27 Oct 2008 11:46:54 -0500 (12:46 -0400) ____ Changed clnt_spcreateerror() to return clearer and more concise error messages. author Steve Dickson Thu, 20 Nov 2008 08:55:31 -0500 (08:55 -0500) ____ Converted all uid and gid variables of the type uid_t and gid_t. author Steve Dickson Wed, 28 Jan 2009 12:44:46 -0500 (12:44 -0500) ____ libtirpc: set r_netid and r_owner in __rpcb_findaddr_timed These fields in the rpcbind GETADDR call are being passed uninitialized to CLNT_CALL. In the case of x86_64 at least, this usually leads to a segfault. On x86, it sometimes causes segfaults and other times causes garbage to be sent on the wire. rpcbind generally ignores the r_owner field for calls that come in over the wire, so it really doesn't matter what we send in that slot. We just need to send something. The reference implementation from Sun seems to send a blank string. Have ours follow suit. author Jeff Layton Fri, 13 Mar 2009 11:44:16 -0500 (12:44 -0400) ____ libtirpc: be sure to free cl_netid and cl_tp When creating a client with clnt_tli_create, it uses strdup to copy strings for these fields if nconf is passed in. clnt_dg_destroy frees these strings already. Make sure clnt_vc_destroy frees them in the same way. author Jeff Layton Fri, 13 Mar 2009 11:47:36 -0500 (12:47 -0400) Obtained from: Bull GNU/Linux NFSv4 Project MFC after: 3 weeks
* Add missing .Pp macro.zeising2012-08-211-0/+1
| | | | | | PR: docs/170380 Submitted by: Garrett Cooper <yanegomi@gmail.com> Approved by: joel (mentor)
* Remove trailing whitespace.joel2012-08-211-1/+1
|
* Add manual pages for clock_getcpuclockid and pthread_getcpuclockid.davidxu2012-08-212-1/+96
|
* Fix prototype. Also the function should return error code instead ofdavidxu2012-08-211-2/+4
| | | | -1 on error.
* Implement syscall clock_getcpuclockid2, so we can get a clock iddavidxu2012-08-175-5/+44
| | | | | | | | for process, thread or others we want to support. Use the syscall to implement POSIX API clock_getcpuclock and pthread_getcpuclockid. PR: 168417
* Make 'junk' volatile so that compilers won't be tempted to optimizekevlo2012-08-171-1/+1
| | | | | Reviewed by: ache MFC after: 3 days
* Merging of projects/armv6, part 2gonzo2012-08-152-0/+10
| | | | Handle TLS for ARMv6 and ARMv7
* Rename aux.c to auxv.c.ed2012-08-112-1/+1
| | | | | | | | | | | On Windows, AUX is the auxiliary device, usually pointing to COM1. Therefore it is forbidden to create a file named aux.c. To make it a bit easier for Windows users to check out our source code, rename this file to auxv.c. MFC after: 1 month Discussed with: kib Suggested by: Eric van Gyzen <eric vangyzen net>
* nftw(): POSIX says directories causing loops should be silently skipped.jilles2012-08-091-3/+2
| | | | Formerly, loops caused nftw() to abort the traversal with ELOOP.
* Refresh with OpenBSD RCS ID changes to reflect that we now have essentionallydelphij2012-08-091-7/+1
| | | | the same file.
* ftw(): Do not check the maxfds argument against OPEN_MAX.jilles2012-08-091-2/+1
| | | | | | | | | | Apart from the fact that nothing should have OPEN_MAX as a limit (as opposed to RLIMIT_NOFILE from getrlimit() or _SC_OPEN_MAX from sysconf()), POSIX does not require us to check this. POSIX does have a requirement on the application that maxfds not exceed {OPEN_MAX}, but does not require the implementation to check it ("may fail"). PR: 95239
* nftw(): Do not check the maxfds argument against OPEN_MAX.jilles2012-08-091-2/+1
| | | | | | | | | Apart from the fact that nothing should have OPEN_MAX as a limit (as opposed to RLIMIT_NOFILE from getrlimit() or _SC_OPEN_MAX from sysconf()), POSIX does not require us to check this. PR: 95239 Submitted by: Todd Miller
* Use calloc().delphij2012-08-011-2/+1
|
* Remove trailing whitespace.joel2012-07-301-1/+1
|
* Add more locale-specific functions to the relevant man pages and Makefile:issyl02012-07-306-14/+86
| | | | | | | | | | | | - lib/libc/locale/islower.3 - lib/libc/locale/ispunct.3 - lib/libc/locale/nl_langinfo.3 - lib/libc/locale/isgraph.3 - lib/libc/locale/isspace.3 Reviewed by: bz Approved by: theraven MFC after: 5 days
* Correct BUGS description of static buffer useemaste2012-07-271-3/+3
| | | | | | | Since r142667 strerror has unconditionally returned a pointer to a static buffer. MFC after: 1 week
* Document F_DUP2FD_CLOEXEC.kib2012-07-271-4/+14
| | | | MFC after: 1 week
* Start manpage with Dd macro and also remove a trailing whitespacejoel2012-07-261-2/+2
| | | | while here.
* Update the 'C1x draft' reference to '.St -isoC-2011' mdoc macro.pluknet2012-07-262-2/+4
| | | | | Reviewed by: theraven MFC after: 1 week
* Add a new man page containing details of new locale-specific functions forissyl02012-07-252-1/+182
| | | | | | | | wctype.h, iswalnum_l(3). Add it and its functions to the Makefile. Reviewed by: gavin, jilles Approved by: theraven MFC after: 5 days
* (Incomplete) fixes for symbols visibility issues and style in fcntl.h.kib2012-07-211-1/+1
| | | | | | | | | | | | | | | | | Append '__' prefix to the tag of struct oflock, and put it under BSD namespace. Structure is needed both by libc and kernel, thus cannot be hidden under #ifdef _KERNEL. Move a set of non-standard F_* and O_* constants into BSD namespace. SUSv4 explicitely allows implemenation to pollute F_* and O_* names after fcntl.h is included, but it costs us nothing to adhere to the specification if exact POSIX compliance level is requested by user code. Change some spaces after #define to tabs. Noted by and discussed with: bde MFC after: 1 week
* Document F_DUPFD_CLOEXEC. Also provide some wording changes forkib2012-07-191-4/+15
| | | | | | F_DUPFD to make it less confusing, at least for me. MFC after: 1 week
* Return zero from get_addrselectpolicy() when no source-address-selectionemax2012-07-181-0/+2
| | | | | | policy is installed. MFC after: 1 week
* libc: Remove some unused strings from getaddrinfo().jilles2012-07-151-13/+12
|
* Jump to the failed label instead of doing cleanup ourselves.brueffer2012-07-151-2/+1
| | | | | Obtained from: DragonFly BSD MFC after: 2 weeks
* Move the ffclock symbols from FBSD_1.2 to FBSD_1.3 where they should have beenlstewart2012-07-101-3/+3
| | | | | | | | put initially. They were added to head during development of 10-CURRENT, not 9-CURRENT. Submitted by: glebius Reviewed by: kib
* Executing CPUID with EAX set to 1 to actually get feature flags.davidxu2012-07-101-1/+1
| | | | PR: 169730
OpenPOWER on IntegriCloud