summaryrefslogtreecommitdiffstats
path: root/lib/libc/include/libc_private.h
Commit message (Collapse)AuthorAgeFilesLines
* MFC r311651:kib2017-01-211-0/+2
| | | | Export __cxa_thread_atexit_impl as an alias for __cxa_thread_atexit.
* MFC r304928:kib2016-09-031-0/+1
| | | | | | | | | | | | | Do not obliterate errno value in the main thread during ptrace(2) call on x86. MFC r304931: Follow ABI when calling __error from the ptrace(2) wrapper. MFC r305012: Rewrite ptrace(2) wrappers in C. MFC r305022: Restore the requirement of setting errno to zero before calling ptrace(2).
* MFC r303795:kib2016-08-201-0/+6
| | | | Add __cxa_thread_atexit(3) API implementation.
* MFC r295416:bdrewery2016-03-121-1/+1
| | | | Fix the gcc build after r295407.
* MFC r295407:kib2016-03-121-0/+2
| | | | Make libc __pthread_map_stacks_exec() interposed.
* MFC r277610 (by jillies):dchagin2016-01-091-0/+4
| | | | Add futimens and utimensat system calls.
* MFC r287292:kib2015-09-051-0/+5
| | | | | | | | | | Switch libc from using _sig{procmask,action,suspend} symbols, which are aliases for the syscall stubs and are plt-interposed, to the libc-private aliases of internally interposed sigprocmask() etc. MFC r287300: Use libthr interposed functions instead of syscalls, in posix_spawn()' child.
* MFC r281712:kib2015-04-251-0/+8
| | | | Make wait6(2), waitid(3) and ppoll(2) cancellation points.
* MFC r280818:kib2015-04-121-0/+4
| | | | Make kevent(2) a cancellation point.
* MFC r278889:kib2015-02-201-1/+1
| | | | Restore the extern qualifier on __cleanup.
* MFC r278751:kib2015-02-171-0/+5
| | | | Properly interpose libc spinlocks, was missed in r276630.
* Fix known issues which blow up the process after dlopen("libthr.so")kib2015-01-181-20/+125
| | | | | | | | | | | | | | | | | | | | | (or loading a dso linked to libthr.so into process which was not linked against threading library). MFC r276630: Remove interposing, fix malloc, reinstall signal handlers wrappers on libthr load. MFC r276681: Avoid calling internal libc function through PLT or accessing data though GOT. MFC r277032: Reduce the size of the interposing table and amount of cancellation-handling code in the libthr. MFC note: r276646 ("do not erronously export 'openat' symbol from rtld") is not applicable to stable/10 yet, since PATHFDS support was not merged.
* libc: Access some unexported variables more efficiently (related to stdio).jilles2013-08-231-2/+2
|
* Use struct vdso_timehands data to implement fast gettimeofday(2) andkib2012-06-221-0/+7
| | | | | | | | | | | | | | | clock_gettime(2) functions if supported. The speedup seen in microbenchmarks is in range 4x-7x depending on the hardware. Only amd64 and i386 architectures are supported. Libc uses rdtsc and kernel data to calculate current time, if enabled by kernel. Hopefully, this code is going to migrate into vdso in some future. Discussed with: bde Reviewed by: jhb Tested by: flo MFC after: 1 month
* Take the spinlock around clearing of the fp->_flags in fclose(3), whichkib2012-04-241-0/+13
| | | | | | | | | indicates the avaliability of FILE, to prevent possible reordering of the writes as seen by other CPUs. Reported by: Fengwei yin <yfw.bsd gmail com> Reviewed by: jhb MFC after: 1 week
* Fetch the aux vector for the static libc, and use the entries tokib2012-02-171-0/+10
| | | | | | | | | | | | | | initialize the cache of the system information as it was done for the dynamic libc. This removes several sysctls from the static binary startup. Use the aux vector to fill the single struct dl_phdr_info describing the static binary itself, to implement dl_iterate_phdr(3) for the static binaries. [1] Based on the submission by: John Marino <draco marino st> [1] Tested by: flo (sparc64) MFC after: 2 weeks
* Fix a problem whereby a corrupt DNS record can cause named to crash. [11:06]cperciva2011-12-231-0/+11
| | | | | | | | | | | | | | | | | | | | Add an API for alerting internal libc routines to the presence of "unsafe" paths post-chroot, and use it in ftpd. [11:07] Fix a buffer overflow in telnetd. [11:08] Make pam_ssh ignore unpassphrased keys unless the "nullok" option is specified. [11:09] Add sanity checking of service names in pam_start. [11:10] Approved by: so (cperciva) Approved by: re (bz) Security: FreeBSD-SA-11:06.bind Security: FreeBSD-SA-11:07.chroot Security: FreeBSD-SA-11:08.telnetd Security: FreeBSD-SA-11:09.pam_ssh Security: FreeBSD-SA-11:10.pam
* To support stack unwinding for cancellation points, add -fexceptions flagdavidxu2010-09-251-0/+5
| | | | | | | for them, two functions _pthread_cancel_enter and _pthread_cancel_leave are added to let thread enter and leave a cancellation point, it also makes it possible that other functions can be cancellation points in libraries without having to be rewritten in libthr.
* On shared object unload, in __cxa_finalize, call and clear all installedkib2010-08-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | atexit and __cxa_atexit handlers that are either installed by unloaded dso, or points to the functions provided by the dso. Use _rtld_addr_phdr to locate segment information from the address of private variable belonging to the dso, supplied by crtstuff.c. Provide utility function __elf_phdr_match_addr to do the match of address against dso executable segment. Call back into libthr from __cxa_finalize using weak __pthread_cxa_finalize symbol to remove any atfork handler which function points into unloaded object. The rtld needs private __pthread_cxa_finalize symbol to not require resolution of the weak undefined symbol at initialization time. This cannot work, since rtld is relocated before sym_zero is set up. Idea by: kan Reviewed by: kan (previous version) MFC after: 3 weeks
* Use aux vector to get values for SSP canary, pagesize, pagesizes array,kib2010-08-171-0/+2
| | | | | | | | | | | number of host CPUs and osreldate. This eliminates the last sysctl(2) calls from the dynamically linked image startup. No objections from: kan Tested by: marius (sparc64) MFC after: 1 month
* Use umtx to implement process sharable semaphore, to make this work,davidxu2010-01-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | now type sema_t is a structure which can be put in a shared memory area, and multiple processes can operate it concurrently. User can either use mmap(MAP_SHARED) + sem_init(pshared=1) or use sem_open() to initialize a shared semaphore. Named semaphore uses file system and is located in /tmp directory, and its file name is prefixed with 'SEMD', so now it is chroot or jail friendly. In simplist cases, both for named and un-named semaphore, userland code does not have to enter kernel to reduce/increase semaphore's count. The semaphore is designed to be crash-safe, it means even if an application is crashed in the middle of operating semaphore, the semaphore state is still safely recovered by later use, there is no waiter counter maintained by userland code. The main semaphore code is in libc and libthr only has some necessary stubs, this makes it possible that a non-threaded application can use semaphore without linking to thread library. Old semaphore implementation is kept libc to maintain binary compatibility. The kernel ksem API is no longer used in the new implemenation. Discussed on: threads@
* Revert the previous change to pthread_once() stub in libc. It is actuallyjhb2009-11-201-1/+0
| | | | | | | | a feature that libstdc++ depends on to simulate the behavior of libc's internal '__isthreaded' variable. One benefit of this is that _libc_once() is now private to _once_stub.c. Requested by: kan
* Add an internal _once() method. This works identical to pthread_once(3)jhb2009-11-201-0/+8
| | | | | | | | | | | | | with the additional property that it is safe for routines in libc to use in both single-threaded and multi-threaded processes. Multi-threaded processes use the pthread_once() implementation from the threading library while single-threaded processes use a simplified "stub" version internal to libc. The libc stub-version of pthread_once() now also uses the simplified "stub" version as well instead of being a nop. Reviewed by: deischen, Matthew Fleming @ Isilon Suggested by: alc MFC after: 1 week
* Add thread-specific caching for small size classes, based on magazines.jasone2008-08-271-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | This caching allows for completely lock-free allocation/deallocation in the steady state, at the expense of likely increased memory use and fragmentation. Reduce the default number of arenas to 2*ncpus, since thread-specific caching typically reduces arena contention. Modify size class spacing to include ranges of 2^n-spaced, quantum-spaced, cacheline-spaced, and subpage-spaced size classes. The advantages are: fewer size classes, reduced false cacheline sharing, and reduced internal fragmentation for allocations that are slightly over 512, 1024, etc. Increase RUN_MAX_SMALL, in order to limit fragmentation for the subpage-spaced size classes. Add a size-->bin lookup table for small sizes to simplify translating sizes to size classes. Include a hard-coded constant table that is used unless custom size class spacing is specified at run time. Add the ability to disable tiny size classes at compile time via MALLOC_TINY.
* Turn execvpe() into an internal libc routine.ed2008-06-231-0/+3
| | | | | | | | | | | | Adding exevpe() has caused some ports to break. Even though execvpe() is a useful routine, it does not conform to any standards. This patch is a little bit different from the patch sent to the mailing list. I forgot to remove execvpe from the Symbol.map (which does not seem to miscompile libc, though). Reviewed by: davidxu Approved by: philip
* Add some compatibility code so that software which is built to use the newdfr2008-04-041-0/+3
| | | | | | | struct flock with l_sysid member can work properly on an an old kernel which doesn't support l_sysid. Sponsored by: Isilon Systems
* Change the C wrappers for mmap/lseek/pread/pwrite/truncate/ftruncate topeter2007-07-041-0/+23
| | | | | | | | | call the pad-less versions of the corresponding syscalls if the running kernel supports it. Check kern.osreldate once per program and cache the result to select the appropriate syscall. This maintains userland compatability with kernel.old's from quite a while back. Approved by: re (kensmith)
* Remove 3rd clause, renumber, ok per emailimp2007-01-121-4/+1
|
* Add some more pthread stubs so that librt can use them.deischen2006-03-051-3/+34
| | | | | | | The thread jump table has been resorted, so you need to keep libc, libpthread, and libthr in sync. Submitted by: xu
* In preparation for a new malloc implementation:jasone2006-01-121-3/+4
| | | | | | | | | | | | | * Add posix_memalign(). * Move calloc() from calloc.c to malloc.c. Add a calloc() implementation in rtld-elf in order to make the loader happy (even though calloc() isn't used in rtld-elf). * Add _malloc_prefork() and _malloc_postfork(), and use them instead of directly manipulating __malloc_lock. Approved by: phk, markm (mentor)
* Move the declaration of __cleanup to libc_private.h as it is used in bothstefanf2005-09-121-0/+5
| | | | stdio/ and stdlib/. Don't define __cleanup twice.
* Add support for TLS in statically linked programs.dfr2004-08-151-0/+9
|
* Remove #include of spinlock.h from libc_private.h. Declare spinlocks asdeischen2003-11-051-3/+1
| | | | | | | struct _spinlock. Keep the typedef in for now; another set of changes may come around to clean up consumers of spinlocks. Requested by: bde
* Externalize malloc's spinlock so that a thread library can takedeischen2003-11-041-0/+8
| | | | | | | | | | | it around an application's fork() call. Our new thread libraries (libthr, libpthread) can now have threads running while another thread calls fork(). In this case, it is possible for malloc to be left in an inconsistent state in the child. Our thread libraries, libpthread in particular, need to use malloc internally after a fork (in the child). Reviewed by: davidxu
* Eliminate 19 warnings in libc (at level WARNS=2) of thenectar2003-02-271-0/+8
| | | | `implicit declaration of function' variety.
* Argh, change declaration of two-dimensional array so that it actuallydeischen2002-11-131-1/+2
| | | | builds.
* Make this compile with whatever error-checking is enabled in buildworlddeischen2002-11-131-2/+2
| | | | and/or beast.
* Use a jump table (a la Solaris) for pthread routines with defaultdeischen2002-11-131-0/+42
| | | | | | | | | | entries in the table being stubs. While I'm here, add macros to auto-generate the stubs. A conforming threads library can override the stub routines by filling in the jump table. Add some entries to namespace.h and sync un-namespace.h to it. Also add a comment to remind folks to update un-namespace.h when changing namespace.h.
* Do not use __progname directly (except in [gs]etprogname(3)).markm2002-03-291-0/+6
| | | | | | Also, 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.
* Remove _THREAD_SAFE and make libc thread-safe by default bydeischen2001-01-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in. Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo. Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible. Remove uneeded includes of <errno.h> from a few files. Add $FreeBSD$ to a few files in order to pass commitprep. Approved by: -arch
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Remove leading underscores from the FILE lock functions that POSIXjb1998-05-051-3/+3
| | | | specifies.
* Add a private header file for libc/libc_r/libpthread to containjb1998-04-111-0/+66
definitions for things like locking etc.
OpenPOWER on IntegriCloud