Commit Graph

6915 Commits

Author SHA1 Message Date
Eitan Adler
96240c89f0 Correct double "the the"
Approved by:	cperciva
MFC after:	3 days
2012-09-14 21:28:56 +00:00
Ed Maste
6cbb6bbb77 According to a clarification at http://austingroupbugs.net/view.php?id=503
ptsname may set errno, so avoid saving and restoring errno across the
function.

PR:		standards/171572
2012-09-12 17:54:09 +00:00
Ed Maste
7877ed7ce3 Avoid mapping ENOENT to ENOTDIR for non-existent path components.
The ENOTDIR mapping was introduced in r235266 for kern/128933 based on
an interpretation of the somewhat ambiguous language in the POSIX realpath
specification.  The interpretation is inconsistent with Solaris and Linux,
a regression from 9.0, and does not appear to be permitted by the
description of ENOTDIR:

     20 ENOTDIR Not a directory.  A component of the specified pathname
             existed, but it was not a directory, when a directory was
             expected.

PR:		standards/171577
MFC after:	3 days
2012-09-12 17:05:39 +00:00
Gleb Smirnoff
be81cc14ab Describe in detail required conditions for receiving the SCM_CREDS
control message and suggest to use LOCAL_CREDS setsockopt() for
reliability.
2012-09-12 09:50:17 +00:00
Dag-Erling Smørgrav
f7668359de Add the same warning to rand48(3) as to rand(3) and random(3).
MFC after:	3 days
2012-09-11 12:55:15 +00:00
Jilles Tjoelker
5ac7ffcc38 libc/amd64: Do not export .cerror.
For some reason, libc exports the symbol .cerror (HIDENAME(cerror)), albeit
in the FBSDprivate_1.0 version. It looks like there is no reason for this
since it is not used from other libraries. Given that it cannot be accessed
from C and its strange calling convention, it is rather unlikely that other
things rely on it. Perhaps it is from a time when symbols could not be
hidden.

Most of the amd64 assembler code jumps to .cerror using the GOT. It can jump
to it directly now, as in non-PIC mode.

There are also some minor size optimizations to instructions but they yield
virtually no benefit in the size of libc.so.7 due to padding.

Reviewed by:	kib
2012-09-06 20:59:49 +00:00
Tom Rhodes
4d8ed60cb4 Avoid segfault if name is invalid. Basically, only
check for CTL_USER if the sysctl fails with ENOENT.

PR:		169056
Reviewed by:	jhb
2012-09-06 20:15:44 +00:00
Jilles Tjoelker
a8599e090f libc/i386: Do not export .cerror.
For some reason, libc exports the symbol .cerror (HIDENAME(cerror)), albeit
in the FBSDprivate_1.0 version. It looks like there is no reason for this
since it is not used from other libraries. Given that it cannot be accessed
from C and its strange calling convention, it is rather unlikely that other
things rely on it. Perhaps it is from a time when symbols could not be
hidden.

Not exporting .cerror causes it to be jumped to directly instead of via the
PLT.

This change also takes advantage of .cerror's new status by not saving and
loading %ebx before jumping to it. (Therefore, .cerror now saves and loads
%ebx itself.) Where there was a conditional jump to a jump to .cerror, the
conditional jump has been changed to jump to .cerror directly (many modern
CPUs don't do static prediction and in any case it is not much of a benefit
anyway).

This change makes libc.so.7 a few kilobytes smaller.

Reviewed by:	kib
2012-09-05 21:41:05 +00:00
John Baldwin
9baeec2982 When WIFCONTINUED was added, the number of "first" macros grew from
three to four.

MFC after:	1 week
2012-09-05 11:55:53 +00:00
Dag-Erling Smørgrav
cf949d1283 Bump dates.
Reminded by:	bz@
2012-09-04 22:03:16 +00:00
Dag-Erling Smørgrav
edab57e04e Add a prominent warning about these functions' unsuitability for
cryptographic purposes, and recommend using arc4random(3) instead.
2012-09-04 21:40:53 +00:00
Ed Schouten
902d9eafbf Rework all non-contributed files that use `struct timezone'.
This structure is not part of POSIX. According to POSIX, gettimeofday()
has the following prototype:

	int gettimeofday(struct timeval *restrict tp, void *restrict tzp);

Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is
not used). Remove dead error handling code. Also use NULL for a
nul-pointer instead of integer 0.

While there, change all pieces of code that only use tv_sec to use
time(3), as this provides less overhead.
2012-09-01 14:45:15 +00:00
Pedro F. Giffuni
43981b6c53 Bring some changes from Bull's NFSv4 libtirpc implementation.
We especifically ignored the glibc compatibility changes
but this should help interaction with Solaris and Linux.
____

Fixed infinite loop in svc_run()
author	Steve Dickson
Tue, 10 Jun 2008 12:35:52 -0500 (13:35 -0400)
Fixed infinite loop in svc_run()
____

__rpc_taddr2uaddr_af() assumes the netbuf to always have a
non-zero data. This is a bad assumption and can lead to a
seg-fault. This patch adds a check for zero length and returns
NULL when found.
author	Steve Dickson
Mon, 27 Oct 2008 11:46:54 -0500 (12:46 -0400)
____

Changed clnt_spcreateerror() to return clearer
and more concise error messages.
author	Steve Dickson
Thu, 20 Nov 2008 08:55:31 -0500 (08:55 -0500)
____

Converted all uid and gid variables of the type uid_t and gid_t.
author	Steve Dickson
Wed, 28 Jan 2009 12:44:46 -0500 (12:44 -0500)
____

libtirpc: set r_netid and r_owner in __rpcb_findaddr_timed

These fields in the rpcbind GETADDR call are being passed uninitialized
to CLNT_CALL. In the case of x86_64 at least, this usually leads to a
segfault. On x86, it sometimes causes segfaults and other times causes
garbage to be sent on the wire.

rpcbind generally ignores the r_owner field for calls that come in over
the wire, so it really doesn't matter what we send in that slot. We just
need to send something. The reference implementation from Sun seems to
send a blank string. Have ours follow suit.
author	Jeff Layton
Fri, 13 Mar 2009 11:44:16 -0500 (12:44 -0400)
____

libtirpc: be sure to free cl_netid and cl_tp

When creating a client with clnt_tli_create, it uses strdup to copy
strings for these fields if nconf is passed in. clnt_dg_destroy frees
these strings already. Make sure clnt_vc_destroy frees them in the same
way.

author	Jeff Layton
Fri, 13 Mar 2009 11:47:36 -0500 (12:47 -0400)

Obtained from:	Bull GNU/Linux NFSv4 Project
MFC after:	3 weeks
2012-09-01 02:56:17 +00:00
Niclas Zeising
faf04960ff Add missing .Pp macro.
PR:		docs/170380
Submitted by:	Garrett Cooper <yanegomi@gmail.com>
Approved by:	joel (mentor)
2012-08-21 16:35:14 +00:00
Joel Dahl
abf0999093 Remove trailing whitespace. 2012-08-21 13:33:48 +00:00
David Xu
9653e55f6a Add manual pages for clock_getcpuclockid and pthread_getcpuclockid. 2012-08-21 09:18:28 +00:00
David Xu
cdfe902650 Fix prototype. Also the function should return error code instead of
-1 on error.
2012-08-21 09:17:13 +00:00
David Xu
d65f1abca7 Implement syscall clock_getcpuclockid2, so we can get a clock id
for process, thread or others we want to support.
Use the syscall to implement POSIX API clock_getcpuclock and
pthread_getcpuclockid.

PR:	168417
2012-08-17 02:26:31 +00:00
Kevin Lo
8437339e10 Make 'junk' volatile so that compilers won't be tempted to optimize
Reviewed by:	ache
MFC after:	3 days
2012-08-17 01:05:56 +00:00
Oleksandr Tymoshenko
8e585021b5 Merging of projects/armv6, part 2
Handle TLS for ARMv6 and ARMv7
2012-08-15 03:09:00 +00:00
Ed Schouten
19c79bf86a Rename aux.c to auxv.c.
On Windows, AUX is the auxiliary device, usually pointing to COM1.
Therefore it is forbidden to create a file named aux.c. To make it a bit
easier for Windows users to check out our source code, rename this file
to auxv.c.

MFC after:	1 month
Discussed with:	kib
Suggested by:	Eric van Gyzen <eric vangyzen net>
2012-08-11 12:07:24 +00:00
Jilles Tjoelker
9d8ca3b2ad nftw(): POSIX says directories causing loops should be silently skipped.
Formerly, loops caused nftw() to abort the traversal with ELOOP.
2012-08-09 22:05:40 +00:00
Xin LI
81b0715a13 Refresh with OpenBSD RCS ID changes to reflect that we now have essentionally
the same file.
2012-08-09 19:22:54 +00:00
Jilles Tjoelker
47875b0caa ftw(): Do not check the maxfds argument against OPEN_MAX.
Apart from the fact that nothing should have OPEN_MAX as a limit (as opposed
to RLIMIT_NOFILE from getrlimit() or _SC_OPEN_MAX from sysconf()), POSIX
does not require us to check this. POSIX does have a requirement on the
application that maxfds not exceed {OPEN_MAX}, but does not require the
implementation to check it ("may fail").

PR:		95239
2012-08-09 15:11:38 +00:00
Jilles Tjoelker
4d767dfea4 nftw(): Do not check the maxfds argument against OPEN_MAX.
Apart from the fact that nothing should have OPEN_MAX as a limit (as opposed
to RLIMIT_NOFILE from getrlimit() or _SC_OPEN_MAX from sysconf()), POSIX
does not require us to check this.

PR:		95239
Submitted by:	Todd Miller
2012-08-09 15:04:06 +00:00
Xin LI
0dfbbb3391 Use calloc(). 2012-08-01 00:21:55 +00:00
Joel Dahl
76c9beff1b Remove trailing whitespace. 2012-07-30 21:02:44 +00:00
Isabell Long
ea91541917 Add more locale-specific functions to the relevant man pages and Makefile:
- lib/libc/locale/islower.3
  - lib/libc/locale/ispunct.3
  - lib/libc/locale/nl_langinfo.3
  - lib/libc/locale/isgraph.3
  - lib/libc/locale/isspace.3

Reviewed by:	bz
Approved by:	theraven
MFC after:	5 days
2012-07-30 20:56:19 +00:00
Ed Maste
cb75848307 Correct BUGS description of static buffer use
Since r142667 strerror has unconditionally returned a pointer to a
static buffer.

MFC after:	1 week
2012-07-27 21:38:14 +00:00
Konstantin Belousov
d5a53d996c Document F_DUP2FD_CLOEXEC.
MFC after:	1 week
2012-07-27 10:41:53 +00:00
Joel Dahl
a18f885152 Start manpage with Dd macro and also remove a trailing whitespace
while here.
2012-07-26 14:46:19 +00:00
Sergey Kandaurov
f6a6151849 Update the 'C1x draft' reference to '.St -isoC-2011' mdoc macro.
Reviewed by:	theraven
MFC after:	1 week
2012-07-26 12:04:11 +00:00
Isabell Long
b3f18e536a Add a new man page containing details of new locale-specific functions for
wctype.h, iswalnum_l(3).  Add it and its functions to the Makefile.

Reviewed by:	gavin, jilles
Approved by:	theraven
MFC after:	5 days
2012-07-25 22:17:44 +00:00
Konstantin Belousov
a53cab2c6c (Incomplete) fixes for symbols visibility issues and style in fcntl.h.
Append '__' prefix to the tag of struct oflock, and put it under BSD
namespace. Structure is needed both by libc and kernel, thus cannot be
hidden under #ifdef _KERNEL.

Move a set of non-standard F_* and O_* constants into BSD namespace.
SUSv4 explicitely allows implemenation to pollute F_* and O_* names
after fcntl.h is included, but it costs us nothing to adhere
to the specification if exact POSIX compliance level is requested by
user code.

Change some spaces after #define to tabs.

Noted by and discussed with:	     bde
MFC after:   1 week
2012-07-21 13:02:11 +00:00
Konstantin Belousov
39c5964c5a Document F_DUPFD_CLOEXEC. Also provide some wording changes for
F_DUPFD to make it less confusing, at least for me.

MFC after:	1 week
2012-07-19 10:23:59 +00:00
Maksim Yevmenkin
0c19b5de29 Return zero from get_addrselectpolicy() when no source-address-selection
policy is installed.

MFC after:	1 week
2012-07-18 15:52:09 +00:00
Jilles Tjoelker
2bd56eacf8 libc: Remove some unused strings from getaddrinfo(). 2012-07-15 20:39:21 +00:00
Christian Brueffer
42c9e355b6 Jump to the failed label instead of doing cleanup ourselves.
Obtained from:	DragonFly BSD
MFC after:	2 weeks
2012-07-15 11:52:24 +00:00
Lawrence Stewart
19220a8330 Move the ffclock symbols from FBSD_1.2 to FBSD_1.3 where they should have been
put initially. They were added to head during development of 10-CURRENT, not
9-CURRENT.

Submitted by:	glebius
Reviewed by:	kib
2012-07-10 08:31:28 +00:00
David Xu
b409107773 Executing CPUID with EAX set to 1 to actually get feature flags.
PR:	169730
2012-07-10 01:47:11 +00:00
David Chisnall
bb4317bf3c Restore the __collate_load_error global that was accidentally removed in the
xlocale refactoring.

MFC after:	1 week
2012-07-06 20:16:22 +00:00
Brooks Davis
9597393516 Document the behavior (from 4.4-lite) that tokens returned by telldir() are
single use.

Sponsored by:	DARPA, AFRL
MFC after:	3 days
2012-07-05 17:02:20 +00:00
Pawel Jakub Dawidek
72de35d0a7 Prefer sysctl to open/read/close for obtaining random data.
This method is more sandbox-friendly and also should be faster as only
one syscall is needed instead of three.
In case of an error fall back to the old method.

Reviewed by:	simon, gleb
MFC after:	2 weeks
2012-07-04 19:51:25 +00:00
Pawel Jakub Dawidek
988a521bf0 The register_printf_render_std() function expects regular string.
Change argument type from 'const unsigned char *' to 'const char *'.

MFC after:	2 weeks
2012-07-04 17:35:07 +00:00
Jilles Tjoelker
57ca132fc8 ctype_l(3): Note that not all these functions are specified by POSIX.1-2008.
The function isascii_l() is not in POSIX even though isascii() is,
probably because isascii() is marked as obsolete.  The other functions,
like digittoint_l() and ishexnumber_l(), are FreeBSD-specific just like
their non-_l versions.
2012-07-01 22:18:20 +00:00
Konstantin Belousov
a87855124c Optimize the handling of SC_NPROCESSORS_CONF, by using auxv AT_NCPU
value if present.

MFC after:	1 week
2012-06-27 20:32:45 +00:00
Joel Dahl
af5b2c7853 Remove end of line whitespace. 2012-06-26 05:34:31 +00:00
Isabell Long
3f19323a07 Add more locale-specific functions to the relevant man pages and
Makefiles:
- libc/stdtime/strftime.3
- libc/stdtime/strptime.3
- libc/stdlib/strfmon.3

Reviewed by:	theraven
Approved by:	gabor (mentor)
2012-06-25 21:51:40 +00:00
Eitan Adler
43be4ab038 Remove the assert added in r237286
The use of assertions in libraries is not widely accepted.

Requested by:	bde, scottl
Approved by:	cperciva
MFC after:	3 days
X-MFC-With:	r237286
2012-06-24 07:03:22 +00:00
Konstantin Belousov
869fd80fd4 Use struct vdso_timehands data to implement fast gettimeofday(2) and
clock_gettime(2) functions if supported. The speedup seen in
microbenchmarks is in range 4x-7x depending on the hardware.

Only amd64 and i386 architectures are supported. Libc uses rdtsc and
kernel data to calculate current time, if enabled by kernel.

Hopefully, this code is going to migrate into vdso in some future.

Discussed with:	bde
Reviewed by:	jhb
Tested by:	flo
MFC after:	1 month
2012-06-22 07:13:30 +00:00