aboutsummaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* msun tests: use standard floating-point exception flags on lrint and fenv testsAlfredo Dal'Ava Junior2020-11-182-9/+12
| | | | | | | | | | | | | | | Some platforms have additional architecture-specific floating-point flags. Msun test cases lrint and test_fegsetenv (fenv) expects only standard flags, so make sure to mask them appropriately. This makes test pass on PowerPC64. Reviewed by: jhibbits, ngie Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D27202 Notes: svn path=/head/; revision=367811
* Split out cwd/root/jail, cmask state from filedesc tableConrad Meyer2020-11-172-7/+14
| | | | | | | | | | | | | | | | No functional change intended. Tracking these structures separately for each proc enables future work to correctly emulate clone(2) in linux(4). __FreeBSD_version is bumped (to 1300130) for consumption by, e.g., lsof. Reviewed by: kib Discussed with: markj, mjg Differential Revision: https://reviews.freebsd.org/D27037 Notes: svn path=/head/; revision=367777
* [POWERPC] msun: fix incorrect flag in fesetexceptflagAlfredo Dal'Ava Junior2020-11-171-1/+1
| | | | | | | | | | | | Fix incorrect mask being used when FE_INVALID bit is wanted by user. The problem was noticed thanks to msun fenv tests. Reviewed by: jhibbits, luporl Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D27201 Notes: svn path=/head/; revision=367761
* _umtx_op: fix a compat32 bug in UMTX_OP_NWAKE_PRIVATEKyle Evans2020-11-172-0/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically, if we're waking up some value n > BATCH_SIZE, then the copyin(9) is wrong on the second iteration due to upp being the wrong type. upp is currently a uint32_t**, so upp + pos advances it by twice as many elements as it should (host pointer size vs. compat32 pointer size). Fix it by just making upp a uint32_t*; it's still technically a double pointer, but the distinction doesn't matter all that much here since we're just doing arithmetic on it. Add a test case that demonstrates the problem, placed with the libthr tests since one messing with _umtx_op should be running these tests. Running under compat32, the new test case will hang as threads after the first 128 get missed in the wake. it's not immediately clear how to hit it in practice, since pthread_cond_broadcast() uses a smaller (sleepq batch?) size observed to be around ~50 -- I did not spend much time digging into it. The uintptr_t change makes no functional difference, but i've tossed it in since it's more accurate (semantically). Reported by: Andrew Gierth (andrew_tao173.riddles.org.uk, inspection) Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27231 Notes: svn path=/head/; revision=367743
* _umtx_op: document UMTX_OP_SEM2_WAIT copyout behaviorKyle Evans2020-11-171-1/+22
| | | | | | | | | | | This clever technique to get a time remaining back was added to support sem_clockwait_np. Reviewed by: kib, vangyzen MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27160 Notes: svn path=/head/; revision=367742
* Revert the whole getlocalbase() set of changes while a different design isScott Long2020-11-154-208/+2
| | | | | | | hashed out. Notes: svn path=/head/; revision=367711
* Because getlocalbase() returns -1 on error, it needs to use a signed typeScott Long2020-11-151-5/+12
| | | | | | | | internally. Do that, and make sure that conversations between signed and unsigned don't overflow Notes: svn path=/head/; revision=367701
* Fix a problem with r367686 related to the use of ssize_t. Not sure how thisScott Long2020-11-142-3/+15
| | | | | | | | | escaped prior testing, but it should be better now. Reported by: lots Notes: svn path=/head/; revision=367689
* Add the library function getlocalbase and its manual page. This helps toScott Long2020-11-144-2/+189
| | | | | | | | | | | unify the retrieval of the various ways that the local software base directory, typically "/usr/local", is expressed in the system. Reviewed by: se Differential Revision: https://reviews.freebsd.org/D27022 Notes: svn path=/head/; revision=367686
* Add missing src.opts.mk includeBrooks Davis2020-11-131-0/+2
| | | | | | | | | | | | This was missed in r364221 so tests were not built. Reviewed by: bdrewery Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27210 Notes: svn path=/head/; revision=367655
* Add a missing Nm macroMateusz Piotrowski2020-11-131-0/+1
| | | | | | | | All functions documented in a manual page should be enumerated with the Nm macros. Notes: svn path=/head/; revision=367641
* Reference setprogname(3) in setproctitle(3)Mateusz Piotrowski2020-11-131-1/+2
| | | | | | | | | | The reference to setproctitle(3) in the setprogname(3) manual is already in place. MFC after: 3 days Notes: svn path=/head/; revision=367639
* pkgbase: Move libprivatezstd from utilities to runtimeEmmanuel Vadot2020-11-121-0/+1
| | | | | | | | | | | | | | | | | | libarchive depends on it by default and tar uses libarchive. So on a update : 1/ runtime contain tar 2/ runtime have libarchive in shlibs_required 3/ libarchive packages depends on utilities 4/ utilities depends on runtime 5/ kaboom All users of libprivatezstd (libarchive related stuff and objcopy/ar) are already in utilities. Discussed with: bapt Notes: svn path=/head/; revision=367616
* Add C startup code tests for PIE binaries.John Baldwin2020-11-103-0/+13
| | | | | | | | | | | | | | | - Force dynamic to be a non-PIE binary. - Add a dynamicpie test which uses a PIE binary. Reviewed by: andrew Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27127 Notes: svn path=/head/; revision=367576
* Fix dso_handle_check for PIE executables.John Baldwin2020-11-101-2/+2
| | | | | | | | | | | | | PIE executables use crtbeginS.o and have a non-NULL dso_handle as a result. Reviewed by: andrew, emaste MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27126 Notes: svn path=/head/; revision=367575
* Rename __JCR_LIST__ to __JCR_END__ in crtend.c.John Baldwin2020-11-101-1/+1
| | | | | | | | | | | | | | This is more consistent with the names used for .ctor and .dtor symbols and better reflects __JCR_END__'s role. Reviewed by: andrew Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27125 Notes: svn path=/head/; revision=367574
* Add collation version support to querylocale(3).Thomas Munro2020-11-085-16/+57
| | | | | | | | | | | | | | | | | | | | | | | Provide a way to ask for an opaque version string for a locale_t, so that potential changes in sort order can be detected. Similar to ICU's ucol_getVersion() and Windows' GetNLSVersionEx(), this API is intended to allow databases to detect when text order-based indexes might need to be rebuilt. The CLDR version is extracted from CLDR source data by the Makefile under tools/tools/locale, written into the machine-generated Makefile under shared/colldef, passed to localedef -V, and then written into LC_COLLATE file headers. The initial version is 34.0. tools/tools/locale was recently updated to pull down 35.0, but the output hasn't been committed under share/colldef yet, so that will provide the first observable change when it happens. Other versioning schemes are possible in future, because the format is unspecified. Reviewed by: bapt, 0mp, kib, yuripv (albeit a long time ago) Differential Revision: https://reviews.freebsd.org/D17166 Notes: svn path=/head/; revision=367476
* malloc: move malloc_type_internal into malloc_typeMateusz Guzik2020-11-061-9/+8
| | | | | | | | | | | | | | | | According to code comments the original motivation was to allow for malloc_type_internal changes without ABI breakage. This can be trivially accomplished by providing spare fields and versioning the struct, as implemented in the patch below. The upshots are one less memory indirection on each alloc and disappearance of mt_zone. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D27104 Notes: svn path=/head/; revision=367432
* pmcstat: fix PPC kernel symbol resolutionLeandro Lupori2020-11-051-0/+25
| | | | | | | | | | | | | | | PowerPC kernel is of DYN type and it has a base address where it is initially loaded, before being relocated. As the start address passed to pmcstat_image_link() is where the kernel was relocated to, but the symbols always use the original base address, we need to subtract it to get the correct offset. Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D26114 Notes: svn path=/head/; revision=367392
* libpmc: add support for POWER8/9 PMCsLeandro Lupori2020-11-051-0/+20
| | | | | | | | | | | This change adds support for POWER8/9 performance counters. Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D26113 Notes: svn path=/head/; revision=367391
* Make linux_errtbl[] static.Edward Tomasz Napierala2020-11-031-1/+0
| | | | | | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27004 Notes: svn path=/head/; revision=367301
* Re-arrange some of the code to separate writable user tree variables fromStefan Eßer2020-11-021-28/+27
| | | | | | | | | | | R/O variables. While here fix some nearby style. No functional change intended. MFC after: 1 month Notes: svn path=/head/; revision=367280
* malloc: export kernel zones instead of relying on them being power-of-2Mateusz Guzik2020-11-022-1/+137
| | | | | | | | Reviewed by: markj (previous version) Differential Revision: https://reviews.freebsd.org/D27026 Notes: svn path=/head/; revision=367274
* [libnetmap] Fix 32 bit compilation under gcc-6.4Adrian Chadd2020-11-021-5/+10
| | | | | | | | | | | | | | | Use uintptr_t to cast a uint64_t to a pointer type. Yeah, it isn't technically correct for platforms with pointers > 64 bits, but it's fine here. This fixes 32 bit compat library builds on amd64 and also mips32 builds. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D26790 Notes: svn path=/head/; revision=367273
* Make sysctl user.local a tunable that can be written at run-timeStefan Eßer2020-10-311-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | This sysctl value had been provided as a read-only variable that is compiled into the C library based on the value of _PATH_LOCALBASE in paths.h. After this change, the value is compiled into the kernel as an empty string, which is translated to _PATH_LOCALBASE by the C library. This empty string can be overridden at boot time or by a privileged user at run time and will then be returned by sysctl. When set to an empty string, the value returned by sysctl reverts to _PATH_LOCALBASE. This update does not change the behavior on any system that does not modify the default value of user.localbase. I consider this change as experimental and would prefer if the run-time write permission was reconsidered and the sysctl variable defined with CLFLAG_RDTUN instead to restrict it to be set at boot time. MFC after: 1 month Notes: svn path=/head/; revision=367243
* Fix reversed condition after attempted style fix in r367196Stefan Eßer2020-10-311-2/+2
| | | | | | | | Reported by: xtouqh@hotmail.com MFC after: 3 days Notes: svn path=/head/; revision=367199
* Fix style, no functional changeStefan Eßer2020-10-311-5/+5
| | | | | | | | Submitted by: kib MFC after: 3 days Notes: svn path=/head/; revision=367196
* Update man-pages to describe the user.localbase variable added in r367179.Stefan Eßer2020-10-301-1/+5
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=367184
* Add read only sysctl variable user.localbaseStefan Eßer2020-10-301-0/+9
| | | | | | | | | | | | The value is provided by the C library as for other sysctl variables in the user tree. It is compiled in and returns the value of _PATH_LOCALBASE defined in paths.h. Reviewed by: imp, scottl Differential Revision: https://reviews.freebsd.org/D27009 Notes: svn path=/head/; revision=367179
* Add defines for Linux errno values and use them to make linux_errtbl[]Edward Tomasz Napierala2020-10-291-0/+1
| | | | | | | | | | | | | more readable. While here, add linux_check_errtbl() function to make sure we don't leave holes. No objections: emaste (earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26972 Notes: svn path=/head/; revision=367132
* Disable ssp raw test without ASANBrooks Davis2020-10-281-1/+1
| | | | | | | | | | | | | r366981 disabled ASAN when it might not be reliable (with an external compiler), but this test is broken without ASAN so disable it completely in that case. PR: 250706 Reviewed by: emaste, lwhsu Differential Revision: https://reviews.freebsd.org/D26982 Notes: svn path=/head/; revision=367121
* Drop "All rights reserved" from all my stuff. This includesEdward Tomasz Napierala2020-10-2820-20/+0
| | | | | | | | | | | | Foundation copyrights, approved by emaste@. It does not include files which carry other people's copyrights; if you're one of those people, feel free to make similar change. Reviewed by: emaste, imp, gbe (manpages) Differential Revision: https://reviews.freebsd.org/D26980 Notes: svn path=/head/; revision=367105
* Significantly reduce compile time for googletest internal testsAlex Richardson2020-10-281-0/+12
| | | | | | | | | | | | | Clang's optimizer spends a really long time on these tests at -O2, so we now use -O0 instead. This reduces the -j32 time for lib/googletest/test from 131s to 29s. Using -O0 also reduces the disk usage from 144MB (at -O2) / 92MB (at -O1) to 82MB. Reviewed By: ngie, dim Differential Revision: https://reviews.freebsd.org/D26751 Notes: svn path=/head/; revision=367101
* Revise the description of MAP_STACK. In particular, describe the guardAlan Cox2020-10-271-19/+23
| | | | | | | | | | | in more detail. Reviewed by: bcr, kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D26908 Notes: svn path=/head/; revision=367087
* Replace literal uses of /usr/local in C sources with _PATH_LOCALBASEStefan Eßer2020-10-272-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Literal references to /usr/local exist in a large number of files in the FreeBSD base system. Many are in contributed software, in configuration files, or in the documentation, but 19 uses have been identified in C source files or headers outside the contrib and sys/contrib directories. This commit makes it possible to set _PATH_LOCALBASE in paths.h to use a different prefix for locally installed software. In order to avoid changes to openssh source files, LOCALBASE is passed to the build via Makefiles under src/secure. While _PATH_LOCALBASE could have been used here, there is precedent in the construction of the path used to a xauth program which depends on the LOCALBASE value passed on the compiler command line to select a non-default directory. This could be changed in a later commit to make the openssh build consistently use _PATH_LOCALBASE. It is considered out-of-scope for this commit. Reviewed by: imp MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D26942 Notes: svn path=/head/; revision=367075
* update write(2)'s iovec limit w/ info about the iosize_max_clamp sysctl...John-Mark Gurney2020-10-261-4/+8
| | | | Notes: svn path=/head/; revision=367048
* Remove intel compiler support from math.hWarner Losh2020-10-241-2/+2
| | | | | | | | | | | The intel compiler support has badly decayed over the years. Stop pretending that we support it. Note, I've stopped short of requiring gcc builtin support with this commit since other compilers may be used to build non-base software and we need to support those so more investigation is needed before simplifying further. Notes: svn path=/head/; revision=367030
* flua: Add a libjail moduleRyan Moeller2020-10-245-0/+627
| | | | | | | | | | | | | | | libjail is pretty small, so it makes for a good proof of concept demonstrating how a system library can be wrapped to create a loadable Lua module for flua. * Introduce 3lua section for man pages * Add libjail module Reviewed by: kevans, manpages Relnotes: yes Differential Revision: https://reviews.freebsd.org/D26080 Notes: svn path=/head/; revision=367013
* warnx: fix needless staticWarner Losh2020-10-241-2/+2
| | | | | | | | | I noticed after the review that these shouldn't be static. Remove the 'static' from them, otherwise concurrent calls to warn* might see a similar but to the original. Notes: svn path=/head/; revision=366983
* warnx: Save errno across calls that might change it.Warner Losh2020-10-231-0/+8
| | | | | | | | | | | | | | | When warn() family of functions is being used after err_set_file() has been set to, for example, /dev/null, errno is being clobbered, rendering it unreliable after, for example, procstat_getpathname() when it is supposed to emit a warning. Then the errno is changed to Inappropriate ioctl for device, destroying the original value (via calls to fprintf()functions). Submitted by: Juraj Lutter Differential Revision: https://reviews.freebsd.org/D26871 Notes: svn path=/head/; revision=366982
* Only use ASAN when using the in-tree compilerBrooks Davis2020-10-231-1/+3
| | | | | | | | | | | | | | When building FreeBSD 11 on a FreeBSD 12 system with CROSS_TOOLCHAIN=llvm10 we end up trying to link against the packaged version of the sanitizer library. This resulted in a requirement for getentropy(3) which is not present in FreeBSD 11. Reviewed by: emaste MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26903 Notes: svn path=/head/; revision=366981
* libelf: add compression header supportEd Maste2020-10-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | GNU and Oracle libelf implementations added support for section compression, intended to reduce the size of DWARF debug info (which might be an order of magnitude larger than the code). There are two compressed ELF section formats: 1. Old GNU - sections are renmaed to start with 'z'. Section contains a magic number, uncompressed size, and compressed data. 2. Oracle and New GNU - compressed sections use the SHF_COMPRESSED flag. The compression header contains the compression type, uncompressed size, and uncompressed alignment. The second style is preferred and this change implements only that one. Submitted by: Tiger Gao <tig@FreeBSDFoundation.org> Reviewed by: markj MFC after: 2 weeks Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24566 Notes: svn path=/head/; revision=366977
* mmap(2): Document guard size for MAP_STACK and related EINVAL.Konstantin Belousov2020-10-211-1/+8
| | | | | | | | | | | Based on submission by: emaste Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D26894 Notes: svn path=/head/; revision=366918
* Move list_cloners to libifconfigRyan Moeller2020-10-212-0/+42
| | | | | | | | | | | Move list_cloners() from ifconfig(8) to libifconfig(3) where it can be reused by other consumers. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D26858 Notes: svn path=/head/; revision=366906
* Further refinements of ptsname_r(3) interface:Xin LI2020-10-202-6/+8
| | | | | | | | | | | | | | | | | - Hide ptsname_r under __BSD_VISIBLE for now as the specification is not finalized at this time. - Keep Symbol.map sorted. - Avoid the interposing of ptsname_r(3) from an user application from breaking ptsname(3) by making the implementation a static method and call the static function from ptsname(3) instead. Reported by: kib Reviewed by: kib, jilles MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26845 Notes: svn path=/head/; revision=366866
* Enable SUBDIR_PARALLEL for lib/googletestAlex Richardson2020-10-191-2/+6
| | | | | | | | | | | This saves a few seconds in a parallel build since we can build the gtest_main and gmock subdirectories in parallel. Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D26760 Notes: svn path=/head/; revision=366851
* Major improvement to build parallelism for googletest internal testsAlex Richardson2020-10-1910-12/+12
| | | | | | | | | | | | | | | | | Currently the googletest internal tests build after the matching library. However, each of these is serialized at the top level makefile. Additionally some of the tests (e.g. the gmock-matches-test) take up to 90 seconds to build with clang -O2. Having to wait for this test to complete before continuing to the next directory seriously slows down the parllelism of a -j32 build. Before this change running `make -C lib/googletest -j32 -s` in buildenv took 202 seconds, now it's 153 due to improved parallelism. Reviewed By: emaste (no objection) Differential Revision: https://reviews.freebsd.org/D26748 Notes: svn path=/head/; revision=366850
* libbe(3): install MLINKS for all of the functions providedKyle Evans2020-10-181-0/+35
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=366821
* libbe(3): document be_snapshot()Kyle Evans2020-10-181-0/+27
| | | | | | | | | | | While toying around with lua bindings for libbe(3), I discovered that I apparently never documented this, despite having documented be_is_auto_snapshot_name that references it. MFC after: 1 week Notes: svn path=/head/; revision=366820
* libbe(3): const'ify a couple argumentsKyle Evans2020-10-184-11/+11
| | | | | | | | | | libbe will never need to mutate these as we either process them into a local buffer or we just don't touch them and write to a separate out argument. MFC after: 1 week Notes: svn path=/head/; revision=366819