aboutsummaryrefslogtreecommitdiff
path: root/lib/libutil/libutil.h
Commit message (Collapse)AuthorAgeFilesLines
* - 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 Notes: svn path=/head/; revision=221807
* Don't duplicate define the stdint types.David E. O'Brien2011-05-051-10/+1
| | | | Notes: svn path=/head/; revision=221502
* Add support for IEE/IEC (and now also SI) power of two notions ofXin LI2011-04-121-0/+2
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=220582
* expand_number() needs uint64_t, declare it here if not already declared.Pawel Jakub Dawidek2011-03-061-0/+5
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=219344
* Simplify expand_number() by combining the (unrolled) loop with theDag-Erling Smørgrav2010-08-141-1/+1
| | | | | | | | | | switch. Since expand_number() does not accept negative numbers, switch from int64_t to uint64_t; this makes it easier to check for overflow. MFC after: 3 weeks Notes: svn path=/head/; revision=211304
* IFH@204581Dag-Erling Smørgrav2010-03-041-4/+28
|\ | | | | | | Notes: svn path=/projects/quota64/; revision=204708
| * 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. Notes: svn path=/head/; revision=202216
| * 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. Notes: svn path=/head/; revision=200035
* | Add and document the quota_convert function which converts between theKirk McKusick2009-12-281-0/+1
| | | | | | | | | | | | | | old 32-bit and the new 64-bit formats. Notes: svn path=/projects/quota64/; revision=201144
* | Add and document new quoat_on and quota_off functions.Kirk McKusick2009-11-161-1/+3
| | | | | | | | Notes: svn path=/projects/quota64/; revision=199328
* | Add quota_maxid which returns the maximum user (or group) identifierKirk McKusick2009-10-201-0/+1
| | | | | | | | | | | | | | | | | | in an associated quotafile. Needed by repquota. Bug fix in quota_read. Notes: svn path=/projects/quota64/; revision=198265
* | Further extend the quotafile API.Dag-Erling Smørgrav2009-09-261-1/+4
| | | | | | | | Notes: svn path=/projects/quota64/; revision=197532
* | Update the quotafile library to manage both active quotas via theKirk McKusick2009-02-141-4/+3
| | | | | | | | | | | | | | | | | | | | | | quotactl(2) interface and inactive quotas by accessing the quota files directly. Update the edquota program to use this new interface as proof of concept. Notes: svn path=/projects/quota64/; revision=188604
* | Make hasquota thread safe.Kirk McKusick2009-02-131-1/+1
| | | | | | | | Notes: svn path=/projects/quota64/; revision=188598
* | Move hasquota() function to libutil.Kirk McKusick2009-02-131-0/+2
| | | | | | | | Notes: svn path=/projects/quota64/; revision=188568
* | WIPDag-Erling Smørgrav2009-01-301-0/+9
|/ | | | Notes: svn path=/projects/quota64/; revision=187914
* 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. Notes: svn path=/head/; revision=185548
* 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 Notes: svn path=/head/; revision=180161
* Add four utility functions related to struct grp processing modeled in-partSean Farley2008-04-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=178431
* 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. Notes: svn path=/head/; revision=173719
* 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) Notes: svn path=/head/; revision=172029
* Well gag me with a spoon... I'm so used to working at high WARNS levelsDag-Erling Smørgrav2007-05-101-1/+1
| | | | | | | that I make stupid fundamental mistakes like this when I don't. Notes: svn path=/head/; revision=169450
* I'm tired of seeing this done incorrectly and non-portably, so add aDag-Erling Smørgrav2007-05-101-0/+1
| | | | | | | | | flopen(3) function which reliably opens and locks a file. MFC after: 3 weeks Notes: svn path=/head/; revision=169446
* Add utility functions for checking if a given kernel module is loaded,Dag-Erling Smørgrav2006-02-181-0/+5
| | | | | | | and loading it. Notes: svn path=/head/; revision=155804
* Add a family of functions for reliable pidfiles handling.Pawel Jakub Dawidek2005-08-241-0/+17
| | | | | | | | Idea from: jmg Discussed on: arch@ Notes: svn path=/head/; revision=149423
* Add humanize_number(3) to libutil for formating numbers into a humanPawel Jakub Dawidek2004-05-241-0/+11
| | | | | | | | | readable form. Obtained from: NetBSD Notes: svn path=/head/; revision=129677
* Add the clean_environment call to libutil.h also.Tim Kientzle2004-02-261-0/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=126299
* ANSIfy, WARNSify, CONSTify. Bit of style(9)-ify.Mark Murray2003-10-181-6/+4
| | | | Notes: svn path=/head/; revision=121193
* Add passwd manipulation code based on parts of vipw and chpass.Dag-Erling Smørgrav2002-05-081-0/+29
| | | | | | | Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=96199
* Remove multi-line __P() usage.David E. O'Brien2002-03-221-8/+7
| | | | Notes: svn path=/head/; revision=92941
* Remove __P() usage.David E. O'Brien2002-03-211-17/+17
| | | | Notes: svn path=/head/; revision=92917
* remove emalloc,ecalloc,erealloc,estrdupAssar Westerlund2001-07-231-4/+0
| | | | Notes: svn path=/head/; revision=80206
* add ecalloc, emalloc, erealloc, estrdup - versions of the e-lessAssar Westerlund2001-07-221-0/+4
| | | | | | | functions that exit instead of failing Notes: svn path=/head/; revision=80167
* o Slap some "_"'s in front of variable names relating to extattr functions,Robert Watson2001-03-221-3/+3
| | | | | | | | | so as not to pollute application namespace. Submitted by: bde Notes: svn path=/head/; revision=74624
* o Rename "namespace" argument to "attrnamespace" as namespace is a C++Robert Watson2001-03-191-2/+3
| | | | | | | | | | | reserved word, causing breakage when a C++ program included libutil.h This change will be propagated elsewhere shortly. Submitted by: jkh Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=74435
* o To support new EA interface with explicit namespaces, introduce twoRobert Watson2001-03-151-0/+2
| | | | | | | | | | | | | | utility functions which convert between string namespace names and numeric constants used by the interface. Right now, two namespaces are supported, EXTATTR_NAMESPACE_SYSTEM ("system") and EXTATTR_NAMESPACE_USER ("user"). These functions are used by various userland EA utilities, rather than hard coding the routines all over the place. Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=74274
* Added PROPERTY_MAX_VALUE and PROPERTY_MAX_NAME defines to libutil.h soMurray Stokely2000-11-081-0/+3
| | | | | | | | | | that applications know how large of a buffer they must allocate before calling property_find(). Also added a $FreeBSD$ tag while I'm here. Approved by: jkh Notes: svn path=/head/; revision=68488
* Constify the arg to logout(3). It is const-safe.Peter Wemm2000-09-041-1/+1
| | | | | | | (cosmetic: drop some "register" qualifications too.) Notes: svn path=/head/; revision=65431
* Move setproctitle() from libutil to libc (after a repo-copy)Brian Somers2000-09-021-1/+0
| | | | | | | | | | | | and bump __FreeBSD_version to 500012 to mark the occasion. setproctitle() is prototyped in unistd.h as opposed to stdlib.h where OpenBSD and NetBSD have it. Reviewed by: peter Notes: svn path=/head/; revision=65353
* Use a more conventional copyright message.Peter Wemm2000-01-261-9/+14
| | | | Notes: svn path=/head/; revision=56626
* several tcp apps IPv6 updateYoshinobu Inoue2000-01-251-0/+3
| | | | | | | | | | | | | | | -inetd -rshd -rlogind -telnetd -rsh -rlogin Reviewed by: freebsd-arch, cvs-committers Obtained from: KAME project Notes: svn path=/head/; revision=56590
* Connect fparseln(3) for mailwrapper(8)Peter Wemm1999-12-291-0/+10
| | | | Notes: svn path=/head/; revision=55227
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50476
* Add realhostname() - a function to correctly lookupBrian Somers1999-04-061-1/+9
| | | | | | | | a name by address and ensure that the name resolves back to the original address. Notes: svn path=/head/; revision=45392
* Declare setproctitle() as printf0-like.Bruce Evans1998-12-161-2/+2
| | | | Notes: svn path=/head/; revision=41876
* o move path in libutil.h to paths.hJordan K. Hubbard1998-10-091-2/+2
| | | | | | | | o make property_read() take a fd instead to avoid stdio.h mess o update auth to new interface. Notes: svn path=/head/; revision=40109
* Take the path spec back out.Jordan K. Hubbard1998-10-091-4/+1
| | | | Notes: svn path=/head/; revision=40108
* remove stdio.h include; I forgot Bruce's cardinal rule that header filesJordan K. Hubbard1998-10-081-2/+1
| | | | | | | | | shouldn't include other ones (which, unfortunately, is also a hellish rule since he broke interfaces like sysctl this way by requiring undocumented header files to be included just in order to be able to use them now - SIGH!). Notes: svn path=/head/; revision=40082
* Add a simple mechanism for reading property lists from files (whichJordan K. Hubbard1998-10-071-1/+16
| | | | | | | | | | I'll convert sysinstall to use shortly) and a simple call which uses this mechanism to implement an /etc/auth.conf file. I'll let Mark Murray handle the format and checkin of the sample auth.conf file. Reviewed by: markm Notes: svn path=/head/; revision=40040
* Add missing uu_lock_txfr() prototypeAndrey A. Chernov1998-06-051-1/+2
| | | | Notes: svn path=/head/; revision=36660