summaryrefslogtreecommitdiffstats
path: root/libutil
Commit message (Collapse)AuthorAgeFilesLines
...
* Consensus between bde and pjd seemed to be that if the function namesGuy Helmer2012-01-261-8/+8
| | | | | | are lined up, then any * after a long type should appear after the type instead of being in front of the function name on the following line.
* Make the comments consistent (capitalization, punctuation, andGuy Helmer2012-01-261-6/+10
| | | | | | format). Requested by bde
* Restore the parenthesis that are necessary around the constant values.Guy Helmer2012-01-261-7/+7
| | | | Requested by bde.
* Fix more disorder in prototypes and constants.Guy Helmer2012-01-161-46/+43
| | | | | | Fix header comments for each section of constants. Fix whitespace in #define lines. Fix unnecessary parenthesis in constants.
* Move struct pidfh definition into pidfile.c, and leave a forward declarationGuy Helmer2012-01-121-12/+6
| | | | | | | | | for pidfh in libutil.h in its place. This allows us to hide the contents of the pidfh structure, and also allowed removal of the "#ifdef _SYS_PARAM_H" guard from around the pidfile_* function prototypes. Suggested by pjd.
* More prototype formatting fixes, struct member formatting fixes,Guy Helmer2012-01-121-10/+17
| | | | | | and namespace fix for property_find() prototype. Provided by bde.
* Fix prototype formatting (indentation, long lines, and continued lines).Guy Helmer2012-01-111-23/+30
| | | | Requested by bde.
* Fix namespace issues with prototype parameter names.Guy Helmer2012-01-111-32/+32
| | | | | | Add missing prototype parameter names. Requested by bde.
* Fix forward structure declaration and prototype disorder.Guy Helmer2012-01-111-34/+33
| | | | Requested by bde.
* Constify arguments.Pawel Jakub Dawidek2012-01-111-1/+1
|
* Add pidfile_fileno() to obtain the file descriptor for an openGuy Helmer2012-01-101-0/+1
| | | | pidfile.
* Add new pw_make_v7 to make a passwd line (in v7 format) out of a struct passwdBaptiste Daroussin2012-01-052-1/+16
| | | | | | while here, fix missing parentheses of the return statement of pw_make. Approved by: des (mentor)
* Modify pw_copy:Baptiste Daroussin2011-12-153-1/+1198
| | | | | | | | | | | | | - if pw is NULL and oldpw is not NULL then the oldpw is deleted - if pw->pw_name != oldpw->pw_name but pw->pw_uid == oldpw->pw_uid then it renames the user add new gr_* functions so now gr_util API is similar to pw_util API, this allow to manipulate groups in a safe way. Reviewed by: des Approved by: des MFC after: 1 month
* - Commit work from libprocstat project. These patches add support for runtimeStanislav Sedov2011-05-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | file and processes information retrieval from the running kernel via sysctl in the form of new library, libprocstat. The library also supports KVM backend for analyzing memory crash dumps. Both procstat(1) and fstat(1) utilities have been modified to take advantage of the library (as the bonus point the fstat(1) utility no longer need superuser privileges to operate), and the procstat(1) utility is now able to display information from memory dumps as well. The newly introduced fuser(1) utility also uses this library and able to operate via sysctl and kvm backends. The library is by no means complete (e.g. KVM backend is missing vnode name resolution routines, and there're no manpages for the library itself) so I plan to improve it further. I'm commiting it so it will get wider exposure and review. We won't be able to MFC this work as it relies on changes in HEAD, which was introduced some time ago, that break kernel ABI. OTOH we may be able to merge the library with KVM backend if we really need it there. Discussed with: rwatson
* Don't duplicate define the stdint types.David E. O'Brien2011-05-051-10/+1
|
* Add support for IEE/IEC (and now also SI) power of two notions ofXin LI2011-04-121-0/+236
| | | | | | | | | | prefixes (Ki, Mi, Gi...) for humanize_number(3). Note that applications has to pass HN_IEC_PREFIXES to use this feature for backward compatibility reasons. Reviewed by: arundel MFC after: 2 weeks
* Create the altix project branch. The altix project will add supportMarcel Moolenaar2010-03-108-2297/+0
| | | | | | | for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting is a two-module system, consisting of a base compute module and a CPU expansion module. SGI's NUMAFlex architecture can be an excellent platform to test CPU affinity and NUMA-aware features in FreeBSD.
* 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.