summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/Makefile.inc
Commit message (Collapse)AuthorAgeFilesLines
* Fix known issues which blow up the process after dlopen("libthr.so")kib2015-01-181-0/+1
| | | | | | | | | | | | | | | | | | | | | (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.
* MFC r261140:pluknet2014-06-271-1/+2
| | | | Add MLINK for fdclosedir.3 to directory.3 and sort fdopendir(3) entry.
* Merge r257633:pjd2013-11-061-0/+1
| | | | | | | | | | - Add manual pages for capability rights (rights(4)), cap_rights_init(3) family of functions and cap_rights_get(3) function. - Update remaining Capsicum-related manual pages. Sponsored by: The FreeBSD Foundation Reviewed by: bdrewery Approved by: re (glebius)
* Add man page dup3(3).jilles2013-08-161-0/+1
|
* Add dup3(), based on F_DUP2FD and F_DUP2FD_CLOEXEC fcntls.jilles2013-08-161-0/+1
| | | | | | | | I removed functionality not proposed for POSIX in Austin group issue #411. A man page (my own) and test cases will follow in later commits. PR: 176233 Submitted by: Jukka Ukkonen
* Update to the latest (un)vis(3) sources from NetBSD. This addsbrooks2013-03-141-2/+16
| | | | | | | | | | | | | multibyte support[0] and the new functions strenvisx and strsenvisx. Add MLINKS for vis(3) functions add by this and the initial import from NetBSD[1]. PR: bin/166364, bin/175418 Submitted by: "J.R. Oldroyd" <fbsd@opal.com>[0] stefanf[1] Obtained from: NetBSD MFC after: 2 weeks
* Link getcontextx(3) to getcontext(3).pluknet2013-03-131-0/+1
| | | | | Reviewed by: kib MFC after: 1 week
* Provide cap_sandboxed(3) function, which is a wrapper around cap_getmode(2)pjd2013-03-021-0/+2
| | | | | | | | | | | system call, which has a nice property - it never fails, so it is a bit easier to use. If there is no support for capability mode in the kernel the function will return false (not in a sandbox). If the kernel is compiled with the support for capability mode, the function will return true or false depending if the calling process is in the capability mode sandbox or not respectively. Sponsored by: The FreeBSD Foundation
* Put one file per line so it is easier to read diffs against those files.pjd2013-02-161-125/+418
|
* Add contrib/libc-vis to the include path so we reliably pick up the rightbrooks2013-01-111-0/+1
| | | | | | version of vis.h. Reported by: dim
* Replace our implementation of the vis(3) and unvis(3) APIs withbrooks2012-12-181-2/+5
| | | | | | | | | NetBSD's. This output size limited versions of vis and unvis functions as well as a set of vis variants that allow arbitrary characters to be specified for encoding. Finally, MIME Quoted-Printable encoding as described in RFC 2045 is supported.
* Implement the waitid() SUSv4 function using wait6() system call.kib2012-11-131-1/+1
| | | | | | PR: standards/170346 Submitted by: "Jukka A. Ukkonen" <jau@iki.fi> MFC after: 1 month
* Replace our version of the pwcache(3) API with NetBSD's implementation.brooks2012-10-191-1/+4
| | | | | | | | | This adds two features: * uid_from_user() and gid_from_group() as the reverse of user_from_uid() and groups_from_gid(). * pwcache_userdb() and pwcache_groupdb() which allow alternative lookup functions to be used. For example lookups from passwd and group databases in a non-standard location.
* Add manual pages for clock_getcpuclockid and pthread_getcpuclockid.davidxu2012-08-211-1/+1
|
* Implement syscall clock_getcpuclockid2, so we can get a clock iddavidxu2012-08-171-1/+1
| | | | | | | | for process, thread or others we want to support. Use the syscall to implement POSIX API clock_getcpuclock and pthread_getcpuclockid. PR: 168417
* Rename aux.c to auxv.c.ed2012-08-111-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>
* Hide DIR definition by making it an opaque struct typedef.gleb2012-05-191-1/+1
| | | | | | | | | | Introduce dirfd() libc exported symbol replacing macro with same name, preserve _dirfd() macro for internal use. Replace dirp->dd_fd with dirfd() call. Avoid using dirfd as variable name to prevent shadowing global symbol. Sponsored by: Google Summer Of Code 2011
* Belatedly add dl_iterate_phdr(3) to the list of installed manpages.kib2012-03-021-1/+1
| | | | MFC after: 3 days
* Implement fdlopen(3), an rtld interface to load shared object by filekib2012-01-071-2/+2
| | | | | | | | descriptor. Requested and tested by: des (previous version) Reviewed by: des, kan (previous version) MFC after: 2 weeks
* Fix a problem whereby a corrupt DNS record can cause named to crash. [11:06]cperciva2011-12-231-0/+1
| | | | | | | | | | | | | | | | | | | | 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
* Replace a proliferation of buggy MD implementations of modf() with adas2011-10-211-0/+2
| | | | | | | working MI one. The MI one only needs to be overridden on machines with non-IEEE754 arithmetic. (The last supported one was the VAX.) It can also be overridden if someone comes up with a faster one that actually passes the regression tests -- but this is harder than it sounds.
* Add a new libc function: cfmakesane(3).ed2010-11-021-3/+3
| | | | | | | | | | | I've noticed various terminal emulators that need to obtain a sane default termios structure use very complex `hacks'. Even though POSIX doesn't provide any functionality for this, extend our termios API with cfmakesane(3), which is similar to the commonly supported cfmakeraw(3), except that it fills the termios structure with sane defaults. Change all code in our base system to use this function, instead of depending on <sys/ttydefaults.h> to provide TTYDEF_*.
* To support stack unwinding for cancellation points, add -fexceptions flagdavidxu2010-09-251-1/+9
| | | | | | | 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.
* Powerpc is special here. powerpc and powerpc64 use different ABIs, soimp2010-08-241-4/+2
| | | | | | their implementations aren't in the same files. Introduce LIBC_ARCH and use that in preference to MACHINE_CPUARCH. Tested by amd64 and powerpc64 builds (thanks nathanw@)
* MFtbemd:imp2010-08-231-3/+3
| | | | | Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want to test of all the CPUs of a given family conform.
* On shared object unload, in __cxa_finalize, call and clear all installedkib2010-08-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | 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
* Also link getutxent.3 to utmpx.3.ed2010-07-211-1/+1
| | | | If you run `man utmpx', you expect to get some info on it.
* Add two changes that should have gone into commit r202274.ed2010-01-141-1/+1
| | | | | | | | | | Phase out ttyslot(3). The ttyslot() function was originally part for SUSv1, marked LEGACY in SUSv2 and removed later on. This function only makes sense when using utmp(5), because it was used to determine the offset of the record for the controlling TTY. It makes little sense to keep it here, because the new utmpx file format doesn't index based on TTY slots.
* Implement <utmpx.h>.ed2010-01-131-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The utmpx interface is the standardized interface of the user accounting database. The standard only defines a subset of the functions that were present in System V-like systems. I'd like to highlight some of the traits my implementation has: - The standard allows the on-disk format to be different than the in-memory representation (struct utmpx). Most operating systems don't do this, but we do. This allows us to keep our ABI more stable, while giving us the opportunity to modify the on-disk format. It also allows us to use a common file format across different architectures (i.e. byte ordering). - Our implementation of pututxline() also updates wtmp and lastlog (now called utx.log and utx.lastlogin). This means the databases are more likely to be in sync. - Care must be taken that our implementation discard any fields that are not applicable. For example, our DEAD_PROCESS records do not hold a TTY name. Just a time stamp, a record identifier and a process identifier. It also guarantees that strings (ut_host, ut_line and ut_user) are null terminated. ut_id is obviously not null terminated, because it's not a string. - The API and its behaviour should be conformant to POSIX, but there may be things that slightly deviate from the standard. This implementation uses separate file descriptors when writing to the log files. It also doesn't use getutxid() to search for a field to overwrite. It uses an allocation strategy similar to getutxid(), but prevents DEAD_PROCESS records from accumulating. Make sure libulog doesn't overwrite the manpages shipped with our C library. Also keep the symbol list in Symbol.map sorted. I'll bump __FreeBSD_version later this evening. I first want to convert everything to <utmpx.h> and get rid of <utmp.h>.
* Use umtx to implement process sharable semaphore, to make this work,davidxu2010-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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@
* Add an internal _once() method. This works identical to pthread_once(3)jhb2009-11-201-1/+2
| | | | | | | | | | | | | 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
* Move pselect(3) man page to section 2.kib2009-10-281-1/+1
| | | | | Noted by: jhb MFC after: 1 month
* Commit libc files missed in r198508kib2009-10-271-1/+1
|
* Add basename_r(3) to complement basename(3). basename_r(3) which acceptsrwatson2009-10-061-0/+1
| | | | | | | | a caller-allocated buffer of at least MAXPATHLEN, rather than using a global buffer. MFC after: 1 month Sponsored by: Google
* Add getpagesizes(3). This functions either the number of supported pagealc2009-09-191-3/+3
| | | | | | | sizes or some number of the sizes themselves. It is functionally compatible with a function by the same name under Solaris. Reviewed by: jhb
* Move msg{snd,recv,get,ctl} manual pages from section 3 to 2.trasz2009-07-131-1/+1
| | | | Approved by: re (kib)
* Add tcsetsid(3).ed2009-05-071-2/+2
| | | | | | | | | | | The entire world seems to use the non-standard TIOCSCTTY ioctl to make a TTY a controlling terminal of a session. Even though tcsetsid(3) is also non-standard, I think it's a lot better to use in our own source code, mainly because it's similar to tcsetpgrp(), tcgetpgrp() and tcgetsid(). I stole the idea from QNX. They do it the other way around; their TIOCSCTTY is just a wrapper around tcsetsid(). tcsetsid() then calls into an IPC framework.
* Allow the NULL, RTLD_SELF and RTLD_NEXT handles to work with dlfunc(3).kib2009-04-031-1/+1
| | | | | | | | | | | | | | | | dlfunc() called dlsym() to do the work, and dlsym() determines the dso that originating the call by the return address. Due to this, dlfunc() operated as if the caller is always the libc. To fix this, move the dlfunc() to rtld, where it can call the internal implementation of dlsym, and still correctly fetch return address. Provide usual weak stub for the symbol from libc for static binaries. dlfunc is put to FBSD_1.0 symver namespace in the ld.so export to override dlfunc@FBSD_1.0 weak symbol, exported by libc. Reported, analyzed and tested by: Tijl Coosemans <tijl ulyssis org> PR: standards/133339 Reviewed by: kan
* Add two new routines: fdevname() and fdevname_r().ed2009-02-111-1/+3
| | | | | | | | | | | | | | 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
* Add manual pages for posix_spawn() functions.davidxu2008-07-281-1/+18
| | | | PR: standards/122051
* Add arc4random_uniform() function (to avoid "modulo bias")ache2008-07-221-1/+1
| | | | Obtained from: OpenBSD
* Add arc4random_buf.3 to MLINKSache2008-07-211-1/+2
|
* Turn execvpe() into an internal libc routine.ed2008-06-231-1/+1
| | | | | | | | | | | | 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 POSIX routines called posix_spawn() and posix_spawnp(), whichdavidxu2008-06-171-2/+2
| | | | | | | | | can be used as replacements for exec/fork in a lot of cases. This change also added execvpe() which allows environment variable PATH to be used for searching executable file, it is used for implementing posix_spawnp(). PR: standards/122051
* Implement fdopendir(3) by splitting __opendir2() into two parts, the upper partdelphij2008-04-161-0/+1
| | | | | | deals with the usual __opendir2() calls, and the rest part with an interface translator to expose fdopendir(3) functionality. Manual page was obtained from kib@'s work for *at(2) system calls.
* Implement POSIX function tcgetsid() which returns session id.davidxu2008-04-151-1/+1
| | | | PR: stand/107561
* Document modff() and modfl(). Technically, modff() and modfl()das2008-03-291-0/+1
| | | | | | live in libm, while modf() lives in libc due to historical mistakes. I'm claiming in the manpage that they all live in libm, since programmers should not rely on the mistake.
* Add manual for function sem_timedwait().davidxu2008-03-121-1/+1
| | | | Reviewed by: ru, deischen
* Our fts(3) API, as inherited from 4.4BSD, suffers from integeryar2008-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fields in FTS and FTSENT structs being too narrow. In addition, the narrow types creep from there into fts.c. As a result, fts(3) consumers, e.g., find(1) or rm(1), can't handle file trees an ordinary user can create, which can have security implications. To fix the historic implementation of fts(3), OpenBSD and NetBSD have already changed <fts.h> in somewhat incompatible ways, so we are free to do so, too. This change is a superset of changes from the other BSDs with a few more improvements. It doesn't touch fts(3) functionality; it just extends integer types used by it to match modern reality and the C standard. Here are its points: o For C object sizes, use size_t unless it's 100% certain that the object will be really small. (Note that fts(3) can construct pathnames _much_ longer than PATH_MAX for its consumers.) o Avoid the short types because on modern platforms using them results in larger and slower code. Change shorts to ints as follows: - For variables than count simple, limited things like states, use plain vanilla `int' as it's the type of choice in C. - For a limited number of bit flags use `unsigned' because signed bit-wise operations are implementation-defined, i.e., unportable, in C. o For things that should be at least 64 bits wide, use long long and not int64_t, as the latter is an optional type. See FTSENT.fts_number aka FTS.fts_bignum. Extending fts_number `to satisfy future needs' is pointless because there is fts_pointer, which can be used to link to arbitrary data from an FTSENT. However, there already are fts(3) consumers that require fts_number, or fts_bignum, have at least 64 bits in it, so we must allow for them. o For the tree depth, use `long'. This is a trade-off between making this field too wide and allowing for 64-bit inode numbers and/or chain-mounted filesystems. On the one hand, `long' is almost enough for 32-bit filesystems on a 32-bit platform (our ino_t is uint32_t now). On the other hand, platforms with a 64-bit (or wider) `long' will be ready for 64-bit inode numbers, as well as for several 32-bit filesystems mounted one under another. Note that fts_level has to be signed because -1 is a magic value for it, FTS_ROOTPARENTLEVEL. o For the `nlinks' local var in fts_build(), use `long'. The logic in fts_build() requires that `nlinks' be signed, but our nlink_t currently is uint16_t. Therefore let's make the signed var wide enough to be able to represent 2^16-1 in pure C99, and even 2^32-1 on a 64-bit platform. Perhaps the logic should be changed just to use nlink_t, but it can be done later w/o breaking fts(3) ABI any more because `nlinks' is just a local var. This commit also inludes supporting stuff for the fts change: o Preserve the old versions of fts(3) functions through libc symbol versioning because the old versions appeared in all our former releases. o Bump __FreeBSD_version just in case. There is a small chance that some ill-written 3-rd party apps may fail to build or work correctly if compiled after this change. o Update the fts(3) manpage accordingly. In particular, remove references to fts_bignum, which was a FreeBSD-specific hack to work around the too narrow types of FTSENT members. Now fts_number is at least 64 bits wide (long long) and fts_bignum is an undocumented alias for fts_number kept around for compatibility reasons. According to Google Code Search, the only big consumers of fts_bignum are in our own source tree, so they can be fixed easily to use fts_number. o Mention the change in src/UPDATING. PR: bin/104458 Approved by: re (quite a while ago) Discussed with: deischen (the symbol versioning part) Reviewed by: -arch (mostly silence); das (generally OK, but we didn't agree on some types used; assuming that no objections on -arch let me to stick to my opinion)
OpenPOWER on IntegriCloud