aboutsummaryrefslogtreecommitdiff
path: root/lib/libnv
Commit message (Collapse)AuthorAgeFilesLines
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-234-4/+0
| | | | | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/ Similar commit in main: (cherry picked from commit d0b2dbfa0ecf)
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-236-12/+0
| | | | | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/ Similar commit in main: (cherry picked from commit 1d386b48a555)
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-239-18/+0
| | | | | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/ Similar commit in main: (cherry picked from commit b3e7694832e8)
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-07-253-3/+3
| | | | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix (cherry picked from commit 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
* libpfct: Fix PIC flagKristof Provost2021-05-071-1/+0
| | | | | | | | | | Use ${PICFLAG} rather than hard-adding -fPIC, which removes the requirement for libnv to be built PIC. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 8403170b3d39326f836bc999534fe8c4d41cda11)
* libnv: Use PICFLAG rather than -fPICKristof Provost2021-05-071-1/+1
| | | | | | | | Suggested by: andrew MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 15ca66220874c177602c13a114b2f3d17773b788)
* libnv: Build PICKristof Provost2021-05-071-0/+1
| | | | | | | | | | | Build libnv as position independent code so we can use it from shared libraries. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29561 (cherry picked from commit 0dd13c77432ade1ae94c9661cbad5537e3e6ab1d)
* Fix libnv build post renameMatt Macy2020-06-271-1/+1
| | | | | | | | Submitted by: Neel Chauhan Differential Revision: https://reviews.freebsd.org/D25481 Notes: svn path=/head/; revision=362669
* Update Makefile.depend filesSimon J. Gerraty2019-12-111-1/+0
| | | | | | | | | | | | | Update a bunch of Makefile.depend files as a result of adding Makefile.depend.options files Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22494 Notes: svn path=/head/; revision=355617
* pkgbase: Put a lot of binaries and lib in FreeBSD-runtimeEmmanuel Vadot2019-09-051-1/+1
| | | | | | | | | | | | All of them are needed to be able to boot to single user and be able to repair a existing FreeBSD installation so put them directly into FreeBSD-runtime. Reviewed by: bapt, gjb Differential Revision: https://reviews.freebsd.org/D21503 Notes: svn path=/head/; revision=351855
* Add a regression test which transfers varying number of rights.Mark Johnston2019-07-161-1/+98
| | | | | | | | | | This exercises the PKG_MAX_SIZE limit mentioned in r350054. MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=350055
* Use a platform-independent constant for PKG_MAX_SIZE.Mark Johnston2019-07-161-1/+7
| | | | | | | | | | | | | | | | | | This constant determines the number of rights libnv will attempt to transmit in a given control message. In practice, the upper limit defined by the kernel is machine-dependent and is smaller on 64-bit kernels than on 32-bit kernels. To ensure that a 32-bit libnv works as expected when run on a 64-bit kernel, use a limit that will work on both 32-bit and 64-bit kernels. PR: 238511 Discussed with: oshogbo MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20942 Notes: svn path=/head/; revision=350054
* Convert the nvlist send/recv tests to ATF.Mark Johnston2019-07-162-198/+189
| | | | | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=350052
* libnv: extend the testsMariusz Zaborski2019-04-151-2/+29
| | | | | | | | | | Add cases for sending file descriptors. Submitted by: Mindaugas Rasiukevicius <rmind@noxt.eu> MFC after: 2 weeks Notes: svn path=/head/; revision=346219
* libnv: add support for nvlist_send()/nvlist_recv() on LinuxMariusz Zaborski2019-04-151-43/+41
| | | | | | | | | | This may be useful for cross build in the feature. Submitted by: Mindaugas Rasiukevicius <rmind@noxt.eu> MFC after: 2 weeks Notes: svn path=/head/; revision=346218
* libnv: fix memory leaksMariusz Zaborski2019-02-101-0/+2
| | | | | | | | | | | | | | | | | | nvpair_create_stringv: free the temporary string; this fix affects nvlist_add_stringf() and nvlist_add_stringv(). nvpair_remove_nvlist_array (NV_TYPE_NVLIST_ARRAY case): free the chain of nvpairs (as resetting it prevents nvlist_destroy() from freeing it). Note: freeing the chain in nvlist_destroy() is not sufficient, because it would still leak through nvlist_take_nvlist_array(). This affects all nvlist_*_nvlist_array() use Submitted by: Mindaugas Rasiukevicius <rmind@netbsd.org> Reported by: clang/gcc ASAN MFC after: 2 weeks Notes: svn path=/head/; revision=343986
* Allow bootstrapping libnv on macOS and LinuxAlex Richardson2018-12-141-0/+9
| | | | | | | | | | | | MacOS/Linux do not define struct cmsgcred but we need to bootstrap libnv when building on non-FreeBSD systems. Since they are not used during bootstrap we can just omit these two functions there. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D18472 Notes: svn path=/head/; revision=342101
* Ensure that libnv can be used when kern.trap_enotcap=1.Mark Johnston2018-11-133-12/+42
| | | | | | | | | | | | | | | | | | | libnv used fcntl(fd, F_GETFL) to test whether fd is a valid file descriptor. Aside from being racy, this check requires CAP_FCNTL rights on fd. Instead, use fcntl(fd, F_GETFD), which does not require any capability rights. Also remove some redundant fd_is_valid() checks to avoid extra system calls; in many cases we were performing this check immediately before dup()ing the descriptor. Reviewed by: cem, oshogbo (previous version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17963 Notes: svn path=/head/; revision=340408
* libnv: Remove -I${SRCTOP}/sysKyle Evans2018-08-091-1/+1
| | | | | | | | | | | | | | | | This should have been done as part of r336019 -- including ${SRCTOP}/sys is not a good business model for something that's build in legacy/bootstrap stages. Beyond that, libnv seems to build quite alright as legacy, part of buildworld, and standalone without. Axe it. Reported by: truckman (head building stable/11) Tested by: Shawn Webb (HardenedBSD) MFC after: 3 days Notes: svn path=/head/; revision=337549
* No longer install sys/nv.h and sys/cnv.h in lib/libnv/MakefileAlex Richardson2018-07-161-3/+0
| | | | | | | | | | | | | Use tools/build/Makefile to install the headers into ${WORLDTMP}/legacy instead. Compared to r336026 this has the minor advantage that it avoids unncessary header installation when building the non-bootstrap libnv. Reviewed By: bdrewery, kevans Approved By: brooks (mentor) Differential Revision: https://reviews.freebsd.org/D16187 Notes: svn path=/head/; revision=336335
* config(8): Fix broken ABIKyle Evans2018-07-061-0/+3
| | | | | | | | | | | | | | | r336019 introduced ${SRCTOP}/sys to the include paths in order to pull in a new sys/{c,}nv.h. This is wrong, because the build tree's ABI isn't guaranteed to match what's running on the host system. Fix instead by removing -I${SRCTOP}/sys and installing the libnv headers with `make -C lib/libnv includes`... this may or may not get re-worked in the future so that a userland lib isn't installing includes from sys/. Reported by: bdrewery Notes: svn path=/head/; revision=336026
* libnv: Add nvlist_append_*_array() family of functions.Mariusz Zaborski2018-06-182-0/+121
| | | | | | | | | | The nvlist_append_{bool,number,string,nvlist,descriptor}_array() functions allows to dynamically extend array stored in the nvlist. Submitted by: Mindaugas Rasiukevicius <rmind@netbsd.org> Notes: svn path=/head/; revision=335347
* libnv: add regression test for r335344.Mariusz Zaborski2018-06-181-0/+1
| | | | Notes: svn path=/head/; revision=335345
* libnv: Remove nvlist argument from cnvlist_{take,free}_* functions.Mariusz Zaborski2018-06-181-18/+18
| | | | | | | | | | | | | All information which are need for those operations is already stored in the cookie. We decided not to bump libnv version because this API is not used yet in the base system. Reviewed by: pjd Notes: svn path=/head/; revision=335343
* lib: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-263-0/+6
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326219
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-312-2/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Remove redundant initialization. Don't use variable - just return the value.Mariusz Zaborski2017-09-211-1/+0
| | | | | | | | | | | | Make scan-build happy by casting to 'void *' instead of 'void **'. Submitted by: pjd@ MFC after: 1 month Found by: scan-build and cppcheck Sponsored by: Wheel Systems Notes: svn path=/head/; revision=323851
* Add HAS_TESTS to all Makefiles that are currently using theEnji Cooper2017-08-021-0/+1
| | | | | | | | | `SUBDIR.${MK_TESTS}+= tests` idiom. This is a follow up to r321912. Notes: svn path=/projects/make-check-sandbox/; revision=321914
* Convert traditional ${MK_TESTS} conditional idiom for including testEnji Cooper2017-08-021-3/+1
| | | | | | | | | | | | | | directories to SUBDIR.${MK_TESTS} idiom This is being done to pave the way for future work (and homogenity) in ^/projects/make-check-sandbox . No functional change intended. MFC after: 1 weeks Notes: svn path=/head/; revision=321912
* :dnvlist_get_string__default_value: fix a bogus string comparison testEnji Cooper2017-05-291-1/+1
| | | | | | | | | | | | Check actual_value vs "5", not "5" vs itself. MFC after: 3 days Reported by: Coverity CID: 1362021 Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=319159
* :nvlist_unpack__duplicate_key : check the result of nvlist_pack(3)Enji Cooper2017-05-291-0/+1
| | | | | | | | | | | | This fixes a potential NULL pointer dereference. MFC after: 3 days Reported by: Coverity CID: 1362051 Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=319156
* lib/libnv/tests/dnv_test: fix memory leaks for memory allocated viaEnji Cooper2017-05-291-0/+5
| | | | | | | | | | | either strdup or one of the dnvlist* libcalls. Reported by: Coverity CID: 1362056-1362060 Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=319155
* Use SRCTOP-relative paths to other directories instead of .CURDIR-relative onesEnji Cooper2017-01-201-2/+2
| | | | | | | | | | This implifies pathing in make/displayed output MFC after: 3 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=312492
* Fix style issue in the cnv API.Mariusz Zaborski2016-08-272-5/+4
| | | | | | | | Remove unused arguments in a macro. Remove unused typedef. Notes: svn path=/head/; revision=304909
* Add cnv API.Mariusz Zaborski2016-08-273-1/+1512
| | | | | | | | | | | cnv API is a set of functions for managing name/value pairs by cookie. The cookie can be obtained by nvlist_next(), nvlist_get_parent() or nvlist_get_pararr() function. This patch also includes unit tests. Submitted by: Adam Starak <starak.adam@gmail.com> Notes: svn path=/head/; revision=304908
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedEnji Cooper2016-05-041-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=299094
* MFHGlen Barber2016-03-101-0/+24
|\ | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296625
| * DIRDEPS_BUILD: Connect MK_TESTS.Bryan Drewery2016-03-091-0/+24
| | | | | | | | | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296587
* | MFHGlen Barber2016-03-021-2/+0
|\| | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296318
| * Remove WARNS inherited fine by ../Makefile.inc.Bryan Drewery2016-02-261-2/+0
| | | | | | | | | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296129
* | First pass through library packaging.Glen Barber2016-02-041-0/+1
| | | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295278
* | First pass to fix the 'tests' packages.Glen Barber2016-02-021-0/+4
|/ | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295171
* Remove free'ing of an uninitialized variableEnji Cooper2016-01-041-2/+0
| | | | | | | | | | | | | | Just remove it completely from the test as it's initialized but unused apart from the free(3) call Differential Revision: https://reviews.freebsd.org/D4769 (part of larger diff) MFC after: 5 days Reported by: cppcheck Reviewed by: oshogbo Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293135
* Use `nitems(x)` macro instead of using hardcoded numbers for indices intoEnji Cooper2016-01-041-53/+59
| | | | | | | | | | | | | | | the nvlists Convert some of the variables from int to unsigned int to squelch -Wsign-compare warnings when converting hardcoded values to nitems(..) Differential Revision: https://reviews.freebsd.org/D4769 (part of larger diff) MFC after: 5 days Reviewed by: oshogbo Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293134
* Convert another `string` variable to `string_arr` missed in r293130Enji Cooper2016-01-041-3/+3
| | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D4769 (part of larger diff) MFC after: 5 days Reviewed by: oshogbo Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293131
* Rename nitems and string variables to avoid collisionsEnji Cooper2016-01-041-105/+106
| | | | | | | | | | | | | | | | | Rename the `nitems` variable to `num_items` to avoid collisions with the macro in sys/param.h for counting elements in an array Similarly, rename `string` to `string_arr` to avoid future collisions with potential keywords, as well as make it clear that `string_arr` isn't a char* value, but instead a char** value. Differential Revision: https://reviews.freebsd.org/D4769 (part of larger diff) MFC after: 5 days Reviewed by: oshogbo Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293130
* Add sys/types.h for for size_t, etcEnji Cooper2016-01-031-0/+1
| | | | | | | | | | stable/10 requires it due to header pollution MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293102
* META MODE: Prefer INSTALL=tools/install.sh to lessen the need for xinstall.host.Bryan Drewery2015-11-251-1/+0
| | | | | | | | | | | This both avoids some dependencies on xinstall.host and allows bootstrapping on older releases to work due to lack of at least 'install -l' support. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291307
* Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) andEnji Cooper2015-10-121-2/+0
| | | | | | | | | | | | | | | netbsd-tests.test.mk (r289151) - Eliminate explicit OBJTOP/SRCTOP setting - Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk - Remove unnecessary TESTSDIR setting - Use SRCTOP where possible for clarity MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Divison Notes: svn path=/head/; revision=289172
* Add support for the arrays in nvlist library.Mariusz Zaborski2015-08-152-0/+1192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add nvlist_{add,get,take,move,exists,free}_{number,bool,string,nvlist, descriptor} functions. - Add support for (un)packing arrays. - Add the nvl_array_next field to the nvlist structure. If an array is added by the nvlist_{move,add}_nvlist_array function this field will contains next element in the array. - Add the nitems field to the nvpair and nvpair_header structure. This field contains number of elements in the array. - Add special flag (NV_FLAG_IN_ARRAY) which is set if nvlist is a part of an array. - Add special type (NV_TYPE_NVLIST_ARRAY_NEXT).This type is used only on packing/unpacking. - Add new API for traversing arrays (nvlist_get_array_next). - Add the nvlist_get_pararr function which combines the nvlist_get_array_next and nvlist_get_parent functions. If nvlist is in the array it will return next element from array. If nvlist is last element in array or it isn't in array it will return his container (parent). This function should simplify traveling over nvlist. - Add tests for new features. - Add documentation for new functions. - Add my copyright. - Regenerate the sys/cddl/compat/opensolaris/sys/nvpair.h file. PR: 191083 Reviewed by: allanjude (doc) Approved by: pjd (mentor) Notes: svn path=/head/; revision=286796