Commit Graph

19786 Commits

Author SHA1 Message Date
Yuri Pankov
9eb7d595e1 Reset persistent mbstates when rune locale encoding changes.
This was shown to be a problem by side effect of now-enabled test case,
which was going through C, en_US.UTF-8, ja_JP.SJIS, and ja_JP.eucJP,
and failing eventually as data in mbrtowc's mbstate, that was
perfectly correct for en_US.UTF-8 was treated as incorrect for
ja_JP.SJIS, failing the entire test case.

This makes the persistent mbstates to be per ctype-component,
and not per-locale so we could easily reset the mbstates when
only LC_CTYPE is changed.

Reviewed by:	bapt, pfg
Approved by:	kib (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D17796
2018-11-09 03:32:53 +00:00
Andrew Turner
a0e4ca397e Add the (untested) mips and sparc64 .init call sequences.
The BSD crtbegin/crtend code now builds on all architectures, however
further work is needed to check if it works correctly.

MFC with:	r339738
Sponsored by:	DARPA, AFRL
2018-11-07 09:49:25 +00:00
Mark Johnston
35b4d0f125 Document the fact that cap_limit_set() always frees the input nvlist.
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2018-11-05 21:01:45 +00:00
Kyle Evans
bc82609ae2 Move pmc* bits behind MK_PMC to fix WITHOUT_PMC build
No objection from:	mmacy
MFC after:	3 days
2018-11-05 00:20:58 +00:00
Yuri Pankov
dd7c41a378 Add hybrid C.UTF-8 locale being identical to default C locale except
that it uses the same ctype maps and functions as other UTF-8 locales.

Reviewed by:	bapt, cem, eadler
Approved by:	kib (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D17833
2018-11-04 22:13:22 +00:00
Mariusz Zaborski
d9c2248dd5 libcasper: using explicit_bzero in cap_grp service
Please notice that we still don't clean information in nvlist structures.

Submitted by:	David CARLIER <devnexen@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D16777
2018-11-04 19:43:59 +00:00
Mariusz Zaborski
577dff6a8d libcasper: fix limitations in dns service
The getaddrinfo(3) and gethostbyname(3) are used to return the address for a
given hostname. The getnameinfo(3) and gethostbyaddr(3) are used to return
hostname for a given address. Right now in casper, we have two limitations:
- NAME which allows resolving DNS names.
- ADDR which allows to do revert DNS lookups.

Before this change the rights was mixed up:
NAME - getnameinfo(3) and gethostbyname(3)
ADDR - gethostbyaddr(3) and getaddrinfo(3)

Which no matters on limitation allowed us to resolve DNS names and do DNS
lookups basically by using a different set of functions.

Now the NAME type allows getaddrinfo(3) and gethostbyname (3)functions,
and the ADDR names allow to use gethostbyaddr(3) and getnameinfo(3) functions.

Reviewed by:	pjd, bcr
MFC after:	3 weeks
Discussed with:	hrs
Differential Revision:	https://reviews.freebsd.org/D16930
2018-11-04 19:38:54 +00:00
Mariusz Zaborski
db9a6e4178 libcasper: Update example in man page to use cap_getnameinfo function.
Reviewed by:	hrs
Differential Revision:	https://reviews.freebsd.org/D16931
2018-11-04 19:31:44 +00:00
Mariusz Zaborski
fe24949034 libcasper: Document the cap_getaddrinfo and cap_getnameinfo functions
Reviewed by:	hrs
Differential Revision:	https://reviews.freebsd.org/D16929
2018-11-04 19:29:19 +00:00
Mariusz Zaborski
9e5493752a Fix a recusive call introduce in the r340130. 2018-11-04 18:52:59 +00:00
Mariusz Zaborski
5a453d5f5b libcapsicum: Introduce caph_{rights,ioctls,fcntls}_limit
The idea behind those functions is not to force consumers to remember that there
is a need to check errno on failure. We already have a caph_enter(3) function
which does the same for cap_enter(2).

MFC after:	2 weeks
2018-11-04 17:22:58 +00:00
Eric van Gyzen
0a48773f8c Update expat to 2.2.6
Update contrib/expat by merging from the vendor branch.

Update expat_config.h manually, using
    make -C /usr/ports/textproc/expat2 configure
as a baseline.

MFC after:	1 month
Relnotes:	yes
Security:	yes; see contrib/expat/Changes since 2.2.0
Sponsored by:	Dell EMC Isilon
2018-11-04 16:08:59 +00:00
Mateusz Piotrowski
6d080f8660 csqrt(3): Fix some typos in the manual page
Submitted by:	Steve Kargl <sgk@troutmask.apl.washington.edu>
Reviewed by:	eadler
Approved by:    krion (mentor, implicit), mat (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D17831
2018-11-04 14:11:38 +00:00
Matt Macy
dacc43df34 Add aditional counter descriptions to AMD 0x17
Submitted by:	Somalapuram Amaranath
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D17401
2018-11-04 06:24:27 +00:00
Yuri Pankov
32a8ec8bdd strptime: make %k and %l specifiers match their description in
strftime(3), and allow them to process space-padded input.

PR:		230720
Submitted by:	rlittle@inetco.com (original version)
Approved by:	kib (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D17761
2018-11-03 23:37:13 +00:00
Eric van Gyzen
77c85705a6 Vendor import of expat 2.2.6
Sponsored by:	Dell EMC Isilon
2018-11-02 22:10:07 +00:00
Conrad Meyer
78c2a9806e kern_poll: Restore explanatory comment removed in r177374
The comment isn't stale.  The check is bogus in the sense that poll(2)
does not require pollfd entries to be unique in fd space, so there is no
reason there cannot be more pollfd entries than open or even allowed
fds.  The check is mostly a seatbelt against accidental misuse or
abuse.  FD_SETSIZE, while usually unrelated to poll, is used as an
arbitrary floor for systems with very low kern.maxfilesperproc.

Additionally, document this possible EINVAL condition in the poll.2
manual.

No functional change.

Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D17671
2018-11-01 23:46:23 +00:00
Kyle Evans
4635676d25 libbe(3): Don't promote non-cloned BEs
Most easily reproducible by attempting to activate the currently activated
BE, one would get a "not a cloned filesystem" error instead of success or a
sane message.

PR:		232488
MFC after:	3 days
2018-11-01 14:00:56 +00:00
Ed Maste
57706376c6 Add __used to __CTOR_LIST__ and __DTOR_LIST__
Enabling BSD_CRTBEGIN on amd64 resulted in
error: unused variable '__CTOR_LIST__'.

__CTOR_LIST__ is indeed unused in crtbegin.c; it marks the beginning of
the .ctors array and is used in crtend.c.  Annotate __DTOR_LIST__ as
well for consistency.

Discussed with:	andrew
MFC with:	r339738
Sponsored by:	The FreeBSD Foundation
2018-10-31 14:19:58 +00:00
Andrew Turner
8522d140a5 Build the csu tests on all architectures.
The tests haven't been run them, but this is enough to build them so I can
get feedback on if the various crt.h headers are correct.

MFC with:	r339738
Sponsored by:	DARPA, AFRL
2018-10-30 14:44:12 +00:00
Andrew Turner
ca34591f29 Disable the .preinit_array test in DSOs, ld.bfd fails to link objects with
the section.

MFC with:	r339738
Sponsored by:	DARPA, AFRL
2018-10-30 11:19:47 +00:00
Andrew Turner
bb966f87bc Fix the location of the static keyword.
MFC with:	r339738
Sponsored by:	DARPA, AFRL
2018-10-30 10:16:21 +00:00
Andrew Turner
6ec0ee844c Run the csu tests on a DSO. This builds the tests into a shared library,
then runs these from the base test programs. With this we can check
crtbeginS.o and crtendS.o are working as expected.

MFC with:	r339738
Sponsored by:	DARPA, AFRL
2018-10-30 09:43:26 +00:00
Andrew Turner
9e26e65c16 The jcr argument to _Jv_RegisterClasses is used, stop marking it otherwise.
MFC with:	r339738
Sponsored by:	DARPA, AFRL
2018-10-30 09:36:31 +00:00
Yuri Pankov
281c29899f Connect libc/tests/time to the build, adding test cases for strptime()
issues fixed recently, and disabling the failing ones (mostly due to TZ
parsing differences with NetBSD).

Reviewed by:	ngie
Approved by:	kib (mentor)
Differential Revision:	https://reviews.freebsd.org/D17546
2018-10-30 02:37:23 +00:00
Konstantin Belousov
1d160e1e9c Convert amd64_get/set_fs/gsbase to ifunc.
Note that this is the first use of ifuncs in our userspace.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
2018-10-30 00:11:30 +00:00
Alex Richardson
2fa224b17d Fix get_maxfds() in jevents
If RLIM_INFINITY == -1ULL (such as on macOS) the min() call will result
in a value of less than 1 being returned. This causes nftw() to fail
with EINVAL.

While touching this file also fix includes to work on Linux/macOS and don't
declare snprintf since it may have different attributes in the system
headers there.

Reviewed By:	mmacy
Approved By:	brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17682
2018-10-29 21:08:34 +00:00
Andrew Turner
fb7128c25e Make the .ctors, .dtors, and .jcr markers as static. They shouldn't be
accessible from out of the files they are defined in.

MFC with:	r339738
Sponsored by:	DARPA, AFRL
2018-10-29 17:55:26 +00:00
Andrew Turner
235130433a Check __dso_handle is NULL in non-DSO objects. It should only be non-NULL
when accessed from a shared object.

MFC with:	r339738
Sponsored by:	DARPA, AFRL
2018-10-29 17:03:20 +00:00
Warner Losh
f64bccc6d9 Bump .Dd forgotten in last commit. 2018-10-28 03:02:09 +00:00
Warner Losh
5669c6748d Note that the kenrel doesn't keep track daylight savings time, nor
timezone offset. These values are generally zero.

While one still theoreticall could set these values, that's almost
never done. Users wishing to have an offset between the time of day
clock hardware and UTC use adjkerntz(8) instead.

localtime(3) should be used to find these values for the current
timezone.
2018-10-28 02:58:22 +00:00
Warner Losh
33b5b3ef75 ftime appeared in 7th Edition Unix to replace gtime.
Note that the timezone and dst entries are always returned as 0.
2018-10-28 02:58:15 +00:00
Warner Losh
366a7b3d0c Ensure that the device path is sane before trying to decode and print
it.

Sponsored by: Netflix, Inc
2018-10-26 22:49:36 +00:00
Andrew Turner
fd8767bb69 Add __dso_handle to the BSD crtbegin. This is used to identify shared
objects.

MFC with:	r339738
Sponsored by:	DARPA, AFRL
2018-10-26 11:53:20 +00:00
Andrew Turner
4b48b463ed Drop the csu tests WARNS to 5 to fix the powerpc64 build.
MFC with:	r339738
Sponsored by:	DARPA, AFRL
2018-10-26 08:12:28 +00:00
Konstantin Belousov
4f77f48884 Implement O_BENEATH and AT_BENEATH.
Flags prevent open(2) and *at(2) vfs syscalls name lookup from
escaping the starting directory.  Supposedly the interface is similar
to the same proposed Linux flags.

Reviewed by:	jilles (code, previous version of manpages), 0mp (manpages)
Discussed with:	allanjude, emaste, jonathan
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D17547
2018-10-25 22:16:34 +00:00
Martin Matuska
b1c91e4b6c MFV r339640,339641,339644:
Sync libarchive with vendor

Relevant vendor changes:
  PR #1013: Add missing h_base offset when performing absolute seeks in
            xar decompression
  PR #1061: Add support for extraction of RAR v5 archives
  PR #1066: Fix out of bounds read on empty string filename for gnutar, pax
            and v7tar
  PR #1067: Fix temporary file path buffer overflow in tests
  IS #1068: Correctly process and verify integer arguments passed to
            bsdcpio and bsdtar
  PR #1070: Don't default XAR entry atime/mtime to the current time

MFC after:	1 month
2018-10-25 21:44:17 +00:00
Andrew Turner
812c4fa807 Add a missing include for src.opts.mk. Without it MK_TESTS isn't defined.
MFC with:	r339738
Sponsored by:	DARPA, AFRL
2018-10-25 21:08:15 +00:00
Andrew Turner
31d62a73c2 Implement a BSD licensed crtbegin/crtend
These are needed for .ctors/.dtors and .jcr handling. The former needs
all the function pointers to be called in the correct order from the
.init/.fini section. The latter just needs to call a gcj specific function
if it exists with a pointer to the start of the .jcr section.

This is currently disabled until __dso_handle support is added.

Reviewed by:	emaste
MFC after:	1 month
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D17587
2018-10-25 17:39:41 +00:00
Mateusz Piotrowski
4026e1cc68 efivar(3): Fix some typos and improve style
- Fix some typos.
- Remove redundant semicolons from the synopsis section.
- Stylize variable names and types with Vt and Va respectively.
- Use a list to present non-implemented functions.
- Sort the order of the sections.
- Add a history section.
- Use Nm when "libefivar" is mentioned.

PR:		232626
Reported by:	Tiwei Bie <btw@mail.ustc.edu.cn>
Reviewed by:	bcr, imp
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D17686
2018-10-25 15:41:19 +00:00
Mark Johnston
b8e4cdda35 Clarify slightly the interaction between wait*() and pdfork().
There are multiple ways to wait for any child process to return a
status (e.g., waitpid(-1, ...), waitid(P_ALL, ...)), so don't be so
specific.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2018-10-24 18:42:13 +00:00
Mark Johnston
e9b1dc32c9 Fix comments.
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2018-10-24 00:17:19 +00:00
Cy Schubert
3ad12d2782 Follow up on r331936. gets_s(3) will also fail in the same way that
gets(3) does. This was missed in r331936.

Reported by:	emaste@
MFC after:	3 days
2018-10-23 14:16:02 +00:00
Alex Richardson
60b905ae2f Fix ncurses fallback.c build with a strict build shell
The script uses shift three times and when building with a strict /bin/sh
shifting without any arguments will cause the script to fail. In this case
the target will fail and we write an empty output file. When doing a
NO_CLEAN build after this will mean fallback.c is up to date and clang
will happily compile the empty input file which leads to strange build
errors later.

Fixed by passing three empty arguments to MkFallback.sh and only creating
fallback.c if MKfallback.sh succeeds.

Aproved By:	brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D16867
2018-10-23 06:31:31 +00:00
Alex Richardson
c5c5072bb0 Fix regex for extracting SHM_* values for libsysdecode
There was an additional + after the {6} which is apparently ignored by the
FreeBSD regex implementation but was giving me an error when compiling on
MacOS.

While changing this also make sure that tables.h is not created if mktables
fails. The current rule would create a partial tables.h which causes following
incremental builds to use that broken file and fail with an unrelated
compilation error or even succeed even though they shouldn't.

Approved By:	jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D17069
2018-10-23 06:31:19 +00:00
Conrad Meyer
0f743729ab Update to Zstandard 1.3.7
Relnotes:	yes
Sponsored by:	Dell EMC Isilon
2018-10-22 18:29:12 +00:00
Glen Barber
91e8ea7f5c Comment -DNDEBUG in head after r339436 when head was switched
from 12.0-ALPHA10 to 13.0-CURRENT.  This edit was a mistake,
and should have been applied to stable/12 upon branching, not
head.

Reported by:	jbeich, dim
Sponsored by:	The FreeBSD Foundation
2018-10-21 15:54:38 +00:00
Poul-Henning Kamp
01652e9c8e Update example to something people less than 40 years old have heard about. 2018-10-21 07:30:26 +00:00
Ed Maste
6492be46b8 ANSIfy libc/quad
Some of these routines exist in both lib/libc/quad/ and sys/libkern/.
r325988 ANSIfied sys/libkern.  Update libc/quad to match.

PR:		223641
Reported by:	bde
Sponsored by:	The FreeBSD Foundation
2018-10-21 00:20:40 +00:00
Ed Maste
05bc9aa78f mcount: tidy up ANSIfication
libc/gmon's mcount was ANSIfied in r124180, with libkern following over
a decade later, in r325988, but some minor discrepancies remained.
Update libc/gmon's mexitcount to an ANSI C function definition, and use
(void) for libkern-only functions that take no arguments.

Reported by:	bde
2018-10-20 22:39:35 +00:00