summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* db: Use O_CLOEXEC instead of separate fcntl() call.jilles2013-08-132-8/+3
|
* Expose _citrus_bcs_trunc_rws_len for libintl's use.peter2013-08-131-0/+1
| | | | Submitted by: Jan Beich <jbeich@tormail.org>
* The iconv in libc did two things - implement the standard APIs, the GNUpeter2013-08-132-15/+20
| | | | | | | | | | | | | | | | | | | | | | | | extensions and also tried to be link time compatible with ports libiconv. This splits that functionality and enables the parts that shouldn't interfere with the port by default. WITH_ICONV (now on by default) - adds iconv.h, iconv_open(3) etc. WITH_LIBICONV_COMPAT (off by default) adds the libiconv_open etc API, linker symbols and even a stub libiconv.so.3 that are good enough to be able to 'pkg delete -f libiconv' on a running system and reasonably expect it to work. I have tortured many machines over the last few days to try and reduce the possibilities of foot-shooting as much as I can. I've successfully recompiled to enable and disable the libiconv_compat modes, ports that use libiconv alongside system iconv etc. If you don't enable the WITH_LIBICONV_COMPAT switch, they don't share symbol space. This is an extension of behavior on other system. iconv(3) is a standard libc interface and libiconv port expects to be able to run alongside it on systems that have it. Bumped osreldate.
* db/hash: Use O_CLOEXEC instead of separate fcntl() call.jilles2013-08-111-2/+1
| | | | | | In particular, a hash db is used by getpwnam() and getpwuid(). MFC after: 1 week
* Add mkostemp() and mkostemps().jilles2013-08-094-21/+106
| | | | | These are like mkstemp() and mkstemps() but allow passing open(2) flags like O_CLOEXEC.
* According to POSIX \ in the fnmatch(3) pattern should escapeache2013-08-081-2/+0
| | | | | | | | | | any character including '\0', but our version replace escaped '\0' with '\\'. I.e. fnmatch("\\", "\\", 0) should not match while fnmatch("\\", "", 0) should (Linux and NetBSD does the same). Was vice versa. PR: 181129 MFC after: 1 week
* Our libc iconv (unlike gnu iconv and the citrus code in NetBSD) has apeter2013-08-081-0/+13
| | | | | | | | bypass mode when src == dst. Unfortunately, there are tools in ports that pass byte streams through iconv to determine if the encodings are valid. eg: gettext-0.18.3+. Disable the optimization and behave like the other implementations.
* Revert r253748,253749avg2013-07-282-0/+2
| | | | | | This WIP should not have been committed yet. Pointyhat to: avg
* remove needless inclusion of machine/cpu.h in userlandavg2013-07-282-2/+0
| | | | MFC after: 21 days
* Remove define and documentation for vm_pageout_algorithm missed in r253587zont2013-07-261-4/+0
|
* Enhance the description of NOTE_TRACK:jhb2013-07-251-6/+11
| | | | | | | | | | | | | | - NOTE_TRACK has never triggered a NOTE_TRACK event from the parent pid. If NOTE_FORK is set, the listener will get a NOTE_FORK event from the parent pid, but not a separate NOTE_TRACK event. - Explicitly note that the event added to monitor the child process preserves the fflags from the original event. - Move the description of NOTE_TRACKERR under NOTE_TRACK as it is not a bit for the user to set (which is what this list pupports to be). Also, explicitly note that if an error occurs, the NOTE_CHILD event will not be generated. MFC after: 1 week
* wordexp(): Fix syntax validation for backslashes in single-quotes.jilles2013-07-231-1/+2
|
* Document EINVAL error return from PT_LWPINFOemaste2013-07-221-1/+9
|
* Teach siglongjmp about the VFP version of the setjmp buffer.andrew2013-07-211-3/+5
| | | | | This fixes a bug where a call to sigsetjmp followed by siglongjmp may fail when run on a machine with VFP enabled.
* [fix to r253380] __setenv: be explicit about placing '=' after nameavg2013-07-171-2/+1
| | | | | | | | | | This should a regression introduced in r253380 if malloc'ed memory happens to have '=' at the right place. Reported by: ache Pointyhat to: me (avg) MFC after: 1 day X-MFC with: r253380
* libc: name passed into __setenv is not necessarily NUL-terminatedavg2013-07-161-1/+1
| | | | | | That's particularly true when __setenv is called from __merge_environ. MFC after: 4 days
* Fix mdoc syntax.hrs2013-07-131-7/+7
| | | | Pointed out by: joeld
* Typo corrected.schweikh2013-07-121-1/+1
|
* Prefix the alias macros for members of struct __mcontext with an underscoremarius2013-07-122-8/+8
| | | | in order to avoid a clash in the net80211 code.
* Add a leaf node CTL_NET.PF_ROUTE.0.AF.NET_RT_DUMP.0.FIB. This returnshrs2013-07-121-9/+9
| | | | routing table with the specified FIB number, not td->td_proc->p_fibnum.
* Fix the handling of SCTP_CURRENT_ASSOC and SCTP_ALL_ASSOC intuexen2013-07-091-0/+5
| | | | | | sctp_opt_info(). MFC after: 3 days
* Fix a bug where SCTP_ENABLE_STREAM_RESET is not handled bytuexen2013-07-091-0/+3
| | | | | | sctp_opt_info(). MFC after: 3 days
* Update references.hrs2013-07-092-12/+11
|
* mktemp(3): Add standards section. Prefer standard header.jilles2013-07-051-4/+29
| | | | | | mktemp(), mkstemp() and mkdtemp() are available in standard <stdlib.h> and also in <unistd.h>. Encourage use of the former by listing it in the synopsis.
* Style fix noted by bde@ache2013-07-041-4/+8
|
* After fixing ranges restore POSIX requirement: rand() call withoutache2013-07-041-1/+6
| | | | | srand() must be the same as srand(1); rand(); (yet one increment)
* In addition to prev. commit, for repeated rand_r(3) calls don't forgetache2013-07-031-1/+5
| | | | | | | to compensate back at the end incremented at the start internal state. MFC after: 2 weeks
* 1) POSIX requires rand(3) return values to be in the [0, RAND_MAX] range,ache2013-07-031-4/+16
| | | | | | | | | | | | | | | | but ACM formula we use have internal state (and return value) in the [1, 0x7ffffffe] range, so our RAND_MAX (0x7fffffff) is never reached because it is off by one, zero is not reached too. Correct both RAND_MAX and rand(3) return value, shifting last one to the 0 by 1 subtracted, resulting POSIXed [0, 0x7ffffffd(=new RAND_MAX)] range. 2) Add a checks for not overflowing on too big seeds. It may happens on the machines, where sizeof(unsigned int) > 32 bits. Reviewed by: bde [1] MFC after: 2 weeks
* Make it clear that there are three separate internal locks.peter2013-07-034-25/+28
|
* As a followup to r252547, propate const down the call stack.peter2013-07-034-9/+9
|
* Replace the #define for "iconv" so it is for the function name instead ofpeter2013-07-035-7/+9
| | | | | | a macro with parameters. Remove a __DECONST hack and add consts instead for gnu libiconv API compatability. This makes it work with things like devel/boost-libs that expects to use "iconv" as though it were a pointer.
* If strdup failed, don't try and free the wrong thing.peter2013-07-011-1/+1
|
* __weak_alias() doesn't exist on FreeBSD. Use __weak_reference();peter2013-07-013-11/+19
| | | | | | | | | | | | | Expose iconv functions as weak symbols as well as their internal remapped #define names. This is necessary for autoconf compatability - on Linux it appears that #include <iconv.h> isn't a link time prerequisite for their version that's built into glibc. Initialize the pthread rwlock. Note that upstream has three separate locks. The file-local static lock appears intentional. I'm using this as a ports-compatible compile-time substitute for converters/libiconv on one of my personal machines.
* libc: Access _sigintr more efficiently.jilles2013-06-302-2/+2
| | | | | The variable _sigintr is not exported via the version script; therefore, tell the compiler that no indirection (to allow interposition) is needed.
* 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
|
OpenPOWER on IntegriCloud