summaryrefslogtreecommitdiffstats
path: root/lib/libutil
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | | | | | | | | Add support for reading MAM attributes to camcontrol(8) and libcam(3).ken2015-06-091-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MAM is Medium Auxiliary Memory and is most commonly found as flash chips on tapes. This includes support for reading attributes and decoding most known attributes, but does not yet include support for writing attributes or reporting attributes in XML format. libsbuf/Makefile: Add subr_prf.c for the new sbuf_hexdump() function. This function is essentially the same function. libsbuf/Symbol.map: Add a new shared library minor version, and include the sbuf_hexdump() function. libsbuf/Version.def: Add version 1.4 of the libsbuf library. libutil/hexdump.3: Document sbuf_hexdump() alongside hexdump(3), since it is essentially the same function. camcontrol/Makefile: Add attrib.c. camcontrol/attrib.c: Implementation of READ ATTRIBUTE support for camcontrol(8). camcontrol/camcontrol.8: Document the new 'camcontrol attrib' subcommand. camcontrol/camcontrol.c: Add the new 'camcontrol attrib' subcommand. camcontrol/camcontrol.h: Add a function prototype for scsiattrib(). share/man/man9/sbuf.9: Document the existence of sbuf_hexdump() and point users to the hexdump(3) man page for more details. sys/cam/scsi/scsi_all.c: Add a table of known attributes, text descriptions and handler functions. Add a new scsi_attrib_sbuf() function along with a number of other related functions that help decode attributes. scsi_attrib_ascii_sbuf() decodes ASCII format attributes. scsi_attrib_int_sbuf() decodes binary format attributes, and will pass them off to scsi_attrib_hexdump_sbuf() if they're bigger than 8 bytes. scsi_attrib_vendser_sbuf() decodes the vendor and drive serial number attribute. scsi_attrib_volcoh_sbuf() decodes the Volume Coherency Information attribute that LTFS writes out. sys/cam/scsi/scsi_all.h: Add a number of attribute-related structure definitions and other defines. Add function prototypes for all of the functions added in scsi_all.c. sys/kern/subr_prf.c: Add a new function, sbuf_hexdump(). This is the same as the existing hexdump(9) function, except that it puts the result in an sbuf. This also changes subr_prf.c so that it can be compiled in userland for includsion in libsbuf. We should work to change this so that the kernel hexdump implementation is a wrapper around sbuf_hexdump() with a statically allocated sbuf with a drain. That will require a drain function that goes to the kernel printf() buffer that can take a non-NUL terminated string as input. That is because an sbuf isn't NUL-terminated until it is finished, and we don't want to finish it while we're still using it. We should also work to consolidate the userland hexdump and kernel hexdump implemenatations, which are currently separate. This would also mean making applications that currently link in libutil link in libsbuf. sys/sys/sbuf.h: Add the prototype for sbuf_hexdump(), and add another copy of the hexdump flag values if they aren't already defined. Ideally the flags should be defined in one place but the implemenation makes it difficult to do properly. (See above.) Sponsored by: Spectra Logic Corporation MFC after: 1 week
* | | | | | | | | | | | | revert r283969,283970 not needed anymore after r283981bapt2015-06-044-53/+4
| | | | | | | | | | | | |
* | | | | | | | | | | | | Capitalize the list of accepted variablesbapt2015-06-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suggested by: wblock
* | | | | | | | | | | | | Add a pw_mkdb2(3) function which does the same thing as pw_mkdb(3) exceptbapt2015-06-034-4/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | it takes a new argument allowing to specify the endianness of the database to generate Differential Revision: https://reviews.freebsd.org/D2730 Reviewed by: ian
* | | | | | | | | | | | | Fix typobapt2015-06-031-2/+2
| | | | | | | | | | | | |
* | | | | | | | | | | | | Export a list of VM objects in the system via a sysctl. The list can bejhb2015-05-274-2/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | examined via 'vmstat -o'. It can be used to determine which files are using physical pages of memory and how much each is using. Differential Revision: https://reviews.freebsd.org/D2277 Reviewed by: alc, kib MFC after: 2 weeks Sponsored by: Norse Corp, Inc. (forward porting to HEAD/10)
* | | | | | | | | | | | | Add <sys/user.h> to the SYNOPSIS of the kinfo_get*() functions since thesejhb2015-05-274-4/+8
| |_|_|_|_|_|_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | functions all return types that are defined in that header. MFC after: 1 week
* | | | | | | | | | | | gr_equal(): Fix a crash that could occur if the first group's member listmarkj2015-01-251-15/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | was longer than the second's. There is no need to compute and compare the member list lengths in a separate pass, since we now just return false when comparing member names if the list lengths are not equal. MFC after: 2 weeks
* | | | | | | | | | | | mdoc: improvements to SEE ALSO.joel2014-12-271-2/+2
| | | | | | | | | | | |
* | | | | | | | | | | | Convert libraries to use LIBADDbapt2014-11-251-2/+1
| |_|_|_|_|_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While here reduce a bit overlinking
* | | | | | | | | | | Fix a clang 3.5 warning about abs(3) being given an argument of typedim2014-10-291-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | quad_t in setusercontext(). While here, sanitize the clamping of the priority value, and use the correct type for the return value of login_getcapnum(). Reviewed by: kib MFC after: 3 days
* | | | | | | | | | | Fix renaming a group via the gr_copy functionbapt2014-10-281-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a regression test to pw(8) because the bug was discovered via using: pw groupmod PR: 187189 Reported by: mcdouga9@egr.msu.edu Tested by: mcdouga9@egr.msu.edu Patch by: Marc de la Gueronniere
* | | | | | | | | | | Integrate lib/libutil into the build/kyuangie2014-08-138-0/+1406
| |_|_|_|_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the .t wrappers Rename all of the TAP test applications from test-<test> to <test>_test to match the convention described in the TestSuite wiki page humanize_number_test.c: - Fix -Wformat warnings with counter variables - Fix minor style(9) issues: -- Header sorting -- Variable declaration alignment/sorting in main(..) -- Fit the lines in <80 columns - Fix an off by one index error in the testcase output [*] - Remove unnecessary `extern char * optarg;` (this is already provided by unistd.h) Phabric: D555 Approved by: jmmv (mentor) MFC after: 2 weeks Obtained from: EMC / Isilon Storage Division [*] Submitted by: Casey Peel <cpeel@isilon.com> [*] Sponsored by: EMC / Isilon Storage Division
* | | | | | | | | | fparseln(3): Update from NetBSD sources.pfg2014-07-231-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -fix a condition so that fparseln() doesn't report spurious empty lines eg after 2 comment lines, or on EOF after a single comment line -no escape character means no escaped characters modify the previous fix so that no pointless realloc()s are done in the case of multiple empty continuation lines, and comment the code to make the logics obvious fparseln is now part of libc in NetBSD so this changes the previous revision numbering. Obtained from: NetBSD (CVS Rev. 1.6-1.7) MFC after: 2 weeks
* | | | | | | | | | mdoc: remove superfluous paragraph macros.joel2014-06-232-2/+0
| | | | | | | | | |
* | | | | | | | | | use .Mt to mark up email addresses consistently (part3)bapt2014-06-235-7/+7
| |_|_|_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR: 191174 Submitted by: Franco Fichtner <franco at lastsummer.de>
* | | | | | | | | Use src.opts.mk in preference to bsd.own.mk except where we need stuffimp2014-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from the latter.
* | | | | | | | | Fix a typo.markj2014-05-031-1/+1
| |_|_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | MFC after: 3 days
* | | | | | | | libutil/pw_util.3: Fix two prototypes.eadler2014-02-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by: marino Obtained from: DragonFlyBSD (e82b5d3dfa969bfcda5ffadceccc682b6bdcd077) MFC After: 3 days
* | | | | | | | Indicate that expand_number is case-insensitive.eadler2013-11-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed by: -scsi
* | | | | | | | Mention in login.conf.5 which fields may be infinite and how to specifify ↵eadler2013-10-271-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | infinity. The number of ways to indicate this confuses people. PR: docs/100196 Reported by: "Dr. Markus Waldeck" <waldeck@gmx.de> Reported by: Jamie Landeg Jones <jamie.landeg.jones@gmail.com>
* | | | | | | | All man pages refer to FreeBSD so there is no need to mention "In .Fx"eadler2013-10-271-3/+1
| | | | | | | |
* | | | | | | | Add a resource limit for the total number of kqueues available to thekib2013-10-212-0/+2
| |_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | user. Kqueue now saves the ucred of the allocating thread, to correctly decrement the counter on close. Under some specific and not real-world use scenario for kqueue, it is possible for the kqueues to consume memory proportional to the square of the number of the filedescriptors available to the process. Limit allows administrator to prevent the abuse. This is kernel-mode side of the change, with the user-mode enabling commit following. Reported and tested by: pho Discussed with: jmg Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* | | | | | | don't assert on bad args, instead return an error..jmg2013-10-072-37/+54
| |_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since so many programs don't check return value, always NUL terminate the buf... fix rounding when using base 1024 (the bug that started it all)... add a set of test cases so we can make sure that things don't break in the future... Thanks to Clifton Royston for testing and the test program... Approved by: re (hrs, glebius) MFC after: 1 week
* | | | | | The round of expand_number() cleanups.pluknet2013-08-301-29/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Fix range error checking to detect overflow when uint64_t < uintmax_t. o Remove a non-functional check for no valid digits as pointed out by Bruce. o Remove a rather pointless comment describing what the function does. o Clean up a bunch of style bugs. Brucified by: bde
* | | | | | libutil: Use O_CLOEXEC for internal file descriptors from open().jilles2013-08-285-9/+12
| | | | | |
* | | | | | Reset errno before strtoumax() call to properly detect ERANGE.pluknet2013-08-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restore saved errno if strtoumax() call is successful. Reported by: ache Reviewed by: jilles MFC after: 1 week
* | | | | | Check strtoumax(3) for ERANGE in case of non-prefixed string.pluknet2013-08-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OK'd by: silence on current@ MFC after: 1 week
* | | | | | Fix -Wunsequenced warningkientzle2013-06-291-1/+1
| |_|_|_|/ |/| | | | | | | | | | | | | | Submitted by: dt71@gmx.com
* | | | | When pidptr was passed as NULL to pidfile_open(3), we were returningpjd2013-03-141-13/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EAGAIN/EWOULDBLOCK when another daemon was running and had the pidfile open. We should return EEXIST in that case, fix it. Reported by: Dirk Engling <erdgeist@erdgeist.org> Reviewed by: jhb, Dirk Engling <erdgeist@erdgeist.org> MFC after: 1 week
* | | | | commit correct tested fix for gr_util.cdb2013-03-091-46/+58
| | | | | | | | | | | | | | | | | | | | Approved by: theraven
* | | | | Cleanup gr_add() so it does not leak memdb2013-03-072-53/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is part of ongoing work on sbin/pw M libutil.h M gr_util.c Approved by: theraven
* | | | | Fixed documented prototype of kinfo_getproc(3).ru2013-03-011-2/+2
| |_|_|/ |/| | |
* | | | libutil: fix typo in comment for gr_fini.mjg2013-01-131-1/+1
| | | | | | | | | | | | | | | | Submitted by: Christoph Mallon <christoph.mallon gmx.de>
* | | | libutil: utilize strsep instead of strcat in a loop in gr_makemjg2013-01-131-6/+10
| | | | | | | | | | | | | | | | Submitted by: Christoph Mallon <christoph.mallon gmx.de>
* | | | libutil: move group_line_format into the scop of its only user.mjg2013-01-131-2/+1
| | | | | | | | | | | | | | | | Submitted by: Christoph Mallon <christoph.mallon gmx.de>
* | | | libutil: eliminate 'found' variable in gr_equalmjg2013-01-131-8/+5
| | | | | | | | | | | | | | | | Submitted by: Christoph Mallon <christoph.mallon gmx.de>
* | | | Simplify pointing dst after the end of all the gr_mem pointers in newgrbapt2012-12-281-2/+1
| | | | | | | | | | | | | | | | | | | | Submitted by: pjd Reviewed by: db
* | | | errno = ENOMEM was supposed to be removed not return (NULL);bapt2012-12-281-1/+1
| | | | | | | | | | | | | | | | Submitted by: gcooper
* | | | malloc() sets errno to ENOMEM already.bapt2012-12-281-5/+1
| | | | | | | | | | | | | | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de>
* | | | Do not leave parts of the new group uninitialized in gr_dup().bapt2012-12-281-0/+4
| | | | | | | | | | | | | | | | | | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de> Reported by: pjd
* | | | avoid arithmetic on uintptr_tbapt2012-12-271-1/+1
| | | | | | | | | | | | | | | | | | | | Submitted by: pjd Reviewed by: jilles
* | | | cast to uintptr_t to properly calculate offsetbapt2012-12-271-1/+1
| | | | | | | | | | | | | | | | | | | | Reported by: mdf Submitted by: db
* | | | Add O_CLOEXEC to flopenbapt2012-12-272-2/+2
| | | | | | | | | | | | | | | | Requested by: jilles
* | | | gr_dup: simplify duplication of groupbapt2012-12-271-21/+20
| | | | | | | | | | | | | | | | Submitted by: db
* | | | - Clean up previous gr_add use malloc instead of callocbapt2012-12-272-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | - Fix tinderbox error Submitted by: db
* | | | New gr_add function to provide a clean and safe method to append a new memberbapt2012-12-272-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | into an existing group. Submitted by: db
* | | | Use flopen(3) instead of open(2) + flock(2)bapt2012-12-272-9/+4
| | | |
* | | | only rename(2) after chmod(2) has succeedbapt2012-11-201-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | report error if chmod(2) fails Reported by: jh
* | | | change mode the group file to 0644 after a successfull rename(2)bapt2012-11-201-1/+8
| |/ / |/| |
OpenPOWER on IntegriCloud