summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* | MFV r299425:mm2016-05-123-5/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update libarchive to 3.2.0 New features: - new bsdcat command-line utility - LZ4 compression (in src only via external utility from ports) - Warc format support - 'Raw' format writer - Zip: Support archives >4GB, entries >4GB - Zip: Support encrypting and decrypting entries - Zip: Support experimental streaming extension - Identify encrypted entries in several formats - New --clear-nochange-flags option to bsdtar tries to remove noschg and similar flags before deleting files - New --ignore-zeros option to bsdtar to handle concatenated tar archives - Use multi-threaded LZMA decompression if liblzma supports it - Expose version info for libraries used by libarchive Patched files (fixed compiler warnings): contrib/libarchive/cat/bsdcat.c (vendor PR #702) contrib/libarchive/cat/bsdcat.h (vendor PR #702) contrib/libarchive/libarchive/archive_read_support_format_mtree.c (PR #701) contrib/libarchive/libarchive_fe/err.c (vendor PR #703) MFC after: 1 month Relnotes: yes
* | Use strlcpy() instead of strncpy() to copy the string returned bytruckman2016-05-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | setlocale() so that static analyzers know that the string is NUL terminated. This was causing a false positive in Coverity even though the longest string returned by setlocale() is ENCODING_LEN (31) and we are copying into a 64 byte buffer. This change is also a bit of an optimization since we don't need the strncpy() feature of padding the rest of the destination buffer with NUL characters. Reported by: Coverity CID: 974654
* | print_positional_test: Fix misuse of wchar APIscem2016-05-121-3/+4
| | | | | | | | | | | | | | | | These APIs take unit length, not byte length parameters. Reported by: Coverity CIDs: 1338543, 1338544, 1338545 Sponsored by: EMC / Isilon Storage Division
* | libmp: Fix trivial buffer overruncem2016-05-121-2/+2
| | | | | | | | | | | | | | | | | | | | fgetln yields a non-NUL-terminated buffer and its length. This routine attempted to NUL-terminate it, but did not allocate space for the NUL. So, allocate space for the NUL. Reported by: Coverity CID: 1017457 Sponsored by: EMC / Isilon Storage Division
* | nss/gethostby_test: fix broken vector iteration of gethostbyaddr h_aliasescem2016-05-121-1/+1
| | | | | | | | | | | | | | | | | | h_aliases is a NULL-terminated rather than fixed-length array. nitems() is not a valid way to determine its end; instead, check for NULL. Reported by: Coverity CID: 1346578 Sponsored by: EMC / Isilon Storage Division
* | libc: Add fopencookie(3) wrapper around funopen(3)cem2016-05-114-3/+329
| | | | | | | | | | | | Reviewed by: jhb, oshogbo Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D6282
* | librpcsec_gss: remove redundant code.pfg2016-05-111-5/+0
| | | | | | | | | | | | | | | | We have identical code no matter the expression behind the if. Avoid the desision altogether and keep doing what is expected. Reviewed by: dfr CID: 1305689
* | Rename dprintf into dbg_printf to avoid collision with dprintf(3)bapt2016-05-101-10/+10
| | | | | | | | | | When dprintf(3) in 2009 was added a _WITH_DPRINTF guard has also been added. This rename is made in preparation for the removal of this guard
* | DIRDEPS_BUILD: Run the staged bootstrap-tools version of build-tools.bdrewery2016-05-092-3/+3
| | | | | | | | | | | | This avoids running target binaries. Sponsored by: EMC / Isilon Storage Division
* | libc/xdr: unsign some loop indexes.pfg2016-05-061-2/+2
| | | | | | | | | | | | Although usually small, values produced by nitems() are unsigned. Unsign inxdeing variables related to nitems() macros to avoid signed vs. unsigned comparisons.
* | Limit Options.inc generation to desired targetsemaste2016-05-051-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As mentioned in the Makefile there's an "atrocious" hack to generate a different version of Options.inc.h, depending on the library being built. Remove the catch-all else case and limit it to specific libraries, so that we don't accidentally use the Options.inc.h from clangdriver if a future libary also uses Options.inc.h. Reviewed by: dim Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6209
* | Do not leak THR_FLAGS_SUSPENDED from the previous suspend/resumekib2016-05-052-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | cycle. The flag currently is cleared by the resumed thread. If next suspend request comes before the thread was able to clean the flag, in which case suspender skip the thread. Instead, clear the THR_FLAGS_SUSPEND flag in resume_common(), we do not care how much code was executed in the resumed thread when the pthread_resume_*np(s) functions returned. PR: 209233 Reported by: Lawrence Esswood <le277@cam.ac.uk> MFC after: 1 week
* | Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedngie2016-05-0448-640/+468
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Improve performance and functionality of the bitstring(3) apiasomers2016-05-041-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two new functions are provided, bit_ffs_at() and bit_ffc_at(), which allow for efficient searching of set or cleared bits starting from any bit offset within the bit string. Performance is improved by operating on longs instead of bytes and using ffsl() for searches within a long. ffsl() is a compiler builtin in both clang and gcc for most architectures, converting what was a brute force while loop search into a couple of instructions. All of the bitstring(3) API continues to be contained in the header file. Some of the functions are large enough that perhaps they should be uninlined and moved to a library, but that is beyond the scope of this commit. sys/sys/bitstring.h: Convert the majority of the existing bit string implementation from macros to inline functions. Properly protect the implementation from inadvertant macro expansion when included in a user's program by prefixing all private macros/functions and local variables with '_'. Add bit_ffs_at() and bit_ffc_at(). Implement bit_ffs() and bit_ffc() in terms of their "at" counterparts. Provide a kernel implementation of bit_alloc(), making the full API usable in the kernel. Improve code documenation. share/man/man3/bitstring.3: Add pre-exisiting API bit_ffc() to the synopsis. Document new APIs. Document the initialization state of the bit strings allocated/declared by bit_alloc() and bit_decl(). Correct documentation for bitstr_size(). The original code comments indicate the size is in bytes, not "elements of bitstr_t". The new implementation follows this lead. Only hastd assumed "elements" rather than bytes and it has been corrected. etc/mtree/BSD.tests.dist: tests/sys/Makefile: tests/sys/sys/Makefile: tests/sys/sys/bitstring.c: Add tests for all existing and new functionality. include/bitstring.h Include all headers needed by sys/bitstring.h lib/libbluetooth/bluetooth.h: usr.sbin/bluetooth/hccontrol/le.c: Include bitstring.h instead of sys/bitstring.h. sbin/hastd/activemap.c: Correct usage of bitstr_size(). sys/dev/xen/blkback/blkback.c Use new bit_alloc. sys/kern/subr_unit.c: Remove hard-coded assumption that sizeof(bitstr_t) is 1. Get rid of unrb.busy, which caches the number of bits set in unrb.map. When INVARIANTS are disabled, nothing needs to know that information. callapse_unr can be adapted to use bit_ffs and bit_ffc instead. Eliminating unrb.busy saves memory, simplifies the code, and provides a slight speedup when INVARIANTS are disabled. sys/net/flowtable.c: Use the new kernel implementation of bit-alloc, instead of hacking the old libc-dependent macro. sys/sys/param.h Update __FreeBSD_version to indicate availability of new API Submitted by: gibbs, asomers Reviewed by: gibbs, ngie MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D6004
* | Correct wording.kib2016-05-031-1/+1
| | | | | | | | | | Submitted by: David A. Bright MFC after: 2 weeks
* | Add EVFILT_VNODE open, read and close notifications.kib2016-05-031-8/+26
| | | | | | | | | | | | | | While there, order EVFILT_VNODE notes descriptions alphabetically. Based on submission, and tested by: Vladimir Kondratyev <wulf@cicgroup.ru> MFC after: 2 weeks
* | Issue NOTE_EXTEND when a directory entry is added to or removed fromkib2016-05-021-2/+8
| | | | | | | | | | | | | | | | the monitored directory as the result of rename(2) operation. The renames staying in the directory are not reported. Submitted by: Vladimir Kondratyev <wulf@cicgroup.ru> MFC after: 2 weeks
* | As a reader service, explain NOTE_LINK reporting for the directories.kib2016-05-011-0/+4
| | | | | | | | | | Submitted by: Vladimir Kondratyev <wulf@cicgroup.ru> MFC after: 1 week
* | lib: minor spelling fixes in comments.pfg2016-05-0114-19/+19
| | | | | | | | No functional change.
* | Provide an example to the kqueue man page, showingbcr2016-05-011-1/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | a basic usage example. Although it is an untypical example for the use of kqueue, it is better than nothing and should get people started. PR: 196844 Submitted by: fernando.apesteguia@gmail.com Reviewed by: kib Approved by: kib MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D6082
* | Remove useless calls to basename().ed2016-05-011-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a couple of places in the source three where we call basename() on constant strings. This is bad, because the prototype standardized by POSIX allows the implementation to use its argument as a storage buffer. This change eliminates some of these unportable calls to basename() in cases where it was only added for cosmetical reasons, namely to trim argv[0]. There's nothing wrong with setting argv[0] to the full path. Reviewed by: jilles Differential Revision: https://reviews.freebsd.org/D6093
* | Don't leak PML4 in _amd64_initvtop(..) if kvm_read2(..) failsngie2016-04-301-0/+1
| | | | | | | | | | | | | | MFC after: 1 week Reported by: Coverity CID: 1341474 Sponsored by: EMC / Isilon Storage Division
* | Remove a -Wunused-but-set-variable variable -- `pa`ngie2016-04-301-2/+0
| | | | | | | | | | Reported by: gcc 5.x Sponsored by: EMC / Isilon Storage Division
* | Remove kvm_getfiles(3)ngie2016-04-305-319/+4
| | | | | | | | | | | | | | | | | | | | | | This libcall has been broken since (at least) r174989/8.0-RELEASE. Bump SHLIB_MAJOR for the change Differential Revision: https://reviews.freebsd.org/D6052 Relnotes: yes Reviewed by: jhb, markj Sponsored by: EMC / Isilon Storage Division
* | Fix memory allocation edgecases in kvm_argv(..)ngie2016-04-301-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | - Don't leak nbufp on realloc failure in kvm_argv - Catch malloc errors with bufp - Set buflen last in the "buflen == 0" case to ensure that bufp/nbufp is properly reallocated on the next go around Differential Revision: https://reviews.freebsd.org/D6051 MFC after: 1 week Reviewed by: jhb, markj Reported by: cppcheck Sponsored by: EMC / Isilon Storage Division
* | libc: spelling fixes.pfg2016-04-3034-43/+43
| | | | | | | | Mostly on comments.
* | Fix including Kyuafile in packaged base system.gjb2016-04-294-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | Fix a related typo while here. Note, this change results in the Kyuafile inclusion in the runtime package, which needs to be fixed, however addresses the PR as far as I can tell in my tests. PR: 209114 Submitted by: ngie Sponsored by: The FreeBSD Foundation
* | Fix va_list handlingngie2016-04-281-38/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add missing va_end's after corresponding va_start's to cleanup state - Eliminate questionable bzero'ing of va_list passed in to do_buff_decode(..) and do_encode(..) from buff_{de,en}code_visit(..) and csio_{de,en}code_visit(..). Make va_list a pointer instead and pass NULL into the underlying functions to handler this in a portable way. - Do some minor style(9) clean up in affected functions. Differential Revision: https://reviews.freebsd.org/D6072 MFC after: 3 days Reported by: cppcheck, Coverity CID: 1018500-1018503 Reviewed by: cem Sponsored by: EMC / Isilon Storage Division
* | Add 'devctl delete' that calls device_delete_child().jhb2016-04-273-2/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | 'devctl delete' can be used to delete a device that is no longer present. As an anti-foot-shooting measure, 'delete' will not delete a device unless it's parent bus says it is no longer present. This can be overridden by passing the force ('-f') flag. Note that this command should be used with care. If a device is deleted that is actually present it can't be resurrected unless the parent bus device's driver supports rescans. Differential Revision: https://reviews.freebsd.org/D6019
* | Add a new rescan method to the bus interface.jhb2016-04-273-2/+28
| | | | | | | | | | | | | | | | The BUS_RESCAN() method rescans a single bus device checking for devices that have been added or removed from the bus. A new 'rescan' command is added to devctl(8) to trigger a rescan. Differential Revision: https://reviews.freebsd.org/D6016
* | libcuse: make more use of the howmany() macro when available.pfg2016-04-261-1/+1
| | | | | | | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read.
* | libstand: make more use of the howmany() macro when available.pfg2016-04-261-1/+1
| | | | | | | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read.
* | libc: make more use of the howmany() macro when available.pfg2016-04-262-3/+2
| | | | | | | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read.
* | regex: prevent two improbable signed integer overflows.pfg2016-04-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | In matcher() we used an integer to index nsub of type size_t. In print() we used an integer to index nstates of type sopno, typedef'd long. In both cases the indexes never take negative values. Match the types to avoid any error. MFC after: 5 days
* | Fix up pointer issues with lib/libkvmngie2016-04-2210-35/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In particular, - avoid dereferencing NULL pointers - test pointers against NULL, not 0 - test for errout == NULL in the top-level functions (kvm_open, kvm_openfiles, kvm_open2, etc) - Replace a realloc and free on failure with reallocf Found with: devel/cocchinelle Differential Revision: https://reviews.freebsd.org/D5954 MFC after: 1 week Reviewed by: jhb Sponsored by: EMC / Isilon Storage Division
* | Completely disable fmaxmin_test (follow up to r297952)ngie2016-04-211-3/+9
| | | | | | | | | | | | | | | | | | | | COMPILER_TYPE/COMPILER_VERSION doesn't get passed down properly at buildworld/installworld with older build hosts MFC after: never PR: 208703, 208963 Reported by: Jenkins Sponsored by: EMC / Isilon Storage Division
* | elftoolchain: Use ${SRCTOP} for the top of the FreeBSD treeemaste2016-04-213-7/+7
| | | | | | | | | | | | | | | | It's provided by sys.mk so there's no need to derive it from ${.CURDIR}. Suggested by: ngie Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5998
* | Restore the original ascii.c from prior to r290494bapt2016-04-211-13/+10
| | | | | | | | | | | | | | | | It was doing the right thing, there was no need to "fail" to reinvent it from none.c Pointy hat: bapt Submitted by: ache
* | Check the returned value of memchr(3) before using itbapt2016-04-201-1/+4
| | | | | | | | | | Reported by: Coverity CID: 1338530
* | Minor indentation issue.pfg2016-04-201-2/+1
| |
* | libc: use our roundup2/rounddown2() macros when param.h is available.pfg2016-04-203-6/+6
| | | | | | | | | | rounddown2 tends to produce longer lines than the original code but still it makes the code more readable.
* | Fix double fclose of `fp1` when freopen failsngie2016-04-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | freopen handles closing file descriptors on error, with the exception of fdopen'ed descriptors, so closing an already fclose'd file descriptor is incorrect CID: 1338525 Differential Revision: https://reviews.freebsd.org/D6013 MFC after: 2 weeks Reported by: Coverity Sponsored by: EMC / Isilon Storage Division
* | Make sure fmemopen succeeds in :test_append_binary_pos before calling ftellngie2016-04-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | on the FILE object This fixes potential null pointer dereferences on failure CID: 1254952 MFC after: 2 weeks Reported by: Coverity Sponsored by: EMC / Isilon Storage Division
* | Remove trailing whitespace and use `nitems(mib)` instead of `2` whenngie2016-04-191-2/+2
| | | | | | | | | | | | | | calling sysctl(3) MFC after: 3 days Sponsored by: EMC / Isilon Storage Division
* | Use GPIOTOGGLE to toggle the pin state instead of read, modify and write.loos2016-04-191-5/+5
| |
* | Unbreak the build if you enable WITH_NANDallanjude2016-04-191-2/+2
| | | | | | | | | | | | | | Followup to r298230 Submitted by: Nikolai Lifanov <lifanov@mail.lifanov.com> (original version) Sponsored by: ScaleEngine Inc.
* | A new implementation of the loader block cacheallanjude2016-04-188-103/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The block cache implementation in loader has proven to be almost useless, and in worst case even slowing down the disk reads due to insufficient cache size and extra memory copy. Also the current cache implementation does not cache reads from CDs, or work with zfs built on top of multiple disks. Instead of an LRU, this code uses a simple hash (O(1) read from cache), and instead of a single global cache, a separate cache per block device. The cache also implements limited read-ahead to increase performance. To simplify read ahead management, the read ahead will not wrap over bcache end, so in worst case, single block physical read will be performed to fill the last block in bcache. Booting from a virtual CD over IPMI: 0ms latency, before: 27 second, after: 7 seconds 60ms latency, before: over 12 minutes, after: under 5 minutes. Submitted by: Toomas Soome <tsoome@me.com> Reviewed by: delphij (previous version), emaste (previous version) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D4713
* | libc: do not include <sys/types.h> where <sys/param.h> was already includedavos2016-04-1839-42/+3
| | | | | | | | | | | | According to style(9): > normally, include <sys/types.h> OR <sys/param.h>, but not both. (<sys/param.h> already includes <sys/types.h> when LOCORE is not defined).
* | Re-use our roundup2() macro instead of reinventing the wheel.pfg2016-04-181-6/+4
| | | | | | | | Obtained from: DragonflyBSD
* | libipsec: use NULL instead of zero for pointers.pfg2016-04-181-1/+1
| |
OpenPOWER on IntegriCloud