aboutsummaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Limit Options.inc generation to desired targetsEd Maste2016-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 Notes: svn path=/head/; revision=299138
* Do not leak THR_FLAGS_SUSPENDED from the previous suspend/resumeKonstantin Belousov2016-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 Notes: svn path=/head/; revision=299114
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedEnji Cooper2016-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 Notes: svn path=/head/; revision=299094
* Improve performance and functionality of the bitstring(3) apiAlan Somers2016-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 Notes: svn path=/head/; revision=299090
* Correct wording.Konstantin Belousov2016-05-031-1/+1
| | | | | | | | Submitted by: David A. Bright MFC after: 2 weeks Notes: svn path=/head/; revision=298984
* Add EVFILT_VNODE open, read and close notifications.Konstantin Belousov2016-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 Notes: svn path=/head/; revision=298982
* Issue NOTE_EXTEND when a directory entry is added to or removed fromKonstantin Belousov2016-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 Notes: svn path=/head/; revision=298922
* As a reader service, explain NOTE_LINK reporting for the directories.Konstantin Belousov2016-05-011-0/+4
| | | | | | | | Submitted by: Vladimir Kondratyev <wulf@cicgroup.ru> MFC after: 1 week Notes: svn path=/head/; revision=298898
* lib: minor spelling fixes in comments.Pedro F. Giffuni2016-05-0114-19/+19
| | | | | | | No functional change. Notes: svn path=/head/; revision=298896
* Provide an example to the kqueue man page, showingBenedict Reuschling2016-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 Notes: svn path=/head/; revision=298893
* Remove useless calls to basename().Ed Schouten2016-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 Notes: svn path=/head/; revision=298876
* Don't leak PML4 in _amd64_initvtop(..) if kvm_read2(..) failsEnji Cooper2016-04-301-0/+1
| | | | | | | | | | MFC after: 1 week Reported by: Coverity CID: 1341474 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=298842
* Remove a -Wunused-but-set-variable variable -- `pa`Enji Cooper2016-04-301-2/+0
| | | | | | | | Reported by: gcc 5.x Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=298841
* Remove kvm_getfiles(3)Enji Cooper2016-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 Notes: svn path=/head/; revision=298840
* Fix memory allocation edgecases in kvm_argv(..)Enji Cooper2016-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 Notes: svn path=/head/; revision=298839
* libc: spelling fixes.Pedro F. Giffuni2016-04-3034-43/+43
| | | | | | | Mostly on comments. Notes: svn path=/head/; revision=298830
* Fix including Kyuafile in packaged base system.Glen Barber2016-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 Notes: svn path=/head/; revision=298768
* Fix va_list handlingEnji Cooper2016-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 Notes: svn path=/head/; revision=298753
* Add 'devctl delete' that calls device_delete_child().John Baldwin2016-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 Notes: svn path=/head/; revision=298709
* Add a new rescan method to the bus interface.John Baldwin2016-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 Notes: svn path=/head/; revision=298707
* libcuse: make more use of the howmany() macro when available.Pedro F. Giffuni2016-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. Notes: svn path=/head/; revision=298602
* libstand: make more use of the howmany() macro when available.Pedro F. Giffuni2016-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. Notes: svn path=/head/; revision=298601
* libc: make more use of the howmany() macro when available.Pedro F. Giffuni2016-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. Notes: svn path=/head/; revision=298600
* regex: prevent two improbable signed integer overflows.Pedro F. Giffuni2016-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 Notes: svn path=/head/; revision=298521
* Fix up pointer issues with lib/libkvmEnji Cooper2016-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 Notes: svn path=/head/; revision=298485
* Completely disable fmaxmin_test (follow up to r297952)Enji Cooper2016-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 Notes: svn path=/head/; revision=298434
* elftoolchain: Use ${SRCTOP} for the top of the FreeBSD treeEd Maste2016-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 Notes: svn path=/head/; revision=298401
* Restore the original ascii.c from prior to r290494Baptiste Daroussin2016-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 Notes: svn path=/head/; revision=298396
* Check the returned value of memchr(3) before using itBaptiste Daroussin2016-04-201-1/+4
| | | | | | | | Reported by: Coverity CID: 1338530 Notes: svn path=/head/; revision=298367
* Minor indentation issue.Pedro F. Giffuni2016-04-201-2/+1
| | | | Notes: svn path=/head/; revision=298353
* libc: use our roundup2/rounddown2() macros when param.h is available.Pedro F. Giffuni2016-04-203-6/+6
| | | | | | | | rounddown2 tends to produce longer lines than the original code but still it makes the code more readable. Notes: svn path=/head/; revision=298323
* Fix double fclose of `fp1` when freopen failsEnji Cooper2016-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 Notes: svn path=/head/; revision=298312
* Make sure fmemopen succeeds in :test_append_binary_pos before calling ftellEnji Cooper2016-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 Notes: svn path=/head/; revision=298311
* Remove trailing whitespace and use `nitems(mib)` instead of `2` whenEnji Cooper2016-04-191-2/+2
| | | | | | | | | | calling sysctl(3) MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=298303
* Use GPIOTOGGLE to toggle the pin state instead of read, modify and write.Luiz Otavio O Souza2016-04-191-5/+5
| | | | Notes: svn path=/head/; revision=298272
* Unbreak the build if you enable WITH_NANDAllan Jude2016-04-191-2/+2
| | | | | | | | | | Followup to r298230 Submitted by: Nikolai Lifanov <lifanov@mail.lifanov.com> (original version) Sponsored by: ScaleEngine Inc. Notes: svn path=/head/; revision=298242
* A new implementation of the loader block cacheAllan Jude2016-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 Notes: svn path=/head/; revision=298230
* libc: do not include <sys/types.h> where <sys/param.h> was already includedAndriy Voskoboinyk2016-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). Notes: svn path=/head/; revision=298226
* Re-use our roundup2() macro instead of reinventing the wheel.Pedro F. Giffuni2016-04-181-6/+4
| | | | | | | Obtained from: DragonflyBSD Notes: svn path=/head/; revision=298215
* libipsec: use NULL instead of zero for pointers.Pedro F. Giffuni2016-04-181-1/+1
| | | | Notes: svn path=/head/; revision=298214
* libstand: use NULL instead of zero for pointers.Pedro F. Giffuni2016-04-183-10/+10
| | | | Notes: svn path=/head/; revision=298210
* libbluetooth: use NULL instead of zero for pointers.Pedro F. Giffuni2016-04-181-2/+2
| | | | Notes: svn path=/head/; revision=298208
* rexec(3): use NULL instead of zero for pointers.Pedro F. Giffuni2016-04-181-5/+5
| | | | Notes: svn path=/head/; revision=298207
* Replace ${CURDIR}/../.. with ${CURDIR:H:H} in elftoolchainEd Maste2016-04-183-3/+3
| | | | | | | | | | This produces a nicer path in debug info and build logs. MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=298204
* Fixed indentation, minor style.Sergey Kandaurov2016-04-181-12/+12
| | | | Notes: svn path=/head/; revision=298201
* MFV r298178:Xin LI2016-04-182-4/+7
| | | | | | | | | | Update file to 5.26. MFC after: 2 weeks Relnotes: yes Notes: svn path=/head/; revision=298192
* Fix markup on "\n" in printf so it renders correctly.Warren Block2016-04-171-4/+4
| | | | | | | | | PR: 208852 Submitted by: coder@tuxfamily.org MFC after: 1 week Notes: svn path=/head/; revision=298156
* Remove lib/libcapsicum and libexec/casper, brought back asGlen Barber2016-04-1718-2534/+0
| | | | | | | | | | part of a merge mishap. Reported by: junovitch Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=298139
* libc: make some more use of the nitems() macro.Pedro F. Giffuni2016-04-1610-26/+22
| | | | | | | | | | | We have an nitems() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read. Given that it is available already without adding additional headers and other parts of libc already use it, extend a bit more its use. Notes: svn path=/head/; revision=298120
* MFHGlen Barber2016-04-1628-68/+87
|\ | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=298092