History log of /freebsd-10-stable/lib/libc/include/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
321074 17-Jul-2017 kib

MFC r320472,r320508,r320509:
Make stdio deferred cancel-safe.

Requested by: eugen


libc_private.h
/freebsd-10-stable/lib/libc/stdio/fclose.c
/freebsd-10-stable/lib/libc/stdio/fflush.c
/freebsd-10-stable/lib/libc/stdio/fgetc.c
/freebsd-10-stable/lib/libc/stdio/fgetln.c
/freebsd-10-stable/lib/libc/stdio/fgets.c
/freebsd-10-stable/lib/libc/stdio/fgetwc.c
/freebsd-10-stable/lib/libc/stdio/fgetwln.c
/freebsd-10-stable/lib/libc/stdio/fgetws.c
/freebsd-10-stable/lib/libc/stdio/fputc.c
/freebsd-10-stable/lib/libc/stdio/fputs.c
/freebsd-10-stable/lib/libc/stdio/fputwc.c
/freebsd-10-stable/lib/libc/stdio/fputws.c
/freebsd-10-stable/lib/libc/stdio/fread.c
/freebsd-10-stable/lib/libc/stdio/freopen.c
/freebsd-10-stable/lib/libc/stdio/fscanf.c
/freebsd-10-stable/lib/libc/stdio/fseek.c
/freebsd-10-stable/lib/libc/stdio/fwrite.c
/freebsd-10-stable/lib/libc/stdio/getc.c
/freebsd-10-stable/lib/libc/stdio/getchar.c
/freebsd-10-stable/lib/libc/stdio/getdelim.c
/freebsd-10-stable/lib/libc/stdio/gets.c
/freebsd-10-stable/lib/libc/stdio/local.h
/freebsd-10-stable/lib/libc/stdio/perror.c
/freebsd-10-stable/lib/libc/stdio/putc.c
/freebsd-10-stable/lib/libc/stdio/putchar.c
/freebsd-10-stable/lib/libc/stdio/puts.c
/freebsd-10-stable/lib/libc/stdio/putw.c
/freebsd-10-stable/lib/libc/stdio/refill.c
/freebsd-10-stable/lib/libc/stdio/scanf.c
/freebsd-10-stable/lib/libc/stdio/setvbuf.c
/freebsd-10-stable/lib/libc/stdio/stdio.c
/freebsd-10-stable/lib/libc/stdio/ungetc.c
/freebsd-10-stable/lib/libc/stdio/ungetwc.c
/freebsd-10-stable/lib/libc/stdio/vfprintf.c
/freebsd-10-stable/lib/libc/stdio/vfscanf.c
/freebsd-10-stable/lib/libc/stdio/vfwprintf.c
/freebsd-10-stable/lib/libc/stdio/vfwscanf.c
/freebsd-10-stable/lib/libc/stdio/vscanf.c
312590 21-Jan-2017 kib

MFC r311651:
Export __cxa_thread_atexit_impl as an alias for __cxa_thread_atexit.

305341 03-Sep-2016 kib

MFC r304928:
Do not obliterate errno value in the main thread during ptrace(2) call on x86.

MFC r304931:
Follow ABI when calling __error from the ptrace(2) wrapper.

MFC r305012:
Rewrite ptrace(2) wrappers in C.

MFC r305022:
Restore the requirement of setting errno to zero before calling ptrace(2).

304527 20-Aug-2016 kib

MFC r303795:
Add __cxa_thread_atexit(3) API implementation.

296767 12-Mar-2016 bdrewery

MFC r295416:

Fix the gcc build after r295407.

296732 12-Mar-2016 kib

MFC r295407:
Make libc __pthread_map_stacks_exec() interposed.

293474 09-Jan-2016 dchagin

MFC r277610 (by jillies):

Add futimens and utimensat system calls.

287480 05-Sep-2015 kib

MFC r287292:
Switch libc from using _sig{procmask,action,suspend} symbols, which
are aliases for the syscall stubs and are plt-interposed, to the
libc-private aliases of internally interposed sigprocmask() etc.

MFC r287300:
Use libthr interposed functions instead of syscalls, in posix_spawn()'
child.

283927 02-Jun-2015 jhb

MFC 281887:
Reassign copyright statements on several files from Advanced
Computing Technologies LLC to Hudson River Trading LLC.


/freebsd-10-stable/lib/libc/gen/_once_stub.c
compat.h
/freebsd-10-stable/lib/libc/stdio/open_memstream.3
/freebsd-10-stable/lib/libc/stdio/open_memstream.c
/freebsd-10-stable/lib/libc/stdio/open_wmemstream.c
/freebsd-10-stable/lib/libc/sys/closefrom.2
/freebsd-10-stable/lib/libc/sys/procctl.2
/freebsd-10-stable/share/man/man9/BUS_BIND_INTR.9
/freebsd-10-stable/share/man/man9/BUS_CHILD_DELETED.9
/freebsd-10-stable/share/man/man9/BUS_CHILD_DETACHED.9
/freebsd-10-stable/share/man/man9/BUS_DESCRIBE_INTR.9
/freebsd-10-stable/share/man/man9/BUS_NEW_PASS.9
/freebsd-10-stable/share/man/man9/VOP_ADVISE.9
/freebsd-10-stable/share/man/man9/VOP_ALLOCATE.9
/freebsd-10-stable/share/man/man9/bus_adjust_resource.9
/freebsd-10-stable/share/man/man9/bus_generic_new_pass.9
/freebsd-10-stable/share/man/man9/bus_set_pass.9
/freebsd-10-stable/share/man/man9/refcount.9
/freebsd-10-stable/share/man/man9/sglist.9
/freebsd-10-stable/share/man/man9/shm_map.9
/freebsd-10-stable/sys/amd64/include/vm.h
/freebsd-10-stable/sys/boot/i386/common/edd.h
/freebsd-10-stable/sys/dev/pci/pci_subr.c
/freebsd-10-stable/sys/i386/include/vm.h
/freebsd-10-stable/sys/sys/procctl.h
/freebsd-10-stable/sys/vm/sg_pager.c
/freebsd-10-stable/sys/x86/acpica/srat.c
/freebsd-10-stable/sys/x86/include/mca.h
/freebsd-10-stable/sys/x86/pci/qpi.c
/freebsd-10-stable/sys/x86/x86/mca.c
/freebsd-10-stable/tools/regression/lib/libc/stdio/test-open_memstream.c
/freebsd-10-stable/tools/regression/lib/libc/stdio/test-open_wmemstream.c
/freebsd-10-stable/tools/regression/netinet/arphold/arphold.c
/freebsd-10-stable/usr.bin/perror/perror.1
/freebsd-10-stable/usr.bin/perror/perror.c
/freebsd-10-stable/usr.bin/procstat/procstat_rusage.c
/freebsd-10-stable/usr.bin/protect/protect.1
/freebsd-10-stable/usr.bin/protect/protect.c
/freebsd-10-stable/usr.sbin/bhyve/ioapic.c
/freebsd-10-stable/usr.sbin/bhyve/ioapic.h
/freebsd-10-stable/usr.sbin/bhyve/pci_irq.c
/freebsd-10-stable/usr.sbin/bhyve/pci_irq.h
/freebsd-10-stable/usr.sbin/bhyve/pm.c
/freebsd-10-stable/usr.sbin/etcupdate/etcupdate.8
/freebsd-10-stable/usr.sbin/etcupdate/etcupdate.sh
/freebsd-10-stable/usr.sbin/etcupdate/tests/always_test.sh
/freebsd-10-stable/usr.sbin/etcupdate/tests/conflicts_test.sh
/freebsd-10-stable/usr.sbin/etcupdate/tests/fbsdid_test.sh
/freebsd-10-stable/usr.sbin/etcupdate/tests/ignore_test.sh
/freebsd-10-stable/usr.sbin/etcupdate/tests/preworld_test.sh
/freebsd-10-stable/usr.sbin/etcupdate/tests/tests_test.sh
/freebsd-10-stable/usr.sbin/etcupdate/tests/tzsetup_test.sh
/freebsd-10-stable/usr.sbin/pciconf/err.c
281981 25-Apr-2015 kib

MFC r281712:
Make wait6(2), waitid(3) and ppoll(2) cancellation points.

281454 12-Apr-2015 kib

MFC r280818:
Make kevent(2) a cancellation point.

281256 08-Apr-2015 kib

MFC r280959:
Correctly handle __fcntl_compat symbol for the !SYSCALL_COMPAT case.

279049 20-Feb-2015 kib

MFC r278889:
Restore the extern qualifier on __cleanup.

278875 17-Feb-2015 kib

MFC r278751:
Properly interpose libc spinlocks, was missed in r276630.

277317 18-Jan-2015 kib

Fix known issues which blow up the process after dlopen("libthr.so")
(or loading a dso linked to libthr.so into process which was not
linked against threading library).

MFC r276630:
Remove interposing, fix malloc, reinstall signal handlers wrappers on
libthr load.

MFC r276681:
Avoid calling internal libc function through PLT or accessing data
though GOT.

MFC r277032:
Reduce the size of the interposing table and amount of
cancellation-handling code in the libthr.

MFC note:
r276646 ("do not erronously export 'openat' symbol from rtld") is not
applicable to stable/10 yet, since PATHFDS support was not merged.


/freebsd-10-stable/contrib/jemalloc/include/jemalloc/internal/mutex.h
/freebsd-10-stable/contrib/jemalloc/src/jemalloc.c
/freebsd-10-stable/contrib/jemalloc/src/mutex.c
/freebsd-10-stable/lib/libc/Makefile
/freebsd-10-stable/lib/libc/compat-43/creat.c
/freebsd-10-stable/lib/libc/gen/Makefile.inc
/freebsd-10-stable/lib/libc/gen/Symbol.map
/freebsd-10-stable/lib/libc/gen/__pthread_mutex_init_calloc_cb_stub.c
/freebsd-10-stable/lib/libc/gen/pause.c
/freebsd-10-stable/lib/libc/gen/raise.c
/freebsd-10-stable/lib/libc/gen/sleep.c
/freebsd-10-stable/lib/libc/gen/swapcontext.c
/freebsd-10-stable/lib/libc/gen/termios.c
/freebsd-10-stable/lib/libc/gen/usleep.c
/freebsd-10-stable/lib/libc/gen/wait.c
/freebsd-10-stable/lib/libc/gen/wait3.c
/freebsd-10-stable/lib/libc/gen/waitpid.c
libc_private.h
/freebsd-10-stable/lib/libc/stdlib/Symbol.map
/freebsd-10-stable/lib/libc/stdlib/jemalloc/Symbol.map
/freebsd-10-stable/lib/libc/stdlib/system.c
/freebsd-10-stable/lib/libc/sys/Makefile.inc
/freebsd-10-stable/lib/libc/sys/Symbol.map
/freebsd-10-stable/lib/libc/sys/__error.c
/freebsd-10-stable/lib/libc/sys/accept.c
/freebsd-10-stable/lib/libc/sys/accept4.c
/freebsd-10-stable/lib/libc/sys/aio_suspend.c
/freebsd-10-stable/lib/libc/sys/close.c
/freebsd-10-stable/lib/libc/sys/connect.c
/freebsd-10-stable/lib/libc/sys/fcntl.c
/freebsd-10-stable/lib/libc/sys/fork.c
/freebsd-10-stable/lib/libc/sys/fsync.c
/freebsd-10-stable/lib/libc/sys/interposing_table.c
/freebsd-10-stable/lib/libc/sys/msync.c
/freebsd-10-stable/lib/libc/sys/nanosleep.c
/freebsd-10-stable/lib/libc/sys/open.c
/freebsd-10-stable/lib/libc/sys/openat.c
/freebsd-10-stable/lib/libc/sys/poll.c
/freebsd-10-stable/lib/libc/sys/pselect.c
/freebsd-10-stable/lib/libc/sys/read.c
/freebsd-10-stable/lib/libc/sys/readv.c
/freebsd-10-stable/lib/libc/sys/recvfrom.c
/freebsd-10-stable/lib/libc/sys/recvmsg.c
/freebsd-10-stable/lib/libc/sys/select.c
/freebsd-10-stable/lib/libc/sys/sendmsg.c
/freebsd-10-stable/lib/libc/sys/sendto.c
/freebsd-10-stable/lib/libc/sys/setcontext.c
/freebsd-10-stable/lib/libc/sys/sigaction.c
/freebsd-10-stable/lib/libc/sys/sigprocmask.c
/freebsd-10-stable/lib/libc/sys/sigsuspend.c
/freebsd-10-stable/lib/libc/sys/sigtimedwait.c
/freebsd-10-stable/lib/libc/sys/sigwait.c
/freebsd-10-stable/lib/libc/sys/sigwaitinfo.c
/freebsd-10-stable/lib/libc/sys/swapcontext.c
/freebsd-10-stable/lib/libc/sys/wait4.c
/freebsd-10-stable/lib/libc/sys/write.c
/freebsd-10-stable/lib/libc/sys/writev.c
/freebsd-10-stable/lib/libthr/Makefile
/freebsd-10-stable/lib/libthr/pthread.map
/freebsd-10-stable/lib/libthr/sys/thr_error.c
/freebsd-10-stable/lib/libthr/thread/thr_create.c
/freebsd-10-stable/lib/libthr/thread/thr_fork.c
/freebsd-10-stable/lib/libthr/thread/thr_init.c
/freebsd-10-stable/lib/libthr/thread/thr_printf.c
/freebsd-10-stable/lib/libthr/thread/thr_private.h
/freebsd-10-stable/lib/libthr/thread/thr_sig.c
/freebsd-10-stable/lib/libthr/thread/thr_syscalls.c
270838 30-Aug-2014 ume

MFC r269867:
Update our stub resolver to final version of libbind
(libbind-6.0).

Obtained from: ISC


/freebsd-10-stable/include/arpa/inet.h
/freebsd-10-stable/include/arpa/nameser.h
/freebsd-10-stable/include/arpa/nameser_compat.h
/freebsd-10-stable/include/res_update.h
/freebsd-10-stable/include/resolv.h
isc/eventlib.h
isc/list.h
port_before.h
/freebsd-10-stable/lib/libc/inet/inet_addr.c
/freebsd-10-stable/lib/libc/inet/inet_cidr_ntop.c
/freebsd-10-stable/lib/libc/inet/inet_cidr_pton.c
/freebsd-10-stable/lib/libc/inet/inet_net_ntop.c
/freebsd-10-stable/lib/libc/inet/inet_net_pton.c
/freebsd-10-stable/lib/libc/inet/inet_neta.c
/freebsd-10-stable/lib/libc/inet/inet_ntoa.c
/freebsd-10-stable/lib/libc/inet/inet_ntop.c
/freebsd-10-stable/lib/libc/inet/inet_pton.c
/freebsd-10-stable/lib/libc/inet/nsap_addr.c
/freebsd-10-stable/lib/libc/isc/ev_streams.c
/freebsd-10-stable/lib/libc/isc/ev_timers.c
/freebsd-10-stable/lib/libc/isc/eventlib_p.h
/freebsd-10-stable/lib/libc/nameser/Symbol.map
/freebsd-10-stable/lib/libc/nameser/ns_name.c
/freebsd-10-stable/lib/libc/nameser/ns_netint.c
/freebsd-10-stable/lib/libc/nameser/ns_parse.c
/freebsd-10-stable/lib/libc/nameser/ns_print.c
/freebsd-10-stable/lib/libc/nameser/ns_samedomain.c
/freebsd-10-stable/lib/libc/nameser/ns_ttl.c
/freebsd-10-stable/lib/libc/resolv/Makefile.inc
/freebsd-10-stable/lib/libc/resolv/Symbol.map
/freebsd-10-stable/lib/libc/resolv/herror.c
/freebsd-10-stable/lib/libc/resolv/res_comp.c
/freebsd-10-stable/lib/libc/resolv/res_data.c
/freebsd-10-stable/lib/libc/resolv/res_debug.c
/freebsd-10-stable/lib/libc/resolv/res_findzonecut.c
/freebsd-10-stable/lib/libc/resolv/res_init.c
/freebsd-10-stable/lib/libc/resolv/res_mkquery.c
/freebsd-10-stable/lib/libc/resolv/res_mkupdate.c
/freebsd-10-stable/lib/libc/resolv/res_query.c
/freebsd-10-stable/lib/libc/resolv/res_send.c
/freebsd-10-stable/lib/libc/resolv/res_update.c
256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


255219 05-Sep-2013 pjd

Change the cap_rights_t type from uint64_t to a structure that we can extend
in the future in a backward compatible (API and ABI) way.

The cap_rights_t represents capability rights. We used to use one bit to
represent one right, but we are running out of spare bits. Currently the new
structure provides place for 114 rights (so 50 more than the previous
cap_rights_t), but it is possible to grow the structure to hold at least 285
rights, although we can make it even larger if 285 rights won't be enough.

The structure definition looks like this:

struct cap_rights {
uint64_t cr_rights[CAP_RIGHTS_VERSION + 2];
};

The initial CAP_RIGHTS_VERSION is 0.

The top two bits in the first element of the cr_rights[] array contain total
number of elements in the array - 2. This means if those two bits are equal to
0, we have 2 array elements.

The top two bits in all remaining array elements should be 0.
The next five bits in all array elements contain array index. Only one bit is
used and bit position in this five-bits range defines array index. This means
there can be at most five array elements in the future.

To define new right the CAPRIGHT() macro must be used. The macro takes two
arguments - an array index and a bit to set, eg.

#define CAP_PDKILL CAPRIGHT(1, 0x0000000000000800ULL)

We still support aliases that combine few rights, but the rights have to belong
to the same array element, eg:

#define CAP_LOOKUP CAPRIGHT(0, 0x0000000000000400ULL)
#define CAP_FCHMOD CAPRIGHT(0, 0x0000000000002000ULL)

#define CAP_FCHMODAT (CAP_FCHMOD | CAP_LOOKUP)

There is new API to manage the new cap_rights_t structure:

cap_rights_t *cap_rights_init(cap_rights_t *rights, ...);
void cap_rights_set(cap_rights_t *rights, ...);
void cap_rights_clear(cap_rights_t *rights, ...);
bool cap_rights_is_set(const cap_rights_t *rights, ...);

bool cap_rights_is_valid(const cap_rights_t *rights);
void cap_rights_merge(cap_rights_t *dst, const cap_rights_t *src);
void cap_rights_remove(cap_rights_t *dst, const cap_rights_t *src);
bool cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little);

Capability rights to the cap_rights_init(), cap_rights_set(),
cap_rights_clear() and cap_rights_is_set() functions are provided by
separating them with commas, eg:

cap_rights_t rights;

cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_FSTAT);

There is no need to terminate the list of rights, as those functions are
actually macros that take care of the termination, eg:

#define cap_rights_set(rights, ...) \
__cap_rights_set((rights), __VA_ARGS__, 0ULL)
void __cap_rights_set(cap_rights_t *rights, ...);

Thanks to using one bit as an array index we can assert in those functions that
there are no two rights belonging to different array elements provided
together. For example this is illegal and will be detected, because CAP_LOOKUP
belongs to element 0 and CAP_PDKILL to element 1:

cap_rights_init(&rights, CAP_LOOKUP | CAP_PDKILL);

Providing several rights that belongs to the same array's element this way is
correct, but is not advised. It should only be used for aliases definition.

This commit also breaks compatibility with some existing Capsicum system calls,
but I see no other way to do that. This should be fine as Capsicum is still
experimental and this change is not going to 9.x.

Sponsored by: The FreeBSD Foundation


255108 31-Aug-2013 jilles

libc: Always use our own copy of sys_errlist and sys_nerr (.so only).

This ensures strerror() and friends continue to work correctly even if a
(non-PIE) executable linked against an older libc imports sys_errlist (which
causes sys_errlist to refer to the executable's copy with a size fixed when
that executable was linked).

The executable's use of sys_errlist remains broken because it uses the
current value of sys_nerr and may access past the bounds of the array.

Different from the message "Using sys_errlist from executables is not
ABI-stable" on freebsd-arch, this change does not affect the static library.
There seems no reason to prevent overriding the error messages in the static
library.


254706 23-Aug-2013 jilles

libc: Access some unexported variables more efficiently (related to stdio).


247602 02-Mar-2013 pjd

Merge Capsicum overhaul:

- Capability is no longer separate descriptor type. Now every descriptor
has set of its own capability rights.

- The cap_new(2) system call is left, but it is no longer documented and
should not be used in new code.

- The new syscall cap_rights_limit(2) should be used instead of
cap_new(2), which limits capability rights of the given descriptor
without creating a new one.

- The cap_getrights(2) syscall is renamed to cap_rights_get(2).

- If CAP_IOCTL capability right is present we can further reduce allowed
ioctls list with the new cap_ioctls_limit(2) syscall. List of allowed
ioctls can be retrived with cap_ioctls_get(2) syscall.

- If CAP_FCNTL capability right is present we can further reduce fcntls
that can be used with the new cap_fcntls_limit(2) syscall and retrive
them with cap_fcntls_get(2).

- To support ioctl and fcntl white-listing the filedesc structure was
heavly modified.

- The audit subsystem, kdump and procstat tools were updated to
recognize new syscalls.

- Capability rights were revised and eventhough I tried hard to provide
backward API and ABI compatibility there are some incompatible changes
that are described in detail below:

CAP_CREATE old behaviour:
- Allow for openat(2)+O_CREAT.
- Allow for linkat(2).
- Allow for symlinkat(2).
CAP_CREATE new behaviour:
- Allow for openat(2)+O_CREAT.

Added CAP_LINKAT:
- Allow for linkat(2). ABI: Reuses CAP_RMDIR bit.
- Allow to be target for renameat(2).

Added CAP_SYMLINKAT:
- Allow for symlinkat(2).

Removed CAP_DELETE. Old behaviour:
- Allow for unlinkat(2) when removing non-directory object.
- Allow to be source for renameat(2).

Removed CAP_RMDIR. Old behaviour:
- Allow for unlinkat(2) when removing directory.

Added CAP_RENAMEAT:
- Required for source directory for the renameat(2) syscall.

Added CAP_UNLINKAT (effectively it replaces CAP_DELETE and CAP_RMDIR):
- Allow for unlinkat(2) on any object.
- Required if target of renameat(2) exists and will be removed by this
call.

Removed CAP_MAPEXEC.

CAP_MMAP old behaviour:
- Allow for mmap(2) with any combination of PROT_NONE, PROT_READ and
PROT_WRITE.
CAP_MMAP new behaviour:
- Allow for mmap(2)+PROT_NONE.

Added CAP_MMAP_R:
- Allow for mmap(PROT_READ).
Added CAP_MMAP_W:
- Allow for mmap(PROT_WRITE).
Added CAP_MMAP_X:
- Allow for mmap(PROT_EXEC).
Added CAP_MMAP_RW:
- Allow for mmap(PROT_READ | PROT_WRITE).
Added CAP_MMAP_RX:
- Allow for mmap(PROT_READ | PROT_EXEC).
Added CAP_MMAP_WX:
- Allow for mmap(PROT_WRITE | PROT_EXEC).
Added CAP_MMAP_RWX:
- Allow for mmap(PROT_READ | PROT_WRITE | PROT_EXEC).

Renamed CAP_MKDIR to CAP_MKDIRAT.
Renamed CAP_MKFIFO to CAP_MKFIFOAT.
Renamed CAP_MKNODE to CAP_MKNODEAT.

CAP_READ old behaviour:
- Allow pread(2).
- Disallow read(2), readv(2) (if there is no CAP_SEEK).
CAP_READ new behaviour:
- Allow read(2), readv(2).
- Disallow pread(2) (CAP_SEEK was also required).

CAP_WRITE old behaviour:
- Allow pwrite(2).
- Disallow write(2), writev(2) (if there is no CAP_SEEK).
CAP_WRITE new behaviour:
- Allow write(2), writev(2).
- Disallow pwrite(2) (CAP_SEEK was also required).

Added convinient defines:

#define CAP_PREAD (CAP_SEEK | CAP_READ)
#define CAP_PWRITE (CAP_SEEK | CAP_WRITE)
#define CAP_MMAP_R (CAP_MMAP | CAP_SEEK | CAP_READ)
#define CAP_MMAP_W (CAP_MMAP | CAP_SEEK | CAP_WRITE)
#define CAP_MMAP_X (CAP_MMAP | CAP_SEEK | 0x0000000000000008ULL)
#define CAP_MMAP_RW (CAP_MMAP_R | CAP_MMAP_W)
#define CAP_MMAP_RX (CAP_MMAP_R | CAP_MMAP_X)
#define CAP_MMAP_WX (CAP_MMAP_W | CAP_MMAP_X)
#define CAP_MMAP_RWX (CAP_MMAP_R | CAP_MMAP_W | CAP_MMAP_X)
#define CAP_RECV CAP_READ
#define CAP_SEND CAP_WRITE

#define CAP_SOCK_CLIENT \
(CAP_CONNECT | CAP_GETPEERNAME | CAP_GETSOCKNAME | CAP_GETSOCKOPT | \
CAP_PEELOFF | CAP_RECV | CAP_SEND | CAP_SETSOCKOPT | CAP_SHUTDOWN)
#define CAP_SOCK_SERVER \
(CAP_ACCEPT | CAP_BIND | CAP_GETPEERNAME | CAP_GETSOCKNAME | \
CAP_GETSOCKOPT | CAP_LISTEN | CAP_PEELOFF | CAP_RECV | CAP_SEND | \
CAP_SETSOCKOPT | CAP_SHUTDOWN)

Added defines for backward API compatibility:

#define CAP_MAPEXEC CAP_MMAP_X
#define CAP_DELETE CAP_UNLINKAT
#define CAP_MKDIR CAP_MKDIRAT
#define CAP_RMDIR CAP_UNLINKAT
#define CAP_MKFIFO CAP_MKFIFOAT
#define CAP_MKNOD CAP_MKNODAT
#define CAP_SOCK_ALL (CAP_SOCK_CLIENT | CAP_SOCK_SERVER)

Sponsored by: The FreeBSD Foundation
Reviewed by: Christoph Mallon <christoph.mallon@gmx.de>
Many aspects discussed with: rwatson, benl, jonathan
ABI compatibility discussed with: kib


242960 13-Nov-2012 kib

Implement the waitid() SUSv4 function using wait6() system call.

PR: standards/170346
Submitted by: "Jukka A. Ukkonen" <jau@iki.fi>
MFC after: 1 month


237434 22-Jun-2012 kib

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


236695 06-Jun-2012 dim

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


234657 24-Apr-2012 kib

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


231868 17-Feb-2012 kib

Fetch the aux vector for the static libc, and use the entries to
initialize the cache of the system information as it was done for the
dynamic libc. This removes several sysctls from the static binary
startup.

Use the aux vector to fill the single struct dl_phdr_info describing
the static binary itself, to implement dl_iterate_phdr(3) for the
static binaries. [1]

Based on the submission by: John Marino <draco marino st> [1]
Tested by: flo (sparc64)
MFC after: 2 weeks


228843 23-Dec-2011 cperciva

Fix a problem whereby a corrupt DNS record can cause named to crash. [11:06]

Add an API for alerting internal libc routines to the presence of
"unsafe" paths post-chroot, and use it in ftpd. [11:07]

Fix a buffer overflow in telnetd. [11:08]

Make pam_ssh ignore unpassphrased keys unless the "nullok" option is
specified. [11:09]

Add sanity checking of service names in pam_start. [11:10]

Approved by: so (cperciva)
Approved by: re (bz)
Security: FreeBSD-SA-11:06.bind
Security: FreeBSD-SA-11:07.chroot
Security: FreeBSD-SA-11:08.telnetd
Security: FreeBSD-SA-11:09.pam_ssh
Security: FreeBSD-SA-11:10.pam


218414 07-Feb-2011 jkim

Introduce a non-portable function pthread_getthreadid_np(3) to retrieve
calling thread's unique integral ID, which is similar to AIX function of
the same name. Bump __FreeBSD_version to note its introduction.

Reviewed by: kib


215144 11-Nov-2010 dim

Remove some unneeded spaces from the __sym_compat() macro, since newer
versions of gas are more fussy about spaces surrounding '@' signs in
versioned symbol names.


214093 20-Oct-2010 davidxu

Revert revision 214007, I realized that MySQL wants to resolve
a silly rwlock deadlock problem, the deadlock is caused by writer
waiters, if a thread has already locked a reader lock, and wants to
acquire another reader lock, it will be blocked by writer waiters,
but we had already fixed it years ago.


214015 18-Oct-2010 davidxu

Unbreak buildworld by including pthread_rwlockattr_setkind_np and
pthread_rwlockattr_getkind_np.


213153 25-Sep-2010 davidxu

To support stack unwinding for cancellation points, add -fexceptions flag
for them, two functions _pthread_cancel_enter and _pthread_cancel_leave
are added to let thread enter and leave a cancellation point, it also
makes it possible that other functions can be cancellation points in
libraries without having to be rewritten in libthr.


211706 23-Aug-2010 kib

On shared object unload, in __cxa_finalize, call and clear all installed
atexit and __cxa_atexit handlers that are either installed by unloaded
dso, or points to the functions provided by the dso.

Use _rtld_addr_phdr to locate segment information from the address of
private variable belonging to the dso, supplied by crtstuff.c. Provide
utility function __elf_phdr_match_addr to do the match of address against
dso executable segment.

Call back into libthr from __cxa_finalize using weak
__pthread_cxa_finalize symbol to remove any atfork handler which
function points into unloaded object.

The rtld needs private __pthread_cxa_finalize symbol to not require
resolution of the weak undefined symbol at initialization time. This
cannot work, since rtld is relocated before sym_zero is set up.

Idea by: kan
Reviewed by: kan (previous version)
MFC after: 3 weeks


211416 17-Aug-2010 kib

Use aux vector to get values for SSP canary, pagesize, pagesizes array,
number of host CPUs and osreldate.

This eliminates the last sysctl(2) calls from the dynamically linked image
startup.

No objections from: kan
Tested by: marius (sparc64)
MFC after: 1 month


204588 02-Mar-2010 joel

The NetBSD Foundation has granted permission to remove clause 3 and 4 from
their software.

Obtained from: NetBSD


201546 05-Jan-2010 davidxu

Use umtx to implement process sharable semaphore, to make this work,
now type sema_t is a structure which can be put in a shared memory area,
and multiple processes can operate it concurrently.
User can either use mmap(MAP_SHARED) + sem_init(pshared=1) or use sem_open()
to initialize a shared semaphore.
Named semaphore uses file system and is located in /tmp directory, and its
file name is prefixed with 'SEMD', so now it is chroot or jail friendly.
In simplist cases, both for named and un-named semaphore, userland code
does not have to enter kernel to reduce/increase semaphore's count.
The semaphore is designed to be crash-safe, it means even if an application
is crashed in the middle of operating semaphore, the semaphore state is
still safely recovered by later use, there is no waiter counter maintained
by userland code.
The main semaphore code is in libc and libthr only has some necessary stubs,
this makes it possible that a non-threaded application can use semaphore
without linking to thread library.
Old semaphore implementation is kept libc to maintain binary compatibility.
The kernel ksem API is no longer used in the new implemenation.

Discussed on: threads@


199614 20-Nov-2009 jhb

Revert the previous change to pthread_once() stub in libc. It is actually
a feature that libstdc++ depends on to simulate the behavior of libc's
internal '__isthreaded' variable. One benefit of this is that _libc_once()
is now private to _once_stub.c.

Requested by: kan


199606 20-Nov-2009 jhb

Add an internal _once() method. This works identical to pthread_once(3)
with the additional property that it is safe for routines in libc to use
in both single-threaded and multi-threaded processes. Multi-threaded
processes use the pthread_once() implementation from the threading library
while single-threaded processes use a simplified "stub" version internal
to libc. The libc stub-version of pthread_once() now also uses the
simplified "stub" version as well instead of being a nop.

Reviewed by: deischen, Matthew Fleming @ Isilon
Suggested by: alc
MFC after: 1 week


197968 11-Oct-2009 jilles

Make openat(2) a cancellation point.

This is required by POSIX and matches open(2).

Reviewed by: kib, jhb
MFC after: 1 month


194910 24-Jun-2009 jhb

Change the ABI of some of the structures used by the SYSV IPC API:
- The uid/cuid members of struct ipc_perm are now uid_t instead of unsigned
short.
- The gid/cgid members of struct ipc_perm are now gid_t instead of unsigned
short.
- The mode member of struct ipc_perm is now mode_t instead of unsigned short
(this is merely a style bug).
- The rather dubious padding fields for ABI compat with SV/I386 have been
removed from struct msqid_ds and struct semid_ds.
- The shm_segsz member of struct shmid_ds is now a size_t instead of an
int. This removes the need for the shm_bsegsz member in struct
shmid_kernel and should allow for complete support of SYSV SHM regions
>= 2GB.
- The shm_nattch member of struct shmid_ds is now an int instead of a
short.
- The shm_internal member of struct shmid_ds is now gone. The internal
VM object pointer for SHM regions has been moved into struct
shmid_kernel.
- The existing __semctl(), msgctl(), and shmctl() system call entries are
now marked COMPAT7 and new versions of those system calls which support
the new ABI are now present.
- The new system calls are assigned to the FBSD-1.1 version in libc. The
FBSD-1.0 symbols in libc now refer to the old COMPAT7 system calls.
- A simplistic framework for tagging system calls with compatibility
symbol versions has been added to libc. Version tags are added to
system calls by adding an appropriate __sym_compat() entry to
src/lib/libc/incldue/compat.h. [1]

PR: kern/16195 kern/113218 bin/129855
Reviewed by: arch@, rwatson
Discussed with: kan, kib [1]


192976 28-May-2009 zml

Revert unnecessary memset after calloc.

Suggested by: jhb
Approved by: dfr (mentor)


192911 27-May-2009 zml

Fix an issue when nss fallback routines are used in a multithreaded application.

Reviewed by: bushman
Approved by: dfr (mentor)


186461 23-Dec-2008 marcel

Add support for the FPA floating-point format on ARM. The
FPA floating-point format is identical to the VFP format,
but is always stored in big-endian.
Introduce _IEEE_WORD_ORDER to describe the byte-order of
the FP representation.

Obtained from: Juniper Networks, Inc


186090 14-Dec-2008 ume

Merge the resolver part of BIND 9.4.3 into HEAD.
It includes the following fix:

2426. [bug] libbind: inet_net_pton() can sometimes return the
wrong value if excessively large netmasks are
supplied. [RT #18512]

Reported by: Maksymilian Arciemowicz <cxib__at__securityreason.com>


186089 14-Dec-2008 ume

prop change.


186088 14-Dec-2008 ume

delete svn:keywords.


186087 14-Dec-2008 ume

prop change


182225 27-Aug-2008 jasone

Add thread-specific caching for small size classes, based on magazines.
This caching allows for completely lock-free allocation/deallocation in the
steady state, at the expense of likely increased memory use and
fragmentation.

Reduce the default number of arenas to 2*ncpus, since thread-specific
caching typically reduces arena contention.

Modify size class spacing to include ranges of 2^n-spaced, quantum-spaced,
cacheline-spaced, and subpage-spaced size classes. The advantages are:
fewer size classes, reduced false cacheline sharing, and reduced internal
fragmentation for allocations that are slightly over 512, 1024, etc.

Increase RUN_MAX_SMALL, in order to limit fragmentation for the
subpage-spaced size classes.

Add a size-->bin lookup table for small sizes to simplify translating sizes
to size classes. Include a hard-coded constant table that is used unless
custom size class spacing is specified at run time.

Add the ability to disable tiny size classes at compile time via
MALLOC_TINY.


179947 23-Jun-2008 ed

Turn execvpe() into an internal libc routine.

Adding exevpe() has caused some ports to break. Even though execvpe() is
a useful routine, it does not conform to any standards.

This patch is a little bit different from the patch sent to the mailing
list. I forgot to remove execvpe from the Symbol.map (which does not
seem to miscompile libc, though).

Reviewed by: davidxu
Approved by: philip


179662 09-Jun-2008 davidxu

Make pthread_cleanup_push() and pthread_cleanup_pop() as a pair of macros,
use stack space to keep cleanup information, this eliminates overhead of
calling malloc() and free() in thread library.

Discussed on: thread@


177911 04-Apr-2008 dfr

Add some compatibility code so that software which is built to use the new
struct flock with l_sysid member can work properly on an an old kernel which
doesn't support l_sysid.

Sponsored by: Isilon Systems


177855 02-Apr-2008 davidxu

Add pthread_setaffinity_np and pthread_getaffinity_np to libc namespace.


177607 25-Mar-2008 ru

Compile libthr with warnings.

(Somehow this file sneaked from initial commit.)


177605 25-Mar-2008 ru

Compile libthr with warnings.


176058 06-Feb-2008 des

Add pthread_mutex_isowned_np() so there is no need for an additional
prototype next to the implementation.

MFC after: 2 weeks


171219 04-Jul-2007 peter

Change the C wrappers for mmap/lseek/pread/pwrite/truncate/ftruncate to
call the pad-less versions of the corresponding syscalls if the running
kernel supports it. Check kern.osreldate once per program and cache the
result to select the appropriate syscall. This maintains userland
compatability with kernel.old's from quite a while back.

Approved by: re (kensmith)


170247 03-Jun-2007 ume

Merge BIND 9.4.1 into main chunk.

MFC after: 2 weeks


170243 03-Jun-2007 ume

This commit was generated by cvs2svn to compensate for changes in r170242,
which included commits to RCS files with non-trunk default branches.


165968 12-Jan-2007 imp

Remove 3rd clause, renumber, ok per email


158787 21-May-2006 ume

Upgrade res_update(3) and the friends to BIND9's one excluding TSIG
support.

X-MFC after: never


158783 21-May-2006 ume

This commit was generated by cvs2svn to compensate for changes in r158782,
which included commits to RCS files with non-trunk default branches.


158115 28-Apr-2006 ume

- Extend the nsswitch to support Services, Protocols and Rpc
databases.
- Make nsswitch support caching.

Submitted by: Michael Bushkov <bushman__at__rsu.ru>
Sponsored by: Google Summer of Code 2005


157223 28-Mar-2006 des

Add semaphore functions, and remove some dupes from the #if 0 section.


157218 28-Mar-2006 des

Add a bunch of missing pthread functions, and move out-of-order functions.


156964 21-Mar-2006 ume

We have gmtime_r(3).


156956 21-Mar-2006 ume

- Merge our local changes.
- Exclude unnecessary functions for us.


156953 21-Mar-2006 ume

This commit was generated by cvs2svn to compensate for changes in r156952,
which included commits to RCS files with non-trunk default branches.


156530 10-Mar-2006 davidxu

Add entries for new pthread stubs.


156319 05-Mar-2006 deischen

Add some more pthread stubs so that librt can use them.
The thread jump table has been resorted, so you need to
keep libc, libpthread, and libthr in sync.

Submitted by: xu


154248 12-Jan-2006 jasone

In preparation for a new malloc implementation:

* Add posix_memalign().

* Move calloc() from calloc.c to malloc.c. Add a calloc() implementation in
rtld-elf in order to make the loader happy (even though calloc() isn't
used in rtld-elf).

* Add _malloc_prefork() and _malloc_postfork(), and use them instead of
directly manipulating __malloc_lock.

Approved by: phk, markm (mentor)


150040 12-Sep-2005 stefanf

Move the declaration of __cleanup to libc_private.h as it is used in both
stdio/ and stdlib/. Don't define __cleanup twice.


148655 03-Aug-2005 deischen

Add namespace #defines for usleep.


141379 06-Feb-2005 das

Update my email address.


133754 15-Aug-2004 dfr

Add support for TLS in statically linked programs.


127625 30-Mar-2004 nectar

When a dynamic NSS module is built and linked against a thread
library, it may pull in that thread library at run time. If the
process started out single-threaded, this could cause attempts to
release locks that do not exist. Guard against this possibility by
checking __isthreaded before invoking thread primitives.

A similar problem remains if the process is linked against one thread
library, but the NSS module is linked against another. This can only
be avoided by careful design of the NSS module.

Submitted by: Sean McNeil <sean@mcneil.com> (mostly; bugs are mine)


126243 25-Feb-2004 green

Make the resolver(3) and many associated interfaces much more reentrant.
The getaddrinfo(3), getipnodebyname(3) and resolver(3) can coincide now
with what should be totally reentrant, and h_errno values will now
be preserved correctly, but this does not affect interfaces such as
gethostbyname(3) which are still mostly non-reentrant.

In all of these relevant functions, the thread-safety has been pushed
down as far as it seems possible right now. This means that operations
that are selected via nsdispatch(3) (i.e. files, yp, dns) are protected
still under global locks that getaddrinfo(3) defines, but where possible
the locking is greatly reduced. The most noticeable improvement is
that multiple DNS lookups can now be run at the same time, and this
shows major improvement in performance of DNS-lookup threaded programs,
and solves the "Mozilla tab serialization" problem.

No single-threaded applications need to be recompiled. Multi-threaded
applications that reference "_res" to change resolver(3) options will
need to be recompiled, and ones which reference "h_errno" will also
if they desire the correct h_errno values. If the applications already
understood that _res and h_errno were not thread-safe and had their own
locking, they will see no performance improvement but will not
actually break in any way.

Please note that when NSS modules are used, or when nsdispatch(3)
defaults to adding any lookups of its own to the individual libc
_nsdispatch() calls, those MUST be reentrant as well.


124655 18-Jan-2004 das

Add a delta accidentally omitted from the previous commit:
Define DBL_MANH_SIZE and DBL_MANL_SIZE to be the sizes of the
high and low words of the mantissa in bits, respectively.


122129 05-Nov-2003 deischen

Remove #include of spinlock.h from libc_private.h. Declare spinlocks as
struct _spinlock. Keep the typedef in for now; another set of changes
may come around to clean up consumers of spinlocks.

Requested by: bde


122069 04-Nov-2003 deischen

Externalize malloc's spinlock so that a thread library can take
it around an application's fork() call. Our new thread libraries
(libthr, libpthread) can now have threads running while another
thread calls fork(). In this case, it is possible for malloc
to be left in an inconsistent state in the child. Our thread
libraries, libpthread in particular, need to use malloc internally
after a fork (in the child).

Reviewed by: davidxu


114443 01-May-2003 nectar

Back out the `hiding' of strlcpy and strlcat. Several people
vocally objected to this safety belt.


114256 29-Apr-2003 nectar

`Hide' strlcpy and strlcat (using the namespace.h / __weak_reference
technique) so that we don't wind up calling into an application's
version if the application defines them.

Inspired by: qpopper's interfering and buggy version of strlcpy


113798 21-Apr-2003 nectar

Correct a bug that was somehow both obvious and hard-to-see. :-)
An incorrectly-sized allocation was being made due to an incorrect
argument to the `sizeof' operator. Obvious, because it violated the
`foo = malloc(sizeof(*foo))' idiom. Hard-to-see, because it was a
missing `*' (`*p' versus `**p').

Resulting failure was
Reported by: ache

Sponsored by: DARPA, Network Associates Laboratories


113595 17-Apr-2003 nectar

= Implement name service switch modules (NSS modules). NSS modules
may be built into libc (`static NSS modules') or dynamically loaded
via dlopen (`dynamic NSS modules'). Modules are loaded/initialized
at configuration time (i.e. when nsdispatch is called and nsswitch.conf
is read or re-read).

= Make the nsdispatch(3) core thread-safe.

= New status code for nsdispatch(3) `NS_RETURN', currently used to
signal ERANGE-type issues.

= syslog(3) problems, don't warn/err/abort.

= Try harder to avoid namespace pollution.

= Implement some shims to assist in porting NSS modules written for
the GNU C Library nsswitch interface.

Sponsored by: DARPA, Network Associates Laboratories


112665 26-Mar-2003 jeff

- Define a _spinunlock() function so that threading implementations may do
more complicated things than just setting the lock to 0.
- Implement stubs for this function in libc and the two threading libraries
that are currently in the tree.


111618 27-Feb-2003 nectar

Eliminate 19 warnings in libc (at level WARNS=2) of the
`implicit declaration of function' variety.


111010 16-Feb-2003 nectar

Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go).
Only warnings that could be fixed without changing the generated object
code and without restructuring the source code have been handled.

Reviewed by: /sbin/md5


110566 08-Feb-2003 mike

Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
<math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
<machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
on the size of its argument. __fpclassifyl() is never called on
alpha because (sizeof(long double) == sizeof(double)), which is good
since __fpclassifyl() can't deal with such a small `long double'.

This was developed by David Schultz and myself with input from bde and
fenner.

PR: 23103
Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>
(significant portions)
Reviewed by: bde, fenner (earlier versions)


108864 07-Jan-2003 tjr

Add waitpid to the list of hidden names for use by wordexp.c and grantpt.c.


106880 13-Nov-2002 deischen

Argh, change declaration of two-dimensional array so that it actually
builds.


106870 13-Nov-2002 deischen

Make this compile with whatever error-checking is enabled in buildworld
and/or beast.


106866 13-Nov-2002 deischen

Use a jump table (a la Solaris) for pthread routines with default
entries in the table being stubs. While I'm here, add macros to
auto-generate the stubs. A conforming threads library can override
the stub routines by filling in the jump table.

Add some entries to namespace.h and sync un-namespace.h to it.
Also add a comment to remind folks to update un-namespace.h
when changing namespace.h.


106288 01-Nov-2002 dfr

* Add stubs for pthread_cond_broadcast.
* Fix typos in rwlock stubs.
* Add pthread_XXX counterparts to the _pthread_XXX stubs which libraries
like libX11 can use to ensure thread-safety without requiring the use
of a thread library.

Submitted by: Terry Lambert (pthread_cond_broadcast)
Reviewed by: deischen


93399 29-Mar-2002 markm

Do not use __progname directly (except in [gs]etprogname(3)).
Also, make an internal _getprogname() that is used only inside
libc. For libc, getprogname(3) is a weak symbol in case a
function of the same name is defined in userland.


92991 22-Mar-2002 obrien

Fix the style of the SCM ID's.
I believe have made all of libc .h's as consistent as possible.


92905 21-Mar-2002 obrien

Remove __P() usage.


86250 11-Nov-2001 bde

Fixed namespace pollution related to `err' in libc in the same way as for
`warn'. Now a whole 2 members of the err() family don't cause pollution.

This fixes world breakage in awk for NOSHARED worlds. contrib/awk/msg.c
has had its own version of err() for a long time, but this somehow
didn't cause problems until the update to awk-3.1.0.


85159 19-Oct-2001 ru

signanosleep(2) hasn't existed since 1998.


82496 29-Aug-2001 bde

Fixed namespace pollution related to `warn' in libc (but not in other
libraries or for other members of the err() family).

This fixes world breakage in bc and rcs/* for NOSHARED worlds.


75186 04-Apr-2001 tmm

Add entries for the posix1e functions that will be overridden in libc_r.

Approved by: rwatson
Obtained from: TrustedBSD Project


74462 19-Mar-2001 alfred

Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.

Bring in required TLI library routines to support this.

Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.

This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).

The submitter has agreed to continue on and bring us up to the
1999 release.

Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.

Many userland updates were done to bring the code up to par with
the recent RPC API.

There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.

While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.

New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.

Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.

Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.

Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul


72373 11-Feb-2001 deischen

libc MT-safety, part 2.

Add a lock to FILE. flockfile and friends are now implemented
(for the most part) in libc. flockfile_debug is implemented in
libc_r; I suppose it's about time to kill it but will do it in
a future commit.

Fix a potential deadlock in _fwalk in a threaded environment.
A file flag (__SIGN) was added to stdio.h that, when set, tells
_fwalk to ignore it in its walk. This seemed to be needed in
refill.c because each file needs to be locked when flushing.

Add a stub for pthread_self in libc. This is needed by flockfile
which is allowed by POSIX to be recursive.

Make fgetpos() error return value (-1) match man page.

Remove recursive calls to locked functions (stdio); I think I've
got them all, but I may have missed a couple.

A few K&R -> ANSI conversions along with removal of a few instances
of "register".

$Id$ -> $FreeBSD$ in libc/stdio/rget.c

Not objected to: -arch, a few months ago


71579 24-Jan-2001 deischen

Remove _THREAD_SAFE and make libc thread-safe by default by
adding (weak definitions to) stubs for some of the pthread
functions. If the threads library is linked in, the real
pthread functions will pulled in.

Use the following convention for system calls wrapped by the
threads library:
__sys_foo - actual system call
_foo - weak definition to __sys_foo
foo - weak definition to __sys_foo

Change all libc uses of system calls wrapped by the threads
library from foo to _foo. In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde). All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes. <db.h> is an exception
and shouldn't be included in between namespace.h and
un-namespace.h namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.

Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE. We have recursive mutexes, but would like to avoid
using them if possible.

Remove uneeded includes of <errno.h> from a few files.

Add $FreeBSD$ to a few files in order to pass commitprep.

Approved by: -arch


50476 28-Aug-1999 peter

$Id$ -> $FreeBSD$


36803 09-Jun-1998 jb

Implement compile time debug support for spinlocks.

Simplify the atomic lock prototype, removing the lock value.

Delete the unlock prototypes that are not required.


35759 05-May-1998 jb

Remove leading underscores from the FILE lock functions that POSIX
specifies.


35753 05-May-1998 jb

In a threaded library, expect the lock field to be declared volatile,
so provide function prototypes that respect that, avoiding a gcc
warning that `volatile' is being thrown away.


35124 11-Apr-1998 jb

Add a private header file for libc/libc_r/libpthread to contain
definitions for things like locking etc.


34365 09-Mar-1998 jb

Add a private (to libc, libc_r and libpthread) header file containing
prototypes for the spinlock functions that will be used for thread locks.
libc will have stubs declared with weak symbols. libpthread and libc_r
will have functions that really do something.