summaryrefslogtreecommitdiffstats
path: root/usr.bin/truss/syscalls.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r317730:tuexen2017-06-011-8/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for listen() call. MFC r317731: Add Socklent for handling args of type socklen_t. MFC r317732: Decode the third argument of socket(). MFC r317736: Add support for [gs]etsockopt(). MFC r317737: Decode the fourth argument of sendto and recvfrom call. MFC r317739: Add support for sendmsg() and recvmsg(). MFC r317747: Add support for socket option names related to the IPPROTO_SCTP level. MFC r317748: Add support for socket option names related to the IPPROTO_IPV6 level. MFC r317750: Add support for sctp_generic_sendmsg() and sctp_generic_recvmsg(). MFC r317789: Add support for socket option names related to the level IPPROTO_UDPLITE. MFC r318879: Improve the decoding of the third argument of the socket() call. Decoding of the third argument depends on the first one. For doing this, add a corresponding function to libsysdecode. Thanks to jhb@ for suggesting this.
* MFC 315335,315336,315496,315497,315500,315502,315504,315509,315523,315524,jhb2017-05-261-44/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 315525: Decode more system call arguments in truss. 315335: Remove duplicate argument from linux_stat64() decoding. 315336: Automate the handling of QUAD_ALIGN and QUAD_SLOTS. Previously, the offset in a system call description specified the array index of the start of a system call argument. For most system call arguments this was the same as the index of the argument in the function signature. 64-bit arguments (off_t and id_t values) passed on 32-bit platforms use two slots in the array however. This was handled by adding (QUAD_SLOTS - 1) to the slot indicies of any subsequent arguments after a 64-bit argument (though written as ("{ Quad, 1 }, { Int, 1 + QUAD_SLOTS }" rather than "{ Quad, 1 }, { Int, 2 + QUAD_SLOTS - 1 }"). If a system call contained multiple 64-bit arguments (such as posix_fadvise()), then additional arguments would need to use 'QUAD_SLOTS * 2' but remember to subtract 2 from the initial number, etc. In addition, 32-bit powerpc requires 64-bit arguments to be 64-bit aligned, so if the effective index in the array of a 64-bit argument is odd, it needs QUAD_ALIGN added to the current and any subsequent slots. However, if the effective index in the array of a 64-bit argument was even, QUAD_ALIGN was omitted. This approach was messy and error prone. This commit replaces it with automated pre-processing of the system call table to do fixups for 64-bit argument offsets. The offset in a system call description now indicates the index of an argument in the associated function call's signature. A fixup function is run against each decoded system call description during startup on 32-bit platforms. The fixup function maintains an 'offset' value which holds an offset to be added to each remaining system call argument's index. Initially offset is 0. When a 64-bit system call argument is encountered, the offset is first aligned to a 64-bit boundary (only on powerpc) and then incremented to account for the second argument slot used by the argument. This modified 'offset' is then applied to any remaining arguments. This approach does require a few things that were not previously required: 1) Each system call description must now list arguments in ascending order (existing ones all do) without using duplicate slots in the register array. A new assert() should catch any future descriptions which violate this rule. 2) A system call description is still permitted to omit arguments (though none currently do), but if the call accepts 64-bit arguments those cannot be omitted or incorrect results will be displated on 32-bit systems. 315496: Decode the arguments passed to cap_fcntls_get() and cap_fcntls_limit(). 315497: Decode arguments passed to posix_fadvise(). 315500: Decode file flags passed to *chflags*(). While here, decode arguments passed to fchflags() and chflagsat(). 315502: Decode flock() operation. 315504: Decode arguments passed to getfsstat(). Note that this does not yet decode the statfs structures returned by getfsstat(). 315509: Decode arguments passed to kldsym() and kldunloadf(). This does not currently decode the kld_sym_lookup structure passed to kldsym(). 315523: Add a Sizet type for 'size_t' values and use it instead of Int. Various size_t arguments were previously decoded as Int values instead which would have truncated values above 2^31 on 64-bit systems. 315524: Decode arguments to madvise(). 315525: Improve decoding of last arguments to ioctl() and sendto(). Decode the last argument to ioctl() as a pointer rather than an int. Eventually this could use 'int' for the _IOWINT() case and pointers for all others. The last argument to sendto() is a socklen_t value, not a pointer.
* MFC 309589: Rework syscall structure lookups.jhb2017-01-131-9/+58
| | | | | | | | | | | | | | Avoid always using an O(n^2) loop over known syscall structures with strcmp() on each system call. Instead, use a per-ABI cache indexed by the system call number. The first 1024 system calls (which should cover all of the normal system calls in currently-supported ABIs) use a flat array indexed by the system call number to find system call structure. For other system calls, a linked list of structures storing an integer to structure mapping is stored in the ABI. The linked list isn't very smart, but it should only be used by buggy applications invoking unknown system calls. This also fixes handling of unknown system calls which currently trigger a NULL pointer dereference.
* MFC 307538,307948,308602,308603,311151: Move kdump's mksubr into libsysdecode.jhb2017-01-121-206/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 307538: Move mksubr from kdump into libsysdecode. Restructure this script so that it generates a header of tables instead of a source file. The tables are included in a flags.c source file which provides functions to decode various system call arguments. For functions that decode an enumeration, the function returns a pointer to a string for known values and NULL for unknown values. For functions that do more complex decoding (typically of a bitmask), the function accepts a pointer to a FILE object (open_memstream() can be used as a string builder) to which decoded values are written. If the function operates on a bitmask, the function returns true if any bits were decoded or false if the entire value was valid. Additionally, the third argument accepts a pointer to a value to which any undecoded bits are stored. This pointer can be NULL if the caller doesn't care about remaining bits. Convert kdump over to using decoder functions from libsysdecode instead of mksubr. truss also uses decoders from libsysdecode instead of private lookup tables, though lookup tables for objects not decoded by kdump remain in truss for now. Eventually most of these tables should move into libsysdecode as the automated table generation approach from mksubr is less stale than the static tables in truss. Some changes have been made to truss and kdump output: - The flags passed to open() are now properly decoded in that one of O_RDONLY, O_RDWR, O_WRONLY, or O_EXEC is always included in a decoded mask. - Optional arguments to open(), openat(), and fcntl() are only printed in kdump if they exist (e.g. the mode is only printed for open() if O_CREAT is set in the flags). - Print argument to F_GETLK/SETLK/SETLKW in kdump as a pointer, not int. - Include all procctl() commands. - Correctly decode pipe2() flags in truss by not assuming full open()-like flags with O_RDONLY, etc. - Decode file flags passed to *chflags() as file flags (UF_* and SF_*) rather than as a file mode. - Fix decoding of quotactl() commands by splitting out the two command components instead of assuming the raw command value matches the primary command component. In addition, truss and kdump now build without triggering any warnings. All of the sysdecode manpages now include the required headers in the synopsis. 307948: Use binary and (&) instead of logical to extract the mask of a capability. 308602: Generate and use a proper .depend file for tables.h. 308603: Move libsysdecode-specific hack out of buildworld. This should fix the lib32 build since it was not removing the generated ioctl.c. This file is generated by a find(1) call, so cannot use normal dependency tracking methods. 311151: Update libsysdecode for getfsstat() 'flags' argument changing to 'mode'. As a followup to r310638, update libsysdecode (and kdump) to decode the 'mode' argument to getfsstat(). sysdecode_getfsstat_flags() has been renamed to sysdecode_getfsstat_mode() and now treats the argument as an enumerated value rather than a mask of flags.
* MFC 307060: Fix printf format warning.jhb2017-01-101-2/+2
|
* MFC r303818, r303833, r303941, r304478, r304481, r304483, r304484, r304554,ed2016-10-121-2/+0
| | | | | | | | | | | | | | | | | | r304555, r304556, r304557, r304558, r304559, r304561, r304563, r304564, r304565, r304615, r304742, r304743, r304744, r304745, r304748, r304886, r304991, r305928, r305938, r305987, r306185: Bring CloudABI support back in sync with HEAD. - Add support for running 32-bit executables on amd64, armv6 and i386. - As these new architectures require the use of the vDSO, merge back vDSO support for 64-bit executables running on amd64 and arm64 as well. This has the advantage that support for vDSO-less execution can be phased out when 11.0 becomes unsupported, as opposed to 11.x. This change has been tested by running the cloudlibc unit tests on all supported architectures, which seems to work fine.
* MFC r303934,r303937,r303942:bdrewery2016-08-151-0/+2
| | | | | | | | | r303934: Support rmdir(2). r303937: Use proper argument length for rmdir(2) for r303934. r303942: Fix sorting in r303934.
* Cleanup unnecessary semicolons from utilities we all love.pfg2016-04-151-1/+1
|
* Replace the CloudABI system call table by a machine generated version.ed2016-03-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The type definitions and constants that were used by COMPAT_CLOUDABI64 are a literal copy of some headers stored inside of CloudABI's C library, cloudlibc. What is annoying is that we can't make use of cloudlibc's system call list, as the format is completely different and doesn't provide enough information. It had to be synced in manually. We recently decided to solve this (and some other problems) by moving the ABI definitions into a separate file: https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt This file is processed by a pile of Python scripts to generate the header files like before, documentation (markdown), but in our case more importantly: a FreeBSD system call table. This change discards the old files in sys/contrib/cloudabi and replaces them by the latest copies, which requires some minor changes here and there. Because cloudabi.txt also enforces consistent names of the system call arguments, we have to patch up a small number of system call implementations to use the new argument names. The new header files can also be included directly in FreeBSD kernel space without needing any includes/defines, so we can now remove cloudabi_syscalldefs.h and cloudabi64_syscalldefs.h. Patch up the sources to include the definitions directly from sys/contrib/cloudabi instead.
* Use ptrace(2) LWP events to track threads reliably in truss.jhb2016-03-091-0/+10
| | | | | | | | | | | | | | - truss can now log the system call invoked by a thread during a voluntary process exit. No return value is logged, but the value passed to exit() is included in the trace output. Arguments passed to thread exit system calls such as thr_exit() are not logged as voluntary thread exits cannot be distinguished from involuntary thread exits during a system call. - New events are now reported for thread births and exits similar to the recently added events for new child processes when following forks. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D5561
* Add handling for non-native error values to libsysdecode.jhb2016-02-231-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add two new functions, sysdecode_abi_to_freebsd_errno() and sysdecode_freebsd_to_abi_errno(), which convert errno values between the native FreeBSD ABI and other supported ABIs. Note that the mappings are not necessarily perfect meaning in some cases multiple errors in one ABI might map to a single error in another ABI. In that case, the reverse mapping will return one of the errors that maps, but which error is non-deterministic. Change truss to always report the raw error value to the user but use libsysdecode to map it to a native errno value that can be used with strerror() to generate a description. Previously truss reported the "converted" error value. Now the user will always see the exact error value that the application sees. Change kdump to report the truly raw error value to the user. Previously kdump would report the absolute value of the raw error value (so for Linux binaries it didn't output the FreeBSD error value, but the positive value of the Linux error). Now it reports the real (i.e. negative) error value for Linux binaries. Also, use libsysdecode to convert the native FreeBSD error reported in the ktrace record to the raw error used by the ABI. This means that the Linux ABI can now be handled directly in ktrsysret() and removes the need for linux_ktrsysret(). Reviewed by: bdrewery, kib Helpful notes: wblock (manpage) Differential Revision: https://reviews.freebsd.org/D5314
* Add support for displaying thread IDs to truss(1).jhb2016-02-231-22/+1
| | | | | | | | | | | | | | | - Consolidate duplicate code for printing the metadata at the start of each line into a shared function. - Add an -H option which will log the thread ID of the relevant thread for each event. While here, remove some extraneous calls to clock_gettime() in print_syscall() and print_syscall_ret(). The caller of print_syscall_ret() always updates the current thread's "after" time before it is called. Reviewed by: kib MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D5363
* Remove an unused variable that snuck into the previous revision.jhb2016-02-161-1/+0
|
* Fetch the current thread and it's syscall state from the trussinfo objectjhb2016-02-161-19/+24
| | | | | | instead of passing some of that state as arguments to print_syscall() and print_syscallret(). This just makes the calls of these functions shorter and easier to read.
* Move the mkioctls script to libsysdecode and use it to generate ajhb2015-12-221-1/+1
| | | | | | | | | | | sysdecode_ioctlname() function. This function matches the behavior of the truss variant in that it returns a pointer to a string description for known ioctls. The caller is responsible for displaying unknown ioctl requests. For kdump this meant moving the logic to handle unknown ioctl requests out of the generated function and into an ioctlname() function in kdump.c instead. Differential Revision: https://reviews.freebsd.org/D4610
* Start on a new library (libsysdecode) that provides routines for decodingjhb2015-12-151-4/+2
| | | | | | | | | | | | | | | | | 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
* Properly format pointer size independent CloudABI system calls.ed2015-10-081-0/+356
| | | | | | | | | | | | | | | | | | | | | | CloudABI has approximately 50 system calls that do not depend on the pointer size of the system. As the ABI is pretty compact, it takes little effort to each truss(8) the formatting rules for these system calls. Start off by formatting pointer size independent system calls. Changes: - Make it possible to include the CloudABI system call definitions in FreeBSD userspace builds. Add ${root}/sys to the truss(8) Makefile so we can pull in <compat/cloudabi/cloudabi_syscalldefs.h>. - Refactoring: patch up amd64-cloudabi64.c to use the CLOUDABI_* constants instead of rolling our own table. - Add table entries for all of the system calls. - Add new generic formatting types (UInt, IntArray) that we'll be using to format unsigned integers and arrays of integers. - Add CloudABI specific formatting types. Approved by: jhb Differential Revision: https://reviews.freebsd.org/D3836
* truss: Add support for utrace(2).bdrewery2015-10-061-0/+37
| | | | | | | | | | | | | | 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
* Group the decoded system calls by ABI and sort the calls within each ABI.jhb2015-10-061-207/+214
| | | | | | Reviewed by: bdrewery Glanced at by: kib Differential Revision: https://reviews.freebsd.org/D3823
* Add decoding for modfind(2)bdrewery2015-10-051-0/+2
|
* Fix tracking of unknown syscalls for 'truss -c'.bdrewery2015-10-051-10/+34
| | | | | | | | | | | | This is done by changing get_syscall() to either lookup the known syscall or add it into the list with the default handlers for printing. This also simplifies some code to not have to check if the syscall variable is set or NULL. Reviewed by: jhb Relnotes: yes Differential Revision: https://reviews.freebsd.org/D3792
* Style fix.bdrewery2015-10-031-0/+1
|
* Add decoding for struct statfs.bdrewery2015-10-031-0/+28
| | | | Reviewed by: jhb (briefly)
* Rather than groveling around in a socket address structure for a socketjhb2015-10-011-33/+35
| | | | | | | address's length (and then overriding it if it "looks wrong"), use the next argument to the system call to determine the length. This is more reliable since this is what the kernel depends on anyway and is also simpler.
* The id_t type used to pass IDs to wait6(2) and procctl(6) is a 64-bitjhb2015-10-011-9/+21
| | | | | | | | | | | integer. Fix the argument decoding to treat this as a quad instead of an int. This includes using QUAD_ALIGN and QUAD_SLOTS as necessary. To continue printing IDs in decimal, add a new QuadHex argument type that prints a 64-bit integer in hex, use QuadHex for the existing off_t arguments, repurpose Quad to print a 64-bit integer in decimal, and use Quad for id_t arguments. This fixes the decoding of wait6(2) and procctl(2) on 32-bit platforms.
* - Remove extra integer argument from truncate() and ftruncate(). This isjhb2015-10-011-5/+5
| | | | | | | | probably fallout from the removal of the extra padding argument before off_t in 7. However, that padding still exists for 32-bit powerpc, so use QUAD_ALIGN. - Fix QUAD_ALIGN to be zero for powerpc64. It should only be set to 1 for 32-bit platforms that add padding to align 64-bit arguments.
* Several changes to truss.jhb2015-09-301-81/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Refactor the interface between the ABI-independent code and the ABI-specific backends. The backends now provide smaller hooks to fetch system call arguments and return values. The rest of the system call entry and exit handling that was previously duplicated among all the backends has been moved to one place. - Merge the loop when waiting for an event with the loop for handling stops. This also means not emulating a procfs-like interface on top of ptrace(). Instead, use a single event loop that fetches process events via waitid(). Among other things this allows us to report the full 32-bit exit value. - Use PT_FOLLOW_FORK to follow new child processes instead of forking a new truss process for each new child. This allows one truss process to monitor a tree of processes and truss -c should now display one total for the entire tree instead of separate summaries per process. - Use the recently added fields to ptrace_lwpinfo to determine the current system call number and argument count. The latter is especially useful and fixes a regression since the conversion from procfs. truss now generally prints the correct number of arguments for most system calls rather than printing extra arguments for any call not listed in the table in syscalls.c. - Actually check the new ABI when processes call exec. The comments claimed that this happened but it was not being done (perhaps this was another regression in the conversion to ptrace()). If the new ABI after exec is not supported, truss detaches from the process. If truss does not support the ABI for a newly executed process the process is killed before it returns from exec. - Along with the refactor, teach the various ABI-specific backends to fetch both return values, not just the first. Use this to properly report the full 64-bit return value from lseek(). In addition, the handler for "pipe" now pulls the pair of descriptors out of the return values (which is the true kernel system call interface) but displays them as an argument (which matches the interface exported by libc). - Each ABI handler adds entries to a linker set rather than requiring a statically defined table of handlers in main.c. - The arm and mips system call fetching code was changed to follow the same pattern as amd64 (and the in-kernel handler) of fetching register arguments first and then reading any remaining arguments from the stack. This should fix indirect system call arguments on at least arm. - The mipsn32 and n64 ABIs will now look for arguments in A4 through A7. - Use register %ebp for the 6th system call argument for Linux/i386 ABIs to match the in-kernel argument fetch code. - For powerpc binaries on a powerpc64 system, fetch the extra arguments on the stack as 32-bit values that are then copied into the 64-bit argument array instead of reading the 32-bit values directly into the 64-bit array. Reviewed by: kib (earlier version) Tested on: amd64 (FreeBSD/amd64 & i386), i386, arm (earlier version) Tested on: powerpc64 (FreeBSD/powerpc64 & powerpc) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D3575
* Trim trailing whitespace.jhb2015-09-301-2/+2
|
* Decode recently added procctl(2) operations.jhb2015-09-291-1/+3
|
* Handle the conditional decoding of execve() argument and environmentjhb2015-08-201-4/+18
| | | | | | | | | arrays generically rather than duplicating a hack in all of the backends. - Add two new system call argument types and use them instead of StringArray for the argument and environment arguments execve and linux_execve. - Honor the -a/-e flags in the handling of these new types. - Instead of printing "<missing argument>" when the decoding is disabled, print the raw pointer value.
* Rework the argv and env string fetching for execve to be more robust.jhb2015-08-201-26/+44
| | | | | | | | | | | | | | Before truss would fetch 100 string pointers and happily walk off the end of the array if it never found a NULL. This also means for a short argv list it could fail entirely if the 100 string pointers spanned into an unmapped page. Instead, fetch page-aligned blocks of string pointers in a loop fetching each string until a NULL is found. While here, make use of the open memstream file descriptor instead of allocating a temporary array. This allows us to fetch each string once instead of twice.
* ino_t is unsigned, so use uintmax_t instead of intmax_t when printing it.jhb2015-08-191-2/+2
| | | | Submitted by: bde (sort of)
* Always use %j with an intmax_t cast to print time_t values. time_t isjhb2015-08-191-17/+18
| | | | | | longer than long on 32-bit platforms with a 64-bit time_t. Inspired by: mail from bde
* Various style and whitespace fixes.jhb2015-08-191-38/+53
|
* Expand the decoding of kevent structures.jhb2015-08-191-8/+86
| | | | | | | - Print the ident value as decimal instead of hexadecimal for filter types that use "small" values such as file descriptors and PIDs. - Decode NOTE_* flags in the fflags field of kevents for several system filter types.
* Change the argument formatting function to use a stdio FILE object openedjhb2015-08-191-217/+154
| | | | | | | | | with open_memstream() to build the string for each argument. This allows for more complicated argument building without resorting to intermediate malloc's, etc. Related, the strsig*() functions no longer return allocated strings but use a static global buffer instead.
* Use an xlat table and xlookup() instead of a home-rolled version for thejhb2015-08-171-9/+6
| | | | sigprocmask operation type.
* Tidy the linux_socketcall decoding:jhb2015-08-171-65/+16
| | | | | | | | - Don't exit if get_struct() fails, instead print the raw pointer value to match all other argument decoding cases. - Use an xlat table instead of a home-rolled switch for the operation name. - Display the nested socketcall args structure as a structure instead of as two inline arguments.
* Decode the optional SOCK_NONBLOCK and SOCK_CLOEXEC flags passed in ajhb2015-08-171-2/+15
| | | | socket type.
* - Decode the arguments for several signal-related system calls: sigpending,jhb2015-08-171-6/+49
| | | | | | | | | sigqueue, sigreturn, sigsuspend, sigtimedwait, sigwait, sigwaitinfo, and thr_kill. - Print signal sets as a structure (with {}'s) and in particular use this to differentiate empty sets from a NULL pointer. - Decode arguments for some other system calls: issetugid, pipe2, sysarch (operations are only decoded for amd64 and i386), and thr_self.
* Consistently use both leading and trailing spaces inside of the {}'sjhb2015-08-061-10/+14
| | | | | when pretty-printing structures. Most structures used both spaces, but some only used a trailing space and some used neither.
* Whitespace fixes to consistently use spaces before }'s andjhb2015-08-061-15/+25
| | | | wrap long lines.
* Decode the arguments passed to the *at() family of system calls. This isjhb2015-08-061-3/+117
| | | | | | | | | | | | especially useful now that libc's open() always calls openat(). While here, fix a few other things: - Decode the mode argument passed to access(), eaccess(), and faccessat(). - Decode the atfd paramete to pretty-print AT_FDCWD. - Decode the special AT_* flags used with some of the *at() system calls. - Decode arguments for fchmod(), lchmod(), fchown(), lchown(), eaccess(), and futimens(). - Decode both of the timeval structures passed to futimes() instead of just the first one.
* Decode the arguments to mkfifo() and fix an off-by-one error in the argumentsjhb2015-08-061-1/+3
| | | | to mknod().
* Don't mark the fcntl flag argument as an output parameter so that it isjhb2015-08-061-1/+1
| | | | always decoded. Previously the argument was not decoded if fcntl() failed.
* Add recently added values of various flags and enumerations includingjhb2015-08-061-12/+20
| | | | | | kevent filters, kevent flags, flags to mmap, seek locations, fcntl operations, file flags, socket domains, open flags, resource limits, and pathconf values.
* Rework get_string() to make it more robust when fetching strings of unknownjhb2015-08-051-17/+29
| | | | | | | length. In particular, instead of blinding fetching 1k blocks, do an initial fetch up to the end of the current page followed by page-sized fetches up to the maximum size. Previously if the 1k buffer crossed a page boundary and the second page was not valid, the entire operation would fail.
* Whitespace fix: remove some spurious spaces before commas.jhb2015-08-051-11/+11
|
* The current POSIX semaphore implementation stores the _has_waiters flagjhb2014-10-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | in a separate word from the _count. This does not permit both items to be updated atomically in a portable manner. As a result, sem_post() must always perform a system call to safely clear _has_waiters. This change removes the _has_waiters field and instead uses the high bit of _count as the _has_waiters flag. A new umtx object type (_usem2) and two new umtx operations are added (SEM_WAIT2 and SEM_WAKE2) to implement these semantics. The older operations are still supported under the COMPAT_FREEBSD9/10 options. The POSIX semaphore API in libc has been updated to use the new implementation. Note that the new implementation is not compatible with the previous implementation. However, this only affects static binaries (which cannot be helped by symbol versioning). Binaries using a dynamic libc will continue to work fine. SEM_MAGIC has been bumped so that mismatched binaries will error rather than corrupting a shared semaphore. In addition, a padding field has been added to sem_t so that it remains the same size. Differential Revision: https://reviews.freebsd.org/D961 Reported by: adrian Reviewed by: kib, jilles (earlier version) Sponsored by: Norse
* Retire the unimplemented MAP_RENAME and MAP_NORESERVE flags to mmap(2).jhb2014-10-181-2/+2
| | | | | | | | Older binaries are still permitted to use these flags. PR: 193961 (exp-run in ports) Differential Revision: https://reviews.freebsd.org/D848 Reviewed by: kib
OpenPOWER on IntegriCloud