/usr/include/gdnsd/file.h is in gdnsd-dev 2.2.0-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | /* Copyright © 2014 Brandon L Black <blblack@gmail.com>
*
* This file is part of gdnsd.
*
* gdnsd is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* gdnsd is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gdnsd. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GDNSD_FILE_H
#define GDNSD_FILE_H
#include <gdnsd/compiler.h>
#include <sys/types.h>
#include <stdbool.h>
struct gdnsd_fmap_s_;
typedef struct gdnsd_fmap_s_ gdnsd_fmap_t;
#pragma GCC visibility push(default)
// Given a filename "fn", this will open the file for reading with an fcntl
// advisory readlock and mmap() it for readonly use.
// On such errors, the return value is NULL.
// This can succeed for zero-length files. In that case the accessors below
// will return length 0 and a valid pointer to 1 NUL byte.
// "seq" is an optimization hint: set to true if expected buffer access
// pattern is sequential.
F_NONNULL
gdnsd_fmap_t* gdnsd_fmap_new(const char* fn, const bool seq);
// Get the length of the mapped file data (zero is possible)
F_NONNULL F_PURE
size_t gdnsd_fmap_get_len(const gdnsd_fmap_t* fmap);
// Get the buffer pointer for the mapped file data (always a valid pointer)
F_NONNULL F_RETNN F_PURE
const void* gdnsd_fmap_get_buf(const gdnsd_fmap_t* fmap);
// Destructs the fmap_t object, which includes unmap() of the memory
// returned via fmap_get_buf() and closing the file descriptor, which
// implicitly also releases the fcntl advisory readlock.
// If a destruction step fails, this returns true (in which case the file data
// should perhaps be considered suspect, even if the caller managed to
// operate on it without error).
F_NONNULL
bool gdnsd_fmap_delete(gdnsd_fmap_t* fmap);
#pragma GCC visibility pop
#endif // GDNSD_FILE_H
|