/usr/include/boinc/lib/filesys.h is in libboinc-app-dev 7.9.3+dfsg-5.
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | // This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
#ifndef BOINC_FILESYS_H
#define BOINC_FILESYS_H
#if defined(_WIN32) && !defined(__CYGWIN32__)
#include "boinc_win.h"
#else
#include <dirent.h>
#include <grp.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/param.h>
#ifdef __cplusplus
#include <string>
#endif
#endif /* !WIN32 */
#ifndef MAXPATHLEN
#define MAXPATHLEN 4096
#endif
#define FILE_RETRY_INTERVAL 5
// On Windows, retry for this period of time, since some other program
// (virus scan, defrag, index) may have the file open.
#ifdef __cplusplus
extern "C" {
#endif
extern int boinc_delete_file(const char*);
extern int boinc_touch_file(const char *path);
extern FILE* boinc_fopen(const char* path, const char* mode);
// like fopen(), except:
// retry a few times on failure
// Unix: set close-on-exec flag
extern int boinc_copy(const char* orig, const char* newf);
extern int boinc_rename(const char* old, const char* newf);
extern int boinc_mkdir(const char*);
#ifdef _WIN32
extern int boinc_allocate_file(const char*, double size);
#else
extern int boinc_copy_attributes(const char* orig, const char* newf);
extern int boinc_chown(const char*, gid_t);
#endif
extern int boinc_rmdir(const char*);
extern void boinc_getcwd(char*);
extern void relative_to_absolute(const char* relname, char* path);
extern int boinc_make_dirs(const char*, const char*);
extern char boinc_failed_file[MAXPATHLEN];
extern int is_file(const char* path);
extern int is_dir(const char* path);
extern int is_file_follow_symlinks(const char* path);
extern int is_dir_follow_symlinks(const char* path);
extern int is_symlink(const char* path);
extern int boinc_truncate(const char*, double);
extern int boinc_file_exists(const char* path);
extern int boinc_file_or_symlink_exists(const char* path);
#ifdef _WIN32
extern FILE* boinc_temp_file(
const char* dir, const char* prefix, char* temp_path, double size
);
#else
extern FILE* boinc_temp_file(const char* dir, const char* prefix, char* temp_path);
#endif
extern void boinc_path_to_dir(const char* path, char* dir);
// given a file path, get path of its directory
// (i.e. remove the last / and what follows)
#ifdef __cplusplus
}
#endif
/* C++ specific prototypes/defines follow here */
#ifdef __cplusplus
extern int file_size(const char*, double&);
extern int clean_out_dir(const char*);
extern int dir_size(const char* dirpath, double&, bool recurse=true);
extern int get_filesystem_info(double& total, double& free, char* path=const_cast<char *>("."));
// TODO TODO TODO
// remove this code - the DirScanner class does the same thing.
// But need to rewrite a couple of places that use it
//
#if defined(_WIN32) && !defined(__CYGWIN32__)
typedef struct _DIR_DESC {
char path[MAXPATHLEN];
bool first;
void* handle;
} DIR_DESC;
typedef DIR_DESC *DIRREF;
#else
typedef DIR *DIRREF;
#endif
extern DIRREF dir_open(const char*);
extern int dir_scan(char*, DIRREF, int);
extern int dir_scan(std::string&, DIRREF);
extern void dir_close(DIRREF);
extern bool is_dir_empty(const char*);
class DirScanner {
#if defined(_WIN32) && !defined(__CYGWIN32__)
std::string dir;
bool first;
void* handle;
#else
DIR* dirp;
#endif
public:
DirScanner(std::string const& path);
~DirScanner();
bool scan(std::string& name); // return true if file returned
};
struct FILE_LOCK {
#if defined(_WIN32) && !defined(__CYGWIN32__)
HANDLE handle;
#else
int fd;
#endif
bool locked;
FILE_LOCK();
~FILE_LOCK();
int lock(const char* filename);
int unlock(const char* filename);
};
#endif /* c++ */
#endif /* double-inclusion protection */
|