Commit Graph

6594 Commits

Author SHA1 Message Date
Ed Schouten
33f3f40866 Reimplement ctermid().
Even though POSIX allows us to return simply /dev/tty as a pathname
identifying the controlling terminal of the running process, it is nicer
if this function were actually useful, by returning the actual pathname
of the controlling terminal.

Implement ctermid() by using the kern.devname sysctl to resolve the
actual name of /dev/tty. Don't use devname(3), since it may return bogus
strings like #C:0x123.
2011-10-01 12:19:48 +00:00
Ed Schouten
9f365aa1d6 Get rid of major/minor number distinction.
As of FreeBSD 6, devices can only be opened through devfs. These device
nodes don't have major and minor numbers anymore. The st_rdev field in
struct stat is simply based a copy of st_ino.

Simply display device numbers as hexadecimal, using "%#jx". This is
allowed by POSIX, since it explicitly states things like the following
(example taken from ls(1)):

	"If the file is a character special or block special file, the
	size of the file may be replaced with implementation-defined
	information associated with the device in question."

This makes the output of these commands more compact. For example, ls(1)
now uses approximately four columns less. While there, simplify the
column length calculation from ls(1) by calling snprintf() with a NULL
buffer.

Don't be afraid; if needed one can still obtain individual major/minor
numbers using stat(1).
2011-09-28 18:53:36 +00:00
Jens Schweikhardt
208aa01fbd Fix grammar.
PR:		140457
Submitted by:	jeremyhu AT apple.com
MFC after:	2 weeks
2011-09-27 17:54:10 +00:00
Gabor Kovesdan
0e6d7a0efa - Fix a trivial bug in iconv. When there is no space to perform the
conversion, conversion must fail and errno must be set to E2BIG.

PR:		standards/160673
Submitted by:	Henning Petersen <henning.petersen@t-online.de>
Reviewed by:	pluknet
Approved by:	re (kib), delphij (mentor)
2011-09-19 22:49:36 +00:00
Konstantin Belousov
745e9ba27d Clarify the behaviour of sigwait() on signal interruption, and note
the difference between sigwait() and sigtimedwait()/sigwaitinfo().

Approved by:	re (bz)
2011-08-25 10:00:38 +00:00
Jonathan Anderson
cfb5f76865 Add experimental support for process descriptors
A "process descriptor" file descriptor is used to manage processes
without using the PID namespace. This is required for Capsicum's
Capability Mode, where the PID namespace is unavailable.

New system calls pdfork(2) and pdkill(2) offer the functional equivalents
of fork(2) and kill(2). pdgetpid(2) allows querying the PID of the remote
process for debugging purposes. The currently-unimplemented pdwait(2) will,
in the future, allow querying rusage/exit status. In the interim, poll(2)
may be used to check (and wait for) process termination.

When a process is referenced by a process descriptor, it does not issue
SIGCHLD to the parent, making it suitable for use in libraries---a common
scenario when using library compartmentalisation from within large
applications (such as web browsers). Some observers may note a similarity
to Mach task ports; process descriptors provide a subset of this behaviour,
but in a UNIX style.

This feature is enabled by "options PROCDESC", but as with several other
Capsicum kernel features, is not enabled by default in GENERIC 9.0.

Reviewed by: jhb, kib
Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-18 22:51:30 +00:00
Robert Watson
a3427d6a49 Cross-reference cap_new(2) from dup(2), as they have similar functionality.
Approved by:	re (kib)
2011-08-14 12:41:44 +00:00
Hiroki Sato
3462b16f29 Fix a pathname (s,netinet/if_ether.h,net/ethernet.h,).
PR:		docs/159341
Submitted by:	Garrett Cooper
Approved by:	re (kib)
2011-08-08 03:09:03 +00:00
Michael Tuexen
ca85e9482a The result of a joint work between rrs@ and myself at the IETF:
* Decouple the path supervision using a separate HB timer per path.
* Add support for potentially failed state.
* Bring back RTO.min to 1 second.
* Accept packets on IP-addresses already announced via an ASCONF
* While there: do some cleanups.

Approved by: re@
MFC after: 2 months.
2011-08-03 20:21:00 +00:00
George V. Neville-Neil
a388fa6823 Remove incorrect attribution.
Approved by:	re (kib)
Pointed out by: brueffer
Pointy hat to: gnn
2011-07-21 20:06:14 +00:00
George V. Neville-Neil
c03b5ad6a9 Make both stpcpy and strcpy be assembly language implementations
on amd64.

Submitted by:	Guillaume Morin (guillaume at morinfr.org)
Reviewed by:	kib, jhb
Approved by:	re (bz)
MFC after:	1 month
2011-07-21 16:32:13 +00:00
Jonathan Anderson
1b7270658f Add cap_new(2) and cap_getrights(2) symbols to libc.
These system calls have already been implemented in the kernel; now we
hook up libc symbols so userspace can drive them.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-07-20 13:29:39 +00:00
Dimitry Andric
8bd9dc088e Fix building of 32-bit compat libraries on amd64 with clang, and using
-g, by reverting r219139.  The LLVM PR referenced in that revision was
fixed in the mean time, and we imported a clang snapshot soon
afterwards, so the temporary workaround of disabling clang's integrated
assembler is no longer needed.

In this particular case, using e.g. DEBUG_FLAGS=-g causes clang to
output certain directives into assembly that our version of GNU as
chokes on.

Reported by:	dougb
Approved by:	re (kib)
2011-07-18 20:07:29 +00:00
Konstantin Belousov
134e789b67 Document RFTSIGZMB. Fix spelling of SIGCHLD. Note that signals are
delivered, not returned.

MFC after:	1 week
2011-07-12 20:38:42 +00:00
Jilles Tjoelker
9ea47cacda posix_spawn: If an error is detected in the child process, reap the zombie.
Formerly, in this case an error was returned but the pid was also returned
to the application, requiring the application to use unspecified behaviour
(the returned pid in error situations) to avoid zombies.

Now, reap the zombie and do not return the pid.

MFC after:	2 weeks
2011-07-10 14:20:11 +00:00
Kevin Lo
5c6d2a0100 Add a HISTORY section
Requested by:	arundel
2011-07-10 06:57:00 +00:00
Kevin Lo
d98b6d6edd - Add xdr_sizeof(3) to libc
- Document xdr_sizeof(3); from NetBSD

Discussed with:	kib
2011-07-09 07:43:56 +00:00
Ed Schouten
1d9a9b79d0 Fix whitespace inconsistencies in libc in files copyrighted by me. 2011-06-26 18:27:17 +00:00
Marius Strobl
1e01d8915a Change sparc64 to use the initial exec TLS model, too. This avoids random
assertion failures in _malloc_thread_cleanup().
2011-06-21 19:15:23 +00:00
Alexander Kabaev
472d2173ba Put a quick bandaid on internal citrus locking.
The code is not quite right still, but it programs from deadlocking
on themselves if one enables new citrus code by mistake.
2011-06-19 13:35:46 +00:00
Ben Laurie
5f301949ef Fix clang warnings.
Approved by:	philip (mentor)
2011-06-18 13:56:33 +00:00
Michael Tuexen
bb3c45bf86 Document the latest changes to sctp_opt_info() in the code.
This makes sctp_opt_info() compiliant with the latest version
of the socket API ID.
2011-06-18 10:36:05 +00:00
David E. O'Brien
a57971c679 Note how wait(3) is implemented. 2011-06-18 00:53:51 +00:00
Xin LI
488d6e0c3d Sync with OpenBSD, primarily make the code easier to read, and a license
change to standard OpenBSD ISC license.

Obtained from:	OpenBSD
MFC after:	2 weeks
2011-06-18 00:33:34 +00:00
Xin LI
8e27b6e60f Sync with OpenBSD (zap rcsid).
MFC after:	2 weeks
2011-06-18 00:29:10 +00:00
Xin LI
25879947d6 The flags argument of mpool_get() is meaningful, document it.
MFC after:	2 weeks
2011-06-18 00:10:21 +00:00
Jilles Tjoelker
876b6796f3 posix_spawn(3): Document r222511 (trying to close already closed fd).
MFC after:	1 week
2011-06-17 21:16:27 +00:00
Michael Tuexen
bb2c20c1a8 Add SCTP_MAX_BURST support to sctp_opt_info().
This only applies to 9.0 and higher, since the type
of the values has changed since we introduced it.
So it can't be MFCed.
2011-06-17 07:06:42 +00:00
Michael Tuexen
13aae0bf1d Update the list of supported socket options for sctp_opt_info().
MFC after: 1 month.
2011-06-17 07:03:42 +00:00
Michael Tuexen
c67a03f99a Fix two typos and remove redundant code.
MFC after: 1 month.
2011-06-16 17:30:50 +00:00
Michael Tuexen
0b064106dd * Fix the handling of addresses in sctp_sendv().
* Add support for SCTP_SENDV_NOINFO.
* Improve the error handling of sctp_sendv() and sctp_recv().

MFC after: 1 month
2011-06-16 15:36:09 +00:00
David Xu
2575b4717b Use size of int to fetch sysctl kern.sched.cpusetsize because it had
switched from long to int type in kernel.

Fixed by: pluknet
2011-06-16 02:22:24 +00:00
Michael Tuexen
e2e7c62edc Add support for the newly added SCTP API.
In particular add support for:
* SCTP_SNDINFO, SCTP_PRINFO, SCTP_AUTHINFO, SCTP_DSTADDRV4, and
  SCTP_DSTADDRV6 cmsgs.
* SCTP_NXTINFO and SCTP_RCVINFO cmgs.
* SCTP_EVENT, SCTP_RECVRCVINFO, SCTP_RECVNXTINFO and SCTP_DEFAULT_SNDINFO
  socket option.
* Special association ids (SCTP_FUTURE_ASSOC, ...)
* sctp_recvv() and sctp_sendv() functions.

MFC after: 1 month.
2011-06-15 23:50:27 +00:00
Ulrich Spörlein
135bce2a9e mdoc: reorder sections consistently 2011-06-02 09:56:53 +00:00
Jilles Tjoelker
562b28821e posix_spawn(): Do not fail when trying to close an fd that is not open.
As noted in Austin Group issue #370 (an interpretation has been issued),
failing posix_spawn() because an fd specified with
posix_spawn_file_actions_addclose() is not open is unnecessarily harsh, and
there are existing implementations that do not fail posix_spawn() for this
reason.

Reviewed by:	ed
MFC after:	10 days
2011-05-30 21:41:06 +00:00
Gabor Kovesdan
15a4dfe2a5 - Move some internal functions to the private namespace
Submitted by:	kan
Approved by:	delphij (mentor)
2011-05-27 10:40:34 +00:00
Ruslan Ermilov
a6d11f7139 [mdoc] Fixed .Dt call. 2011-05-25 14:13:53 +00:00
Jilles Tjoelker
7a18096cea mq_setattr(2): Add missing const to man page.
The declaration in the header file is correct.

MFC after:	1 week
2011-05-17 21:03:34 +00:00
Attilio Rao
4b547324c0 Disconnect sun4v architecture from the three.
Some files keep the SUN4V tags as a code reference, for the future,
if any rewamped sun4v support wants to be added again.

Reviewed by:	marius
Tested by:	sbruno
Approved by:	re
2011-05-14 01:53:38 +00:00
Sergey Kandaurov
e2ea39cbdb Update sticky(7) cross references.
PR:		docs/124468
X-MFC with:	r218998
2011-05-13 16:29:57 +00:00
Michael Tuexen
48f65f00fa * Update copyright notice.
* Cleanup usage of iov's.
* Add support for SCTP_TIMEOUTS socketoption.
* Fix a bug in sctp_recvmsg(): return the msg_flags in case of an error.
* Fix a bug in the error handling of sctp_peeloff(): return the -1.
2011-05-05 19:49:27 +00:00
Xin LI
5b5140322d Fix prototype for ffsll(3) and fls(3).
PR:		docs/156796
Submitted by:	Jean-Yves Migeon <jeanyves.migeon free.fr>
MFC after:	3 days
2011-05-03 19:33:06 +00:00
Glen Barber
796b74169c - Clarification on kld_file_stat.size
- While here, remove a few C comments that don't seem to contribute
  anything additional to the man page.

PR:		146047
Submitted by:	arundel
MFC after:	3 days
2011-04-23 20:59:58 +00:00
Matthew D Fleming
d91f88f7f3 Add the posix_fallocate(2) syscall. The default implementation in
vop_stdallocate() is filesystem agnostic and will run as slow as a
read/write loop in userspace; however, it serves to correctly
implement the functionality for filesystems that do not implement a
VOP_ALLOCATE.

Note that __FreeBSD_version was already bumped today to 900036 for any
ports which would like to use this function.

Also reserve space in the syscall table for posix_fadvise(2).

Reviewed by:	-arch (previous version)
2011-04-18 16:32:22 +00:00
Jilles Tjoelker
3472288282 getfh(2): Add xrefs for fhopen(2), open(2), stat(2).
MFC after:	1 week
2011-04-14 22:06:11 +00:00
Sergey Kandaurov
603c2b9b9b Remove vestiges of disklabel(5).
Reviewed by:	uqs
MFC after:	5 days
2011-04-14 08:53:04 +00:00
Rick Macklem
e2c83f74f4 Fix a bug in the userland rpc library, where it would use a
negative return value from write to update its position in
a buffer. The patch, courtesy of Andrey Simonenko, also simplifies
a conditional by removing the "i != cnt" clause, since it is
always true at this point in the code. The bug caused problems
for mountd, when it generated a large reply to an exports RPC
request.

Submitted by:	simon at comsys.ntu-kpi.kiev.ua
MFC after:	2 weeks
2011-04-10 14:11:07 +00:00
Edward Tomasz Napierala
181b4eebb9 Make it possible to use permission sets (full_set, modify_set, read_set
and write_set) with setfacl(1).

PR:		kern/154113
Submitted by:	Shawn Webb <lattera at gmail dot com> (earlier version)
MFC after:	1 month
2011-04-09 07:42:25 +00:00
Jilles Tjoelker
2973057493 Allow strerror(0) and strerror_r(0, ...).
Of course, strerror_r() may still fail with ERANGE.

Although the POSIX specification said this could fail with EINVAL and
doing this likely indicates invalid use of errno, most other
implementations permitted it, various POSIX testsuites require it to
work (matching the older sys_errlist array) and apparently some
applications depend on it.

PR:		standards/151316
MFC after:	1 week
2011-04-05 21:56:05 +00:00
Konstantin Belousov
05f2ecd1fa Fix mdoc errors.
Submitted by:	ru
MFC after:	3 days
2011-04-01 19:57:27 +00:00