Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:02

0001 /*
0002  * Copyright (c) 1996  Peter Wemm <peter@FreeBSD.org>.
0003  * All rights reserved.
0004  * Copyright (c) 2002 Networks Associates Technology, Inc.
0005  * All rights reserved.
0006  *
0007  * Portions of this software were developed for the FreeBSD Project by
0008  * ThinkSec AS and NAI Labs, the Security Research Division of Network
0009  * Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035
0010  * ("CBOSS"), as part of the DARPA CHATS research program.
0011  *
0012  * Redistribution and use in source and binary forms, with or without
0013  * modification, is permitted provided that the following conditions
0014  * are met:
0015  * 1. Redistributions of source code must retain the above copyright
0016  *    notice, this list of conditions and the following disclaimer.
0017  * 2. Redistributions in binary form must reproduce the above copyright
0018  *    notice, this list of conditions and the following disclaimer in the
0019  *    documentation and/or other materials provided with the distribution.
0020  * 3. The name of the author may not be used to endorse or promote
0021  *    products derived from this software without specific prior written
0022  *    permission.
0023  *
0024  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
0025  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0026  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0027  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
0028  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0029  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0030  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0031  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0032  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0033  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0034  * SUCH DAMAGE.
0035  *
0036  * $FreeBSD: src/lib/libutil/libutil.h,v 1.47 2008/04/23 00:49:12 scf Exp $
0037  */
0038 
0039 #ifndef LIBBSD_LIBUTIL_H
0040 #define LIBBSD_LIBUTIL_H
0041 
0042 #ifdef LIBBSD_OVERLAY
0043 #include <sys/cdefs.h>
0044 #else
0045 #include <bsd/sys/cdefs.h>
0046 #endif
0047 #include <sys/types.h>
0048 #include <stdint.h>
0049 #include <stdio.h>
0050 
0051 struct pidfh;
0052 
0053 __BEGIN_DECLS
0054 int humanize_number(char *buf, size_t len, int64_t bytes,
0055     const char *suffix, int scale, int flags);
0056 int expand_number(const char *_buf, uint64_t *_num);
0057 
0058 int flopen(const char *_path, int _flags, ...);
0059 int flopenat(int dirfd, const char *path, int flags, ...);
0060 
0061 struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr);
0062 int pidfile_fileno(const struct pidfh *pfh);
0063 int pidfile_write(struct pidfh *pfh);
0064 int pidfile_close(struct pidfh *pfh);
0065 int pidfile_remove(struct pidfh *pfh);
0066 
0067 char   *fparseln(FILE *, size_t *, size_t *, const char[3], int);
0068 __END_DECLS
0069 
0070 /* Values for humanize_number(3)'s flags parameter. */
0071 #define HN_DECIMAL      0x01
0072 #define HN_NOSPACE      0x02
0073 #define HN_B            0x04
0074 #define HN_DIVISOR_1000     0x08
0075 #define HN_IEC_PREFIXES     0x10
0076 
0077 /* Values for humanize_number(3)'s scale parameter. */
0078 #define HN_GETSCALE     0x10
0079 #define HN_AUTOSCALE        0x20
0080 
0081 /*
0082  * fparseln() specific operation flags.
0083  */
0084 #define FPARSELN_UNESCESC   0x01
0085 #define FPARSELN_UNESCCONT  0x02
0086 #define FPARSELN_UNESCCOMM  0x04
0087 #define FPARSELN_UNESCREST  0x08
0088 #define FPARSELN_UNESCALL   0x0f
0089 
0090 #endif /* !LIBBSD_LIBUTIL_H */