1STATFS(2) 386BSD Programmer's Manual STATFS(2) 2 3NNAAMMEE 4 ssttaattffss - get file system statistics 5 6SSYYNNOOPPSSIISS 7 ##iinncclluuddee <<ssyyss//ttyyppeess..hh>> 8 ##iinncclluuddee <<ssyyss//mmoouunntt..hh>> 9 10 _i_n_t 11 ssttaattffss(_c_o_n_s_t _c_h_a_r *_p_a_t_h, _s_t_r_u_c_t _s_t_a_t_f_s *_b_u_f) 12 13 _i_n_t 14 ffssttaattffss(_i_n_t _f_d, _s_t_r_u_c_t _s_t_a_t_f_s *_b_u_f) 15 16DDEESSCCRRIIPPTTIIOONN 17 SSttaattffss() returns information about a mounted file system. _P_a_t_h is the 18 path name of any file within the mounted filesystem. _B_u_f is a pointer to 19 a ssttaattffss() structure defined as follows: 20 21 typedef quad fsid_t; 22 23 #define MNAMELEN 32 /* length of buffer for returned name */ 24 25 struct statfs { 26 short f_type; /* type of filesystem (see below) */ 27 short f_flags; /* copy of mount flags */ 28 long f_fsize; /* fundamental file system block size */ 29 long f_bsize; /* optimal transfer block size */ 30 long f_blocks; /* total data blocks in file system */ 31 long f_bfree; /* free blocks in fs */ 32 long f_bavail; /* free blocks avail to non-superuser */ 33 long f_files; /* total file nodes in file system */ 34 long f_ffree; /* free file nodes in fs */ 35 fsid_t f_fsid; /* file system id */ 36 long f_spare[6]; /* spare for later */ 37 char f_mntonname[MNAMELEN]; /* mount point */ 38 char f_mntfromname[MNAMELEN]; /* mounted filesystem */ 39 }; 40 /* 41 * File system types. 42 */ 43 #define MOUNT_UFS 1 44 #define MOUNT_NFS 2 45 #define MOUNT_MFS 3 46 #define MOUNT_PC 4 47 48 Fields that are undefined for a particular file system are set to -1. 49 FFssttaattffss() returns the same information about an open file referenced by 50 descriptor _f_d. 51 52RREETTUURRNN VVAALLUUEESS 53 Upon successful completion, a value of 0 is returned. Otherwise, -1 is 54 returned and the global variable _e_r_r_n_o is set to indicate the error. 55 56EERRRROORRSS 57 SSttaattffss() fails if one or more of the following are true: 58 59 [ENOTDIR] A component of the path prefix of _P_a_t_h is not a directory. 60 61 [EINVAL] _p_a_t_h contains a character with the high-order bit set. 62 63 [ENAMETOOLONG] 64 The length of a component of _p_a_t_h exceeds 255 characters, 65 66 or the length of _p_a_t_h exceeds 1023 characters. 67 68 [ENOENT] The file referred to by _p_a_t_h does not exist. 69 70 [EACCES] Search permission is denied for a component of the path 71 prefix of _p_a_t_h. 72 73 [ELOOP] Too many symbolic links were encountered in translating 74 _p_a_t_h. 75 76 [EFAULT] _B_u_f or _p_a_t_h points to an invalid address. 77 78 [EIO] An I/O error occurred while reading from or writing to the 79 file system. 80 81 FFssttaattffss() fails if one or both of the following are true: 82 83 [EBADF] _F_d is not a valid open file descriptor. 84 85 [EFAULT] _B_u_f points to an invalid address. 86 87 [EIO] An I/O error occurred while reading from or writing to the 88 file system. 89 90HHIISSTTOORRYY 91 The ssttaattffss function call is currently under development. 92 93BSD Experimental July 23, 1991 2 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