Commit Graph

14543 Commits

Author SHA1 Message Date
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
Andrew Turner
6b14dddf9a Add the sys directory we create to the list of items to clean. 2012-06-24 09:19:24 +00:00
Andrew Turner
ec280fdbf5 Create a symlink to sys/elf32.h, sys/elf64.h, and sys/elf_common.h.
When building libelf in the bootstrap stage this would include the tree
versions of, for example, sys/_types.h. This would work as long as the
tree's version of this file was close enough to the system's version of
the file. If, however, there was a change in the tree such that the location
of a typedef was moved this would cause problems. In this case the version
of sys/_types.h in the tree no longer defines __wchar_t and expects it to
to be defined in machine/_types.h, however we pick up machine/_types.h from
the system and find it is not defined there. The solution is to restrict the
parts of sys er include from the tree to those that are needed.

This fixes the recent Tinderbox failure.

Pointy Hat to:	andrew
2012-06-24 08:43:34 +00:00
Joel Dahl
f2de8db466 Fix mandoc "Oc breaks Op" warning. 2012-06-24 07:54:28 +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
Pedro F. Giffuni
8abd4c975c Merge changes from upstream libedit.
Our libedit has been diverging from the mainstream version
maintained in NetBSD. As a consequence it has been difficult
to do an appropriate MFV and we have been bringing only
partial updates.

Here we update most of the files to at least match the
version available in NetBSD's snapshot of 20091228. This
version was chosen because it still doesn't include wide
character support (UTF-8), which involves many changes and
new files.

From NetBSD's logs:

Dec 15 22:13:33 2006 - editline.3 el.c el.h histedit.h
add EL_GETFP, and EL_SETFP.

Apr 5 15:53:28 2008 - editline.3 el.c histedit.h readline.c
add EL_REFRESH for the benefit of readline

Sep 10 15:45:37 2008 - common.c el.c read.c refresh.c sig.c term.c term.h tty.c
Allow a single process to control multiple ttys (for pthreads using _REENTRANT)
using multiple EditLine objects.

Jan 18 12:17:24 2009 - el.c read.c readline.c
fix -Wsign-compare issues

Feb 6 14:40:32 2009 - history.c
Plug memory leak, from MySQL.

Feb 5 19:15:44 2009 - histedit.h read.c
match documentation in el_push

Feb 6 13:14:37 2009 - vi.c
Portability fix.

Feb 12 13:39:49 2009 - readline.c term.c
More fixes for existing portability stuff.

Feb 15 21:24:13 2009 - el.h read.c
don't restart on EINTR, instead return NULL immediately. From Anon Ymous

Feb 15 21:25:01 2009 - sig.c sig.h
in order for read() to return EINTR we need to use sigaction, not signal,
otherwise SA_RESTART is set.

Feb 15 21:55:23 2009 - chared.c chared.h common.c emacs.c filecomplete.c
filecomplete.h key.c key.h read.c readline.c refresh.c search.c
term.c tokenizer.c tty.c vi.c
pass lint on _LP64.

Feb 17 21:34:26 2009 - el.c histedit.h	prompt.c prompt.h
allow for a prompt argument.

Feb 18 15:04:40 2009 - sig.c
SA_RESTART for all signals but SIGINT. From Anon Ymous.

Feb 19 15:20:22 2009 - read.c sig.c sig.h
reset and redraw on sigcont. From Anon Ymous.

Feb 21 23:31:56 2009 - key.c key.h readline.c vi.c
more size_t stuff.

Mar 10 20:46:15 2009 - editline.3 read.c
make el_gets set the count to -1 on error to distinguish between EOF and
error.

Mar 31 17:38:27 2009 - editline.3 el.c histedit.h prompt.c prompt.h
refresh.c term.c term.h
Implement literal prompt sequences. Now someone can implement
RL_PROMPT_START_LITERAL/RL_PROMPT_END_LITERAL :-)

Mar 31 21:33:17 2009 - term.c
cast to size_t to avoid sign / unsigned comparison warning.

Apr 23 02:03 2009 - term.c
Apply patch (requested by msaitoh in ticket #2007):
Coverity CID 1668: Plug memory leak when malloc() failed.:55 2009

May 11 18:33:30 2009 - editline.3 el.c histedit.h
restore binary compatibility by providing new prompt functions that take
an extra literal character.

May 19 21:45:14 2009 - refresh.c
always scroll when we advance past bottom. From Caleb Welton
cwelton at greenplum dot com.

Jul 17 12:27:57 2009 - term.c
- off by one in the term.h case.
- make code more similar to tcsh (if we want to handle wide chars, this is
  needed; for now it is a no-op)

Jul 22 15:56:29 2009 - el.c
Move filename to the scope it is being used.
From Michael Cook mcook at bbn dot com

Jul 22 15:57:00 2009 - read.c
Always initialize nread since it is an out param.
From Michael Cook mcook at bbn dot com

Jul 22 18:25:26 2009 - el.c
Only need path if we have issetugid... From Anon Ymous

Jul 25 21:19:23 2009 - el.c
Ignore comment lines in .editrc from Jess Thrysoee

Sep 7 21:24:33 2009
histedit.h history.c readline.c
apply apple patches from:
http://opensource.apple.com/source/libedit/libedit-11/patches/

Dec 28 21:52:43 2009 - refresh.c
Fix bug where tab completion on the second or > line that caused listing
ended up corrupting the display by an extra space in the beginning. Reported
by Mac Chan.

Dec 28 22:15:36 2009 - refresh.c term.c
reduce diff with tcsh

Obtained from:	NetBSD
Tested by:	bapt, jilles and current@
MFC after:	1 week
2012-06-22 18:01: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
Xin LI
a2953f767d MFV: Update zlib to 1.2.7.
(x86 assembler optimization disabled for now because it
requires the new .cfi_* directives that is not supported
by base system binutils).

MFC after:	1 week
2012-06-21 21:47:08 +00:00
Isabell Long
93af1bc413 Add the functions documented in the man pages in commit 237393 to the
relevant Makefile.

Reminded by:	gavin
Approved by:	gabor (mentor)
MFC after:	5 days
2012-06-21 18:28:48 +00:00
David E. O'Brien
d91d816266 Be explicit about the dependency on nsparser.h. 2012-06-21 15:47:06 +00:00
Isabell Long
db356f0370 Add more locale-specific functions to the relevant man pages:
- libc/string/strcoll.3
- libc/string/strstr.3
- libc/string/strxfrm.3
- libc/string/strcasecmp.3

Reviewed by:	theraven, gabor
Approved by:	gabor (mentor)
MFC after:	5 days
2012-06-21 12:52:15 +00:00
Eitan Adler
bf36cf8e1b Don't close an uninitialized descriptor. [1]
Add a sanity check for the validity of the passed fd.

PR:		kern/139080 [1]
Submitted by:	Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> [1]
Reviewed by:	pjd (briefly)
Approved by:	cperciva
MFC after:	1 week
2012-06-20 06:38:41 +00:00
John Baldwin
cd4ecf3cd2 Further refine the implementation of POSIX_FADV_NOREUSE.
First, extend the changes in r230782 to better handle the common case
of using NOREUSE with sequential reads.  A NOREUSE file descriptor
will now track the last implicit DONTNEED request it made as a result
of a NOREUSE read.  If a subsequent NOREUSE read is adjacent to the
previous range, it will apply the DONTNEED request to the entire range
of both the previous read and the current read.  The effect is that
each read of a file accessed sequentially will apply the DONTNEED
request to the entire range that has been read.  This allows NOREUSE
to properly handle misaligned reads by flushing each buffer to cache
once it has been completely read.

Second, apply the same changes made to read(2) by r230782 and this
change to writes.  This provides much better performance in the
sequential write case as it allows writes to still be clustered.  It
also provides much better performance for misaligned writes.  It does
mean that NOREUSE will be generally ineffective for non-sequential
writes as the current implementation relies on a future NOREUSE
write's implicit DONTNEED request to flush the dirty buffer from the
current write.

MFC after:	2 weeks
2012-06-19 18:42:24 +00:00
Dag-Erling Smørgrav
b4f560356a Switch the default password hash from md5 to sha512.
MFC after:	1 week
2012-06-19 14:46:18 +00:00
Baptiste Daroussin
2f1b1e91a3 Revert user comparison back to user names as some user can share uids (root/toor
for example)

get the username information from old_pw structures to still allow renaming of a
user.

Reported by:	Claude Buisson <clbuisson@orange.fr>
Approved by:	des (mentor)
MFC after:	3 weeks
2012-06-19 11:39:56 +00:00
Jilles Tjoelker
770284d809 libc: Reduce relative relocations in strftime(). 2012-06-17 21:40:13 +00:00
Konstantin Belousov
17ec7b7aa8 More style.
MFC after:	3 days
2012-06-16 13:11:10 +00:00
Konstantin Belousov
3a3c91219b Revert part of the r235740 which changed separate allocation of the
string buffer for each linelist l_line into one large string. Since
linelists parsed out during the previous passes store the pointers to
previously allocated l_lines, the reallocation caused undefined
behaviour on accessing the buffers, and quite deterministic fault on
freeing them (in mountd(8) startup).

This fixes reading of netgroup(5) file which contains more then one
netgroup.

Discussed with:	ghelmer
MFC after:	3 days
2012-06-16 13:10:22 +00:00
Joel Dahl
15e92497e2 mandoc fixes.
Obtained from:	OpenBSD
2012-06-16 06:38:11 +00:00
Tim Kientzle
061103347c Per kib, since __flt_rounds is being added to FreeBSD 10, it
belongs in FBSD_1.3.

MFC after:	1 week
2012-06-15 03:57:16 +00:00
Konstantin Belousov
61235d9e01 Make sure that fstab fd is not leaked on exec.
PR:  kern/169023
Submitted by:	Jukka Ukkonen <jau iki fi>
MFC after:	1 week
2012-06-14 12:28:43 +00:00
Tim Kientzle
ed1589b9b7 __flt_rounds is a public symbol (expands from the FLT_ROUNDS macro),
so include it in the public namespace on arm just as with
other architectures.

This corrects r236816.

Submitted by:	Jan Sieka
MFC after:	1 week
2012-06-14 03:27:01 +00:00
Dimitry Andric
0bd7a6f878 Make sure libkiconv.so.4 is installed into /lib, not into /usr/lib,
which was inadvertently caused by r236185: if SHLIBDIR is set using the
?= operator, it must be done *before* bsd.own.mk is included, otherwise
the default value is still used.

Note, bsd.lib.mk will take care of removing the copy in /usr/lib upon
installation, so no addition to ObsoleteFiles.inc is needed.

X-MFC-With:	r236185
2012-06-12 20:24:57 +00:00
Dag-Erling Smørgrav
a0ee974f0b Stop using auth_getval() now that it always returns NULL. Instead,
hardcode the default to what it would be if we didn't hardcode it,
i.e. DES if supported and MD5 otherwise.

MFC after:	3 weeks
2012-06-12 17:14:19 +00:00
Dag-Erling Smørgrav
7c5a921699 Finally nuke auth.conf, nine years after it was deprecated. The only
thing it was still used for was to set the "global default" password
hash.  Since the stock auth.conf contained nothing but comments, the
global default was actually the first algorithm in crypt(3)'s list,
which happens to be DES; I take the fact that nobody noticed as proof
that it was not used outside of crypt(3).

The only other use in our tree was in the Kerberos support code in
in tinyware's passwd(1).  I removed that code in an earlier commit;
it would not have compiled anyway, as it only supported Kerberos IV.

The auth_getval() function is now a stub that always returns NULL,
which has the same effect as a functional auth_getval() with an
empty auth.conf.

MFC after:	3 weeks
2012-06-12 17:02:53 +00:00
Hans Petter Selasky
f7287225df LibUSB v1.0 API compiliance and bugfixes.
- Use CLOCK_MONOTONIC instead of CLOCK_REALTIME, because CLOCK_MONOTONIC
does not wrap into negative in near future. This fixes any potential
problems using "pthread_cond_timedwait()".

- Fix a bug where the "libusb_wait_for_event()" function computes an
absolute timeout instead of a relative timeout. USB transfers do
not depend on this timeout value.

- Add dependency towards LibPthread to Makefile, because LibUSB v1.0
needs this library to function correctly.

MFC after:	1 week
2012-06-12 07:28:25 +00:00
Xin LI
1b74dc4a8b Switch from 4-clause to 2-clause BSD license. (OpenBSD r1.22)
No functional change.

Obtained from:	NetBSD via OpenBSD
2012-06-11 22:25:20 +00:00
David Chisnall
fe13239287 Clean up some symbol versions for libsupc++ / libcxxrt.
MFC after:	1 week
Reviewed by:	kan
2012-06-11 15:40:57 +00:00
David Chisnall
1967332863 Fix a leak when setting the global character locale to "C" from something else.
Reported by:	mm
2012-06-11 14:02:02 +00:00
Tim Kientzle
d849ce3315 __flt_rounds was omitted from the exported symbols here.
Submitted by:	Jan Sieka
Reviewed by:	arm@
MFC after:	1 week
2012-06-09 16:09:53 +00:00
Dag-Erling Smørgrav
fb374358bf Document that we also support sha256 and sha512.
MFC after:	1 week
2012-06-08 12:36:08 +00:00
Joel Dahl
6a557179e1 mdoc: add missing -width argument to Bl -tag. 2012-06-08 12:09:00 +00:00
John Baldwin
a9f5e42532 Teach procstat_get_shm_info_kvm() how to fetch the pathname of a SHM file
descriptor from a core and set it in fts->fs_path.

MFC after:	1 week
2012-06-07 15:54:52 +00:00
Dimitry Andric
f61ac9d9bd Fix two warnings about self-assignment in libc. These normally only
trigger with clang, when you either use -save-temps, or ccache.

Reported by:	Sevan / Venture37 <venture37@gmail.com>
MFC after:	3 days
2012-06-06 21:16:26 +00:00
Joel Dahl
5d53fe3984 mdoc: add missing -width argument to Bl -tag. 2012-06-06 08:07:47 +00:00
Joel Dahl
a4dec862ed Remove repeated words. 2012-06-05 18:19:52 +00:00
Andrey A. Chernov
5f5a50728c 1) Although unpublished version of standard
http://austingroupbugs.net/view.php?id=385#c713
(Resolved state) recommend this way for the current standard (called
"earlier" in the text)

"However, earlier versions of this standard did not require this, and the
same example had to be written as:

    // buf was obtained by malloc(buflen)
    ret = write(fd, buf, buflen);
    if (ret < 0) {
        int save = errno;
        free(buf);
        errno = save;
        return ret;
    }
"

from feedback I have for previous commit it seems that many people prefer
to avoid mass code change needed for current standard compliance
and prefer to track unpublished standard instead, which requires now
that free() itself must save errno, not its usage code.

So, I back out "save errno across free()" part of previous commit,
and will fill PR for changing free() isntead.

2) Remove now unused serrno.

MFC after:      1 week
2012-06-05 16:16:33 +00:00
Andrey A. Chernov
96700463ec 1) IEEE Std 1003.1-2008, "errno" section, is explicit that
"The setting of errno after a successful call to a function is
unspecified unless the description of that function specifies that
errno shall not be modified."

However, free() in IEEE Std 1003.1-2008 does not mention its interaction
with errno, so MAY modify it after successful call
(it depends on particular free() implementation, OS-specific, etc.).

So, save errno across free() calls to make code portable and
POSIX-conformant.

2) Remove unused serrno assignment.

MFC after:      1 week
2012-06-04 21:34:49 +00:00
Dimitry Andric
cd38c40872 Install libcxxrt's C++ ABI and unwind headers. This is done in libc++'s
Makefile, so these headers go into the same destination directory as
libc++'s own headers, currently /usr/include/c++/v1.

MFC after:	3 days
2012-06-02 11:07:19 +00:00
Dimitry Andric
01dd3d87fb Tabify libcxxrt and libc++'s Makefiles.
MFC after:	3 days
2012-06-02 11:00:48 +00:00
Ed Schouten
0089e0c430 Remove invalid remark about pipes.
The stat structures returned on pipes seems to contain all the
information required by POSIX. Especially the wording "and thus to a
pipe" makes little sense, because it seems to imply a certain
relationship between sockets and pipes that simply isn't there.

MFC after:	2 weeks
2012-06-02 10:50:25 +00:00
Joel Dahl
9ee2158b55 mdoc: minor Bl improvements. 2012-06-02 08:47:26 +00:00
Guy Helmer
3d1d73c22f Style(9) improvements: remove unnecessary parenthesis, improve order
of local variable declarations, remove bogus casts, and resolve long
lines.

Reviewed by:	bde
2012-06-01 15:02:23 +00:00
Eitan Adler
b9f0348640 Add characters mapping for codepages used in Germany.
(not verified by me to be accurate)

PR:		bin/163847
Submitted by:	Gabor Fischer <Gabor.Fischer@gmx.net>
Reviewed by:	bp
Approved by:	cperciva
MFC after:	3 weeks
2012-06-01 03:59:08 +00:00
Eitan Adler
e5d9109aab Only set _w to 0 when the file stream is not currently reading. Without
this fflush may fail to write data in the buffer.

PR:		kern/137819
Submitted by:	Eric Blake <ebb9@byu.net>
Reviewed by:	theraven
Approved by:	cperciva
MFC after:	2 weeks
2012-05-30 04:06:38 +00:00
Doug Barton
687aeb3821 Upgrade to BIND version 9.8.3, the latest from ISC.
Feature Change

*  BIND now recognizes the TLSA resource record type, created to
   support IETF DANE (DNS-based Authentication of Named Entities)

Bug Fix

*  The locking strategy around the handling of iterative queries
   has been tuned to reduce unnecessary contention in a multi-
   threaded environment.

Other critical bug fixes are included.

All BIND users are encouraged to upgrade.
2012-05-28 19:47:56 +00:00
Jilles Tjoelker
28fd93073a libfetch: Avoid SIGPIPE on network connections.
To avoid unexpected process termination from SIGPIPE when writing to a
closed network connection, enable SO_NOSIGPIPE on all network connections.

The POSIX standard MSG_NOSIGNAL is not used since it requires modifying all
send calls to add this flag. This is particularly nasty for SSL connections.

Reviewed by:	des
Tested by:	bapt
MFC after:	5 days
2012-05-28 19:22:23 +00:00
Gabor Kovesdan
54ca36aeac - Include forgotten bsd.own.mk and fix condition
Reported by:	Jan Beich <jbeich@tormail.org>
2012-05-28 14:45:12 +00:00
Doug Barton
084de27e02 Vendor import of BIND 9.8.3 2012-05-28 09:49:28 +00:00
David Chisnall
8f62d384b9 Allow inclusion of libc++ <cmath> to work after including math.h
Submitted by:	Yamaya Takashi
Reviewed by:	das
MFC after:	1 week
2012-05-27 12:54:41 +00:00
David Xu
e3b090f037 Return EBUSY for PTHREAD_MUTEX_ADAPTIVE_NP too when the mutex could not
be acquired.

PR:	168317
MFC after:	3 days
2012-05-27 01:24:51 +00:00
Dag-Erling Smørgrav
2f3ed61901 Update to OpenPAM Micrampelis. 2012-05-26 17:10:16 +00:00
Dag-Erling Smørgrav
8d6900eab8 Passing NULL as a key casues a segfault when loading SSH 1 keys. Use
an empty string instead.
2012-05-26 17:03:45 +00:00
Dag-Erling Smørgrav
55b76c4090 Vendor import of OpenPAM Micrampelis. 2012-05-26 14:23:18 +00:00
Konstantin Belousov
86b0103262 Clarify the SEEK_HOLE description, it repositions the file pointer.
MFC after:  3 days
2012-05-26 05:25:55 +00:00
Gabor Kovesdan
af483ad6ef - Add support for BSD iconv when it is build into libc
PR:		bin/162670
Submitted by:	Jan Beich <jbeich@tormail.net>
MFC after:	2 weeks
2012-05-25 22:07:13 +00:00
Marcel Moolenaar
f7e3011309 Doh... Don't add __eabi to an old version tag (i.e. FBSD_1.0). Add it to the
current one (= FBSD_1.3).

Pointed out by: kib
2012-05-25 16:30:42 +00:00
David E. O'Brien
8bed40c9fe Consitently use "__LP64__".
[there are 33 __LP64__'s in the kernel (minus cddl/ and contrib/),
and 11 _LP64's]
2012-05-24 21:44:46 +00:00
Marcel Moolenaar
a4dcff16c8 Allow building for the PowerPC EABI by providing a dummy __eabi()
function. The purpose of the __eabi() function is to set up the
runtime and is called first thing by main(). The runtime is already
set up for us prior to caling main, so there's nothing to do for
us in the EABI case.
2012-05-24 20:12:46 +00:00
Warren Block
344c81a166 Fixes to man8 groff mandoc style, usage mistakes, or typos.
PR:		168016
Submitted by:	Nobuyuki Koganemaru
Approved by:	gjb
MFC after:	3 days
2012-05-24 02:24:03 +00:00
Dimitry Andric
64cc5073b2 Upgrade our copy of llvm/clang to 3.1 release. Release notes can be
found at: http://llvm.org/releases/3.1/docs/ReleaseNotes.html

MFC after:	3 days
2012-05-23 21:48:49 +00:00
Dimitry Andric
41e20f564a Vendor import of clang release_31 r156863 (the actual 3.1 release):
http://llvm.org/svn/llvm-project/cfe/branches/release_31@156863
2012-05-23 21:39:13 +00:00
Dimitry Andric
0378662f5b Vendor import of llvm release_31 r156863 (the actual 3.1 release):
http://llvm.org/svn/llvm-project/llvm/branches/release_31@156863
2012-05-23 21:37:39 +00:00
Isabell Long
af27459ace Add two new locale-specific man pages:
- libc/stdio/scanf_l.3
- libc/stdio/printf_l.3

Reviewed by:	theraven
Approved by:	gabor (mentor)
MFC after:	5 days
2012-05-23 17:13:30 +00:00
Michael Tuexen
43dc9e2f41 Update copyright date.
MFC after: 3 days
2012-05-23 10:35:40 +00:00
Dimitry Andric
e51da3eab6 Vendor import of clang release_31 final r156748:
http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_31/final@156748
2012-05-22 21:36:38 +00:00
Dimitry Andric
887c359eb0 Vendor import of llvm release_31 final r156748:
http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_31/final@156748
2012-05-22 21:30:23 +00:00
Jamie Gritton
cee9d6cc1d The fix in r235291 re-broke the "allow.nomount" case. Re-fix it
by testing for the right parameter name.
2012-05-22 18:30:32 +00:00
Kevin Lo
d52995b6cf Add missing header needed by free()
Reported by:	tinderbox
2012-05-22 01:28:32 +00:00
Guy Helmer
fed7420ced Add checks for memory allocation failures in appropriate places, and
avoid creating bad entries in the grp list as a result of memory allocation
failures while building new entries.

PR:		bin/83340
Reviewed by:	delphij (prior version of patch)
2012-05-21 21:10:00 +00:00
Guy Helmer
299bafae0c Apply style(9) to return and switch/case statements.
Reviewed by:	delphij (prior version of the patch)
2012-05-21 21:04:29 +00:00
Gleb Kurtsou
c7e5232438 Disable NLS catalog use in libc if built with WITHOUT_NLS option.
Functions affected: strerror, strsignal, gai_strerror.
2012-05-21 08:10:42 +00:00
Marcel Moolenaar
46ad370763 Don't link against libssp if MK_SSP is set to no.
Note that this still misses a proper dependency at this time.
2012-05-19 17:49:20 +00:00
Gleb Kurtsou
31bfa3ca7c Put my name as copyright owner of lib/libc/gen/dirfd.c added in r235647.
Requested by:	kib@
2012-05-19 14:30:49 +00:00
Gleb Kurtsou
0bb2aabf26 Hide DIR definition by making it an opaque struct typedef.
Introduce dirfd() libc exported symbol replacing macro with same name,
preserve _dirfd() macro for internal use.

Replace dirp->dd_fd with dirfd() call. Avoid using dirfd as variable
name to prevent shadowing global symbol.

Sponsored by:	Google Summer Of Code 2011
2012-05-19 12:44:27 +00:00
Marcel Moolenaar
cf0d539f8b Use the LLINDEX macro to access the link-level I/F index. This makes
it possible to work with a different type for the sdl_index field --
it only requires a recompile.

Obtained from:	Juniper Networks, Inc.
2012-05-19 02:39:43 +00:00
Marcel Moolenaar
aaa975e19d Don't depend on getline being on the build machine. That's
not the case for FreeBSD 7.x machines.
2012-05-19 02:30:10 +00:00
Gleb Kurtsou
e458cb776e Don't cast inode number or file size down to long or unsigned.
Since ino_t size is about to change to 64-bits, casts to long would
truncate 64-bit numbers on 32-bit archs.

Sponsored by:	Google Summer of Code 2011
2012-05-18 10:15:46 +00:00
Grzegorz Bernacki
7f725bcd5c Import work done under project/nand (@235533) into head.
The NAND Flash environment consists of several distinct components:
  - NAND framework (drivers harness for NAND controllers and NAND chips)
  - NAND simulator (NANDsim)
  - NAND file system (NAND FS)
  - Companion tools and utilities
  - Documentation (manual pages)

This work is still experimental. Please use with caution.

Obtained from: Semihalf
Supported by:  FreeBSD Foundation, Juniper Networks
2012-05-17 10:11:18 +00:00
Alexander Motin
cff79d9ed3 HID Report ID is unsigned value, so clear the rest of bits from possible
sign expansion.
2012-05-16 17:51:56 +00:00
Marius Strobl
45e2c46b37 Switch sparc64 to using libcompiler_rt; since r230021 we have a workaround
in place allowing it to be used there and since r235388 (see also r235486)
we also have usable div/mod optimizations like libgcc has.
2012-05-15 22:47:34 +00:00
Xin LI
d1e8733132 Merge from vendor branch: update libpcap to 1.2.1.
MFC after:	2 weeks
2012-05-14 05:12:56 +00:00
Joel Dahl
67783ce453 mdoc: avoid unterminated quoted strings. 2012-05-13 14:28:00 +00:00
Joel Dahl
35471bf8ef Minor mdoc nits. 2012-05-13 14:16:04 +00:00
Joel Dahl
790752beb4 Minor mdoc nits. 2012-05-12 20:27:13 +00:00
Joel Dahl
9650117163 Remove tab from kernel configuration option. This is consistent with the rest
of our manual pages.
2012-05-12 16:08:05 +00:00
Glen Barber
7b1d17a1bc General mdoc(7) and typo fixes.
PR:		167804
Submitted by:	Nobuyuki Koganemaru (kogane!jp.freebsd.org)
MFC after:	3 days
2012-05-12 15:08:22 +00:00
Joel Dahl
8521fde5fc mdoc: end list context with El. 2012-05-12 07:52:45 +00:00
Jamie Gritton
fb8d1d4f19 The linker isn't consistent in the ordering of dynamic sysctls, so don't
assume that the unnamed final component of "security.jail.param.foo." is
one less than the "foo" component.  It might be one greater instead.
2012-05-11 21:22:52 +00:00
Glen Barber
a3fb6da9ba General mdoc(7) and typo fixes.
PR:		167734
Submitted by:	Nobuyuki Koganemaru (kogane!jp.freebsd.org)
MFC after:	3 days
2012-05-11 20:06:46 +00:00
Konstantin Belousov
fdbe55fccb According to SUSv4, realpath(3) must fail if
[ENOENT]  A component of file_name does not name an existing file or
    file_name points to an empty string.
[ENOTDIR] A component of the path prefix is not a directory, or the
    file_name argument contains at least one non- <slash> character
    and ends with one or more trailing <slash> characters and the last
    pathname component names an existing file that is neither a
    directory nor a symbolic link to a directory.
Add checks for the listed conditions, and set errno accordingly.

Update the realpath(3) manpage to mention SUS behaviour. Remove the
requirement to include sys/param.h before stdlib.h.

PR:	    128933
MFC after:  3 weeks
2012-05-11 11:29:08 +00:00
Dimitry Andric
83c476cd09 Fix copy/paste error in lib/libc/locale/toupper.c.
Submitted by:	Kohji Okuno <okuno.kohji@jp.panasonic.com>
2012-05-10 20:03:34 +00:00
David Xu
fa782a2611 Create a common function lookup() to search a chan, this eliminates
redundant SC_LOOKUP() calling.
2012-05-10 09:30:37 +00:00
Eitan Adler
9ff418da7f Remove reference to non-existent FreeBSD Security Architecture
Approved by:	cperciva
MFC after:	3 days
2012-05-09 17:27:49 +00:00
Konstantin Belousov
9a36eaa36e Plug a leak.
Submitted by:	Greg Bednarek <gbednarek averesystems com>
MFC after:	1 week
2012-05-08 19:47:52 +00:00
Glen Barber
9f63b42217 General mdoc(7) and typo fixes.
PR:		167713
Submitted by:	Nobuyuki Koganemaru (kogane!jp.freebsd.org)
2012-05-08 18:56:21 +00:00
Hans Petter Selasky
78ed0e49ff Add missing LibUSB 1.0 API function: libusb_get_string_descriptor().
Reported by:	Xiaofan Chen
2012-05-07 14:07:13 +00:00
David Xu
173943ace3 Fix mis-merged line, move SC_LOOKUP() call to
upper level.
2012-05-05 23:51:24 +00:00
Dimitry Andric
acf4e8ef71 Make sure a few new internal clang headers get installed, I missed these
in the last import.  They are sometimes needed when you want to use
advanced instructions.

Also, add clang's internal stdalign.h header to ObsoleteFiles.inc, since
it is redundant: we already have a stdalign.h header in /usr/include.

Pointy hat to:	dim
PR:		kern/167574
Submitted by:	jkim
Reported by:	Oliver Hartmann <ohartman@zedat.fu-berlin.de>
MFC after:	2 weeks
2012-05-05 15:35:22 +00:00
Michael Tuexen
ff9452e199 Remove debug output.
MFC after: 3 days
2012-05-04 10:26:50 +00:00
Dimitry Andric
cb4dff8563 Upgrade our copy of llvm/clang to r155985, from upstream's release_31
branch.  This brings us very close to the 3.1 release, which is planned
for May 14th.

MFC after:	2 weeks
2012-05-03 20:41:21 +00:00
Dimitry Andric
6b9a6e390f Vendor import of clang release_31 branch r155985:
http://llvm.org/svn/llvm-project/cfe/branches/release_31@155985
2012-05-03 16:53:59 +00:00
Dimitry Andric
b61ab53cb7 Vendor import of llvm release_31 branch r155985:
http://llvm.org/svn/llvm-project/llvm/branches/release_31@155985
2012-05-03 16:50:55 +00:00
David Xu
84ac0fb8ca MFp4:
Enqueue thread in LIFO, this can cause starvation, but it gives better
performance. Use _thr_queuefifo to control the frequency of FIFO vs LIFO,
you can use environment string LIBPTHREAD_QUEUE_FIFO to configure the
variable.
2012-05-03 09:17:31 +00:00
Dag-Erling Smørgrav
f51b84bcc4 Don't reuse credentials if redirected to a different host.
Submitted by:	Niels Heinen <heinenn@google.com>
MFC after:	3 weeks
2012-04-30 12:12:48 +00:00
Dag-Erling Smørgrav
30787285b5 Since the socket is non-blocking, it is necessary to use select(2) even
when there is no timeout, because read(2) will return immediately if there
is no data waiting in the TCP buffer, causing fetch_read() to busy-loop on
slow connections.

MFC after:	3 weeks
Noticed by:	Yanhui Shen <shen.elf@gmail.com>
2012-04-30 12:11:45 +00:00
Jean-Sébastien Pédron
671c033623 Remove incorrect __restrict qualifier on several pointers
The typical case was:
static __inline int
convert_ccl(FILE *fp, char * __restrict p, [...])
{
        [...]

        if (p == SUPPRESS_PTR) {
		[...]
	} else {
		[...]
	}

	[...]
}

This qualifier says that the pointer is the only one at that time
pointing to the resource.

Here, clang considers that "p" will never match "SUPPRESS_PTR" and
optimize the if{} block out. This leads to segfaults in programs calling
vfscanf(3) and vfwscanf(3) with just the format string (no arguments
following it).

The following softwares were reported to abort with segmentation fault
and this patch fixes it:
    o  cmake
    o  smartd
    o  devel/ORBit2

dim@ opened an LLVM PR to discuss this clang optimization:
    http://llvm.org/bugs/show_bug.cgi?id=12656

Tested by:	bsam@
2012-04-30 11:28:17 +00:00
Robert Watson
ceebc4ca95 fix a further typo in the pdfork(2) man page.
Submitted by:	Norman Hardy
MFC after:	3 days
2012-04-30 08:00:52 +00:00
Robert Watson
aa5d4b9247 The returned file descriptor from pdfork(2) is via fdp, not pidp.
Submitted by:	Norman Hardy
MFC after:	3 days
2012-04-30 07:32:39 +00:00
David Schultz
cbd3cbbae0 Fix a bug in *wscanf's handling of non-wide %s, %c, and %[
conversions.  Both the specification and the documentation say the
width is interpreted as the max number of wide characters to read, but
the implementation was interpreting it as the number of bytes to convert.
(See also r105317.)

This change has security implications for any applications that depend
on the buggy behavior, but the impact in practice is probably nil.
Any such application would already be buggy on other platforms that
get the semantics right.  Also, these conversions are rarely used;
%ls, %lc, and %l[ are more appropriate.
2012-04-30 01:08:18 +00:00
Eitan Adler
74af13c61a pread(2) might fail with EBUSY, so document it
PR:		docs/167201
Submitted by:	Kurt Jaeger <fbsd-ports@opsec.eu>
Approved by:	cperciva
MFC after:	3 days
2012-04-29 22:23:00 +00:00
Eitan Adler
be8490925a Allow users of gprof to get per run output files (using the pid)
PR:		bin/99800
Submitted by:	Peter Jeremy <peterjeremy@optushome.com.au>
Reviewed by:	jilles (code)
Reviewed by:	dwhite (doc)
Approved by:	cperciva
MFC after:	1 week
2012-04-29 22:19:58 +00:00
David Schultz
d7af8cf14b Previously, vfscanf()'s wide character processing functions were
reading wide characters manually.  With this change, they now use
fgetwc().  To make this work, we use an internal version of fgetwc()
with a few extensions: it takes an mbstate * because non-wide streams
don't have a built-in mbstate, and it indicates the number of bytes
read.

vfscanf() now resembles vfwscanf() more closely.  Minor functional
improvements include working xlocale support in vfscanf(), setting the
stream error indicator on encoding errors, and proper handling of
shift-based encodings.  (Actually, making shift-based encodings work
with non-wide streams is hopeless, but the implementation now matches
the broken specification.)
2012-04-29 16:28:39 +00:00
Jeremie Le Hen
5a239e7000 Fix small documentation mistakes.
Submitted by:	brueffer
Approved by:	kib (mentor)
2012-04-28 21:50:30 +00:00
Jeremie Le Hen
6486b015fc Import stdbuf(1) and the shared library it relies on.
This tool changes the default buffering behaviour of standard
stdio streams.

It only works on dynamic binaries.  To make it work for static
ones it would require cluttering stdio because there no single
entry point.

PR:		166660
Reviewed by:	current@, jhb
Approved by:	kib (mentor)
MFC after:	1 week
2012-04-28 20:52:20 +00:00
Konstantin Belousov
ed8ddc6ea0 Fix several memory and lock leaks on the out of memory condition.
Reported by:	Matt Miller <matt matthewjmiller net>
MFC after:	1 week
2012-04-28 18:57:27 +00:00
David E. O'Brien
9b9c301802 Remove the RFC 1319 MD2 Message-Digest Algorithm routines from libmd.
1. The licensing terms for the MD2 routines from RFC is not under a BSD-like
   license.  Instead it is only granted for non-commercial Internet
   Privacy-Enhanced Mail.
2. MD2 is quite deprecated as it is no longer considered a cryptographically
   strong algorithm.

Discussed with:	so (cperciva), core
2012-04-28 02:48:51 +00:00
Michael Tuexen
a1cd9c816d Move sctp_sendv and sctp_recvv to FBSD_1.3 as suggested by
Konstantin Belousov.

MFC after: 1 week.
X-MFC with: r234715
2012-04-26 19:56:06 +00:00
Michael Tuexen
0273a6a333 Export symbols for sctp_sendv() and sctp_recvv().
MFC after: 1 week
2012-04-26 19:31:16 +00:00
Eitan Adler
b9cec40c61 Use the .Bx macro instead of BSD
Submitted by:	ru
Approved by:	ru
MFC after:	3 days
X-MFC-With:	r234700
2012-04-26 19:21:58 +00:00
Jamie Gritton
91b24c185b A new jail(8) with a configuration file, ultimately to replace the work
currently done by /etc/rc.d/jail.

MFC after:	3 months
2012-04-26 17:36:05 +00:00
Eitan Adler
faf6e9484f Document the standardization status of err* and warn*
PR:		docs/164939
Submitted by:	Niclas Zeising <zeising@daemonic.se>
Approved by:	bcr
MFC after:	3 days
2012-04-26 12:59:08 +00:00
David E. O'Brien
5293615570 Correct r228114 and use the same implementation for tilde.h as for history.h 2012-04-26 00:51:43 +00:00
Hans Petter Selasky
cb0df9e86e Fix typo. 2012-04-25 21:59:56 +00:00
Hans Petter Selasky
93fab61dfa Bump the libusb major version due to the last commit, which
changes the libusb 1.0 API. While at it, correct a manual
page symlink.

Suggested by:	kib @
2012-04-25 21:50:20 +00:00
Dag-Erling Smørgrav
084f679591 I stopped using my middle name years ago. 2012-04-25 18:07:35 +00:00
Hans Petter Selasky
85ff9a0313 Fix binary compatibility to the official LibUSB 1.0.
This is useful for GNU/kFreeBSD and the libusb2debian port.
Applications using the asynchronous API of LibUSB 1.0 needs
to be recompiled after this update.

Found by: lme @
2012-04-25 17:54:26 +00:00
Konstantin Belousov
46ffdf3bbd Take the spinlock around clearing of the fp->_flags in fclose(3), which
indicates the avaliability of FILE, to prevent possible reordering of
the writes as seen by other CPUs.

Reported by:	Fengwei yin <yfw.bsd gmail com>
Reviewed by:	jhb
MFC after:	1 week
2012-04-24 17:51:36 +00:00
Dimitry Andric
db3212b375 Revert r234356 for now, as it leads to run-time problems on 32-bit
PowerPC.  Note this will break world.

Reported by:	andreast
Pointy hat to:	dim
2012-04-23 06:33:27 +00:00
David Schultz
06b4e48852 Bugfix: Include whitespace characters in the count of the number of
characters read.
2012-04-22 21:28:33 +00:00
David Schultz
f010dc7dc4 Bugfix: Correctly count the number of characters read for %l[ conversions. 2012-04-22 21:28:14 +00:00
David Schultz
01d2a7858e Bugfix: %n doesn't count as a conversion, so
sscanf("abc", "ab%ncd", &i) returns EOF, not 0.
2012-04-22 21:22:14 +00:00
David Schultz
51300896cb Refactor scanf to improve modularity. Conversions are now performed
by separate conversion functions.  This will hopefully make bugs more
noticeable (I noticed several already) and provide opportunities to
reduce code duplication.
2012-04-22 21:18:41 +00:00
David Chisnall
6ed2e496fd Fix some incorrect symbol versions.
Reported by:	das
2012-04-22 18:51:38 +00:00
Jason Evans
4bcb1430a8 Import jemalloc a8f8d7540d66ddee7337db80c92890916e1063ca (dev branch,
prior to 3.0.0 release).  This fixes several bugs related to memory
initialization.

Mangle __jemalloc_a0{malloc,calloc,free}() just like all the other
library-internal symbols in jemalloc, and adjust the tls allocation code
in libc to use the mangled names.
2012-04-22 08:49:13 +00:00
Xin LI
e3a635d15f - Use quote when tab is used;
- Follow the same macros used in device driver manual pages.
2012-04-22 07:51:49 +00:00
David Schultz
86dc3a9ae2 As noted by Peter Jeremy, r234528 only partially fixed the infinite
loop bug introduced in r187302.  This completes the fix.

PR:		167039
MFC after:	3 days
2012-04-21 07:31:27 +00:00
David Schultz
666d00d34a If the size passed to {,v}s{w,n}printf is larger than INT_MAX+1
(i.e., the return value would overflow), set errno to EOVERFLOW
and return an error.  This improves the chances that buggy
applications -- for instance, ones that pass in a negative integer
as the size due to a bogus calculation -- will fail in safe ways.
Returning an error in these situations is specified by POSIX, but
POSIX appears to have an off-by-one error that isn't duplicated in
this change.

Previously, some of these functions would silently cap the size at
INT_MAX+1, and others would exit with an error after writing more
than INT_MAX characters.

PR:		39256
MFC after:	2 weeks
2012-04-21 06:10:18 +00:00
David Schultz
31fe39edac - Fix the claim that the output is always null-terminated. This isn't
true if the size is zero.
- Fix a claim that sprintf() is the same as snprintf() with an
  infinite size.  It's equivalent to snprintf() with a size of
  INT_MAX + 1.
- Document the return values in the return values section.
- Document the possible errno value of EOVERFLOW.

MFC after:	2 weeks
2012-04-21 06:09:09 +00:00
David Schultz
04acf36509 Ensure that the {,v}swprintf functions always null-terminate the
output string, even if an encoding error or malloc failure occurs.
2012-04-21 06:08:29 +00:00
David Schultz
177628ce75 Fix a bug introduced in r187302 that was causing fputws() to enter an
infinite loop pretty much unconditionally.  It's remarkable that the
patch that introduced the bug was never tested, but even more
remarkable that nobody noticed for over two years.

PR:		167039
MFC after:	3 days
2012-04-21 06:08:02 +00:00
Dimitry Andric
d2cc835cb5 After r217375, some startup objects under lib/csu are built in a special
way: first they are compiled to assembly, then some sed'ing is done on
the assembly, and lastly the assembly is compiled to an object file.

This last step is done using ${CC}, and not ${AS}, because when the
compiler is clang, it outputs directives that are too advanced for our
old gas.  So we use clang's integrated assembler instead.  (When the
compiler is gcc, it just calls gas, and nothing is different, except one
extra fork.)

However, in the .s to .o rules in lib/csu/$ARCH/Makefile, I still passed
CFLAGS to the compiler, instead of ACFLAGS, which are specifically for
compiling .s files.

In case you are using '-g' for debug info anywhere in your CFLAGS, it
causes the .s files to already contain debug information in the assembly
itself.  In the next step, the .s files are also compiled using '-g',
and if the compiler is clang, it complains: "error: input can't have
.file dwarf directives when -g is used to generate dwarf debug info for
assembly code".

Fix this by using ${ACFLAGS} for compiling the .s files instead.

Reported by:	jasone
MFC after:	1 week
2012-04-20 21:00:39 +00:00
Hans Petter Selasky
d81535d1f9 Fix some compile warnings.
MFC after:	1 week
2012-04-20 14:29:45 +00:00
Ed Schouten
08f9924ec6 Properly use SHA1_Final() instead of SHA_Final().
In this case it doesn't really matter, as long as we turn a TTY name
into a set of shuffled bytes. Still, for correctness we should use the
proper function.

MFC after:	2 weeks
2012-04-19 15:28:15 +00:00