Commit Graph

15093 Commits

Author SHA1 Message Date
Baptiste Daroussin
1067c64a19 gr_dup: simplify duplication of group
Submitted by:	db
2012-12-27 19:33:43 +00:00
Baptiste Daroussin
2bfeb4fe75 - Clean up previous gr_add use malloc instead of calloc
- Fix tinderbox error

Submitted by:	db
2012-12-27 16:51:29 +00:00
Baptiste Daroussin
be49c83011 New gr_add function to provide a clean and safe method to append a new member
into an existing group.

Submitted by:	db
2012-12-27 14:30:19 +00:00
Baptiste Daroussin
98e79fb122 Use flopen(3) instead of open(2) + flock(2) 2012-12-27 14:09:50 +00:00
Sergey Kandaurov
322f22f7b5 Fix libproc test case to work with clang premature optimization
observed with -O2 (used by default).
Avoid function inlining for t1_bkpt_t on which we set a breakpoint.
Otherwise the address of the function is never called thus the
breakpoint never triggers.

Reported by:	zont
Reviewed by:	rpaulo
2012-12-26 05:11:48 +00:00
Andrey Zonov
bde505592f - Update manual pages accordingly to r244384 and r244385.
Approved by:	kib (mentor)
MFC after:	1 week
2012-12-25 13:43:01 +00:00
Dimitry Andric
c80e6c4bec Upgrade our copy of llvm/clang to 3.2 release.
Release notes for llvm:
http://llvm.org/releases/3.2/docs/ReleaseNotes.html

Release notes for clang:
http://llvm.org/releases/3.2/tools/clang/docs/ReleaseNotes.html

MFC after:	2 weeks
2012-12-23 13:04:00 +00:00
Dimitry Andric
be7c9ec198 Vendor import of clang tags/RELEASE_32/final r170710 (effectively, 3.2
release):
http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_32/final@170710
2012-12-22 15:00:54 +00:00
Dimitry Andric
482e7bddf6 Vendor import of llvm tags/RELEASE_32/final r170710 (effectively, 3.2
release):
http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_32/final@170710
2012-12-22 14:58:30 +00:00
Xin LI
53e075c0b9 - Reduce buffer size from LINE_MAX to PATH_MAX, there is no point to store
path longer than this.
 - Fix an unreached case of check against sizeof buf, which in turn leads
   to an off-by-one nul byte write on the stack.  The original condition
   can never be satisfied because the passed boundary is the maximum value
   that can be returned, so code was harmless.

MFC after:	1 month
2012-12-21 22:20:59 +00:00
Brooks Davis
6bea876644 Add libnetbsd, a thin compatibility layer intended to allow a limited
set of NetBSD software to compile as part of the FreeBSD build with
little or no modifiction.  It is built as a static library and not
installed for general use.  Likewise, its header files are not
installed.

Sponsored by:	DARPA, AFRL
2012-12-21 20:37:38 +00:00
Kevin Lo
a5752d55e0 Fix socket calls on error post-r243965.
Submitted by:	Garrett Cooper
2012-12-21 15:54:13 +00:00
Rui Paulo
a443a16906 Move the 64-bit _setjmp to lib/libstand. 2012-12-21 15:15:35 +00:00
Brooks Davis
8ccca1222d Replace our implementation of the vis(3) and unvis(3) APIs with
NetBSD's.  This output size limited versions of vis and unvis functions
as well as a set of vis variants that allow arbitrary characters to be
specified for encoding.

Finally, MIME Quoted-Printable encoding as described in RFC 2045 is
supported.
2012-12-18 16:37:24 +00:00
Andrew Turner
e376173cab Get libcompiler-rt and libgcc building on ARM with clang.
* Don't provide clear_cache or the __sync_* functions on ARM with clang as
  they are provided by clang as builtin functions.
* Tell clang it is aloud to compile some libgcc code using heinous GCC
  extensions.
2012-12-18 07:26:55 +00:00
Eitan Adler
49a8f2aa6c Fix warning from valgrind when a failed entry is tested.
PR:		kern/173008
Submitted by:	Zhihao Yuan <lichray@gmail.com>
Reviewed by:	gabor
Approved by:	cperciva (implicit)
MFC after:	1 week
2012-12-17 12:57:36 +00:00
Jilles Tjoelker
571d9493ad libc/iconv: Fix race condition with setting FD_CLOEXEC.
A fork/exec could happen between open and fcntl, leaking a file descriptor.
Using O_CLOEXEC fixes this and as a side effect simplifies the code.

NetBSD already had this (I checked this after making the change myself).

Reviewed by:	gabor
2012-12-17 10:38:51 +00:00
Mikolaj Golub
fdd6757e71 New devstat metrics for devstat_compute_statistics():
DSM_TOTAL_DURATION
  DSM_TOTAL_DURATION_READ
  DSM_TOTAL_DURATION_WRITE
  DSM_TOTAL_DURATION_FREE
  DSM_TOTAL_DURATION_OTHER
  DSM_TOTAL_BUSY_TIME
2012-12-15 18:19:48 +00:00
Pawel Jakub Dawidek
997b5d9426 Eliminate redundant variable. 2012-12-12 15:27:33 +00:00
Jilles Tjoelker
07588bf421 libc: Make various internal file descriptors close-on-exec.
These are obtained via fopen().
2012-12-11 22:52:56 +00:00
Dimitry Andric
a36ffd6955 Cleanup a few duplicate llvm libs that snuck in with the recent update.
Noticed by:	rdivacky
2012-12-11 20:08:57 +00:00
Jilles Tjoelker
1084b38bea libc: Make various internal file descriptors close-on-exec.
These are obtained via fopen().
2012-12-10 17:56:51 +00:00
Brooks Davis
1652751915 Improve style(9) compliance of function declarations. 2012-12-10 17:34:33 +00:00
Erwin Lansing
ebd98a8393 Re-disable GSSAPI, which does not build on several archs.
Approved by:	delphij (mentor)
2012-12-07 16:05:04 +00:00
Erwin Lansing
cfd4d2c42e Update to 9.8.4-P1.
Security Fixes

   Prevents named from aborting with a require assertion failure
   on servers with DNS64 enabled.  These crashes might occur as a
   result of  specific queries that are received.

New Features

*  Elliptic Curve Digital Signature Algorithm keys and signatures in
   DNSSEC are now supported per RFC 6605. [RT #21918]

Feature Changes

*  Improves OpenSSL error logging [RT #29932]

*  nslookup now returns a nonzero exit code when it is unable to get
   an answer.  [RT #29492]

Other critical bug fixes are included.

Approved by:	delphij (mentor)
MFC after:	3 days
Security:	CVE-2012-5688
Sponsored by:	DK Hostmaster A/S
2012-12-07 12:39:58 +00:00
Kevin Lo
0ff48e7194 Document that socket(2) may fail with EAFNOSUPPORT if the family cannot
be found.

Reviewed by:	glebius
Obtained from:	NetBSD
2012-12-07 02:26:08 +00:00
Xin LI
c2654dc8fa Fix build: reflect the increased field number. 2012-12-07 01:36:53 +00:00
Sergey Matveychuk
bf5a1b6502 - Rewrite radius servers traversal algorithm.
- Add functions for working with IPv6 attributes.

Approved by:	ae
2012-12-06 19:00:37 +00:00
Baptiste Daroussin
6a969461db remove redundant yyparse declarations
PR:		conf/174079
Submitted by:	Garrett Cooper <yanegomi@gmail.com>
2012-12-05 20:28:44 +00:00
Erwin Lansing
a503af91a8 Vendor import of Bind 9.8.4
Approved by:	delphij (mentor)
Sponsored by:	DK Hostmaster A/S
2012-12-05 12:53:50 +00:00
Jilles Tjoelker
273e3bbfe6 libc: Use the new 'e' fopen() mode option to simplify fstab.c.
No functional change is intended.
2012-12-04 16:54:43 +00:00
Kevin Lo
5e48557ef0 Document that bind(2) can fail with EAFNOSUPPORT.
Reviewed by:	glebius
2012-12-04 09:53:09 +00:00
Neel Natu
32531ccb84 IFC @r243836 2012-12-04 04:37:42 +00:00
Dimitry Andric
3861d79fd7 Upgrade our copy of llvm/clang to r168974, from upstream's release_32
branch.  This is effectively llvm/clang 3.2 RC2; the 3.2 release is
coming soon.
2012-12-03 19:24:08 +00:00
Dimitry Andric
13cc256e40 Vendor import of clang release_32 branch r168974 (effectively, 3.2 RC2):
http://llvm.org/svn/llvm-project/cfe/branches/release_32@168974
2012-12-02 13:20:44 +00:00
Dimitry Andric
522600a229 Vendor import of llvm release_32 branch r168974 (effectively, 3.2 RC2):
http://llvm.org/svn/llvm-project/llvm/branches/release_32@168974
2012-12-02 13:10:19 +00:00
Marcel Moolenaar
daab0b01ed Protect against DoS attacks, such as being described in CVE-2010-2632.
The changes were derived from what has been committed to NetBSD, with
modifications. These are:
1.  Preserve the existsing GLOB_LIMIT behaviour by including the number
    of matches to the set of parameters to limit.
2.  Change some of the limits to avoid impacting normal use cases:
    GLOB_LIMIT_STRING - change from 65536 to ARG_MAX so that glob(3)
	can still provide a full command line of expanded names.
    GLOB_LIMIT_STAT - change from 128 to 1024 for no other reason than
	that 128 feels too low (it's not a limit that impacts the
	behaviour of the test program listed in CVE-2010-2632).
    GLOB_LIMIT_PATH - change from 1024 to 65536 so that glob(3) can
	still provide a fill command line of expanded names.
3.  Protect against buffer overruns when we hit the GLOB_LIMIT_STAT or
    GLOB_LIMIT_READDIR limits. We append SEP and EOS to pathend in
    those cases. Return GLOB_ABORTED instead of GLOB_NOSPACE when we
    would otherwise overrun the buffer.

This change also modifies the existing behaviour of glob(3) in case
GLOB_LIMIT is specifies by limiting the *new* matches and not all
matches. This is an important distinction when GLOB_APPEND is set or
when the caller uses a non-zero gl_offs. Previously pre-existing
matches or the value of gl_offs would be counted in the number of
matches even though the man page states that glob(3) would return
GLOB_NOSPACE when gl_matchc or more matches were found.

The limits that cannot be circumvented are GLOB_LIMIT_STRING and
GLOB_LIMIT_PATH all others can be crossed by simply calling glob(3)
again and with GLOB_APPEND set.

The entire description above applies only when GLOB_LIMIT has been
specified of course. No limits apply when this flag isn't set!

Obtained from: Juniper Networks, Inc
2012-12-01 21:26:46 +00:00
Marcel Moolenaar
43cc14e088 In globextend(), take advantage of the fact that realloc(NULL, size) is
equivalent to malloc(size). This eliminates the conditional expression
used for calling either realloc() or malloc() when realloc() will do
all the time.
2012-12-01 17:50:39 +00:00
Marcel Moolenaar
b628fac5ea In globextend() when the pathv vector cannot be (re-)allocated, don't
free and clear the gl_pathv pointer in the glob_t structure. Such
breaks the invariant of the glob_t structure, as stated in the comment
right in front of the globextend() function. If gl_pathv was non-NULL,
then gl_pathc was > 0. Making gl_pathv a NULL pointer without also
setting gl_pathc to 0 is wrong.

Since we otherwise don't free the memory associated with a glob_t in
error cases, it's unlikely that this change will cause a memory leak
that wasn't already there to begin with. Callers of glob(3) must
call globfree(3) irrespective of whether glob(3) returned an error
or not.
2012-12-01 17:44:06 +00:00
Eitan Adler
8c039ae154 The getline function returns the number of characters read, not
written. Use clearer text for this.

PR:		docs/174023
Submitted by:	Paul Procacci <pprocacci@gmail.com>
Approved by:	bcr (mentor)
MFC after:	1 week
2012-12-01 15:25:41 +00:00
Jilles Tjoelker
5ba651f004 libc: Allow setting close-on-exec in fopen/freopen/fdopen.
This commit adds a new mode option 'e' that must follow any 'b', '+' and/or
'x' options. C11 is clear about the 'x' needing to follow 'b' and/or '+' and
that is what we implement; therefore, require a strict position for 'e' as
well.

For freopen() with a non-NULL path argument and fopen(), the close-on-exec
flag is set iff the 'e' mode option is specified. For freopen() with a NULL
path argument and fdopen(), the close-on-exec flag is turned on if the 'e'
mode option is specified and remains unchanged otherwise.

Although the same behaviour for fopen() can be obtained by open(O_CLOEXEC)
and fdopen(), this needlessly complicates the calling code.

Apart from the ordering requirement, the new option matches glibc.

PR:		kern/169320
2012-11-30 23:51:33 +00:00
Kevin Lo
51fb3b32c4 Document that getpeername(2) and getsockname(2) can fail with EINVAL.
Reviewed by:	glebius
2012-11-23 10:14:54 +00:00
Baptiste Daroussin
09259e6c48 only rename(2) after chmod(2) has succeed
report error if chmod(2) fails

Reported by:	jh
2012-11-20 14:03:09 +00:00
Baptiste Daroussin
2d2b6ad74d change mode the group file to 0644 after a successfull rename(2) 2012-11-20 07:22:07 +00:00
Michael Tuexen
9340982291 Cleanup the code a bit, which improves the portability.
MFC after: 1 week
2012-11-19 19:26:19 +00:00
Michael Tuexen
d51b57018e Fix the handling of mapped IPv6 addresses in sctp_connectx().
MFC after: 3 days
2012-11-19 19:19:04 +00:00
Neel Natu
3248464555 IFC @ r243164 2012-11-17 02:55:47 +00:00
Kevin Lo
5744601120 - the preferred way to write a NULL pointer constant is with NULL
- whitespace nit

Reviewed by:	glebius
2012-11-16 15:02:35 +00:00
Dag-Erling Smørgrav
eab7a548ba Fix weird indentation. 2012-11-16 12:31:43 +00:00
Joel Dahl
90c819e0a0 mdoc: Use the Ev macro for environmental variables. 2012-11-16 12:03:50 +00:00
Kevin Lo
b95b21c7ab Document that rtprio(2) and rtprio_thread(2) can fail with EFAULT
due to the invoked copyout(9).

Reviewed by:	davidxu
2012-11-16 09:56:25 +00:00
Greg Lehey
c90e931745 Complete man page.
MFC after:	2 weeks
2012-11-16 01:41:42 +00:00
Kevin Lo
d9b3cfecfd Document that sendfile(2) can fail with ENOBUFS.
Reviewed by:	glebius
2012-11-14 01:45:10 +00:00
Konstantin Belousov
0b92b54045 Document wait6() and waitid().
PR:	standards/170346
Submitted by:	"Jukka A. Ukkonen" <jau@iki.fi>
MFC after:	1 month
2012-11-13 12:56:42 +00:00
Konstantin Belousov
eb3d4e1fbd Implement the waitid() SUSv4 function using wait6() system call.
PR:	standards/170346
Submitted by:	"Jukka A. Ukkonen" <jau@iki.fi>
MFC after:	1 month
2012-11-13 12:55:52 +00:00
Neel Natu
7d3d462b09 IFC @ r242940 2012-11-13 07:39:05 +00:00
Dimitry Andric
34a4971299 Add an explanatory comment to lib/libc/gen/isnan.c about the fix to make
static linking with libc and libm work.

Requested by:	jilles
MFC after:	1 week
X-MFC-With:	242879
2012-11-11 13:28:04 +00:00
Neel Natu
a10c6f5544 IFC @ r242684 2012-11-11 03:26:14 +00:00
Dimitry Andric
0779690c2e Only define isnan, isnanf, __isnan and __isnanf in libc.so, not in
libc.a and libc_p.a.  In addition, define isnan in libm.a and libm_p.a,
but not in libm.so.

This makes it possible to statically link executables using both isnan
and isnanf with libc and libm.

Tested by:	kargl
MFC after:	1 week
2012-11-10 21:22:10 +00:00
Greg Lehey
a012e04865 Clarify that the ' flag is an apostrophe.
MFC after:	2 weeks
2012-11-08 02:01:04 +00:00
Justin Hibbits
c757049235 Implement DTrace for PowerPC. This includes both 32-bit and 64-bit.
There is one known issue:  Some probes will display an error message along the
lines of:  "Invalid address (0)"

I tested this with both a simple dtrace probe and dtruss on a few different
binaries on 32-bit.  I only compiled 64-bit, did not run it, but I don't expect
problems without the modules loaded.  Volunteers are welcome.

MFC after:	1 month
2012-11-07 23:45:09 +00:00
Simon J. Gerraty
62b43b7f0d Simple unit-tests for libcrypt, to show how easy it is.
Approved by:	marcel (mentor)
2012-11-07 22:03:59 +00:00
Kevin Lo
0f5e7edc14 Fix typo; s/ouput/output 2012-11-07 07:00:59 +00:00
Marcel Moolenaar
3f3708b3dd Remove -L<path> from LDADD, it doesn't belong there.
Add it to LDFLAGS instead.

Submitted by:   Garrett Cooper <yanegomi@gmail.com>
2012-11-07 00:23:51 +00:00
Dimitry Andric
f0bbe9aa78 Fix a few warnings from newer clang 3.2 in libpmc, about comparing enum
pmc_event values against integer constants which fall outside the enum
range.

Reviewed by:	fabient, sbruno
MFC after:	3 days
2012-11-05 18:49:21 +00:00
Michael Tuexen
4ed0ebf649 Fix errno in a couple of error cases.
MFC after: 3 days
2012-11-03 13:22:25 +00:00
Baptiste Daroussin
46f8c63df6 Fix typo 2012-11-03 00:30:22 +00:00
Dimitry Andric
a006bb4ba3 Fix broken macro checking in the libc++ Makefile, introduced in r241909.
This caused -std=c++0x not to be passed to the build by default.

Pointy hat to:	dim
MFC after:	3 days
2012-11-02 12:18:38 +00:00
Jilles Tjoelker
cc32b2eda8 fopen(3): Mention that the "x" mode option is from C11.
MFC after:	1 week
2012-11-01 22:47:42 +00:00
Jilles Tjoelker
252462b3bd fcntl(2): Fix typos in name of constant "F_DUP2FD_CLOEXEC".
MFC after:	1 week
2012-11-01 09:38:28 +00:00
Dag-Erling Smørgrav
192bc3edf4 Correct attribution. 2012-10-31 15:04:27 +00:00
Joel Dahl
2acb4741ca Minor mdoc and language fixes. 2012-10-30 22:30:30 +00:00
Baptiste Daroussin
f5a05b2ba4 Removed unnecessary bits in the header that shows where I stole the template 2012-10-30 22:26:19 +00:00
Baptiste Daroussin
42818163b4 Document the pw_util(3) functions
Reviewed by:	des, gjb
2012-10-30 22:18:08 +00:00
Baptiste Daroussin
b3d9795c98 backout r242319, racy and not done in the right place
Reported by:	Garrett Cooper  <yanegomi@gmail.com>
2012-10-29 18:06:09 +00:00
Baptiste Daroussin
29e575503c make pw_init and gr_init fail if the specified master password or group file is
a directory.

MFC after:	1 month
2012-10-29 17:19:43 +00:00
Matthew D Fleming
bb196eb480 Const-ify the zone name argument to uma_zcreate(9).
MFC after:	3 days
2012-10-26 17:51:05 +00:00
Peter Grehan
fbfc1c763c Remove mptable generation code from libvmmapi and move it to bhyve.
Firmware tables require too much knowledge of system configuration,
and it's difficult to pass that information in general terms to a library.
The upcoming ACPI work exposed this - it will also livein bhyve.

Also, remove code specific to NetApp from the mptable name, and remove
the -n option from bhyve.

Reviewed by:	neel
Obtained from:	NetApp
2012-10-26 13:40:12 +00:00
Jaakko Heinonen
e8f6ee4a99 Improve libgeom XML parsing error handling.
- Abort parsing and return an error if we run out of memory.
- Return EILSEQ from geom_xml2tree() for XML syntax errors.

Silence on:	freebsd-geom
2012-10-26 12:46:33 +00:00
Sean Bruno
cdfd0cc862 Cleanup and rename some variables in libpmc and hwpmc.
Submitted by:	hiren panchasara <hiren.panchasara@gmail.com>
Reviewed by:	jimharris@ sbruno@
Obtained from:	Yahoo! Inc.
MFC after:	2 weeks
2012-10-24 01:26:29 +00:00
Dimitry Andric
cb554de222 Allow building libc++ with any custom -std=xxx flag. Note that using
-std=gnu++98 will give a lot of warnings with clang, so please use
-std=c++0x or higher, or use NO_WERROR.

MFC after:	1 week
2012-10-22 19:44:17 +00:00
Warner Losh
98fd12e162 Revert r241756 2012-10-22 13:21:11 +00:00
Warner Losh
b3f94d242f Revert r241755 2012-10-22 13:20:31 +00:00
Eitan Adler
c965707311 Update the kill(2) and killpg(2) man pages to the modern permission
checks. Also indicate killpg(2) is POSIX compliant.

Reviewed by:	jilles
Reviewed by:	wblock
Approved by:	cperciva
MFC after:	3 days
2012-10-22 03:37:00 +00:00
Eitan Adler
db702c59cf remove duplicate semicolons where possible.
Approved by:	cperciva
MFC after:	1 week
2012-10-22 03:00:37 +00:00
Eitan Adler
8d049fb235 Implement HTTP 305 redirect handling.
PR:		172452
Submitted by:	gcooper
Reviewed by:	des
Approved by:	cperciva
MFC after:	1 week
2012-10-22 03:00:15 +00:00
Eitan Adler
c4fa1489ec Don't deny non-temporary redirects if the -A option is set (per
the man page) [0]

While here add support for draft-reschke-http-status-308-07

PR:		172451 [0]
Submitted by:	gcooper [0]
Reviewed by:	des
Approved by:	cperciva
MFC after:	1 week
2012-10-22 03:00:10 +00:00
Eitan Adler
e6c0e200f4 Be a bit more lenient in the maximum number of redirects allowed.
Chrome and Firefox have a limit of 20. IE has a limit of 8.

Reviewed by:	des
Approved by:	cperciva
MFC after:	3 days
2012-10-22 03:00:04 +00:00
Marcel Moolenaar
c175365cec Add ATF to the build. This is may be a bit rought around the egdes,
but committing it helps to get everyone on the same page and makes
sure we make progress.

Tinderbox breakages that are the result of this commit are entirely
the committer's fault -- in other words: buildworld testing on amd64
only.

Credits follow:

Submitted by:	Garrett Cooper <yanegomi@gmail.com>
Sponsored by:	Isilon Systems
Based on work by:	keramida@
Thanks to:	gnn@, mdf@, mlaier@, sjg@
Special thanks to:	keramida@
2012-10-22 01:18:41 +00:00
Andre Oppermann
dc00208ec4 Grammar fixes to r241781.
Submitted by:	alc
2012-10-20 19:38:22 +00:00
Andre Oppermann
2bdf61ca29 Hide the unfortunate named sysctl kern.ipc.somaxconn from sysctl -a
output and replace it with a new visible sysctl kern.ipc.acceptqueue
of the same functionality.  It specifies the maximum length of the
accept queue on a listen socket.

The old kern.ipc.somaxconn remains available for reading and writing
for compatibility reasons so that existing programs, scripts and
configurations continue to work.  There no plans to ever remove the
orginal and now hidden kern.ipc.somaxconn.
2012-10-20 12:53:14 +00:00
Ulrich Spörlein
cc4842a1c7 Apply local patches to mandoc and connect it to the build.
- adds a couple more library strings used in the tree
- changes some more to the current groff spelling
- changes page footer to match groff style
2012-10-20 10:06:38 +00:00
Warner Losh
527a7c56f7 Document the method used to compute expf. Taken from exp, with
changes to reflect differences in computation between the two.
2012-10-19 22:47:44 +00:00
Warner Losh
aa616aa22d Document the methods used to compute logf. Taken and edited from the
double version, with adaptations for the differences between it and
the float version.
2012-10-19 22:46:48 +00:00
Ulrich Spörlein
e4d7d10517 Merge mandoc from vendor into contrib and provide the necessary Makefile glue.
It's not yet connected to the build.
2012-10-19 22:21:01 +00:00
Joel Dahl
ad2f1898bc Remove trailing whitespace. 2012-10-19 18:30:50 +00:00
Sean Bruno
29f79bb342 Update man page crossreferences to sandybridge xeon class
MFC after:	2 weeks
2012-10-19 17:21:10 +00:00
Sean Bruno
fabe02f5f3 Update hwpmc to support the Xeon class of Sandybridge processors.
(Model 0x2D     /* Per Intel document 253669-044US 08/2012. */)

Add manpage to document all the goodness that is available in this
processor model.

No support for uncore events at this time.

Submitted by:	hiren panchasara <hiren.panchasara@gmail.com>
Reviewed by:	jimharris@ fabient@
Obtained from:	Yahoo! Inc.
MFC after:	  2 weeks
2012-10-19 17:01:27 +00:00
Brooks Davis
4c0d7cdf5d Replace our version of the pwcache(3) API with NetBSD's implementation.
This adds two features:
 * uid_from_user() and gid_from_group() as the reverse of user_from_uid()
   and groups_from_gid().
 * pwcache_userdb() and pwcache_groupdb() which allow alternative lookup
   functions to be used.  For example lookups from passwd and group
   databases in a non-standard location.
2012-10-19 12:44:22 +00:00
Ed Schouten
ae824d80f2 Fix warnings found by -Wmising-variable-declarations.
This self-written compiler warning, which is hopefully going to be
committed into LLVM sources soon, warns about potentially missing
`static' keywords, similar to -Wmissing-prototypes.

- bin/pax: Move external declaration of chdname and s_mask into extern.h.
- bin/setfacl: Move setfacl.c-specific stuff out of setfacl.h.
- sbin/mount_fusefs: Remove char *progname; use getprogname().
- others: add `static' where possible.
2012-10-19 05:43:38 +00:00
Ed Schouten
9a41df2a0e Remove WARNS=6 lines.
WARNS=6 is already implied at this point.
2012-10-18 15:39:29 +00:00
Attilio Rao
2e564269d0 Disconnect non-MPSAFE SMBFS from the build in preparation for dropping
GIANT from VFS. In addition, disconnect also netsmb, which is a base
requirement for SMBFS.

In the while SMBFS regular users can use FUSE interface and smbnetfs
port to work with their SMBFS partitions.

Also, there are ongoing efforts by vendor to support in-kernel smbfs,
so there are good chances that it will get relinked once properly locked.

This is not targeted for MFC.
2012-10-18 12:04:56 +00:00
Attilio Rao
a42ac676f5 Disconnect non-MPSAFE NTFS from the build in preparation for dropping
GIANT from VFS. This code is particulary broken and fragile and other
in-kernel implementations around, found in other operating systems,
don't really seem clean and solid enough to be imported at all.
If someone wants to reconsider in-kernel NTFS implementation for
inclusion again, a fair effort for completely fixing and cleaning it
up is expected.

In the while NTFS regular users can use FUSE interface and ntfs-3g
port to work with their NTFS partitions.

This is not targeted for MFC.
2012-10-17 11:30:00 +00:00
Attilio Rao
e6116d5b8e Disconnect non-MPSAFE NWFS from the build in preparation for dropping
GIANT from VFS. In addition, disconnect also netncp, which is a base
requirement for NWFS.

In the possibility of a future maintenance of the code and later
readd to the FreeBSD base, maybe we should think about a better location
for netncp. I'm not entirely sure the / top location is actually right,
however I will let network people to comment on that more specifically.

This is not targeted for MFC.
2012-10-17 11:16:17 +00:00
Joel Dahl
284eab32c0 mdoc: avoid nested displays. 2012-10-14 14:45:54 +00:00
Steve Kargl
f81d134e7e * Update the comment that explains the choice of values in the
table and the requirement on trailing zero bits.

* Remove the __aligned() compiler directives as these were found
  to have a negative effect on the produced code.

Submitted by:	bde
Approved by:	das (mentor)
2012-10-13 19:53:11 +00:00
Neel Natu
13f4cf6c6b Add an api to map a vm capability type into a string to be used for display
purposes.
2012-10-12 17:39:28 +00:00
Stefan Farfeleder
1dcbb99523 Fix my last commit. Only call strunvis after properly checking the argument is
not NULL.
2012-10-11 08:18:28 +00:00
Stefan Farfeleder
da0878836b Decode the first two fstab fields with strunvis(3). This allows having spaces
in devices and mount paths, encoded as \s or \040.

PR:		bin/117687
Submitted by:	Martin Kammerhofer
Discussed on:	arch
2012-10-11 07:54:29 +00:00
Stefan Farfeleder
a31c8b58b5 Apply some style. Checked with md5. 2012-10-11 07:39:51 +00:00
Eitan Adler
6a762eb23e Remove undefined behavior from sranddev() and
srandomdev(). This doesn't actually work
with any modern C compiler:

In particular, both clang and modern gcc
verisons silently elide any xor operation
with 'junk'.

Approved by:	secteam
MFC after:	3 days
2012-10-09 14:25:14 +00:00
Andriy Gapon
391bdfb835 procstat_getprocs: honor kvm_getprocs interface - cnt is signed
MFC after:	10 days
2012-10-06 20:17:28 +00:00
Andriy Gapon
ca895af355 kvm_getprocs: gracefully handle errors from kvm_deadprocs
and don't confuse callers with incorrect return value

MFC after:	9 days
2012-10-06 20:16:04 +00:00
Andriy Gapon
9fb9ea1c03 kvm_proclist: ignore processes in larvae state
Reviewed by:	jhb
MFC after:	8 days
2012-10-06 20:12:24 +00:00
Marcel Moolenaar
0815243c39 Add support for bmake. This includes:
1.  Don't do upgrade_checks when using bmake. As long as we have WITH_BMAKE,
    there's a bootstrap complication in ths respect. Avoid it. Make the
    necessary changes to have upgrade_checks work wth bmake anyway.
2.  Remove the use of -E. It's not needed in our build because we use ?= for
    the respective variables, which means that we'll take the environment
    value (if any) anyway.
3.  Properly declare phony targets as phony as bmake is a lot smarter (and
    thus agressive) about build avoidance.
4.  Make sure CLEANFILES is complete and use it on .NOPATH. bmake is a lot
    smarter about build avoidance and should not find files we generate in
    the source tree. We should not have files in the repository we want to
    generate, but this is an easier way to cross this hurdle.
5.  Have behavior under bmake the same as it is under make with respect to
    halting when sub-commands fail. Add "set -e" to compound commands so
    that bmake is informed when sub-commands fail.
6.  Make sure crunchgen uses the same make as the rest of the build. This
    is important when the make utility isn't called make (but bmake for
    example).
7.  While here, add support for using MAKEOBJDIR to set the object tree
    location. It's the second alternative bmake looks for when determining
    the actual object directory (= .OBJDIR).

Submitted by:	Simon Gerraty <sjg@juniper.net>
Submitted by:	John Van Horne <jvanhorne@juniper.net>
2012-10-06 20:01:05 +00:00
Tim Kientzle
5847daf4c2 Fix "make install"
Also make arm the same as other platforms:  Install man
pages for all CPUs in the family.
2012-10-06 17:54:42 +00:00
Xin LI
15752fa858 MFV: libpcap 1.3.0.
MFC after:	4 weeks
2012-10-05 18:42:50 +00:00
Jung-uk Kim
430849e1b9 Do not install incomplete unwind.h from clang. This header file was meant
to be a wrapper for the canonical system header file.  Unfortunately, we do
not have one (yet) and some times it is causing weird failures when clang
is used for building ports.  More complete and correct file will come from
libcxxrt in the future.

Discussed with:	dim, kib, theraven
MFC after:	1 week
2012-10-05 00:35:13 +00:00
Jamie Gritton
49f903d5fc Fix some memory allocation errors:
* jail_setv will leak a parameter name if jailparam_import fails.
* jailparam_all loses the jailparam pointer on realloc error
  (a clear freshman mistake).
* If jailparam_init fails, the caller doesn't need to jailparam_free
  the buffer.  That's not really clear, so set things to NULL allowing
  jailparam_free to work without error (though it's still not required).
2012-10-04 19:07:05 +00:00
Pedro F. Giffuni
0d1040e5e1 rpc: convert all uid and gid variables to u_int.
After further discussion, instead of pretending to use
uid_t and gid_t as upstream Solaris and linux try to, we
are better using u_int, which is in fact what the code
can handle and best approaches the range of values used
by uid and gid.

Discussed with:	bde
Reviewed by:	bde
2012-10-04 04:15:18 +00:00
Neel Natu
4b52a1e497 The ioctl VM_GET_MEMORY_SEG is no longer able to return the host physical
address associated with the guest memory segment. This is because there is
no longer a 1:1 mapping between GPA and HPA.

As a result 'vmmctl' can only display the guest physical address and the
length of the lowmem and highmem segments.
2012-10-04 03:07:05 +00:00
Neel Natu
f7d51510f1 Change vm_malloc() to map pages in the guest physical address space in 4KB
chunks. This breaks the assumption that the entire memory segment is
contiguously allocated in the host physical address space.

This also paves the way to satisfy the 4KB page allocations by requesting
free pages from the VM subsystem as opposed to hard-partitioning host memory
at boot time.
2012-10-04 02:27:14 +00:00
Pedro F. Giffuni
ff12c59d9c rpc: convert all uid and gid variables of the type uid_t and gid_t.
The previous change (based on Solaris) doesn't work properly either
as the casting only has the effect of quieting the compiler.

Move back to the previous solution but adjust the sizeof()
type in xdr_array(). This should mostly work (by accident).

Reported by:	bde
2012-10-03 20:39:11 +00:00
Grzegorz Bernacki
47ed3abe8e Correct detection of a superblock.
Obtained from:	Smartcom Bulgaria AD
2012-10-03 10:06:48 +00:00
Andrey A. Chernov
542e13498f Optimize prev. commit for speed.
1) Don't iterate the loop from the environment array beginning each time,
iterate it under the last place we deactivate instead.
2) Call __rebuild_environ() not on each iteration but once, only at the end
of whole loop (of course, only in case if something is changed).

MFC after:      1 week
2012-10-03 04:46:58 +00:00
Pedro F. Giffuni
e9f7ad1fa4 rpc: convert all uid and gid variables of the type uid_t and gid_t.
As part of the previous commit, uses of xdr_int() were replaced
with xdr_u_int(). This has undesired effects as the second
argument doesn't match exactly uid_t or gid_t. It also breaks
assumptions in the size of the provided types.

To work around those issues we revert back to the use of xdr_int()
but provide proper casting so the behaviour doesn't change.

While here fix a style issue in the affected lines.

Reported by:	bde
2012-10-03 03:44:23 +00:00
Pedro F. Giffuni
0c2222baf4 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.

This change matches the reference (OpenSolaris) implementation.

Tested by:	David Wolfskill
Obtained from:	Bull GNU/Linux NFSv4 Project (libtirpc)
MFC after:	2 weeks
2012-10-02 19:10:19 +00:00
Pedro F. Giffuni
b4e7a879ab Fix __rpc_getconfip
__rpc_getconfip is supposed to return the first netconf
entry supporting tcp or udp, respectively. The code will
currently return the *last* entry, plus it will leak
memory when there is more than one such entry.

This change matches the reference (OpenSolaris)
implementation.

Tested by:	David Wolfskill
Obtained from:	Bull GNU/linux NFSv4 Project (libtirpc)
MFC after:	1 week
2012-10-02 19:03:21 +00:00
Pedro F. Giffuni
f3c3ef7b2a RPC: Convert all uid and gid variables of the type uid_t and gid_t.
This matches what upstream (OpenSolaris) does.

Tested by:	David Wolfskill
Obtained from:	Bull GNU/Linux NFSv4 project (libtirpc)
MFC after:	3 days
2012-10-02 19:00:56 +00:00
Andrey A. Chernov
2de80aea80 Using putenv() and later direct pointer contents modification it is possibe
to craft environment variables with similar names like that:
a=1
a=2
...
unsetenv("a") should remove them all to make later getenv("a") impossible.
Fix it to do so (this is GNU autoconf test #3 failure too).

PR:             172273
MFC after:      1 week
2012-10-02 17:44:08 +00:00
Eitan Adler
a181e90d14 clarify the wording for 'first' and 'last'
Approved by:	wblock
MFC after:	3 days
2012-09-30 03:25:04 +00:00
Steve Kargl
a077586c53 * src/math_private.h:
. Change the API for the LD80C by removing the explicit passing
    of the sign bit.  The sign can be determined from the last
    parameter of the macro.
  . On i386, load long double by bit manipulations to work around
    at least a gcc compiler issue.  On non-i386 ld80 architectures,
    use a simple assignment.

* ld80/s_expl.c:
  . Update the only consumer of LD80C.

Submitted by:	bde
Approved by:	das (mentor)
2012-09-29 16:40:12 +00:00
Jilles Tjoelker
05eb11cbc4 libc: Use O_CLOEXEC for various internal file descriptors.
This fixes a race condition where another thread may fork() before CLOEXEC
is set, unintentionally passing the descriptor to the child process.

This commit only adds O_CLOEXEC flags to open() or openat() calls where no
fcntl(fd, F_SETFD, FD_CLOEXEC) follows. The separate fcntl() call still
leaves a race window so it should be fixed later.
2012-09-29 11:54:34 +00:00
Dag-Erling Smørgrav
d755552558 Slight stylification. 2012-09-28 13:50:37 +00:00
Dag-Erling Smørgrav
a612142b11 Remove unnecessary #include. 2012-09-28 12:29:25 +00:00
Jilles Tjoelker
6b42272163 libc/fts: Use O_CLOEXEC for internal file descriptors.
Because fts keeps internal file descriptors open across calls, making such
descriptors close-on-exec helps not only multi-threaded applications but
also single-threaded applications.

In particular, this prevents passing a temporary file descriptor for saving
the current directory to processes created via find -exec.
2012-09-27 22:05:54 +00:00
Pedro F. Giffuni
06f13fb3f4 Complete revert of r239963:
The attempt to merge changes from the linux libtirpc caused
rpc.lockd to exit after startup under unclear conditions.

After many hours of selective experiments and inconsistent results
the conclusion is that it's better to just revert everything and
restart in a future time with a much smaller subset of the
changes.
____

MFC after:	3 days
Reported by:	David Wolfskill
Tested by:	David Wolfskill
2012-09-27 19:10:25 +00:00
Jilles Tjoelker
b30cd8df7c sigaction(2),sigwait(2),sigwaitinfo(2): Remove [EFAULT] error condition.
Passing an invalid pointer results in undefined behaviour.

The wrappers in libthr access some of the data pointed to by the arguments
in userland, so that an invalid pointer will cause a signal and not an
[EFAULT] error return.

Furthermore, if the [EFAULT] error occurs when the kernel is writing, it is
not a proper error in the sense that the call still commits (changing the
signal disposition or accepting the signal).

MFC after:	1 week
2012-09-27 17:48:04 +00:00
Kevin Lo
09e1da2f6c Initialize the num variable to avoid uninitialized data.
This fixes the bug introduced by r238378.

Reviewed by:	pfg
2012-09-27 05:26:29 +00:00
Neel Natu
e90273829b Add ioctls to control the X2APIC capability exposed by the virtual machine to
the guest.

At the moment this simply sets the state in the 'vcpu' instance but there is
no code that acts upon these settings.
2012-09-25 19:08:51 +00:00
Kevin Lo
b7b6a643aa Revert r240850 and remove redundant NULL check before free(3).
free(3) handles NULL parameter fine.

Reviewed by:	kib, Garrett Cooper
2012-09-24 05:24:10 +00:00
Pedro F. Giffuni
c148237d44 Partial revert of r239963:
The following change caused rpc.lockd to exit after startup:
____

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.
____

MFC after:	3 days
Reported by:	David Wolfskill
Tested by:	David Wolfskill
2012-09-24 03:14:17 +00:00
Steve Kargl
dba466c344 * ld80/s_expl.c:
. Fix the threshold for expl(x) where |x| is small.
  . Also update the previously incorrect comment to match the
    new threshold.

* ld128/s_expl.c:
  . Re-order logic in exceptional cases to match the logic used in
    other long double functions.
  . Fix the threshold for expl(x) where is |x| is small.
  . Also update the previously incorrect comment to match the
    new threshold.

Submitted by:	bde
Approved by:	das (mentor)
2012-09-23 18:32:03 +00:00
Steve Kargl
724c1ee29f Fix whitespace issue.
Approved by:	das (mentor, implicit)
2012-09-23 18:13:46 +00:00
Steve Kargl
8f647ffd7f * ld80/s_expl.c:
. Guard a comment from reformatting by indent(1).
  . Re-order variables in declarations to alphabetical order.
  . Remove a banal comment.

* ld128/s_expl.c:
  . Add a comment to point to ld80/s_expl.c for implementation details.
  . Move the #define of INTERVAL to reduce the diff with ld80/s_expl.c.
  . twom10000 does not need to be volatile, so move its declaration.
  . Re-order variables in declarations to alphabetical order.
  . Add a comment that describes the argument reduction.
  . Remove the same banal comment found in ld80/s_expl.c.

Reviewed by:	bde
Approved by:	das (mentor)
2012-09-23 18:06:27 +00:00
Steve Kargl
c1a077829a * Update the lookup table to use 53-bit high and low values.
Also, update the comment to describe the choice of using
  a high and low decomposition of 2^(i/INTERNVAL) for
  0 <= i <= INTERVAL in preparation for an implementation of
  expm1l.

* Move the #define of INTERVAL above the comment, because the
  comment refers to INTERVAL.

Reviewed by:	bde
Approved by:	das (mentor)
2012-09-23 17:36:01 +00:00
Kevin Lo
6e427123e2 Avoid NULL dereference 2012-09-23 08:38:06 +00:00
Steve Kargl
340076f0f6 * Use ENTERI() and RETURNI() to toggle the rounding precision if
necessary, so that cosl(), sinl() and tanl() work on i386 even
  for naive callers.

Suggested by:	bde
Reviewed by:	bde
Approved by: 	das (mentor)
2012-09-22 15:38:29 +00:00
Steve Kargl
e6f9129aa0 * Make STRICT_ALIGN() work for doubles as well as for floats. This
only affects i386.  The double case was intentionally left broken
  as an optimization, but we are getting closer to supporting
  applications and/or kernels that change the (FreeBSD i386) default
  rounding precision from FP_PD to FP_PE and never change it back,
  and this requires the STRICT_ALIGN()s that were added to support
  FP_PE to actually work in all precisions.

* Remove an extraneous semicolon at the end of a macro that was
  supposed to be function-like.

Submitted by:	bde
Approved by:	das (mentor)
2012-09-22 15:19:11 +00:00
Alexander Motin
4b1b92312e Make nfs_readdir() more careful about using response data, cached in global
buffer. For now it fixes bug when following `ls` command will return data
from previous one aborted by pager. Also it should allow to read several
directories same time, for example, for recursive tracerse.
2012-09-21 13:25:50 +00:00
Alexander Motin
e34e909b1f Don't use global nfs_root_node variable as per-file storage. There are
fields that should be file-specific.
2012-09-21 12:19:36 +00:00
Alexander Motin
ec9b9fbd50 Restore handling of the third argument (id) of hid_start_parse(), same as
it is done in NetBSD/OpenBSD, and as it was here before r205728.

I personally think this API or its implementation is incorrect, as it is not
correct to filter collections based on report ID, as they are orthogonal
in general case, but I see no harm from supporting this feature.

PR:		usb/171810
Submitted by:	Vitaly Magerya <vmagerya@gmail.com>
MFC after:	1 month
2012-09-20 18:56:27 +00:00
Doug Barton
c8aac173de Vendor import of BIND 9.8.3-P3 2012-09-20 03:38:28 +00:00
Kevin Lo
cc77b2d8e2 Remove the restrict qualifier to match function prototype. 2012-09-20 02:25:18 +00:00
Jilles Tjoelker
1ceeb358f2 strsignal(): Reindent. 2012-09-19 19:22:24 +00:00
Jilles Tjoelker
b8d472d710 strsignal(): Do not append signal numbers to messages for known signals.
Messages for known signals looked like "Terminated: 15" instead of
"Terminated".
2012-09-19 19:21:22 +00:00
Tijl Coosemans
71dad5d6ad Optimise i387 trigonometric functions. Replace "andw 0x400,%ax \ jnz" with
"sahf \ jp", "fprem1" with "fprem" and "fstsw %ax" with "fnstsw %ax".
2012-09-16 16:58:49 +00:00
Eitan Adler
96240c89f0 Correct double "the the"
Approved by:	cperciva
MFC after:	3 days
2012-09-14 21:28:56 +00:00
Eitan Adler
eae8be706e Bump date missed in r202756
PR:		docs/171624
Submitted by:	bdrewery
Approved by:	gabor
MFC after:	3 days
2012-09-14 17:50:42 +00:00
Dag-Erling Smørgrav
0e50a83330 Use libmd if and only if OpenSSL is not available.
PR:		bin/171402
MFC after:	3 days
2012-09-14 13:00:43 +00:00
Eitan Adler
42415fcb52 Adding missing return statements during error conditions.
PR:		kern/171187
Submitted by:	Mark Johnston <markjdb@gmail.com>
Reviewed by:	des
Approved by:	cperciva
MFC after:	2 weeks
2012-09-14 12:15:13 +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
Baptiste Daroussin
de0bfe73b9 Fix IEC / SI binary prefixes (Ki, Mi, Gi, etc) production by humanize_number(3)
PR:		bin/171487
Submitted by:	matthew
MFC after:	1 week
2012-09-12 11:41:03 +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
David E. O'Brien
c2774610af r235638 is not the clean way to add support for building on ancient FreeBSD
versions.  Instead use Imp's good work on "legacy" and follow the outcome
of the previous TRB discussions on this topic.

Now use the libc getline() if it exists, and only where it doesn't
create a bootstraping version.
2012-09-11 22:38:33 +00:00
Joel Dahl
ff34c32ac4 Minor mdoc fix. 2012-09-11 17:40:06 +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
Kevin Lo
bedceb7c9c If the IdlePDPT is not present, PAE is not active 2012-09-10 08:16:45 +00:00
Rui Paulo
404087cc06 When calling the C++ demangler, make sure to free the returned buffer,
which might have been reallocated.

Pointed out by:	stefanf
2012-09-07 02:38:07 +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
Joel Dahl
4c7c24efe0 Remove trailing whitespace. 2012-09-06 19:24:48 +00:00
Joel Dahl
a619d8f7a1 Minor mdoc fix. 2012-09-06 19:14:02 +00:00
Fabien Thomas
1e862e5ad0 Add Intel Ivy Bridge support to hwpmc(9).
Update offcore RSP token for Sandy Bridge.
Note: No uncore support.

Will works on Family 6 Model 3a.

MFC after: 1 month
Tested by: bapt, grehan
2012-09-06 13:54:01 +00:00
Rui Paulo
cd906041ea Add support for demangling C++ symbols. This requires linking libproc with
libc++rt/libsupc++.

Discussed with:	theraven
2012-09-06 03:19:48 +00:00
Rui Paulo
202f1c2c8d Fix test cases to work with the latest version of the API. 2012-09-06 01:24:18 +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
Mikolaj Golub
d1145837a5 Add __BEGIN_DECLS and __END_DECLS to make libprocstat more C++-friendly.
Submitted by:	Daniel Dettlaff <dmilith gmail com>
MFC after:	1 week
2012-09-04 05:51:50 +00:00
Rui Paulo
19a75aff51 Make sure we visit both symbol sections even if one of them doesn't
exist. This makes it possible to dtrace some C++ programs like devd.
2012-09-02 18:14:01 +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
Dimitry Andric
1c7dd55c33 Teach libdwarf about the DW_FORM_flag_present dwarf attribute, so
programs using libdwarf (such as ctfconvert) don't error out on files
containing the attribute.

MFC after:	2 weeks
2012-08-29 18:49:41 +00:00
David Xu
a7b84c6512 In suspend_common(), don't wait for a thread which is in creation, because
pthread_suspend_all_np() may have already suspended its parent thread.
Add locking code in pthread_suspend_all_np() to only allow one thread
to suspend other threads, this eliminates a deadlock where two or more
threads try to suspend each others.
2012-08-27 03:09:39 +00:00
Peter Grehan
177fd53318 Add sysctls to display the total and free amount of hard-wired mem for VMs
# sysctl hw.vmm
   hw.vmm.mem_free: 2145386496
   hw.vmm.mem_total: 2145386496

Submitted by:	Takeshi HASEGAWA hasegaw at gmail com
2012-08-26 01:41:41 +00:00
Dimitry Andric
15e154df01 Add libcxxrt's objects (prefixing them with cxxrt_ to avoid collisions)
to libc++.a and libc++_p.a, to make static linking of C++ executables
with libc++ easier.  This is similar to the approach used in libstdc++.

MFC after:	2 weeks
2012-08-25 13:15:44 +00:00
Dimitry Andric
5ea2b3b5db Sprinkle a bit of style.Makefile(5) across various clang Makefiles. No
functional changes.

MFC after:	3 days
2012-08-23 17:08:07 +00:00
David Xu
0aa81bff0b Eliminate redundant code, _thr_spinlock_init() has already been called
in init_private(), don't call it again in fork() wrapper.
2012-08-23 05:15:15 +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
Dimitry Andric
d4271816c7 Add three additional clang intrinsics headers, which I missed in the
previous import.
2012-08-20 20:56:40 +00:00
Dimitry Andric
7ae0e2c9f0 Upgrade our copy of llvm/clang to trunk r162107. With thanks to
Benjamin Kramer and Joerg Sonnenberger for their input and fixes.
2012-08-20 18:33:03 +00:00
Dimitry Andric
657bc3d984 Vendor import of clang trunk r162107:
http://llvm.org/svn/llvm-project/cfe/trunk@162107
2012-08-19 10:33:04 +00:00
Dimitry Andric
902a7b5298 Vendor import of llvm trunk r162107:
http://llvm.org/svn/llvm-project/llvm/trunk@162107
2012-08-19 10:31:50 +00:00
Stephen McKay
a0ebde2020 Correct a regression introduced during the import of file(1) 5.11.
Magic tests containing "search" or "regex" directives were incorrectly
compiled by "mkmagic" and were effectively ignored.  This caused troff
files (for example) to be detected as simply "ASCII text" instead of
as "troff or preprocessor input, ASCII text".

PR:		bin/170415
Approved by:	consensus on developers@
MFC after:	3 days
2012-08-17 02:27:17 +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
Dimitry Andric
56d91b49b1 Vendor import of clang trunk r161861:
http://llvm.org/svn/llvm-project/cfe/trunk@161861
2012-08-15 20:02:54 +00:00
Dimitry Andric
58b69754af Vendor import of llvm trunk r161861:
http://llvm.org/svn/llvm-project/llvm/trunk@161861
2012-08-15 19:34:23 +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
Oleksandr Tymoshenko
89e757fe6f Merging of projects/armv6, part 2
Handle TLS for ARMv6 and ARMv7
2012-08-15 03:08:29 +00:00
Hans Petter Selasky
07b6ce3ba9 Add support for streams to LibUSB v2.0.
MFC after:	2 weeks
2012-08-13 18:10:52 +00:00
David Xu
aa75bc577a Do defered mutex wakeup once. 2012-08-12 00:56:56 +00:00
David Xu
e220a13ab9 MFp4:
Further decreases unexpected context switches by defering mutex wakeup
until internal sleep queue lock is released.
2012-08-11 23:17:02 +00:00
Dimitry Andric
f049a6cb4a Add __always_inline to __ieee754_rem_pio2() and __ieee754_rem_pio2f(),
since some older versions of gcc refuse to inline these otherwise.

Requested by:	bde
MFC after:	1 week
2012-08-11 15:47:22 +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
Dimitry Andric
2b795b2921 Change a few extern inline functions in libm to static inline, since
they need to refer to static constants, which C99 does not allow for
extern inline functions.

While here, change a comment in e_rem_pio2f.c to mention the correct
number of bits.

Reviewed by:	bde
MFC after:	1 week
2012-08-11 11:13:48 +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
Dimitry Andric
1843e23c48 Fix an instance in pam_krb5(8), where the variable 'user' could be used
uninitialized.

Found by:	clang 3.2
Reviewed by:	des
MFC after:	1 week
2012-08-06 18:44:59 +00:00
Dimitry Andric
2251b30757 Fix two instances in pam_krb5(8), where the variable 'princ_name' could
be used uninitialized.

Found by:	clang 3.2
Reviewed by:	des
MFC after:	1 week
2012-08-06 18:40:14 +00:00
Doug Rabson
957487515e Add an option for pam_krb5 to allow it to authenticate users which don't have
a local account.

PR:		76678
Submitted by:	daved at tamu.edu
MFC after:	2 weeks
2012-08-05 13:40:35 +00:00
Neel Natu
1ff856dbd7 Allow the 'bhyve' process to control whether or not the virtual machine sees an
ioapic.

Obtained from: NetApp
2012-08-04 22:46:29 +00:00
Neel Natu
90d4b48f60 API to map an apic id to the vcpu.
At the moment this is a simple mapping because the numerical values are
identical.
2012-08-04 02:38:05 +00:00
Neel Natu
32c96bc813 There is no need to explicitly specify the CR4_VMXE bit when writing to guest
CR4. This bit is specific to the Intel VTX and removing it makes the library
more portable to AMD/SVM.

In the Intel VTX implementation, the hypervisor will ensure that this bit is
always set. See vmx_fix_cr4() for details.

Suggested by: grehan
2012-08-04 02:14:27 +00:00
Xin LI
0dfbbb3391 Use calloc(). 2012-08-01 00:21:55 +00:00
Steve Kargl
82b89f4850 ieeefp.h is only needed on i386 class hardware.
Submitted by:	bde
Approved by:	das (pre-approved)
2012-07-30 21:58:28 +00:00
Steve Kargl
ca50c4b871 Whitespace.
Submitted by:	bde
Approved by:	das (pre-approved)
2012-07-30 21:55:49 +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
Martin Matuska
10ed66fdf8 Backport NFSv4 ACL fix from libarchive master branch.
Source:
https://github.com/libarchive/libarchive/commit/f67370d5

Obtained from:	libarchive (master branch)
2012-07-30 14:47:35 +00:00
Martin Matuska
27b0f55431 Catch up config_freebsd.h with libarchive 3.0.4 2012-07-29 06:34:45 +00:00
Martin Matuska
fd082e96c4 Update libarchive to 3.0.4 2012-07-28 06:38:44 +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
Pedro F. Giffuni
8064706450 Drop non-portable libedit's el_data_set() and el_data_get() for
private data.

We can set/get private data with the documented el_get() and
el_set() so there's no need for our local extensions, which
never received much use anyway.

While here, also re-arrange the call to term_init_arrow. This
was left over from r89735 but is not required anymore.

This changes reduce differences against NetBSD's libedit.

MFC after:	2 months
2012-07-26 15:48:07 +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
Steve Kargl
8345cbd275 Replace the macro name NUM with INTERVALS. This change provides
compatibility with the INTERVALS macro used in the soon-to-be-commmitted
expm1l() and someday-to-be-committed log*l() functions.

Add a comment into ld128/s_expl.c noting at gcc issue that was
deleted when rewriting ld80/e_expl.c as ld128/s_expl.c.

Requested by:	bde
Approved by:	das (mentor)
2012-07-26 04:05:08 +00:00
Steve Kargl
f7cfe68f59 * ld80/expl.c:
. Remove a few #ifdefs that should have been removed in the initial
    commit.
  . Sort fpmath.h to its rightful place.

* ld128/s_expl.c:
  . Replace EXPMASK with its actual value.
  . Sort fpmath.h to its rightful place.

Requested by:	bde
Approved by:	das (mentor)
2012-07-26 03:59:33 +00:00
Steve Kargl
3458a81e65 Replace code that toggles between 53 and 64 bits on i386
class hardware with the ENTERI and RETURNI macros, which
are now available in math_private.h.

Suggested by:	bde
Approved by: das (mentor)
2012-07-26 03:50:24 +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
Doug Barton
edbc2a977c Vendor import of BIND 9.8.3-P2 2012-07-24 18:48:17 +00:00
Andrey A. Chernov
7066cac012 Don't ever build files depending on the directory where they are placed in.
It is obvious that its modification time will change with each such file
builded.
This bug cause whole libelf to rebuild itself each second make run
(and relink that files on each first make run) in the loop.
2012-07-24 16:03:28 +00:00
Steve Kargl
8a489dc248 Hook ld80/s_expl.c or ld128/s_expl.c into the building of libm.
PR: standards/152415
Approved by: das (mentor)
2012-07-23 19:23:49 +00:00
Steve Kargl
b83ccea32c Compute the exponential of x for Intel 80-bit format and IEEE 128-bit
format.  These implementations are based on

PTP Tang, "Table-driven implementation of the exponential function
in IEEE floating-point arithmetic," ACM Trans. Math. Soft., 15,
144-157 (1989).

PR: standards/152415
Submitted by: kargl
Reviewed by: bde, das
Approved by: das (mentor)
2012-07-23 19:13:55 +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
David Xu
5674256c7f Don't forget to initialize return value. 2012-07-20 05:47:12 +00:00
David Xu
ec225efc58 Simplify code by replacing _thr_ref_add() with _thr_find_thread(). 2012-07-20 03:37:19 +00:00
David Xu
340e384de9 Eliminate duplicated code. 2012-07-20 03:27:07 +00:00
David Xu
30dd4f448c Don't assign same value. 2012-07-20 03:22:17 +00:00
David Xu
670bc18dfe Eliminate duplicated code. 2012-07-20 03:16:52 +00:00
David Xu
7e0cf81bc9 Eliminate duplicated code. 2012-07-20 03:00:41 +00:00