Commit Graph

398 Commits

Author SHA1 Message Date
Emmanuel Vadot
1d6d0a43ce pkgbase: move man pages from runtime-manual to runtime
We don't split the other man pages in their own package so do the same for runtime.

Reviewed by:	bapt, gjb
Differential Revision:	https://reviews.freebsd.org/D20962
2019-07-19 15:12:20 +00:00
Mark Johnston
970a1ed345 Add some missing MLINKs for tree(3).
MFC after:	3 days
2019-06-17 16:57:44 +00:00
Edward Tomasz Napierala
ac0879c396 Add usage example to tree(3).
Obtained from:	OpenBSD
MFC after:	2 weeks
Sponsored by:	Klara Inc.
2019-05-08 18:49:59 +00:00
John Baldwin
2e43efd0bb Drop "All rights reserved" from my copyright statements.
Reviewed by:	rgrimes
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D19485
2019-03-06 22:11:45 +00:00
Mark Johnston
a51c7dc5fe Typo.
Reported by:	Christian Barthel
MFC after:	3 days
2019-01-02 16:01:54 +00:00
Mateusz Piotrowski
e8df8a1da0 CMSG_DATA(3): Use consistent variable names
The description of CMSG_FIRSTHDR used two variables (mhdr and msg) to
reference the same thing. Use msghdr consistency across the manual page
instead.

Reviewed by:	bcr
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
MFC after:      1 week
Differential Revision:	https://reviews.freebsd.org/D17804
2018-11-01 15:40:57 +00:00
Mateusz Piotrowski
c8b8b38e5f Document socket control message routines for ancillary data access (CMSG_DATA).
PR:		227777
Reviewed by:	bcr, eadler
Approved by:	mat (mentor), manpages (bcr)
Obtained from:	OpenBSD
Differential Revision:	https://reviews.freebsd.org/D15215
2018-08-19 17:42:49 +00:00
Konstantin Belousov
74b7f25ef3 Fix typo.
Noted by:	Yuri Pankov <yuripv@yuripv.net>
MFC after:	12 days
2018-08-19 13:23:46 +00:00
Pedro F. Giffuni
b6413b6db8 POSIX compliance improvements in the pthread(3) functions.
This basically adds makes use of the C99 restrict keyword, and also
adds some 'const's to four threading functions: pthread_mutexattr_gettype(),
pthread_mutexattr_getprioceiling(), pthread_mutexattr_getprotocol(), and
pthread_mutex_getprioceiling. The changes are in accordance to POSIX/SUSv4-2018.

Hinted by:	DragonFlyBSD

Relnotes:	yes
MFC after:	1 month
Differential Revision:	D16722
2018-08-18 01:05:38 +00:00
Konstantin Belousov
4627d47bc8 Add pthread_get_name_np(3).
The function retrieves the thread name previously set by
pthread_set_name_np(3). The name is cached in the process memory.

Requested by:	Willem Jan Withagen <wjw@digiware.nl>
Man page update:	Yuri Pankov <yuripv@yuripv.net>
Reviewed by:	ian (previous version)
Discussed with:	arichardson, bjk (man page)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D16702
2018-08-17 18:34:07 +00:00
Alan Somers
6040822c4e Make timespecadd(3) and friends public
The timespecadd(3) family of macros were imported from NetBSD back in
r35029. However, they were initially guarded by #ifdef _KERNEL. In the
meantime, we have grown at least 28 syscalls that use timespecs in some
way, leading many programs both inside and outside of the base system to
redefine those macros. It's better just to make the definitions public.

Our kernel currently defines two-argument versions of timespecadd and
timespecsub.  NetBSD, OpenBSD, and FreeDesktop.org's libbsd, however, define
three-argument versions.  Solaris also defines a three-argument version, but
only in its kernel.  This revision changes our definition to match the
common three-argument version.

Bump _FreeBSD_version due to the breaking KPI change.

Discussed with:	cem, jilles, ian, bde
Differential Revision:	https://reviews.freebsd.org/D14725
2018-07-30 15:46:40 +00:00
Warner Losh
2a9836a508 Depart from normal man page proactice a little and provide guidance on
when to use assert, as well as providing a bad example of using
assert.  While not strictly necessary, experience has shown issues
with poor assert choice happen often enough that this departure seems
warranted. Also, tighten up the previous example (there's no need
to have extra paragraphs or gratuitously long lines).

Reviewed by: emaste@ (earlier version)
2018-05-31 14:23:33 +00:00
Eric van Gyzen
23d2383783 Bump the date on man pages in r334306
It seems a shame to ruin the patina of the June 4, 1993 date
on abort.3, especially since it still matched the date of
the SCCS ID, but those are the rules.

Reported by:	araujo
MFC after:	3 days
Sponsored by:	Dell EMC
2018-05-29 02:41:32 +00:00
Eric van Gyzen
4c72d794f0 Cross-reference abort2(2) from a few man pages
I didn't know abort2 existed until it was mentioned on a mailing list.
Mention it in related pages so others can find it easily.

MFC after:	3 days
Sponsored by:	Dell EMC
2018-05-29 01:16:00 +00:00
Xin LI
b6f7731dba Remove "All rights reserved" from my files.
See r333391 for the rationale.

MFC after:	1 week
2018-05-10 06:41:08 +00:00
John Baldwin
c81f8aa528 Document the TRAP_CAP code for SIGTRAP.
MFC after:	3 days
2018-04-24 23:20:15 +00:00
Eitan Adler
bcc5c36fe5 pthread: adding missing header to man page
Reported by:	swildner@DragonFlyBSD.org
2018-02-03 20:50:46 +00:00
Warner Losh
133d84f4d1 Be less verbose and more precise. 2018-01-01 19:04:40 +00:00
Warner Losh
a1895a9244 Add note that assert.h may be included multiple times
with and without NDEBUG defined.
2018-01-01 18:59:11 +00:00
Warner Losh
c40f7c0583 assert(3) appeared first in the 7th Edition Unix, not the 6th, at
least according to the extant distributions preserved at tuhs.org.

Obtained from: http://www.tuhs.org/cgi-bin/utree.pl?file=V7/usr/include/assert.h
2018-01-01 18:55:13 +00:00
Eitan Adler
df0e741af5 Add missing word
Reported by:	swildner@dragonflybsd.org
2017-12-02 19:10:52 +00:00
Eitan Adler
82012c275f Fix pthread_condattr(3) type
Reported by: Sascha Wildner <swildner@dragonflybsd.org>
Reviewed by: mjg
2017-11-30 07:15:32 +00:00
Konstantin Belousov
1e94ddb453 Provide more detailed specification for major(), minor() and makedev().
Remove some statements which are no longer correct after ino64, and
clarify other.

The rewording is not in fact specific to ino64 and improvements are
useful on the stable branches.

Noted and reviewed by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-08-05 07:52:15 +00:00
Enji Cooper
1fdf757c79 pthread_mutex_consistent: sort SEE ALSO by reference name
MFC after:	3 days
Reported by:	make manlint
Sponsored by:	Dell EMC Isilon
2017-03-27 19:17:30 +00:00
Enji Cooper
3bbc702ffb intro(3): fix markup
- Use `Em` with `.It` macro when referring to other libraries, instead of
  `Xr`.
- Use `.Em` instead of `.Xr` when referring to libraries.
- Remove commented out lines.

MFC after:	1 month
Reported by:	make manlint
Sponsored by:	Dell EMC Isilon
2017-03-23 05:26:44 +00:00
Eric van Gyzen
3f8455b090 Add clock_nanosleep()
Add a clock_nanosleep() syscall, as specified by POSIX.
Make nanosleep() a wrapper around it.

Attach the clock_nanosleep test from NetBSD. Adjust it for the
FreeBSD behavior of updating rmtp only when interrupted by a signal.
I believe this to be POSIX-compliant, since POSIX mentions the rmtp
parameter only in the paragraph about EINTR. This is also what
Linux does. (NetBSD updates rmtp unconditionally.)

Copy the whole nanosleep.2 man page from NetBSD because it is complete
and closely resembles the POSIX description. Edit, polish, and reword it
a bit, being sure to keep any relevant text from the FreeBSD page.

Reviewed by:	kib, ngie, jilles
MFC after:	3 weeks
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D10020
2017-03-19 00:51:12 +00:00
Eric van Gyzen
b215ceaaec Add sem_clockwait_np()
This function allows the caller to specify the reference clock
and choose between absolute and relative mode.  In relative mode,
the remaining time can be returned.

The API is similar to clock_nanosleep(3).  Thanks to Ed Schouten
for that suggestion.

While I'm here, reduce the sleep time in the semaphore "child"
test to greatly reduce its runtime.  Also add a reasonable timeout.

Reviewed by:	ed (userland)
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D9656
2017-02-23 19:36:38 +00:00
Eric van Gyzen
ff07dd913e thr_set_name(): silently truncate the given name as needed
Instead of failing with ENAMETOOLONG, which is swallowed by
pthread_set_name_np() anyway, truncate the given name to MAXCOMLEN+1
bytes.  This is more likely what the user wants, and saves the
caller from truncating it before the call (which was the only
recourse).

Polish pthread_set_name_np(3) and add a .Xr to thr_set_name(2)
so the user might find the documentation for this behavior.

Reviewed by:	jilles
MFC after:	3 days
Sponsored by:	Dell EMC
2016-12-03 01:14:21 +00:00
Conrad Meyer
06b9366795 queue(3): Enhance queue debugging macros
Split the QUEUE_MACRO_DEBUG into QUEUE_MACRO_DEBUG_TRACE and
QUEUE_MACRO_DEBUG_TRASH.

Add the debug macrso QMD_IS_TRASHED() and QMD_SLIST_CHECK_PREVPTR().

Document these in queue.3.

Reviewed by:	emaste
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D3984
2016-09-08 21:20:01 +00:00
Kirk McKusick
65d3199746 Add two new macros, SLIST_CONCAT and LIST_CONCAT. Note in both the
queue.h header file and in the queue.3 manual page that they are O(n)
so should be used only in low-usage paths with short lists (otherwise
an STAILQ or TAILQ should be used).

Reviewed by: kib
2016-08-16 17:07:48 +00:00
Konstantin Belousov
1c1cc89580 The fdatasync(2) call must be cancellation point.
Sponsored by:	The FreeBSD Foundation
MFC after:	13 days
2016-08-16 08:27:03 +00:00
Benjamin Kaduk
90df28ccf7 Re-correct the documentation for the 'type' parameter of the _SWAP
macros from sys/queue.h -- only the singly-linked forms do not need
the 'field' argument.

Pointy Hat to:	bjk
Reported by:	akshay1994.leo_gmail.com
2016-08-06 19:12:23 +00:00
Benjamin Kaduk
60fa6e9f49 Correct the documentation of the 'type' parameter for the _SWAP
macros from sys/queue.h

Submitted by:	akshay1994.leo_gmail.com (for STAILQ)
Differential Revision:	https://reviews.freebsd.org/D7428
2016-08-06 17:27:07 +00:00
Sergey Kandaurov
18ac59f431 Grammar fixes. 2016-08-04 11:38:53 +00:00
Sergey Kandaurov
eb6a434243 mdoc: The .Fn function. 2016-08-04 11:22:51 +00:00
Bryan Drewery
e7f9419458 Add links for bit_ffc_at(3) and bit_ffs_at(3).
MFC after:	3 days
2016-07-26 03:47:16 +00:00
John Baldwin
463970da7b Add documentation for the sigevent structure.
- Add a sigevent(3) manpage to give a general overview of the sigevent
  structure and the available notification mechanisms.
- Document that AIO requests contain a nested sigevent structure that can
  be used to request completion notification.
- Expand the sigevent details in other manuals to note details such as
  the extra values stored in a queued signal's information or in a posted
  kevent.

Reviewed by:	kib
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D7122
2016-07-15 15:12:56 +00:00
John Baldwin
c93042724e Fix rendering issues.
- Use Ta to separate column headers.
- Correct width of the 'Code' column in the last table.

MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D7118
2016-07-14 23:35:55 +00:00
Edward Tomasz Napierala
eb49a6d366 Last few instances of "sentence not on new line".
MFC after:	1 month
2016-06-08 09:36:07 +00:00
Eric van Gyzen
28e3357884 Improve errno documentation in pthread_create(3) and thr_new(2)
Add some missing errno values to thr_new(2) and pthread_create(3).
In particular, EDEADLK was not documented in the latter.
While I'm here, improve some English and cross-references.

Reviewed by:	kib
Sponsored by:	Dell Inc.
Differential Revision:	https://reviews.freebsd.org/D6663
2016-06-03 14:30:32 +00:00
Jilles Tjoelker
631e4e3abe Remove mentions that PTHREAD_PROCESS_SHARED is not supported from man pages.
Also add support for process-shared synchronization objects to the HISTORY
sections where they already exist.
2016-05-31 21:16:34 +00:00
Jilles Tjoelker
a8aad86462 Fix typo ESRC -> ESRCH in pthread man pages. 2016-05-31 21:09:42 +00:00
Jilles Tjoelker
60404ec965 Remove non-history libkse references and fix PTHREAD_PROCESSES_PRIVATE typo. 2016-05-29 18:25:11 +00:00
Alan Somers
1b82e02f4d Add bit_count to the bitstring(3) api
Add a bit_count function, which efficiently counts the number of bits set in
a bitstring.

sys/sys/bitstring.h
tests/sys/sys/bitstring_test.c
share/man/man3/bitstring.3
	Add bit_alloc

sys/kern/subr_unit.c
	Use bit_count instead of a naive counting loop in check_unrhdr, used
	when INVARIANTS are enabled. The userland test runs about 6x faster
	in a generic build, or 8.5x faster when built for Nehalem, which has
	the POPCNT instruction.

sys/sys/param.h
	Bump __FreeBSD_version due to the addition of bit_alloc

UPDATING
	Add a note about the ABI incompatibility of the bitstring(3)
	changes, as suggested by lidl.

Suggested by:	gibbs
Reviewed by:	gibbs, ngie
MFC after:	9 days
X-MFC-With:	299090, 300538
Relnotes:	yes
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D6255
2016-05-23 20:29:18 +00:00
Konstantin Belousov
2a339d9e3d Add implementation of robust mutexes, hopefully close enough to the
intention of the POSIX IEEE Std 1003.1TM-2008/Cor 1-2013.

A robust mutex is guaranteed to be cleared by the system upon either
thread or process owner termination while the mutex is held.  The next
mutex locker is then notified about inconsistent mutex state and can
execute (or abandon) corrective actions.

The patch mostly consists of small changes here and there, adding
neccessary checks for the inconsistent and abandoned conditions into
existing paths.  Additionally, the thread exit handler was extended to
iterate over the userspace-maintained list of owned robust mutexes,
unlocking and marking as terminated each of them.

The list of owned robust mutexes cannot be maintained atomically
synchronous with the mutex lock state (it is possible in kernel, but
is too expensive).  Instead, for the duration of lock or unlock
operation, the current mutex is remembered in a special slot that is
also checked by the kernel at thread termination.

Kernel must be aware about the per-thread location of the heads of
robust mutex lists and the current active mutex slot.  When a thread
touches a robust mutex for the first time, a new umtx op syscall is
issued which informs about location of lists heads.

The umtx sleep queues for PP and PI mutexes are split between
non-robust and robust.

Somewhat unrelated changes in the patch:
1. Style.
2. The fix for proper tdfind() call use in umtxq_sleep_pi() for shared
   pi mutexes.
3. Removal of the userspace struct pthread_mutex m_owner field.
4. The sysctl kern.ipc.umtx_vnode_persistent is added, which controls
   the lifetime of the shared mutex associated with a vnode' page.

Reviewed by:	jilles (previous version, supposedly the objection was fixed)
Discussed with:	brooks, Martin Simmons <martin@lispworks.com> (some aspects)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
2016-05-17 09:56:22 +00:00
Konstantin Belousov
9c671dbd0b Warn about consequences of suspending threads in arbitrary state of
execution.

While there, fix minor nits in markup.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-05-05 10:22:19 +00:00
Alan Somers
8907f744ff Improve performance and functionality of the bitstring(3) api
Two new functions are provided, bit_ffs_at() and bit_ffc_at(), which allow
for efficient searching of set or cleared bits starting from any bit offset
within the bit string.

Performance is improved by operating on longs instead of bytes and using
ffsl() for searches within a long. ffsl() is a compiler builtin in both
clang and gcc for most architectures, converting what was a brute force
while loop search into a couple of instructions.

All of the bitstring(3) API continues to be contained in the header file.
Some of the functions are large enough that perhaps they should be uninlined
and moved to a library, but that is beyond the scope of this commit.

sys/sys/bitstring.h:
        Convert the majority of the existing bit string implementation from
        macros to inline functions.

        Properly protect the implementation from inadvertant macro expansion
        when included in a user's program by prefixing all private
        macros/functions and local variables with '_'.

        Add bit_ffs_at() and bit_ffc_at(). Implement bit_ffs() and
        bit_ffc() in terms of their "at" counterparts.

        Provide a kernel implementation of bit_alloc(), making the full API
        usable in the kernel.

        Improve code documenation.

share/man/man3/bitstring.3:
        Add pre-exisiting API bit_ffc() to the synopsis.

        Document new APIs.

        Document the initialization state of the bit strings
        allocated/declared by bit_alloc() and bit_decl().

        Correct documentation for bitstr_size(). The original code comments
        indicate the size is in bytes, not "elements of bitstr_t". The new
        implementation follows this lead. Only hastd assumed "elements"
        rather than bytes and it has been corrected.

etc/mtree/BSD.tests.dist:
tests/sys/Makefile:
tests/sys/sys/Makefile:
tests/sys/sys/bitstring.c:
        Add tests for all existing and new functionality.

include/bitstring.h
	Include all headers needed by sys/bitstring.h

lib/libbluetooth/bluetooth.h:
usr.sbin/bluetooth/hccontrol/le.c:
        Include bitstring.h instead of sys/bitstring.h.

sbin/hastd/activemap.c:
        Correct usage of bitstr_size().

sys/dev/xen/blkback/blkback.c
        Use new bit_alloc.

sys/kern/subr_unit.c:
        Remove hard-coded assumption that sizeof(bitstr_t) is 1.  Get rid of
        unrb.busy, which caches the number of bits set in unrb.map.  When
        INVARIANTS are disabled, nothing needs to know that information.
        callapse_unr can be adapted to use bit_ffs and bit_ffc instead.
        Eliminating unrb.busy saves memory, simplifies the code, and
        provides a slight speedup when INVARIANTS are disabled.

sys/net/flowtable.c:
        Use the new kernel implementation of bit-alloc, instead of hacking
        the old libc-dependent macro.

sys/sys/param.h
        Update __FreeBSD_version to indicate availability of new API

Submitted by:   gibbs, asomers
Reviewed by:    gibbs, ngie
MFC after:      4 weeks
Sponsored by:   Spectra Logic Corp
Differential Revision:  https://reviews.freebsd.org/D6004
2016-05-04 22:34:11 +00:00
Glen Barber
bf2df150f1 Separate manual pages into their own package.
Sponsored by:	The FreeBSD Foundation
2016-01-21 16:36:33 +00:00
Conrad Meyer
7ebf41220c Document bitset(9) 2015-10-17 19:55:58 +00:00
Hans Petter Selasky
38b622e199 Make the system queue header file fully usable within C++ programs by
adding macros to define class lists.

This change is backwards compatible for all use within C and C++
programs. Only C++ programs will have added support to use the queue
macros within classes. Previously the queue macros could only be used
within structures.

The queue.3 manual page has been updated to describe the new
functionality and some alphabetic sorting has been done while
at it.

Differential Revision:	https://reviews.freebsd.org/D2745
PR:			200827 (exp-run)
MFC after:		2 weeks
2015-06-28 21:06:45 +00:00