summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys
Commit message (Collapse)AuthorAgeFilesLines
* Provide an example to the kqueue man page, showingbcr2016-05-011-1/+52
| | | | | | | | | | | | | a basic usage example. Although it is an untypical example for the use of kqueue, it is better than nothing and should get people started. PR: 196844 Submitted by: fernando.apesteguia@gmail.com Reviewed by: kib Approved by: kib MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D6082
* libc: spelling fixes.pfg2016-04-301-1/+1
| | | | Mostly on comments.
* Document KTRFAC_FAULT and KTRFAC_FAULTEND.brooks2016-03-311-1/+3
| | | | | | Obtained from: CheriBSD (9d70f563f1b033e6a9b51eaf3b145a8cbbc6617c) MFC after: 1 week Sponsored by: DARPA, AFRL
* Fix bunch of .Xrs.trasz2016-03-281-1/+1
| | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation
* Fully handle size_t lengths in AIO requests.jhb2016-03-212-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | First, update the return types of aio_return() and aio_waitcomplete() to ssize_t. POSIX requires aio_return() to return a ssize_t so that it can represent all return values from read() and write(). aio_waitcomplete() should use ssize_t for the same reason. aio_return() has used ssize_t in <aio.h> since r31620 but the manpage and system call entry were not updated. aio_waitcomplete() has always returned int. Note that this does not require new system call stubs as this is effectively only an API change in how the compiler interprets the return value. Second, allow aio_nbytes values up to IOSIZE_MAX instead of just INT_MAX. aio_read/write should now honor the same length limits as normal read/write. Third, use longs instead of ints in the aio_return() and aio_waitcomplete() system call functions so that the 64-bit size_t in the in-kernel aiocb isn't truncated to 32-bits before being copied out to userland or being returned. Finally, a simple test has been added to verify the bounds checking on the maximum read size from a file.
* Use the right argumant namejulian2016-03-181-1/+1
| | | | | MFC after: 1 week Sponsored by: Panzura inc
* Remove Symbol.map entries for old AIO system calls for FreeBSD 6 compat.jhb2016-03-121-9/+0
| | | | | | | | | | | These entries should have never been present since they only exist for compat with FreeBSD 6.x (and older) binaries. This was missed in r296572. Technically this breaks the ABI by removing versioned symbols. However, no binaries should be linked against these symbols. No release has shipped with a header that contained a prototype for these functions. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D5615
* Fix spelling of MAXNAMLEN.trasz2016-03-091-2/+2
| | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation
* kenv(8) -> kenv(1)trasz2016-02-291-1/+1
| | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation
* sysconf(2) -> sysconf(3)trasz2016-02-291-1/+1
| | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation
* Bump .Dd for r295764bjk2016-02-181-3/+3
| | | | Also fix a spelling and grammar nit while here.
* Right now, the "virtual hole" API feature of lseek(2) is very vaguelysobomax2016-02-181-4/+12
| | | | | | | | | | | documented and easy to miss. At the same time, it's pretty important for anyone who is trying to use SEEK_HOLE/SEEK_DATA in real app. Try to bridge that gap by making that description more pronounced and also document how it affects failure codes. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D5162
* Remove man page references to rndassociates.com, which has been taken overjamie2016-02-101-1/+0
| | | | by a domain squatter.
* If libthr.so is dlopened without RTLD_GLOBAL flag, the libthr symbolskib2016-02-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | do not participate in the global symbols namespace, but rtld locks are still replaced and functions are interposed. In particular, __pthread_map_stacks_exec is resolved to the libc version. If a library is loaded later, which requires adjustment of the stack protection mode, rtld calls into libc __pthread_map_stacks_exec due to the symbols scope. The libc version might recurse into binder and recursively acquire rtld bind lock, causing the hang. Make libc __pthread_map_stacks_exec() interposed, which synchronizes rtld locks and version of the stack exec hook when libthr loaded, regardless of the symbol scope control or symbol resolution order. The __pthread_map_stacks_exec() symbol is removed from the private version in libthr since libc symbol now operates correctly in presence of libthr. Reported and tested by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* semget(2): Add missing [EINVAL] conditions.jilles2016-02-071-1/+12
| | | | PR: 206927
* - connect(2) Clarify namelenjgh2016-02-041-1/+9
| | | | | | | | PR: 206838 Submitted by: t@tobik.me Approved by: bcr (mentor) MFH: after 1 week Differential Revision: https://reviews.freebsd.org/D5194
* Add implementations of sendmmsg(3) and recvmmsg(3) functions whichkib2016-01-293-20/+135
| | | | | | | | | | | | | | | | | | wraps sendmsg(2) and recvmsg(2) into batch send and receive operation. The goal of this implementation is only to provide API compatibility with Linux. The cancellation behaviour of the functions is not quite right, but due to relative rare use of cancellation it is considered acceptable comparing with the complexity of the correct implementation. If functions are reimplemented as syscalls, the fix would come almost trivial. The direct use of the syscall trampolines instead of libc wrappers for sendmsg(2) and recvmsg(2) is to avoid data loss on cancellation. Submitted by: Boris Astardzhiev <boris.astardzhiev@gmail.com> Discussed with: jilles (cancellation behaviour) MFC after: 1 month
* Restore flushing of output for revoke(2) again. Document revoke()'skib2016-01-261-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | intended behaviour in its man page. Simplify tty_drain() to match. Don't call ttydevsw methods in tty_flush() if the device is gone since we now sometimes call it then. The flushing was supposed to be implemented by passing the FNONBLOCK flag to VOP_CLOSE() for revoke(). The tty driver is one of the few that can block in close and was one of the fewer that knew about this. This almost worked in FreeBSD-1 and similarly in Net/2. These versions only almost worked because there was and is considerable confusion between IO_NDELAY and FNONBLOCK (aka O_NONBLOCK). IO_NDELAY is only valid for VOP_READ() and VOP_WRITE(). For other VOPs it has the same value as O_SHLOCK. But since vfs_subr.c and tty.c consistently used the wrong flag and the O_SHLOCK flag is rarely set, this mostly worked. It also gave the feature than applications could get the non-blocking close by abusing O_SHLOCK. This was first broken then fixed in 1995. I changed only the tty driver to use FNONBLOCK, as a hack to get non-blocking via the normal flag FNONBLOCK for last closes. I didn't know about revoke()'s use of IO_NDELAY or change it to be consistent, so revoke() was broken. Then I changed revoke() to match. This was next broken in 1997 then fixed in 1998. Importing Lite2 made the flags inconsistent again by undoing the fix only in vfs_subr.c. This was next broken in 2008 by replacing everything in tty.c and not checking any flags in last close. Other bugs in draining limited the resulting unbounded waits to drain in some cases. It is now possible to fix this better using the new FREVOKE flag. Just restore flushing for revoke() for now. Don't restore or undo any hacks for ordinary last closes yet. But remove dead code in the 1-second relative timeout (r272789). This did extra work to extend the buggy draining for revoke() for as long as possible. The 1-second timeout made this not very long by usually flushing after 1 second. Submitted by: bde MFC after: 2 weeks
* mdoc: sort Xrjoel2016-01-181-1/+1
|
* utimensat(2): Correct description of [EINVAL] error.jilles2016-01-171-3/+6
| | | | MFC after: 4 days
* - Add the 'restrict' type qualifier to match function prototype.kevlo2016-01-141-4/+3
| | | | - Remove sys/types.h.
* Update futimens/utimensat for MFC to stable/10:jilles2016-01-123-4/+10
| | | | | | | | | | * Fix __FreeBSD_version check. * Update history section in man page. An MFC of this commit to stable/10 will allow using the new system calls instead of the fallback. MFC after: 3 days
* New sendfile(2) syscall. A joint effort of NGINX and Netflix from 2013 andglebius2016-01-081-32/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | up to now. The new sendfile is the code that Netflix uses to send their multiple tens of gigabits of data per second. The new implementation features asynchronous I/O, when I/O operations are launched, but not awaited to be complete. An explanation of why such behavior is beneficial compared to old one is going to be too long for a commit message, so we will skip it here. Additional features of new syscall are extra flags, which provide an application more control over data sent. The SF_NOCACHE flag tells kernel that data shouldn't be cached after it was sent. The SF_READAHEAD() macro allows to specify readahead size in pages. The new syscalls is a drop in replacement. No modifications are required to applications. One can take nginx binary for stable/10 and run it successfully on head. Although SF_NODISKIO lost its original sense, as now sendfile doesn't block, and now means something completely different (tm), using the new sendfile the old way is absolutely safe. Celebrates: Netflix global launch! Sponsored by: Nginx, Inc. Sponsored by: Netflix Relnotes: yes
* Document the recently added support for ptrace(2) LWP events.jhb2015-12-301-1/+38
|
* Verify that tv_sec value specified in settimeofday() and clock_settime()dchagin2015-12-272-2/+8
| | | | | | | | | | | | | | (CLOCK_REALTIME case) system calls is non negative. This commit hides a kernel panic in atrtc_settime() as the clock_ts_to_ct() does not properly convert negative tv_sec. ps. in my opinion clock_ts_to_ct() should be rewritten to properly handle negative tv_sec values. Differential Revision: https://reviews.freebsd.org/D4714 Reviewed by: kib MFC after: 1 week
* clock_gettime(2),gettimeofday(2): Remove [EFAULT] error.jilles2015-12-202-8/+2
| | | | | | | | | | | Depending on system configuration and parameters, clock_gettime() and gettimeofday() may not be system calls. If so, passing an invalid pointer will cause a signal and not an [EFAULT] error. From a standards perspective, this is OK since passing an invalid pointer is undefined behaviour. MFC after: 1 week
* Remove sys/types.h due to STANDARDS and unistd.h also includes sys/types.h.kevlo2015-12-155-10/+5
|
* Remove sys/types.h due to STANDARDS and unistd.h also includes sys/types.h.kevlo2015-12-152-4/+2
| | | | Reviewed by: bde
* Start on a new library (libsysdecode) that provides routines for decodingjhb2015-12-151-2/+3
| | | | | | | | | | | | | | | | | system call information such as system call arguments. Initially this will consist of pulling duplicated code out of truss and kdump though it may prove useful for other utilities in the future. This commit moves the shared utrace(2) record parser out of kdump into the library and updates kdump and truss to use it. One difference from the previous version is that the library version treats unknown events that start with the "RTLD" signature as unknown events. This simplifies the interface and allows the consumer to decide how to handle all non-recognized events. Instead, this function only generates a string description for known malloc() and RTLD records. Reviewed by: bdrewery Differential Revision: https://reviews.freebsd.org/D4537
* cpuset.9: Link to/from the new pagecem2015-10-202-4/+6
| | | | | | A follow-up to r289667. Sponsored by: EMC / Isilon Storage Division
* Switch pl_child_pid from int to pid_t.jhb2015-10-201-2/+2
| | | | | | Reviewed by: emaste, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3857
* Change the default setting of kern.ipc.shm_allow_removed from 0 to 1.trasz2015-10-101-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the need for manually changing this flag for Google Chrome users. It also improves compatibility with Linux applications running under Linuxulator compatibility layer, and possibly also helps in porting software from Linux. Generally speaking, the flag allows applications to create the shared memory segment, attach it, remove it, and then continue to use it and to reattach it later. This means that the kernel will automatically "clean up" after the application exits. It could be argued that it's against POSIX. However, SUSv3 says this about IPC_RMID: "Remove the shared memory identifier specified by shmid from the system and destroy the shared memory segment and shmid_ds data structure associated with it." From my reading, we break it in any case by deferring removal of the segment until it's detached; we won't break it any more by also deferring removal of the identifier. This is the behaviour exhibited by Linux since... probably always, and also by OpenBSD since the following commit: revision 1.54 date: 2011/10/27 07:56:28; author: robert; state: Exp; lines: +3 -8; Allow segments to be used even after they were marked for deletion with the IPC_RMID flag. This is permitted as an extension beyond the standards and this is similar to what other operating systems like linux do. MFC after: 1 month Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3603
* Document the recently added pl_syscall_* fields in struct ptrace_lwpinfo.jhb2015-10-071-1/+24
| | | | | Reviewed by: emaste, kib Differential Revision: https://reviews.freebsd.org/D3833
* truss: Add support for utrace(2).bdrewery2015-10-061-2/+3
| | | | | | | | | | | | | | This uses the kdump(1) utrace support code directly until a common library is created. This allows malloc(3) tracing with MALLOC_CONF=utrace:true and rtld tracing with LD_UTRACE=1. Unknown utrace(2) data is just printed as hex. PR: 43819 [inspired by] Reviewed by: jhb MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D3819
* Revert r288628 and instead fix a discrepancy between the posix_fadvise(2)markj2015-10-031-5/+7
| | | | | | | man page and POSIX: posix_fadvise(2) returns an error number on failure. Reported by: jilles MFC after: 1 week
* Annotate arm userspace assembler sources stating their tolerance tokib2015-09-291-1/+1
| | | | | | | the non-executable stack. Reviewed by: andrew Sponsored by: The FreeBSD Foundation
* Avoid adding duplicates into OBJS. bsd.lib.mk already handles addingbdrewery2015-09-221-2/+0
| | | | | | | entries to OBJS based on SRCS. MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Add missing include to eliminate -Wmissing-prototypes warningsrodrigc2015-09-201-0/+2
|
* Add missing includes to eliminate -Wmissing-prototypes warningsrodrigc2015-09-205-0/+5
|
* There is no HP 300 support in FreeBSD anymore, so remove the obsoletedelphij2015-09-181-6/+1
| | | | | | | | BUGS section. While I'm there also bump Dd date. MFC after: 2 weeks
* Kernel part of reroot support - a way to change rootfs without reboot.trasz2015-09-181-0/+7
| | | | | | | | | | | | | Note that the mountlist manipulations are somewhat fragile, and not very pretty. The reason for this is to avoid changing vfs_mountroot(), which is (obviously) rather mission-critical, but not very well documented, and thus hard to test properly. It might be possible to rework it to use its own simple root mount mechanism instead of vfs_mountroot(). Reviewed by: kib@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D2698
* setuid(2): Suggest O_CLOEXEC instead of fcntl(F_SETFD).jilles2015-09-131-7/+2
|
* Switch libc from using _sig{procmask,action,suspend} symbols, whichkib2015-08-293-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | are aliases for the syscall stubs and are plt-interposed, to the libc-private aliases of internally interposed sigprocmask() etc. Since e.g. _sigaction is not interposed by libthr, calling signal() removes thr_sighandler() from the handler slot etc. The result was breaking signal semantic and rtld locking. The added __libc_sigprocmask and other symbols are hidden, they are not exported and cannot be called through PLT. The setjmp/longjmp functions for x86 were changed to use direct calls, and since PIC_PROLOGUE only needed for functional PLT indirection on i386, it is removed as well. The PowerPC bug of calling the syscall directly in the setjmp/longjmp implementation is kept as is. Reported by: Pete French <petefrench@ingresso.co.uk> Tested by: Michiel Boland <boland37@xs4all.nl> Reviewed by: jilles (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Editing pass on procctl.2bjk2015-08-211-26/+26
| | | | | | | | | | Spell "descendant" correctly. Grammar fixes. Use correct width argument to Bl. Use Po and Pc to avoid leaving a dangling '(' on the end of a line.
* If process becomes reaper (procctl(PROC_REAP_ACQUIRE)) while alreadykib2015-08-201-2/+6
| | | | | | | | | | | | | having some children, the children' reaper is not reset to the parent. This allows for the situation where reaper has children but not descendands and the too strict asserts in the reap_status() fire. Remove the wrong asserts, add some clarification for the situation to the procctl(2) REAP_STATUS. Reported and tested by: feld Sponsored by: The FreeBSD Foundation MFC after: 1 week
* getrlimit.2: Document RSS, AS/VMEM limit behavior more clearlycem2015-08-201-15/+46
| | | | | | | | | Alphabetize the RLIMIT_ list while here. Reviewed by: jilles (previous version), wblock (previous version) Approved by: markj (mentor) Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3433
* Remove a stale comment and clarify the original where it was taken frompfg2015-08-141-2/+2
| | | | | | | | | The comment in the libc/sys symbol map referenced the generated symbols for the syscall trampolines. Such comment was out of place in the secure symbol map so remove the stale comment and attempt to clarify the old one to avoid risks of confusion. Pointed out by: kib
* Move the stack protector to a new "secure" directorypfg2015-08-144-142/+0
| | | | | | | | | | As part of the code refactoring to support FORTIFY_SOURCE we want a new subdirectory "secure" to keep the files related to security. Move the stack protector functions to this new directory. No functional change. Differential Review: https://reviews.freebsd.org/D3333
* Make it possible to implement poll(2) on top of kqueue(2).ed2015-08-051-1/+9
| | | | | | | | | | | | | | It looks like EVFILT_READ and EVFILT_WRITE trigger under the same conditions as poll()'s POLLRDNORM and POLLWRNORM as described by POSIX. The only difference is that POLLRDNORM has to be triggered on regular files unconditionally, whereas EVFILT_READ only triggers when not EOF. Introduce a new flag, NOTE_FILE_POLL, that can be used to make EVFILT_READ and EVFILT_WRITE behave identically to poll(). This flag will be used by cloudlibc's poll() function. Reviewed by: jmg Differential Revision: https://reviews.freebsd.org/D3303
* Copy the fencing of the algorithm to do lock-less update and readingkib2015-08-041-11/+14
| | | | | | | | | | | | | | of the timehands, from the kern_tc.c implementation to vdso. Add comments giving hints where to look for the algorithm explanation. To compensate the removal of rmb() in userspace binuptime(), add explicit lfence instruction before rdtsc. On i386, add usual complications to detect SSE2 presence; assume that old CPUs which do not implement SSE2 also execute rdtsc almost in order. Reviewed by: alc, bde (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
OpenPOWER on IntegriCloud