X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=fd.h;h=45d08b3a3e327c17e2050cbee7382de7fabee75e;hb=a00170132c28eeea61033d820c22e8d48d35a0fd;hp=4b802062d7207344ef3441542a3fe090ba18bd67;hpb=da40398fa79dc25801e7d276fd86da7439bd3e41;p=osl.git diff --git a/fd.h b/fd.h index 4b80206..45d08b3 100644 --- a/fd.h +++ b/fd.h @@ -8,12 +8,12 @@ int osl_open(const char *path, int flags, mode_t mode); int para_opendir(const char *dirname, DIR **dir, int *cwd); -int para_fchdir(int fd); int mmap_full_file(const char *filename, int open_mode, void **map, size_t *size, int *fd_ptr); int osl_munmap(void *start, size_t length); int write_all(int fd, const char *buf, size_t *len); int write_file(const char *filename, const void *buf, size_t size); +int truncate_file(const char *filename, off_t size); /** * A wrapper for mkdir(2). @@ -46,3 +46,10 @@ _static_inline_ int osl_rename(const char *old_path, const char *new_path) return -ERRNO_TO_ERROR(errno); return 1; } + +_static_inline_ int osl_stat(const char *path, struct stat *buf) +{ + if (stat(path, buf) >= 0) + return 1; + return -ERRNO_TO_ERROR(errno); +}