summaryrefslogtreecommitdiffstats
path: root/libutil
Commit message (Collapse)AuthorAgeFilesLines
* Remove login(3), logout(3) and logwtmp(3) from libutil.Ed Schouten2010-01-131-4/+0
| | | | | | | | | | These functions only apply to utmp(5). They cannot be kept intact when moving towards utmpx. The login(3) function would break, because its argument is an utmp structure. The logout(3) and logwtmp(3) functions cannot be used, since they provide a functionality which partially overlaps. Increment SHLIB_MAJOR to 9 to indicate the removal.
* Remove a dead store.Sean Farley2009-12-121-2/+2
| | | | MFC after: 5 days
* Make <libutil.h> work when included by itself.Ed Schouten2009-12-021-0/+28
| | | | | | | There are several reasons why it didn't work: - It was missing <sys/cdefs.h> for __BEGIN_DECLS. - It uses various primitive types that were not declared.
* sigset() is the name of function specified by SUSv4.Konstantin Belousov2009-11-261-4/+4
| | | | | | Replace it to avoid conflict. MFC after: 3 weeks
* Revert (once again, and hopefully for the last time) to flock(2) locks.Dag-Erling Smørgrav2009-06-061-8/+5
| | | | | | The problem with fcntl(2) locks is that they are not inherited by child processes. This breaks pidfile(3), where the common idiom is to open and lock the PID file before daemonizing.
* Merge user/peter/kinfo branch as of r185547 into head.Peter Wemm2008-12-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes struct kinfo_filedesc and kinfo_vmentry such that they are same on both 32 and 64 bit platforms like i386/amd64 and won't require sysctl wrapping. Two new OIDs are assigned. The old ones are available under COMPAT_FREEBSD7 - but it isn't that simple. The superceded interface was never actually released on 7.x. The other main change is to pack the data passed to userland via the sysctl. kf_structsize and kve_structsize are reduced for the copyout. If you have a process with 100,000+ sockets open, the unpacked records require a 132MB+ copyout. With packing, it is "only" ~35MB. (Still seriously unpleasant, but not quite as devastating). A similar problem exists for the vmentry structure - have lots and lots of shared libraries and small mmaps and its copyout gets expensive too. My immediate problem is valgrind. It traditionally achieves this functionality by parsing procfs output, in a packed format. Secondly, when tracing 32 bit binaries on amd64 under valgrind, it uses a cross compiled 32 bit binary which ran directly into the differing data structures in 32 vs 64 bit mode. (valgrind uses this to track file descriptor operations and this therefore affected every single 32 bit binary) I've added two utility functions to libutil to unpack the structures into a fixed record length and to make it a little more convenient to use.
* Fixed style issues with variable ordering and naming, spacing andSean Farley2008-11-231-75/+97
| | | | | | | | | | | | | | | | | parentheses. Fixed alignment issue in gr_dup() in its assignment of gr_mem using a struct to force alignment without performing alignment mathematics. This was noticed recently with libutil was built with WARNS=6 on platform such as sparc64. Added checks to gr_dup(), gr_equal() and gr_make() to prevent segfaults when examining struct group's with the struct members pointing to NULL's. With fix of alignment issue, restore WARNS?=6. Reviewed by: des MFC after: 1 week
* style(9) fixes.Sean Farley2008-11-111-20/+14
| | | | MFC after: 1 week
* Avoid assigning a const char * to a char *.Dag-Erling Smørgrav2008-11-041-4/+5
| | | | MFC after: 3 weeks
* Diff reduction against Varnish, including one important fix: use a sharedDag-Erling Smørgrav2008-10-201-12/+12
| | | | lock if the file is opened with O_RDONLY.
* Reimplement flopen(3) using fcntl(2) locks instead of flock(2) locks.Dag-Erling Smørgrav2008-10-201-5/+7
|
* Since in_lt() and in_lts() are not static, assume that they are intended toDag-Erling Smørgrav2008-10-201-0/+2
| | | | be part of the public API. Accordingly, add prototypes and document them.
* Since setclasscpumask() is not static, assume that it is intended to beDag-Erling Smørgrav2008-10-201-0/+1
| | | | part of the public API. Accordingly, add a prototype and document it.
* Style and whitespace.Dag-Erling Smørgrav2008-10-201-15/+19
|
* Add support for a new login capability, cpumask which allows loginBrooks Davis2008-07-251-1/+2
| | | | sessions to be pinned to cpus by login class.
* Merge hexdump(9) to userland as hexdump(3) in libutil. I'm tired of doingJohn Baldwin2008-07-011-0/+8
| | | | | | this by hand in userland utilities. MFC after: 1 month
* Add four utility functions related to struct grp processing modeled in-partSean Farley2008-04-232-0/+241
| | | | | | | | | | | | | | | | | | | after similar calls related to struct pwd in libutil/pw_util.c: - gr_equal() Perform a deep comparison of two struct grp's. It does a thorough, yet unoptimized comparison of all the members regardless of order. - gr_make() Create a string (see group(5)) from a struct grp. - gr_dup() Duplicate a struct grp. Returns a value that is a single contiguous block of memory. - gr_scan() Create a struct grp from a string (as produced by gr_make()). MFC after: 3 weeks
* Constify the first argument to expand_number() so that it canJohn Birrell2007-11-181-1/+1
| | | | be called with a const without the compiler grisling.
* Implement expand_number(3), which is the opposite of humanize_number(3), ie.Pawel Jakub Dawidek2007-09-011-0/+1
| | | | | | | | | | a number in human-readable form is converted to int64_t, for example: 123b -> 123 10k -> 10240 16G -> 17179869184 First version submitted by: Eric Anderson <anderson@freebsd.org> Approved by: re (bmah)
* Back out previous commit until I figure out why my regression test fails.Dag-Erling Smørgrav2007-08-031-7/+4
| | | | Approved by: re (kensmith)
* Use fcntl(2)-style locks instead of less-portable flock(2)-style locks.Dag-Erling Smørgrav2007-08-031-4/+7
| | | | Approved by: re (kensmith)
* Update some comments, mostly regarding LOGIN_MECLASS and ~/.login_conf.Yaroslav Tykhiy2007-06-141-8/+18
|
* Nit: avoid shadowing truncate(2) with a local variable.Dag-Erling Smørgrav2007-05-231-3/+3
|
* Fix stupid braino in previous commit.Dag-Erling Smørgrav2007-05-231-1/+1
|
* If (flags & O_TRUNC), don't truncate the file until we've successfullyDag-Erling Smørgrav2007-05-231-1/+11
| | | | | | locked it. MFC after: 3 weeks
* Well gag me with a spoon... I'm so used to working at high WARNS levelsDag-Erling Smørgrav2007-05-102-1/+5
| | | | that I make stupid fundamental mistakes like this when I don't.
* Remove superfluous unexpanded RCS tag.Dag-Erling Smørgrav2007-05-101-2/+0
|
* DTRT when O_NONBLOCK is specified.Dag-Erling Smørgrav2007-05-101-4/+7
| | | | MFC after: 3 weeks
* I'm tired of seeing this done incorrectly and non-portably, so add aDag-Erling Smørgrav2007-05-102-0/+92
| | | | | | flopen(3) function which reliably opens and locks a file. MFC after: 3 weeks
* Remove California Regent's clause 3, per letterWarner Losh2007-01-091-4/+0
|
* Minor comment fix.Thomas Quinot2006-09-081-1/+1
|
* (pw_copy): Handle the case of a malformed line in master.passwdThomas Quinot2006-09-041-2/+11
| | | | | | | | (copy it silently, do not dereference NULL pointer). PR: bin/102848 Reviewed by: security-officer (cperciva) MFC after: 1 week
* Add utility functions for checking if a given kernel module is loaded,Dag-Erling Smørgrav2006-02-181-0/+5
| | | | and loading it.
* Add a family of functions for reliable pidfiles handling.Pawel Jakub Dawidek2005-08-241-0/+17
| | | | | Idea from: jmg Discussed on: arch@
* Properly spell default in a comment.Tom Rhodes2005-04-221-1/+1
|
* Grammar in a comment.Ruslan Ermilov2004-12-181-1/+1
|
* Add humanize_number(3) to libutil for formating numbers into a humanPawel Jakub Dawidek2004-05-241-0/+11
| | | | | | readable form. Obtained from: NetBSD
* Don't depend on NULL's expansion being a pointer, cast it before it is passedStefan Farfeleder2004-05-181-3/+4
| | | | | | to variadic functions. Approved by: das (mentor)
* Bring the description for login_getclassbyname in sync with the function'sDiomidis Spinellis2004-05-111-3/+4
| | | | | | | arguments. The function has as a second argument a struct passwd * pointer, not a directory name. MFC after: 2 weeks
* Add the clean_environment call to libutil.h also.Tim Kientzle2004-02-261-0/+2
| | | | MFC after: 2 weeks
* (mostly) Clean up some const warnings here. The code takes some libertiesPeter Wemm2003-10-261-8/+9
| | | | | because it is the originator of various const strings and knows that they came from malloc.
* ANSIfy, WARNSify, CONSTify. Bit of style(9)-ify.Mark Murray2003-10-185-74/+79
|
* Tidy up. Sort headers.Mark Murray2003-06-142-10/+9
|
* Brucify.Dag-Erling Smørgrav2003-04-101-4/+8
|
* Correctly detect the case where a password entry was changed while we wereDag-Erling Smørgrav2003-04-091-2/+7
| | | | | | preparing to edit it. PR: bin/50563
* Apply the correct fix for bin/50679: don't mess around with process groupsDag-Erling Smørgrav2003-04-091-13/+19
| | | | | | | or the tty, just block selected signals in the parent like system(3) does. Many thanks to bde for his assistance in finding the correct solution. PR: bin/50679
* Band-aid for the "^C kills the editor" problem. I haven't yet found theDag-Erling Smørgrav2003-04-081-10/+6
| | | | | | | | proper way to fix this. The way this works is to prepend "exec " to the editor command to eliminate the "shell in the middle" which prevents us from properly reawakening the editor after a SIGTSTP. PR: bin/50679
* Make pw_edit() use /bin/sh to interpret the EDITOR environmentDavid Schultz2003-03-171-2/+12
| | | | | | | variable. PR: 48748 Reviewed by: mike (mentor)
* Don't forget to '\n'-terminate new entries. This unbreaks chpass -a.Dag-Erling Smørgrav2002-10-291-1/+2
| | | | Submitted by: joerg
* Replace various spelling with FALLTHROUGH which is lint()ablePhilippe Charnier2002-08-251-1/+1
|