"Fossies" - the Fresh Open Source Software Archive

Member "honggfuzz-2.2/libhfcommon/files.h" (23 Apr 2020, 2522 Bytes) of package /linux/privat/honggfuzz-2.2.tar.gz:

As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "files.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.1_vs_2.2.

    1 /*
    2  *
    3  * honggfuzz - file operations
    4  * -----------------------------------------
    5  *
    6  * Author: Robert Swiecki <swiecki@google.com>
    7  *
    8  * Copyright 2010-2018 by Google Inc. All Rights Reserved.
    9  *
   10  * Licensed under the Apache License, Version 2.0 (the "License"); you may
   11  * not use this file except in compliance with the License. You may obtain
   12  * a copy of the License at
   13  *
   14  * http://www.apache.org/licenses/LICENSE-2.0
   15  *
   16  * Unless required by applicable law or agreed to in writing, software
   17  * distributed under the License is distributed on an "AS IS" BASIS,
   19  * implied. See the License for the specific language governing
   20  * permissions and limitations under the License.
   21  *
   22  */
   24 #ifndef _HF_COMMON_FILES_H_
   25 #define _HF_COMMON_FILES_H_
   27 #include <stdbool.h>
   28 #include <stdint.h>
   29 #include <sys/socket.h>
   30 #include <unistd.h>
   32 #include "common.h"
   34 extern ssize_t files_readFileToBufMax(const char* fname, uint8_t* buf, size_t fileMaxSz);
   35 extern bool files_writeBufToFile(const char* fname, const uint8_t* buf, size_t fileSz, int flags);
   36 extern bool files_writeStrToFile(const char* fname, const char* str, int flags);
   37 extern int files_writeBufToTmpFile(const char* dir, const uint8_t* buf, size_t fileSz, int flags);
   38 extern bool files_writeToFd(int fd, const uint8_t* buf, size_t fileSz);
   39 extern bool files_writeStrToFd(int fd, const char* str);
   40 extern ssize_t files_readFromFd(int fd, uint8_t* buf, size_t fileSz);
   41 extern ssize_t files_readFromFdSeek(int fd, uint8_t* buf, size_t fileSz, off_t pos);
   42 extern bool files_writePatternToFd(int fd, off_t size, unsigned char p);
   44 extern bool files_sendToSocketNB(int fd, const uint8_t* buf, size_t fileSz);
   45 extern bool files_sendToSocket(int fd, const uint8_t* buf, size_t fileSz);
   46 extern sa_family_t files_sockFamily(int sock);
   47 extern const char* files_sockAddrToStr(const struct sockaddr* sa, const socklen_t len);
   49 extern bool files_exists(const char* fname);
   50 extern const char* files_basename(const char* path);
   51 extern bool files_resetFile(int fd, size_t sz);
   53 extern uint8_t* files_mapFile(const char* fname, off_t* fileSz, int* fd, bool isWritable);
   54 extern int files_getTmpMapFlags(int flag, bool nocore);
   55 extern int files_createSharedMem(size_t sz, const char* name, bool exportmap);
   56 extern void* files_mapSharedMem(size_t sz, int* fd, const char* name, bool nocore, bool export);
   58 extern size_t files_parseSymbolFilter(const char* inFIle, char*** filterList);
   60 #endif /* ifndef HF_COMMON_FILES */