Commit Graph

15141 Commits

Author SHA1 Message Date
Ed Schouten
a6f45121b5 Make some tiny improvements to iconv_open().
- Remove an unneeded variable.
- Fix whitespace bugs.
- Fix typoes in comment.
- Improve string handling a bit. Don't handroll strstr() and don't
  terminate a strdup()'ed string. Instead, simply strndup() the part we
  need.
2013-05-25 12:13:54 +00:00
Ed Schouten
907b803190 Only call free() on something we allocated.
If we were already provided a struct _citrus_iconv (e.g. through
iconv_open_into()), we should not call free() in case io_init_context()
fails. Instead, call it on the pointer of the allocated object, which
will be NULL in case of iconv_open_into().
2013-05-25 12:11:20 +00:00
Ed Schouten
b94c7c3e21 Let iconv build on -HEAD properly.
- Add NO_WMISSING_VARIABLE_DECLARATIONS where we use Yacc/Lex.
- Add variable declarations where possible.
- Add missing static keyword.
2013-05-23 18:07:01 +00:00
Ed Schouten
8ed7462feb Update manpages for r250887.
Remove the lists of unneeded header files.

Requested by:	eadler
2013-05-21 21:39:18 +00:00
Ed Schouten
50c77c6e8b Add <uchar.h>.
The <uchar.h> header, part of C11, adds a small number of utility
functions for 16/32-bit "universal" characters, which may or may not be
UTF-16/32. As our wchar_t is already ISO 10646, simply add light-weight
wrappers around wcrtomb() and mbrtowc().

While there, also add (non-yet-standard) _l functions, similar to the
ones we already have for the other locale-dependent functions.

Reviewed by:	theraven
2013-05-21 19:59:37 +00:00
Marcel Moolenaar
e9d8fda02c Add a makefle that recurses into the right architecture-specific
sub-directory. This to allow simpler logic outside of the csu
directory.

Obtained from:	Juniper Networks, Inc.
2013-05-21 17:47:53 +00:00
Julian Elischer
956e8eee53 Update the setfib man page to reflect recent changes. 2013-05-20 20:47:40 +00:00
Jilles Tjoelker
e9dec7758d popen(): Add 'e' mode character to set close-on-exec on the new fd.
If 'e' is used, the kernel must support the recently added pipe2() system
call.

The use of pipe2() with O_CLOEXEC also fixes race conditions between
concurrent popen() calls from different threads, even if the close-on-exec
flag on the fd of the returned FILE is later cleared (because popen() closes
all file descriptors from earlier popen() calls in the child process).
Therefore, this approach should be used in all cases when pipe2() can be
assumed present.

The old version of popen() rejects "re" and "we" but treats "r+e" like "r+".
2013-05-20 17:31:18 +00:00
David Xu
8096915018 Return one-based key so that user can check if the key is ever allocated
in the first place.

Initial patch submitted by: phk
2013-05-16 03:01:04 +00:00
Hiren Panchasara
3627fbff6c Fix a typo: It should be "strtoll" and not "stroll".
PR:	178642
Reported by:	Michael Galassi (michaelgalassi@gmail.com)
Approved by:	sbruno (mentor)
MFC after:	1 week
2013-05-14 20:25:07 +00:00
Dimitry Andric
a420df3c8a Use an ugly hack to get around bootstrapping problems when building
clang on head between r239347 and r245428.

The former revision introduced CLOCK_PROCESS_CPUTIME_ID as a clock id
for the clock_gettime() function and friends, but it was only added in
<sys/time.h>, not in <time.h>.  Any program including <time.h> would
therefore not be able to use CLOCK_PROCESS_CPUTIME_ID, even though the
value of _POSIX_CPUTIME indicates its existence.  The latter revision
synchronized the defines again.

Work around this problem by defining the id on the command line for the
particular .cpp file that needs it.  If the id ever changes value, this
hack will need to be updated.
2013-05-13 20:14:58 +00:00
Joel Dahl
2710751bc3 mdoc sweep. 2013-05-12 22:22:12 +00:00
Eitan Adler
a164074fc4 Fix several typos
PR:		kern/176054
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
MFC after:	3 days
2013-05-12 16:43:26 +00:00
Sergey Kandaurov
b6dd17329c Typo. 2013-05-12 05:54:58 +00:00
Jilles Tjoelker
38cf77de66 posix_spawn_file_actions_adddup2(3): Document difference with dup2().
The ability to clear a file descriptor's close-on-exec flag via
posix_spawn_file_actions_adddup2() is in fact proposed in Austin Group issue
#411.

MFC after:	1 week
2013-05-09 21:29:13 +00:00
Jilles Tjoelker
39e499a8d2 posix_spawn_file_actions_addopen(3): Correct error for bad file descriptor.
As per POSIX.1-2008, posix_spawn_file_actions_add* return [EBADF] if a file
descriptor is negative, not [EINVAL]. The bug was only in the manual page;
the code is correct.

MFC after:	1 week
2013-05-09 16:42:01 +00:00
Jilles Tjoelker
ae4c676c55 wordexp(): Simplify code by deferring work to sh. 2013-05-09 11:43:45 +00:00
David Xu
66f6c2721d Fix return value for setcontext and swapcontext. 2013-05-09 04:41:03 +00:00
Mikolaj Golub
467112b4d1 Make errbuf optional, so if a caller is not interested in an error
message she can pass NULL (procstat(1) already does this).

MFC after:	2 weeks
2013-05-08 19:11:47 +00:00
Ed Maste
5906bf4984 Add libusb_get_port_path wrapper
This follows the libusbx API reference at
http://libusbx.sourceforge.net/api-1.0/group__dev.html

Reviewed by: hselasky@
2013-05-08 00:55:29 +00:00
Ed Maste
22a962c9fe Constify libusb_get_pollfds return
The correct return type, per our libusb(3) man page and the libusb.org
and libusbx projects (whose interface we intend to follow for our libusb),
is const struct libusb_pollfd **.

Unfortunately the doxygen-generated libusbx API documentation[1] omits[2]
the const for some reason.

[1] http://libusbx.sourceforge.net/api-1.0/group__poll.html#gab1a72869a926552b27a6c667695df3a2

[2] http://sourceforge.net/mailarchive/forum.php?thread_name=497D10BE.8090007%40n-dimensional.de&forum_name=libusb-devel

Reviewed by: hselasky@
2013-05-07 20:35:47 +00:00
Xin LI
1392a0b021 MFV: Update zlib to 1.2.8.
MFC after:	1 month
2013-05-05 06:20:49 +00:00
Sergey Kandaurov
e0906c9a0d POSIX 1003.1-2008: add ENOTRECOVERABLE, EOWNERDEAD errnos. 2013-05-04 19:07:22 +00:00
Sergey Kandaurov
424b842a5d Document that the return type is different from 1003.1-2008.
MFC after:	1 week
2013-05-04 17:21:44 +00:00
Sergey Kandaurov
4f79ce7b4c mdoc: missing comma in .Dd macro. 2013-05-04 17:06:47 +00:00
Sergey Kandaurov
c951cd462f Add entry for errno ECAPMODE.
MFC after:	3 days
2013-05-04 12:57:21 +00:00
Sergey Kandaurov
f45590da31 Bump date. 2013-05-04 12:44:00 +00:00
Jilles Tjoelker
7b05a79942 libkvm: Make second /dev/null file descriptor close-on-exec as well.
MFC after:	1 week
2013-05-04 11:45:48 +00:00
Jilles Tjoelker
76dce67f0f libkvm: Use O_CLOEXEC instead of separate fcntl(F_SETFD) call.
MFC after:	1 week
2013-05-04 09:47:51 +00:00
Jung-uk Kim
a7880d59c9 Improve compatibility with recent flex from flex.sourceforge.net. 2013-05-03 23:51:32 +00:00
John Baldwin
958aa57537 Similar to 233760 and 236717, export some more useful info about the
kernel-based POSIX semaphore descriptors to userland via procstat(1) and
fstat(1):
- Change sem file descriptors to track the pathname they are associated
  with and add a ksem_info() method to copy the path out to a
  caller-supplied buffer.
- Use the fo_stat() method of shared memory objects and ksem_info() to
  export the path, mode, and value of a semaphore via struct kinfo_file.
- Add a struct semstat to the libprocstat(3) interface along with a
  procstat_get_sem_info() to export the mode and value of a semaphore.
- Teach fstat about semaphores and to display their path, mode, and value.

MFC after:	2 weeks
2013-05-03 21:11:57 +00:00
Dimitry Andric
4b6b67b08e Allow building clang on older FreeBSD releases, where log2() does not
exist yet.  With this change, I have verified that building head on
8.1-RELEASE works.

Noticed by:	Ryan Stone <rysto32@gmail.com>
2013-05-03 16:29:51 +00:00
Sergey Kandaurov
67ff590b9e Also, add a missing period. 2013-05-03 13:27:13 +00:00
Sergey Kandaurov
cc7a693fa7 Remove an extra comma. 2013-05-03 12:45:45 +00:00
Sergey Kandaurov
88bbbe88d7 Remove the STANDARDS section.
querylocale is not part of IEEE Std 1003.1-2008.

MFC after:	3 days
2013-05-03 12:42:43 +00:00
Ulrich Spörlein
4bbdf74796 Always install pmc.foo(3) manpages.
There is no point in hiding, e.g. pmc.xscale(3) from a developer running
on amd64, when the target arch in question will probably never have
manual pages installed at all.

Reviewed by:	sbruno, hiren
2013-05-03 08:20:10 +00:00
Hans Petter Selasky
c77a24c24a Add new USB API to get the port path of a USB device.
MFC after:	2 weeks
Requested by:	emaste @
2013-05-03 07:44:58 +00:00
Jilles Tjoelker
ed5987bd08 accept(2), pipe(2): Fix .Dd. 2013-05-01 22:47:47 +00:00
Jilles Tjoelker
dc570d5e56 Add pipe2() system call.
The pipe2() function is similar to pipe() but allows setting FD_CLOEXEC and
O_NONBLOCK (on both sides) as part of the function.

If p points to two writable ints, pipe2(p, 0) is equivalent to pipe(p).

If the pointer is not valid, behaviour differs: pipe2() writes into the
array from the kernel like socketpair() does, while pipe() writes into the
array from an architecture-specific assembler wrapper.

Reviewed by:	kan, kib
2013-05-01 22:42:42 +00:00
Jilles Tjoelker
da7d2afb6d Add accept4() system call.
The accept4() function, compared to accept(), allows setting the new file
descriptor atomically close-on-exec and explicitly controlling the
non-blocking status on the new socket. (Note that the latter point means
that accept() is not equivalent to any form of accept4().)

The linuxulator's accept4 implementation leaves a race window where the new
file descriptor is not close-on-exec because it calls sys_accept(). This
implementation leaves no such race window (by using falloc() flags). The
linuxulator could be fixed and simplified by using the new code.

Like accept(), accept4() is async-signal-safe, a cancellation point and
permitted in capability mode.
2013-05-01 20:10:21 +00:00
Mikolaj Golub
dd70ad64bf procstat_getpathname: for kvm method, instead of returning the error
that the method is not supported, return an empty string.

This looks more handy for callers like procstat(1), which will not
abort after the failed call and still output some useful information.

MFC after:	3 weeks
2013-05-01 15:02:58 +00:00
Mikolaj Golub
1f84c47e42 KVM method support for procstat_getgroups, procstat_getumask,
procstat_getrlimit, and procstat_getosrel.

MFC after:	3 weeks
2013-05-01 15:01:05 +00:00
Brooks Davis
7be2362060 Wrap the creation of the ../include link in /usr/lib in
!defined(LIBRARIES_ONLY) so it is only created once on architectures
with 32-bit compat support.

Replace ln -fhs with ${INSTALL_SYMLINK} to the link is logged in the
METALOG.
2013-04-30 18:14:22 +00:00
Robert Watson
a532cafd5e Enable building string functions as part of libstand on mips; the Makefile
is a bit obfuscated here, as ia64 adds string source files elsewhere, so
simply exclude it here.

Reviewed by:	imp
MFC after:	3 days
Sponsored by:	DARPA, AFRL
2013-04-28 16:35:24 +00:00
Robert Watson
1f05db3e5c Merge @228176 from Perforce to fix a bug introduced in r249553:
Trim two now-unneeded (and likely harmful) lines from the libstand
  setjmp/longjmp for MIPS.

  Spotted by:   jmallett

MFC after:      3 days
Sponsored by:	DARPA, AFRL
2013-04-28 14:40:29 +00:00
David Xu
9ae844e124 Remove extra code for SA_RESETHAND, it is not needed because kernel has
already done this.
2013-04-28 03:13:45 +00:00
Jilles Tjoelker
3cb14a8923 libthr: Fix a parameter name in an internal header file. 2013-04-27 14:21:36 +00:00
Jilles Tjoelker
3143f63a23 intro(2): Fix some errors in ENFILE and EMFILE descriptions.
MFC after:	1 week
2013-04-27 11:55:23 +00:00
Ed Schouten
0315980bb8 Unbreak <stdatomic.h> on ARM + Clang.
Clang only supports atomic operations for ARMv6. For non-ARMv6, we still
need to emit these functions.

Clang's prototype for these functions slightly differs, as it is truly
based on GCC's documentation. It requires the use of signed types, but
also requires varargs. Still, we are not allowed to simply implement
this function directly. Cleverly work around this by implementing it
under a different name and using __strong_reference().
2013-04-27 04:56:02 +00:00
Jilles Tjoelker
34d0fed913 sysconf(3): Correct the description of _SC_OPEN_MAX.
Reported by:	bde
MFC after:	1 week
2013-04-26 21:43:42 +00:00