summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* Renumber clauses to reduce diffs to other versionsemaste2013-06-1328-28/+28
| | | | | NetBSD, OpenBSD, and Android's Bionic number the clauses 1 through 3, so follow suit to make comparison easier.
* Turn libc.so into an ld script rather than a symlink pointing to thejlh2013-06-122-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | real shared object and libssp_nonshared.a. This was the last showstopper that prevented from enabling SSP for ports by default. portmgr@ performed a buildworld which showed no significant breakage with this patch. Details: On i386 for PIC objects, gcc uses the __stack_chk_fail_local hidden symbol instead of calling __stack_chk_fail directly [1]. This happen not only with our gcc-4.2.1 but also with the latest gcc-4.8. If you want the very nasty details, see [2]. OTOH the problem doesn't exist on other architectures. It also doesn't exist with Clang as the latter will somehow manage to create the function in the object file at compile time (contrary to only referencing it through a symbol that will be brought in at link time). In a perfect world, when an object file is compiled with -fstack-protector, it will be linked into a binary or a DSO with this same flag as well, so GCC will add libssp_nonshared.a to the linker command-line. Unfortunately, we don't control softwares in ports and we may have such broken DSO. This is the whole point of this patch. You can reproduce the problem on i386 by compiling a source file into an object file with "-fstack-protector-all -fPIE" and linking it into a binary without "-fstack-protector". This ld script automatically proposes libssp_nonshared.a along with the real libc DSO to the linker. It is important to understand that the object file contained in this library will be pulled in the resulting binary _only if_ the linker notices one of its symbols is needed (i.e. one of the SSP symbol is missing). A theorical performance impact could be when compiling, but my testing showed less than 0.1% of difference. [1] For 32-bit code gcc saves the PIC register setup by using __stack_chk_fail_local hidden function instead of calling __stack_chk_fail directly. See comment line 19460 in: src/contrib/gcc/config/i386/i386.c [2] When compiling a source file to an object file, if you use something which is external to the compilation unit, GCC doesn't know yet if this symbol will be inside or outside the DSO. So it expects the worst case and routes the symbol through the GOT, which means additional space and extra relocation for rtld(1). Declaring a symbol has hidden tells GCC to use the optimal route (no GOT), but on the other hand this means the symbol has to be provided in the same DSO (namely libssp_nonshared.a). On i386, GCC actually uses an hidden symbol for SSP in PIC objects to save PIC register setup, as said in [1]. PR: ports/138228 PR: ports/168010 Reviewed by: kib, kan
* Make recv() and send() cancellation points, as required by POSIX.jilles2013-06-092-6/+10
| | | | | Call the recvfrom() and sendto() functions overridden by libthr instead of the _recvfrom() and _sendto() versions that are not cancellation points.
* Minor mdoc fixes.joel2013-06-091-3/+3
|
* sigaction(2): Document various non-POSIX functions as async-signal safe.jilles2013-06-081-2/+15
|
* Add new system call - aio_mlock(). The name speaks for itself. It allowsglebius2013-06-083-0/+135
| | | | | | | | to perform the mlock(2) operation, which can consume a lot of time, under control of aio(4). Reviewed by: kib, jilles Sponsored by: Nginx, Inc.
* Finish pulling in the NetBSD setjmp/longjmp updates on ARM.andrew2013-06-074-4/+162
| | | | | | | | Store/restore the VFP registers in setjmp/longjmp on ARM EABI if VFP is enabled in the kernel. It checks the hw.floatingpoint sysctl to see if floating-point is available and uses this to determine if it should store them. If it does it uses a different magic value so longjmp is able to know if it should load them.
* Include machine/setjmp.h to get the definition of _JB_MAGIC__SETJMP. Thisandrew2013-06-071-1/+3
| | | | allows us to remove it from the ARM copy of machine/asm.h.
* Switch to 2-clause license and standard textemaste2013-06-061-11/+11
| | | | Approved by: bms@
* Remove part of the NetBSD longjmp code that was not ready to be merged.andrew2013-06-051-2/+1
|
* Start to merge the updated ARM NetBSD setjump/longjmp functions. To beginandrew2013-06-042-75/+52
| | | | | | | | | | with merge the functions but leave out the code to save/load the VFP registers as that requires other changes to ensure the VFP is enabled first. This removes storing the old fpa registers. These were never fully supported, and the only user of this code I can find have moved to newer CPUs which use a VFP.
* mdoc: convert .Fd to .In, which is much nicer.joel2013-06-043-7/+7
|
* Add libiconv based versions of *c16*() and *c32*().ed2013-06-037-3/+314
| | | | | | | | | | | | | I initially thought wchar_t was locale independent, but this seems to be only the case on Linux. This means that we cannot depend on the *wc*() routines to implement *c16*() and *c32*(). Instead, use the Citrus libiconv that is part of libc. I'll see if there is anything I can do to make the existing functions somewhat useful in case the system is built without libiconv in the nearby future. If not, I'll simply remove the broken implementations. Reviewed by: jilles, gabor
* Switch to 2-clause licenseemaste2013-06-031-6/+0
| | | | Approved by: bms@
* dup(2): Clarify return value, in particular of dup2().jilles2013-05-311-4/+5
|
* sigaction(2): *at system calls are async-signal safe.jilles2013-05-311-0/+14
|
* sigaction(2): Extend description of async-signal safe functions:jilles2013-05-311-13/+108
| | | | | * Improve description when unsafe functions are unsafe. * Add various safe functions from POSIX.1-2008 and Austin Group issue #692.
* fork(2): Add information about fork() in multi-threaded processes.jilles2013-05-311-0/+12
| | | | | There is nothing about pthread_atfork(3) or extensions like calling malloc(3) in the child process as this may be unreliable or broken.
* fork(2): #include <sys/types.h> is not needed.jilles2013-05-311-2/+1
|
* Remove clause 3 and 4 from TNF licensesemaste2013-05-2913-91/+0
| | | | | | | Per the NetBSD Foundation statement Third parties are encouraged to change the license on any files which have a 4-clause license contributed to the NetBSD Foundation to a 2-clause license.
* Remove the advertising clause from the Regents of the University ofemaste2013-05-285-25/+5
| | | | California's license, per the letter dated July 22, 1999.
* Renumber clauses to reduce diffs to other versionsemaste2013-05-28100-100/+100
| | | | | NetBSD, OpenBSD, and Android's Bionic number the clauses 1 through 3, so follow suit to make comparison easier.
* Remove the advertising clause from the Regents of the University ofemaste2013-05-2810-50/+10
| | | | California's license, per the letter dated July 22, 1999.
* The getcontext() from the __fillcontextx() call in thekib2013-05-289-6/+69
| | | | | | | | | | | | | | | | | | | | | | | | | check_deferred_signal() returns twice, since handle_signal() emulates the return from the normal signal handler by sigreturn(2)ing the passed context. Second return is performed on the destroyed stack frame, because __fillcontextx() has already returned. This causes undefined and bad behaviour, usually the victim thread gets SIGSEGV. Avoid nested frame and the need to return from it by doing direct call to getcontext() in the check_deferred_signal() and using a new private libc helper __fillcontextx2() to complement the context with the extended CPU state if the deferred signal is still present. The __fillcontextx() is now unused, but is kept to allow older libthr.so to be used with the new libc. Mark __fillcontextx() as returning twice [1]. Reported by: pgj Pointy hat to: kib Discussed with: dim Tested by: pgj, dim Suggested by: jilles [1] MFC after: 1 week
* cap_rights_limit(2): CAP_ACCEPT also permits accept4(2).jilles2013-05-271-1/+3
|
* Make the malloc(3) family of functions weak and make their non-weakmarcel2013-05-251-0/+11
| | | | | | | | | | | | | | implementations visible for use by applications. The functions $F that are now weak symbols are: allocm, calloc, dallocm, free, malloc, malloc_usable_size, nallocm, posix_memalign, rallocm, realloc, sallocm The non-weak implementations of $F are exported as __$F. Submitted by: stevek@juniper.net Reviewed by: jasone@, kib@ Approved by: jasone@ (jemalloc) Obtained from: juniper Networks, Inc
* sigreturn(2): Remove ancient compatibility warning about 4.2BSD.jilles2013-05-251-4/+0
| | | | The HISTORY subsection still says that sigreturn() was added in 4.3BSD.
* Make some tiny improvements to iconv_open().ed2013-05-251-21/+15
| | | | | | | | | - Remove an unneeded variable. - Fix whitespace bugs. - Fix typoes in comment. - Improve string handling a bit. Don't handroll strstr() and don't terminate a strdup()'ed string. Instead, simply strndup() the part we need.
* Only call free() on something we allocated.ed2013-05-251-2/+2
| | | | | | | If we were already provided a struct _citrus_iconv (e.g. through iconv_open_into()), we should not call free() in case io_init_context() fails. Instead, call it on the pointer of the allocated object, which will be NULL in case of iconv_open_into().
* Let iconv build on -HEAD properly.ed2013-05-233-0/+3
| | | | | | - Add NO_WMISSING_VARIABLE_DECLARATIONS where we use Yacc/Lex. - Add variable declarations where possible. - Add missing static keyword.
* Update manpages for r250887.ed2013-05-213-9/+3
| | | | | | Remove the lists of unneeded header files. Requested by: eadler
* Add <uchar.h>.ed2013-05-219-52/+410
| | | | | | | | | | | | The <uchar.h> header, part of C11, adds a small number of utility functions for 16/32-bit "universal" characters, which may or may not be UTF-16/32. As our wchar_t is already ISO 10646, simply add light-weight wrappers around wcrtomb() and mbrtowc(). While there, also add (non-yet-standard) _l functions, similar to the ones we already have for the other locale-dependent functions. Reviewed by: theraven
* Update the setfib man page to reflect recent changes.julian2013-05-201-3/+6
|
* popen(): Add 'e' mode character to set close-on-exec on the new fd.jilles2013-05-202-10/+27
| | | | | | | | | | | | | | If 'e' is used, the kernel must support the recently added pipe2() system call. The use of pipe2() with O_CLOEXEC also fixes race conditions between concurrent popen() calls from different threads, even if the close-on-exec flag on the fd of the returned FILE is later cleared (because popen() closes all file descriptors from earlier popen() calls in the child process). Therefore, this approach should be used in all cases when pipe2() can be assumed present. The old version of popen() rejects "re" and "we" but treats "r+e" like "r+".
* Fix a typo: It should be "strtoll" and not "stroll".hiren2013-05-141-3/+3
| | | | | | | PR: 178642 Reported by: Michael Galassi (michaelgalassi@gmail.com) Approved by: sbruno (mentor) MFC after: 1 week
* Fix several typoseadler2013-05-121-1/+1
| | | | | | PR: kern/176054 Submitted by: Christoph Mallon <christoph.mallon@gmx.de> MFC after: 3 days
* Typo.pluknet2013-05-121-1/+1
|
* posix_spawn_file_actions_adddup2(3): Document difference with dup2().jilles2013-05-091-2/+23
| | | | | | | | The ability to clear a file descriptor's close-on-exec flag via posix_spawn_file_actions_adddup2() is in fact proposed in Austin Group issue #411. MFC after: 1 week
* posix_spawn_file_actions_addopen(3): Correct error for bad file descriptor.jilles2013-05-091-2/+2
| | | | | | | | As per POSIX.1-2008, posix_spawn_file_actions_add* return [EBADF] if a file descriptor is negative, not [EINVAL]. The bug was only in the manual page; the code is correct. MFC after: 1 week
* wordexp(): Simplify code by deferring work to sh.jilles2013-05-091-13/+3
|
* POSIX 1003.1-2008: add ENOTRECOVERABLE, EOWNERDEAD errnos.pluknet2013-05-043-1/+11
|
* Document that the return type is different from 1003.1-2008.pluknet2013-05-041-2/+9
| | | | MFC after: 1 week
* mdoc: missing comma in .Dd macro.pluknet2013-05-045-5/+5
|
* Add entry for errno ECAPMODE.pluknet2013-05-041-0/+2
| | | | MFC after: 3 days
* Improve compatibility with recent flex from flex.sourceforge.net.jkim2013-05-031-3/+2
|
* Also, add a missing period.pluknet2013-05-033-3/+3
|
* Remove an extra comma.pluknet2013-05-033-3/+3
|
* Remove the STANDARDS section.pluknet2013-05-031-4/+1
| | | | | | querylocale is not part of IEEE Std 1003.1-2008. MFC after: 3 days
* accept(2), pipe(2): Fix .Dd.jilles2013-05-012-2/+2
|
* Add pipe2() system call.jilles2013-05-013-2/+46
| | | | | | | | | | | | | The pipe2() function is similar to pipe() but allows setting FD_CLOEXEC and O_NONBLOCK (on both sides) as part of the function. If p points to two writable ints, pipe2(p, 0) is equivalent to pipe(p). If the pointer is not valid, behaviour differs: pipe2() writes into the array from the kernel like socketpair() does, while pipe() writes into the array from an architecture-specific assembler wrapper. Reviewed by: kan, kib
OpenPOWER on IntegriCloud