Commit Graph

90 Commits

Author SHA1 Message Date
David Xu
1b2bb4a55f posix_spawn() is supported, set _POSIX_SPAWN to 200212L. 2008-07-08 03:08:32 +00:00
Ed Schouten
c605eea952 Turn execvpe() into an internal libc routine.
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
2008-06-23 05:22:06 +00:00
David Xu
947aa542e9 Add POSIX routines called posix_spawn() and posix_spawnp(), which
can be used as replacements for exec/fork in a lot of cases. This
change also added execvpe() which allows environment variable
PATH to be used for searching executable file, it is used for
implementing posix_spawnp().

PR: standards/122051
2008-06-17 06:26:29 +00:00
Konstantin Belousov
196afaa91c Add the restrict qualifiers to the pointer arguments of the readlinkat. 2008-04-10 12:13:56 +00:00
Konstantin Belousov
914c696304 Correct the prototype for the faccessat().
Reported by:	ru
2008-04-01 10:49:06 +00:00
Konstantin Belousov
ba2983e5b3 Add the libc glue and headers definitions for the *at() syscalls.
Based on the submission by rdivacky,
	sponsored by Google Summer of Code 2007
Reviewed by:	rwatson, rdivacky
Tested by:	pho
2008-03-31 12:14:04 +00:00
Ruslan Ermilov
a059c409c2 Added the "restrict" type-qualifier to the readlink() prototype. 2008-02-26 20:33:52 +00:00
Ruslan Ermilov
5f56182b6f Change readlink(2)'s return type and type of the last argument
to match POSIX.

Prodded by:	Alexey Lyashkov
2008-02-12 20:09:04 +00:00
David Xu
0248203e2b _POSIX_THREAD_CPUTIME is now supported. 2008-01-18 08:48:32 +00:00
John Baldwin
ce309a2f26 Add a feature_present(3) function which checks to see if a named kernel
feature is present by checking the kern.features sysctl MIB.

MFC after:	1 week
2008-01-10 22:11:21 +00:00
Pawel Jakub Dawidek
143943aa35 Forgot to commit this file: add definition for _SC_PHYS_PAGES. 2006-12-14 21:42:03 +00:00
David Xu
ea8fe575cd barrier and spin_lock had already been implemented in libpthread and
libthr for a long time, set both _POSIX_BARRIERS and _POSIX_SPIN_LOCKS
to 200112L.
2005-12-02 02:36:13 +00:00
Xin LI
8dcb56dc78 Provide more POSIX-complaint ttyname_r(3) interface[1], which is slightly
different from what has been offered in libc_r (the one spotted in the
original PR which is found in libthr has already been removed by David's
commit, which is rev. 1.44 of lib/libthr/thread/thr_private.h):
	- Use POSIX standard prototype for ttyname_r, which is,
		int ttyname_r(int, char *, size_t);
	  Instead of:
	  	char *ttyname_r(int, char *, size_t);
	  This is to conform IEEE Std 1003.1, 2004 Edition [1].
	- Since we need to use standard errno for return code, include
	  errno.h in ttyname.c
	- Update ttyname(3) implementation according to reflect the API
	  change.
	- Document new ttyname_r(3) behavior
	- Since we already make use of a thread local storage for
	  ttyname(3), remove the BUGS section.
	- Remove conflicting ttyname_r related declarations found in libc_r.

Hopefully this change should not have changed the API/ABI, as the ttyname_r
symbol was never introduced before the last unistd.h change which happens a
couple of days before.

[1] http://www.opengroup.org/onlinepubs/009695399/functions/ttyname.html

Requested by:	Tom McLaughlin <tmclaugh sdf lonestar org>
Through PR:	threads/76938
Patched by:	Craig Rodrigues <rodrigc crodrigues org> (with minor changes)
Prompted by:	mezz@
2005-05-13 16:27:30 +00:00
Xin LI
f73fd5bd75 Connect MLINKS for ttyname_r(3), and add prototype into unistd.h. 2005-05-11 14:07:25 +00:00
David Schultz
3eea66586b - Declare mknod in stat.h (in addition to unistd.h), as per XSI.
- Use blksize_t and blkcnt_t in struct stat.
- Hide non-standard fields in stat.h when !__BSD_VISIBLE.
- Add restrict qualifiers in stat.h.
2005-03-22 01:19:18 +00:00
Tom Rhodes
2f5cde3c64 According to the information on:
http://www.opengroup.org/onlinepubs/009695399/functions/swab.html
the prototype for swab() should be in <unistd.h> and not in <string.h>.
Move it, and update to match SUS.  Leave the prototype in string.h for
now, for backwards compat.

PR:		74751
Submitted by:	Craig Rodrigues <rodrigc@crodrigues.org>
Discussed with:	das
2004-12-10 15:24:40 +00:00
Poul-Henning Kamp
47837a50b0 Remove nfsclnt() prototype. 2004-12-07 07:10:39 +00:00
Andrey A. Chernov
de693dcb58 Add optreset to getopt.h too since NetBSD getopt_long() (but not GNU one)
use it too.
2004-02-23 04:51:07 +00:00
Andrey A. Chernov
1919b885d0 Try to better mimic GNU getopt.h which does not assume to make visible
all unistd.h functions, use _GETOPT_DECLARE define for that.
2004-02-23 04:17:59 +00:00
Andrey A. Chernov
8720578d06 POSIX clearly states that getsubopt() should be declared in <stdlib.h>,
not in <unistd.h>
2004-02-23 03:16:59 +00:00
Marcel Moolenaar
12eb46c8bb Change the definition of NULL on ia64 (for LP64 compilations) from
an int constant to a long constant. This change improves consistency
in the following two ways:
1. The first 8 arguments are always passed in registers on ia64, which
   by virtue of the generated code implicitly widens ints to longs and
   allows the use of an 32-bit integral type for 64-bit arguments.
   Subsequent arguments are passed onto the memory stack, which does
   not exhibit the same behaviour and consequently do not allow this.
   In practice this means that variadic functions taking pointers
   and given NULL (without cast) work as long as the NULL is passed
   in one of the first 8 arguments. A SIGSEGV is more likely the
   result if such would be done for stack-based arguments. This is
   due to the fact that the upper 4 bytes remain undefined.
2. All 64-bit platforms that FreeBSD supports, with the obvious
   exception of ia64, allow 32-bit integral types (specifically NULL)
   when 64-bit pointers are expected in variadic functions by way of
   how the compiler generates code. As such, code that works correctly
   (whether rightfully so or not) on any platform other than ia64, may
   fail on ia64.

To more easily allow tweaking of the definition of NULL, this commit
removes the 12 definitions in the various headers and puts it in a
new header that can be included whenever NULL is to be made visible.

This commit fixes GNOME, emacs, xemacs and a whole bunch of ports
that I don't particularly care about at this time...
2003-12-07 21:10:06 +00:00
Garrett Wollman
73282a3b6c Update gethostname() prototype to match source and standard. 2003-08-19 20:39:49 +00:00
Bruce Evans
f5bdb0f7bd Fixed namespace pollution and unsorting of the 1003.1-1990 list in
previous commit.
2003-07-01 12:09:06 +00:00
Gordon Tetlow
09f49aab84 Add a libc function execvP that takes the search path as an arguement.
Change execvp to be a wrapper around execvP. This is necessary for some
of the /rescue pieces. It may also be more generally applicable as well.

Submitted by:	Tim Kientzle <kientzle@acm.org>
Approved by:	Silence on arch@
2003-06-29 17:33:34 +00:00
Mike Barcroft
90bf910025 o Add typedef for off_t, pid_t, and useconds_t.
o Use useconds_t where appropriate.
o Fix a bug in typedef for uid_t (5.0-R candidate).
2002-12-29 01:07:55 +00:00
Matthew Dillon
92da00bb24 This is David Schultz's swapoff code which I am finally able to commit.
This should be considered highly experimental for the moment.

Submitted by:	David Schultz <dschultz@uclink.Berkeley.EDU>
MFC after:	3 weeks
2002-12-15 19:17:57 +00:00
Mike Barcroft
41eaee750b Fix XSI (X/Open) namespace support. 2002-11-12 14:41:49 +00:00
Garrett Wollman
c9885518de Create a small library function, check_utility_compat(3), to determine
whether a named utility should behave in FreeBSD 4.x-compatible mode
or in a standard mode (default standard).  The configuration is done
malloc(3)-style, with either an environment variable or a symlink.

Update expr(1) to use this new interface.
2002-10-28 00:15:43 +00:00
Garrett Wollman
188c541ceb Update limits and configuration parameters for 1003.1/TC1/D6.
Implement new sysconf keys.  Change the implenentation of
_SC_ASYNCHRONOUS_IO in preparation for the next set of changes.

Move some limits which had been in <sys/syslimits.h> to <limits.h> where
they belong.  They had only ever been in syslimits.h to provide for the
kernel implementation of the CTL_USER MIB branch, which went away with
newsysctl years ago.  (There is a #error in <sys/syslimits.h> which I
will downgrade in the next commit.)
2002-10-27 18:03:02 +00:00
Mike Barcroft
d3d0ea18c2 Move the _POSIX_VERSION constant from <unistd.h> to <sys/unistd.h>, so
that it can be used in-kernel for a sysctl.
2002-10-13 14:25:01 +00:00
Garrett Wollman
dcbfb460ca Back down to 1003.2-1992 for the time being -- it is causing too many
headaches for common but deprecated uses of standard utilities.
2002-09-25 01:58:56 +00:00
Mike Barcroft
56144d5a4d o Move select() helper macros from <sys/types.h> to <sys/select.h>.
o Include <sys/select.h> from <sys/types.h> in the __BSD_VISIBLE case,
  so applications and base software can be slowly updated.
o Prototype select() in <sys/select.h>.  It was previously only
  prototyped in <unistd.h>.
o Add some XXX's to <sys/types.h>.

Reviewed by: -standards
2002-09-23 17:45:51 +00:00
Garrett Wollman
ffb1998145 Define constants for those POSIX options and option groups which are
(or would be) implemented (or not) exclusively in user-land.  A threads
expert should check over the values I have set to make sure that they
correctly reflect reality.

Move all sysconf() keys here from <sys/unistd.h> as they are not implemented
in the kernel.  Add new keys from 1003.1-2001 final text.  (Some additional
keys are expected in TC1.)

Add some protection against redundant declarations between <stdlib.h>
and <unistd.h> for some functions which XSI requires in the former and
BSD traditionally declares in the latter.  Restrict qualifiers and other
changes from 1003.1-2001 have not been made to the functions prototyped here.

(3 of 5)
2002-09-21 02:08:32 +00:00
Tim J. Robbins
58d38e2520 Style: One space between "restrict" qualifier and "*". 2002-09-06 11:24:06 +00:00
Mike Barcroft
abbd890233 o Merge <machine/ansi.h> and <machine/types.h> into a new header
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
  macros, which are only MD because of gratuitous differences between
  architectures.
o Change all headers to make use of this.  This mainly involves
  changing:
    #ifdef _BSD_FOO_T_
    typedef	_BSD_FOO_T_	foo_t;
    #undef _BSD_FOO_T_
    #endif
  to:
    #ifndef _FOO_T_DECLARED
    typedef	__foo_t	foo_t;
    #define	_FOO_T_DECLARED
    #endif

Concept by:	bde
Reviewed by:	jake, obrien
2002-08-21 16:20:02 +00:00
Garrett Wollman
603a6e79d8 Support POSIX/SUS ``programming environment'' mistake in confstr(). 2002-07-15 22:21:33 +00:00
Garrett Wollman
476d84ff75 Move _CS_PATH from <sys/unistd.h> to <unistd.h> -- the kernel isn't involved
in confstr() processing.
2002-07-15 21:56:40 +00:00
Garrett Wollman
ef5b639902 getopt(3) was also added in 1003.2-1992. 2002-07-15 21:32:45 +00:00
Garrett Wollman
2d7aab98c6 Fix visibility:
- symlink() is from 1003.1-2001 and XPG4.2
- fchown() is from 1003.1-2001
- fsync() is from ISO/IEC 9945-1:1995
- confstr() is from 1003.2-1992
2002-07-15 20:33:58 +00:00
Garrett Wollman
1cb2a9ae56 Partially fix namespace visibility issues by using new visibility macros.
Some issues still remain, and will require research in old POSIX standards
if we care to get them right.
2002-06-15 23:35:37 +00:00
Mike Barcroft
8822d3fb83 o Implement <sys/_types.h>, a new header for storing types that are
MI, not required to be a fixed size, and used in multiple headers.
  This will grow in time, as more things move here from <sys/types.h>
  and <machine/ansi.h>.
o Add missing type definitions (uint16_t and uint32_t) to
  <arpa/inet.h> and <netinet/in.h>.
o Reduce pollution in <sys/types.h> by using `#if _FOO_T_DECLARED'
  widgets to avoid including <sys/stdint.h>.
o Add some missing type definitions to <unistd.h> and note the ones
  that still need to be added.
o Make use of <sys/_types.h> primitives in <grp.h> and <sys/types.h>.

Reviewed by:	bde
2002-04-01 08:12:25 +00:00
Warner Losh
bb28f3c29b Breath deep and take __P out of the system include files.
# This appears to not break X11, but I'm having problems compiling the
# glide part of the server with or without this patch, so I can't tell
# for sure.
2002-03-23 17:24:55 +00:00
David Malone
98d1592458 Change brk's prototype from char *brk(const char *) to int brk(const void *)
and sbrk's prototype from char *sbrk(int) to void *sbrk(intptr_t).

This makes us more consistant with NetBSD and standards which include
these functions. Bruce pointed out that ptrdiff_t would probably
have been better than intptr_t, but this doesn't match other
implimentations.

Also remove local declarations of sbrk and unnecessary casting.

PR:		32296
Tested by:	Harti Brandt <brandt@fokus.gmd.de>
MFC after:	1 month
2002-01-24 12:11:31 +00:00
Mark Murray
5567b258eb Use the proper type (gid_t) for (group)->gr_gid to be orthogonal
with uid_t usage and (user)->pw_uid.

PR:		3242
2002-01-22 17:32:53 +00:00
Mike Barcroft
ec55a6050d Fix support for K&R C.
MFC after:	3 days
2001-12-22 05:18:37 +00:00
Alfred Perlstein
0a679263f9 NFS split forgot to prototype nfsclnt() syscall, do it. 2001-11-13 09:07:31 +00:00
Ruslan Ermilov
e117e7a5b0 - Put missing prototype for rcmd() in <unistd.h>.
- Clean up the manpage.
- style(9) rcmdsh.c.

Committed from:	BSDCon/EU 2k+1 terminal room
2001-11-09 15:19:25 +00:00
Robert Watson
7c80f09bae o Update unistd.h with the prototype for the new eaccess(2) system call.
Obtained from:	TrustedBSD Project
2001-09-21 22:50:39 +00:00
Dima Dorfman
e6063dd1a6 Implement getpeereid(3), a front-end to the LOCAL_PEERCRED
socket option for the Unix domain.  It's weaker than the
socket option (this only returns the uid and gid, while the
socket opt. can return the entire group list), and is
implemented mostly for compatibility with OpenBSD.
2001-08-17 22:09:15 +00:00
Robert Nordier
0f639cc8b0 Drop nested __P(). This trips up Supelec's dcc. 2001-05-27 19:57:36 +00:00