-
Notifications
You must be signed in to change notification settings - Fork 452
AppDev
David Anderson edited this page Aug 10, 2023
·
3 revisions
BOINC supplies various functions that may be useful in applications, such as cross-platform interfaces to operating system features.
General functions (in lib/util.cpp/h):
double dtime()
return Unix time with fractional seconds
double dday()
return Unix time at start of this day
void boinc_sleep(double)
sleep for given number of seconds
double drand(), rand_normal()
uniform and normal random numbers
read_file_string(const char* path, string&)
read file into string
File system functions (in lib/filesys.cpp/h):
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);
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_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 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 bool is_dir_empty(const char*);
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);
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);
class DirScanner; // for scanning directories
struct FILE_LOCK; // for locking a file
See lib/parse.cpp,h
See lib/str_util.h
Cross-platform support for strlcpy(), strlcat(), strcasestr() and strcasecmp() is in lib/str_replace.cpp,h
See lib/crypt.cpp,h
See lib/md5.cpp,h
See lib/synch.cpp,h
See lib/shmem.cpp,h
See lib/network.cpp,h
See lib/proc_control.cpp,h