Path: blob/main/tools/build/cross-build/include/linux/libutil.h
39565 views
/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright 2018-2020 Alex Richardson <[email protected]>4*5* This software was developed by SRI International and the University of6* Cambridge Computer Laboratory (Department of Computer Science and7* Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the8* DARPA SSITH research programme.9*10* This software was developed by SRI International and the University of11* Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)12* ("CTSRD"), as part of the DARPA CRASH research programme.13*14* Redistribution and use in source and binary forms, with or without15* modification, are permitted provided that the following conditions16* are met:17* 1. Redistributions of source code must retain the above copyright18* notice, this list of conditions and the following disclaimer.19* 2. Redistributions in binary form must reproduce the above copyright20* notice, this list of conditions and the following disclaimer in the21* documentation and/or other materials provided with the distribution.22*23* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND24* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE25* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE26* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE27* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL28* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS29* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)30* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT31* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY32* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF33* SUCH DAMAGE.34*/35#pragma once3637#include <sys/types.h>38#include <sys/socket.h>3940#include <stdint.h>41#include <stdio.h>4243struct pidfh;4445__BEGIN_DECLS46int humanize_number(char *buf, size_t len, int64_t bytes, const char *suffix,47int scale, int flags);48int expand_number(const char *_buf, int64_t *_num);4950int flopen(const char *_path, int _flags, ...);51int flopenat(int dirfd, const char *path, int flags, ...);5253char *fparseln(FILE *, size_t *, size_t *, const char[3], int);54__END_DECLS5556/* Values for humanize_number(3)'s flags parameter. */57#define HN_DECIMAL 0x0158#define HN_NOSPACE 0x0259#define HN_B 0x0460#define HN_DIVISOR_1000 0x0861#define HN_IEC_PREFIXES 0x106263/* Values for humanize_number(3)'s scale parameter. */64#define HN_GETSCALE 0x1065#define HN_AUTOSCALE 0x206667/*68* fparseln() specific operation flags.69*/70#define FPARSELN_UNESCESC 0x0171#define FPARSELN_UNESCCONT 0x0272#define FPARSELN_UNESCCOMM 0x0473#define FPARSELN_UNESCREST 0x0874#define FPARSELN_UNESCALL 0x0f757677