summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen
Commit message (Collapse)AuthorAgeFilesLines
* As the comment says, close() frees the variable, record. So we obtaindelphij2009-05-141-1/+1
| | | | | | | | the length by evaluating the value from the copy, cbuf instead. This fixes a crash caused by previous commit (use-after-free) Submitted by: Dimitry Andric <dimitry andric com> Pointy hat to: delphij
* TTYs don't necessarily use /dev/ttyxx.ed2009-05-091-3/+2
| | | | Submitted by: csjp
* Add tcsetsid(3).ed2009-05-075-3/+109
| | | | | | | | | | | 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.
* Fix whitespace and sorting in Symbol.map.ed2009-05-041-25/+25
|
* Allow the NULL, RTLD_SELF and RTLD_NEXT handles to work with dlfunc(3).kib2009-04-033-31/+9
| | | | | | | | | | | | | | | | 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
* Properly handle malloc() failures.delphij2009-04-021-5/+7
| | | | PR: bin/83338
* Properly update the shm_open/shm_unlink symbol versioning metadata afterjhb2009-04-021-2/+0
| | | | | | | these functions were moved into the kernel: - Move the version entries from gen/ to sys/. Since the ABI of the actual routines did not change, I'm still exporting them as FBSD 1.0 on purpose. - Add FBSD-private versions for the _ and __sys_ variants.
* Document RTLD_NODELETE, -z nodelete and -z origin support.kib2009-04-011-2/+9
|
* Fix a file descriptor leak in fts_child().das2009-03-041-1/+3
| | | | Obtained from: NetBSD
* Sync license changes.delphij2009-03-042-20/+3
| | | | Obtained from: NetBSD
* Properly invalidate highest pts number when calling setttyent().ed2009-02-121-5/+4
| | | | | | | | | When calling setttyent() after calling endttyent(), pts_valid will never be set to 1, because the readdir()-loop will likely never vind a pts that has a higher number than before. Simplify the code by removing pts_valid. We'll just set maxpts to -1 when we don't have a valid count yet.
* Make ttyslot(3) work with pts(4) devices.ed2009-02-121-6/+5
| | | | | | | It seems ttyslot() calls rindex(), to strip the device name to the last slash, but this is obviously invalid. /dev/pts/0 should be stripped until pts/0. Because /etc/ttys only supports TTY names in /dev/, just strip this piece of the pathname.
* Add two new routines: fdevname() and fdevname_r().ed2009-02-115-15/+85
| | | | | | | | | | | | | | 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
* Update the description of KERN_PROC.trhodes2009-01-281-5/+3
| | | | | PR: 100242 Reviewed by: jhb
* The times(3) function returns the number of CLK_TCKs since thekeramida2008-12-011-4/+9
| | | | | | | | startup time of FreeBSD, not since the UNIX Epoch. PR: docs/122359 Submitted by: Viktor &#352;tujber MFC after: 1 week
* Add two rtld exported symbols, _rtld_atfork_pre and _rtld_atfork_post.kib2008-11-272-0/+14
| | | | | | | | | | | | | | Threading library calls _pre before the fork, allowing the rtld to lock itself to ensure that other threads of the process are out of dynamic linker. _post releases the locks. This allows the rtld to have consistent state in the child. Although child may legitimately call only async-safe functions, the call may need plt relocation resolution, and this requires working rtld. Reported and debugging help by: rink Reviewed by: kan, davidxu MFC after: 1 month (anyway, not before 7.1 is out)
* Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes.pjd2008-11-171-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bring huge amount of changes, I'll enumerate only user-visible changes: - Delegated Administration Allows regular users to perform ZFS operations, like file system creation, snapshot creation, etc. - L2ARC Level 2 cache for ZFS - allows to use additional disks for cache. Huge performance improvements mostly for random read of mostly static content. - slog Allow to use additional disks for ZFS Intent Log to speed up operations like fsync(2). - vfs.zfs.super_owner Allows regular users to perform privileged operations on files stored on ZFS file systems owned by him. Very careful with this one. - chflags(2) Not all the flags are supported. This still needs work. - ZFSBoot Support to boot off of ZFS pool. Not finished, AFAIK. Submitted by: dfr - Snapshot properties - New failure modes Before if write requested failed, system paniced. Now one can select from one of three failure modes: - panic - panic on write error - wait - wait for disk to reappear - continue - serve read requests if possible, block write requests - Refquota, refreservation properties Just quota and reservation properties, but don't count space consumed by children file systems, clones and snapshots. - Sparse volumes ZVOLs that don't reserve space in the pool. - External attributes Compatible with extattr(2). - NFSv4-ACLs Not sure about the status, might not be complete yet. Submitted by: trasz - Creation-time properties - Regression tests for zpool(8) command. Obtained from: OpenSolaris
* Sync with OpenBSD's dirname(3) - license change, avoid strcpy() overdelphij2008-11-032-68/+46
| | | | | string constant, use memcpy() instead of strncpy() and improve code readibility. No functional change.
* In example use of err(3) and errx(3), use sysexits(3) constants.rwatson2008-10-311-4/+5
| | | | | MFC after: 3 days Submitted by: Bruce Cran <bruce at cran dot org dot uk>
* Fix a typo.rdivacky2008-10-231-1/+1
| | | | Approved by: kib (mentor)
* Fix a typo. q is already a pointer.kib2008-10-221-1/+1
| | | | | Reported by: ache Pointy hat to: kib
* Remove doubtful structure definition with variable array members.kib2008-10-221-67/+75
| | | | | | | | | | | | I believe this is not a valid C99 construct. Use directly calculated offsets into the supplied buffer, using specified members length, to fill appropriate structure. Either use sysctl, or copy the value of the UNAME_x environment variable, instead of unconditionally doing sysctl, and then overriding a returned value with user-specified one. Noted and tested by: rdivacky
* Add unistd.h to the getosreldate(3) manpage.kib2008-09-301-1/+2
| | | | | | Update referenced example to include unistd.h per manpage. Update example to be more style(9)-ish, silence warnings and add FreeBSD id to the source file.
* <osreldate.h> does not have a forward declration of getosreldate(), sorodrigc2008-09-201-1/+0
| | | | | | remove it from this man page. MFC after: 3 days
* Return two fixes from previous backout which does not requireache2008-09-091-1/+2
| | | | | | | | | | | | | | | | | review by secteam@ for the reasons mentioned below. 1) Rename /dev/urandom to /dev/random since urandom marked as XXX Deprecated alias in /sys/dev/random/randomdev.c (this is our naming convention and no review by secteam@ required) 2) Set rs_stired flag after forced initialization to prevent double stearing. (this is already in OpenBSD, i.e. they don't have double stearing. It means that this change matches their code path and no additional secteam@ review required) Submitted by: Thorsten Glaser <tg@mirbsd.de> (2)
* Set "max" to a reasonable value if BLOCKSIZE has a bogus unit. Priorcperciva2008-08-041-0/+1
| | | | | | | | | to this commit, "env BLOCKSIZE=4X df" prints not only "4X: unknown blocksize" as expected, but sometimes also "maximum blocksize is 1G" and "minimum blocksize is 512" depending on what happened to be on the stack. Found by: LLVM/Clang Static Checker
* Restored from previous backing out (because that is OpenBSD way, soache2008-08-031-12/+16
| | | | | | | | | assumed to be reviewd by them): Stir directly from the kernel PRNG, without taking less random pid & time bytes too (when it is possible). The difference with OpenBSD code is that they have KERN_ARND sysctl for that task, while we need to read /dev/random
* Teach fmtcheck() about wint_t, intmax_t, char *, intmax_t *, anddas2008-08-022-37/+99
| | | | | | | | | wide string arguments. Also simplify the code that handles length modifiers and make it more conservative. For instance, be explicit about the modifiers allowed for %d, rather than assuming that anything other than L, q, t, or z implies an int argument.
* Convert popen()'s `pidlist' to a SLIST, for consistency.ed2008-07-291-11/+13
| | | | | | | | | | | | | I guess the original author of the popen() code didn't want to use our <sys/queue.h> macro's, because the single linked list macro's didn't offer O(1) deletion. Because I introduced SLIST_REMOVE_NEXT() some time ago, we can now use the macro's here. By converting the code to an SLIST, it is more consistent with other parts of the C library and the operating system. Reviewed by: csjp Approved by: philip (mentor, implicit)
* Fix the email address formats in some posix_spawn(3) manpages.ed2008-07-282-2/+2
| | | | | | | | It seems I made a small bug when writing some of the posix_spawn(3) manpages. Remove the redundant "Ed Schouten", which broke the AUTHORS section. Approved by: philip (mentor, implicit)
* Add manual pages for posix_spawn() functions.davidxu2008-07-2811-1/+1483
| | | | PR: standards/122051
* Per rwatson's request:ache2008-07-251-29/+17
| | | | | | | | | | | | "If you don't get a review within a day or two, I would firmly recommend backing out the changes" back out all my changes, i.e. not comes from merging from OpenBSD as unreviewed by secteam@ yet. (OpenBSD changes stays in assumption they are reviewd by OpenBSD) Yes, it means some old bugs returned, like not setted rs_stired = 1 in arc4random_stir(3) causing double stirring.
* Fixes based on bde's feedback.ache2008-07-221-9/+9
| | | | | | | | | | 1) Unindent and sort variables. 2) Indent struct members. 3) Remove _packed, use guaranteed >128 bytes size and only first 128 bytes from the structure. 4) Reword comment. Obtained from: bde
* Change /dev/urandom to /dev/random since urandom marked asache2008-07-221-1/+1
| | | | | XXX Deprecated alias in /sys/dev/random/randomdev.c
* In arc4random_uniform() detect simple "power of two" case andache2008-07-221-1/+5
| | | | return just (arc4random() % upper_bound)
* Add arc4random_uniform() function (to avoid "modulo bias")ache2008-07-224-1/+58
| | | | Obtained from: OpenBSD
* Increase initially dropped bytes from 512 to 768 (768 is alsoache2008-07-221-3/+3
| | | | | | | | suggested in the Ilya Mironov's article). 768 taken from another research where it treats as default for RC4-drop(768): http://www.users.zetnet.co.uk/hopwood/crypto/scan/cs.html#RC4-drop Minor style tweak.
* Add feature_present(3) to the FBSD 1.1 symbol map.jhb2008-07-211-0/+1
|
* 1) Use __packed attr on rdat structure to make it exact 128 bytes.ache2008-07-211-10/+17
| | | | | | | | | | 2) Use gettimeofday() and getpid() only if reading from /dev/urandom fails or impossible. 3) Discard N bytes on very first initialization only (i.e. don't discard on re-stir). 4) Reduce N from 1024 to 512 as really suggested in the "(Not So) Random Shuffles of RC4" paper: http://research.microsoft.com/users/mironov/papers/rc4full.pdf
* 1) Update copyright notice.ache2008-07-211-43/+53
| | | | | | | | | 2) Eliminate "struct arc4_stream *as" arg since only single arg is possible. 3) Set rs.j = rs.i after arc4random key schedule to be more like arc4 stream cipher. Obtained from: OpenBSD
* Add arc4random_buf to FBSD_1.1 spaceache2008-07-211-0/+1
|
* Add arc4random_buf.3 to MLINKSache2008-07-211-1/+2
|
* Implement arc4random_buf() functionache2008-07-212-4/+28
| | | | Obtained from: OpenBSD
* Decrease arc4_count only when needed and with proper bytes amount.ache2008-07-211-1/+2
| | | | Obtained from: OpenBSD
* 1) Set stired flag after forced initialization.ache2008-07-211-1/+2
| | | | | | | 2) Increase arc4_count to the limit OpenBSD use. Submitted by: Thorsten Glaser <tg@mirbsd.de> (1) Obtained from: OpenBSD (2)
* Make it more clear what it means that SA_RESTART is set for signalsimon2008-07-171-3/+5
| | | | | | | handlers added with signal(3). Submitted by: gnn (slightly modified by me) MFC after: 1 week
* Gcc barfs in glob.c when run with -O3. To fix this make g_strchr() work onmtm2008-06-261-5/+5
| | | | | | | and return (const Char *) pointers instead of just (Char *) and get rid of all the type casting. PR: kern/124334
* Turn execvpe() into an internal libc routine.ed2008-06-235-19/+9
| | | | | | | | | | | | 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
* Process spawn attributes in POSIX document order.davidxu2008-06-191-21/+22
|
* Style fix.davidxu2008-06-171-1/+2
|
OpenPOWER on IntegriCloud