1 /* 2 * Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #include "compatibility.h" 7 8 #include "fssh_stat.h" 9 10 #include <sys/stat.h> 11 12 #include "stat_util.h" 13 14 15 using FSShell::from_platform_stat; 16 using FSShell::to_platform_mode; 17 18 19 int 20 fssh_mkdir(const char *path, fssh_mode_t mode) 21 { 22 return mkdir(path, to_platform_mode(mode)); 23 } 24 25 26 int 27 fssh_stat(const char *path, struct fssh_stat *fsshStat) 28 { 29 struct stat st; 30 if (stat(path, &st) < 0) 31 return -1; 32 33 from_platform_stat(&st, fsshStat); 34 35 return 0; 36 } 37 38 39 int 40 fssh_fstat(int fd, struct fssh_stat *fsshStat) 41 { 42 struct stat st; 43 if (fstat(fd, &st) < 0) 44 return -1; 45 46 from_platform_stat(&st, fsshStat); 47 48 return 0; 49 } 50 51 52 int 53 fssh_lstat(const char *path, struct fssh_stat *fsshStat) 54 { 55 struct stat st; 56 if (lstat(path, &st) < 0) 57 return -1; 58 59 from_platform_stat(&st, fsshStat); 60 61 return 0; 62 } 63