1 /* $Id: bsd-statvfs.h,v 1.3 2014/01/17 07:48:22 dtucker Exp $ */ 2 3 /* 4 * Copyright (c) 2008,2014 Darren Tucker <dtucker@zip.com.au> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER 15 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 16 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #include "includes.h" 20 21 #if !defined(HAVE_STATVFS) || !defined(HAVE_FSTATVFS) 22 23 #include <sys/types.h> 24 25 #ifdef HAVE_SYS_MOUNT_H 26 #include <sys/mount.h> 27 #endif 28 #ifdef HAVE_SYS_STATFS_H 29 #include <sys/statfs.h> 30 #endif 31 32 #ifndef HAVE_FSBLKCNT_T 33 typedef unsigned long fsblkcnt_t; 34 #endif 35 #ifndef HAVE_FSFILCNT_T 36 typedef unsigned long fsfilcnt_t; 37 #endif 38 39 #ifndef ST_RDONLY 40 #define ST_RDONLY 1 41 #endif 42 #ifndef ST_NOSUID 43 #define ST_NOSUID 2 44 #endif 45 46 /* as defined in IEEE Std 1003.1, 2004 Edition */ 47 struct statvfs { 48 unsigned long f_bsize; /* File system block size. */ 49 unsigned long f_frsize; /* Fundamental file system block size. */ 50 fsblkcnt_t f_blocks; /* Total number of blocks on file system in */ 51 /* units of f_frsize. */ 52 fsblkcnt_t f_bfree; /* Total number of free blocks. */ 53 fsblkcnt_t f_bavail; /* Number of free blocks available to */ 54 /* non-privileged process. */ 55 fsfilcnt_t f_files; /* Total number of file serial numbers. */ 56 fsfilcnt_t f_ffree; /* Total number of free file serial numbers. */ 57 fsfilcnt_t f_favail; /* Number of file serial numbers available to */ 58 /* non-privileged process. */ 59 unsigned long f_fsid; /* File system ID. */ 60 unsigned long f_flag; /* BBit mask of f_flag values. */ 61 unsigned long f_namemax;/* Maximum filename length. */ 62 }; 63 #endif 64 65 #ifndef HAVE_STATVFS 66 int statvfs(const char *, struct statvfs *); 67 #endif 68 69 #ifndef HAVE_FSTATVFS 70 int fstatvfs(int, struct statvfs *); 71 #endif 72