summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/Makefile.inc
Commit message (Collapse)AuthorAgeFilesLines
* 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)
* Add a feature_present(3) function which checks to see if a named kerneljhb2008-01-101-2/+3
| | | | | | feature is present by checking the kern.features sysctl MIB. MFC after: 1 week
* Add a new file descriptor type for IPC shared memory objects and use it tojhb2008-01-081-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | implement shm_open(2) and shm_unlink(2) in the kernel: - Each shared memory file descriptor is associated with a swap-backed vm object which provides the backing store. Each descriptor starts off with a size of zero, but the size can be altered via ftruncate(2). The shared memory file descriptors also support fstat(2). read(2), write(2), ioctl(2), select(2), poll(2), and kevent(2) are not supported on shared memory file descriptors. - shm_open(2) and shm_unlink(2) are now implemented as system calls that manage shared memory file descriptors. The virtual namespace that maps pathnames to shared memory file descriptors is implemented as a hash table where the hash key is generated via the 32-bit Fowler/Noll/Vo hash of the pathname. - As an extension, the constant 'SHM_ANON' may be specified in place of the path argument to shm_open(2). In this case, an unnamed shared memory file descriptor will be created similar to the IPC_PRIVATE key for shmget(2). Note that the shared memory object can still be shared among processes by sharing the file descriptor via fork(2) or sendmsg(2), but it is unnamed. This effectively serves to implement the getmemfd() idea bandied about the lists several times over the years. - The backing store for shared memory file descriptors are garbage collected when they are not referenced by any open file descriptors or the shm_open(2) virtual namespace. Submitted by: dillon, peter (previous versions) Submitted by: rwatson (I based this on his version) Reviewed by: alc (suggested converting getmemfd() to shm_open())
* Add fts_set_clientptr(3), fts_get_clientptr(3) and fts_get_stream(3) manscf2007-09-281-1/+2
| | | | | | | | page links to fts(3). Approved by: wes Approved by: re (hrs) MFC after: 5 days
* Change the C wrappers for mmap/lseek/pread/pwrite/truncate/ftruncate topeter2007-07-041-1/+2
| | | | | | | | | 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)
* Retire more remnants of a.out support, as threatened in 2002.peter2007-01-251-2/+2
| | | | Laughed-at-by: kris
* Add each directory's symbol map file to SYM_MAPS.deischen2006-03-131-0/+2
|
* Add MLINK for execvP(3).jhb2005-12-011-1/+1
| | | | | | PR: docs/89783 Submitted by: Andreas Kohn andreas at syndrom23 dot de MFC after: 3 days
* Add an MLINK for devname_r().stefanf2005-09-101-0/+1
|
* Add missing links from getgrent_r.3, getgrnam_r.3, and getgrgid_r.3 tosimon2005-08-121-1/+2
| | | | | | | getgrent.3. Submitted by: Ulf Lilleengen <lulf@kerneled.org> MFC after: 3 days
* Connect MLINKS for ttyname_r(3), and add prototype into unistd.h.delphij2005-05-111-1/+1
|
* Add manpage links for frexpf, frexpl, ldexpf, and ldexpl.das2005-03-071-0/+2
|
* - Move the functions presently described in in ieee(3) to their owndas2005-01-271-1/+2
| | | | | | | | manpages. They are not very related, so separating them makes it easier to add meaningful cross-references and extend some of the descriptions. - Move the part of math(3) that discusses IEEE 754 to the ieee(3) manpage.
* Remove ntp_gettime.c which was a wrapper around sysctlbyname(3).marks2004-11-181-1/+1
| | | | | | | This is now a native system call. Reviewed by: imp, phk, njl, peter Approved by: njl
* Replace the current implementations of ftw() and nftw() with the OpenBSDtjr2004-08-241-1/+1
| | | | | implementations written by Todd C. Miller. These are cleaner, less buggy and actively maintained.
* Add stubs for TLS functions. These will be replaced at runtime by thedfr2004-08-031-3/+4
| | | | functional versions in rtld.
* Add an nftw(3) link.tjr2004-07-251-0/+1
|
* Fix two bugs in the signbit() macro, which was implemented last year:das2004-07-191-3/+2
| | | | | | | | - It was added to libc instead of libm. Hopefully no programs rely on this mistake. - It didn't work properly on large long doubles because its argument was converted to type double, resulting in undefined behavior.
* Replace seven nominally MD implementations of frexp() that are brokendas2004-07-181-1/+1
| | | | for subnormals with one implementation that works.
* Implement the classification macros isfinite(), isinf(), isnan(), anddas2004-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | isnormal() the hard way, rather than relying on fpclassify(). This is a lose in the sense that we need a total of 12 functions, but it is necessary for binary compatibility because we have never bumped libm's major version number. In particular, isinf(), isnan(), and isnanf() were BSD libc functions before they were C99 macros, so we can't reimplement them in terms of fpclassify() without adding a dependency on libc.so.5. I have tried to arrange things so that programs that could be compiled in FreeBSD 4.X will generate the same external references when compiled in 5.X. At the same time, the new macros should remain C99-compliant. The isinf() and isnan() functions remain in libc for historical reasons; however, I have moved the functions that implement the macros isfinite() and isnormal() to libm where they belong. Moreover, half a dozen MD versions of isinf() and isnan() have been replaced with MI versions that work equally well. Prodded by: kris
* Add implementations of ftw(3) and nftw(3) and the corresponding headerdas2004-07-051-2/+3
| | | | | | | | ftw.h. This is the implementation written by Joel Baker <fenton@debian.org> for inclusion in NetBSD, but with several bugfixes. Obtained from: Debian
* Belatedly remove the getvfsent(3) API. All the consumers have beenmux2004-04-111-5/+2
| | | | | updated to use getvfsbyname(3) or the vfs.conflist sysctl since a long time, except mount_smbfs(8) which has just been fixed.
* Fixed style of previous commit.ru2004-01-151-3/+2
| | | | Submitted by: bde
* - libc/sys/sem.c was repocopied to libc/gen/sem.c.ru2004-01-141-2/+7
| | | | | | | - sem_*(3) manpages were repocopied from libc_r. Reviewed by: deischen Repocopy by: markm
* Add the POSIX 1003.1-2001 posix_madvise() interface.bms2003-08-091-1/+2
| | | | | | PR: standards/54634 Reviewed by: das Approved by: jake (mentor)
* = Implement name service switch modules (NSS modules). NSS modulesnectar2003-04-171-1/+3
| | | | | | | | | | | | | | | | | | | | | may be built into libc (`static NSS modules') or dynamically loaded via dlopen (`dynamic NSS modules'). Modules are loaded/initialized at configuration time (i.e. when nsdispatch is called and nsswitch.conf is read or re-read). = Make the nsdispatch(3) core thread-safe. = New status code for nsdispatch(3) `NS_RETURN', currently used to signal ERANGE-type issues. = syslog(3) problems, don't warn/err/abort. = Try harder to avoid namespace pollution. = Implement some shims to assist in porting NSS modules written for the GNU C Library nsswitch interface. Sponsored by: DARPA, Network Associates Laboratories
* - Add setfstab() and getfstab().mdodd2003-04-071-1/+2
| | | | | - Use the environment variable 'PATH_FSTAB' if set rather than the hardcoded '/etc/fstab' (fstab.h:_PATH_FSTAB)
* Add dlinfo(3) manual page to the rank of base system manpagesphantom2003-02-151-2/+2
|
* o Implement C99 classification macros isfinite(), isinf(), isnan(),mike2003-02-121-2/+6
| | | | | | | | | isnormal(). The current isinf() and isnan() are perserved for binary compatibility with 5.0, but new programs will use the macros. o Implement C99 comparison macros isgreater(), isgreaterequal(), isless(), islessequal(), islessgreater(), isunordered(). Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>
OpenPOWER on IntegriCloud