Commit Graph

14446 Commits

Author SHA1 Message Date
David Chisnall
bb4317bf3c Restore the __collate_load_error global that was accidentally removed in the
xlocale refactoring.

MFC after:	1 week
2012-07-06 20:16:22 +00:00
Pedro F. Giffuni
a880c5109e Merge a small update from NetBSD.
Feb 15 21:55:23 2009 - chared.c chared.h
pass lint on _LP64.

MFC after:	1 week
2012-07-06 19:30:50 +00:00
Pedro F. Giffuni
dcb0dada6b Fix issue resizing bin/sh
This partially reverts some changes from r237448 that are causing
breakage when resizing under bin/sh .

Reverted changes from NetBSD are:

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.

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

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

PR:		169603
Reported by:	Peter Jeremy, David Shao
MFC after:	3 days
2012-07-06 16:43:56 +00:00
Brooks Davis
9597393516 Document the behavior (from 4.4-lite) that tokens returned by telldir() are
single use.

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

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

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

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

Reviewed by:	theraven
Approved by:	gabor (mentor)
2012-06-25 21:51:40 +00:00
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