Home | History | Annotate | Download | only in openbsd-compat
      1 /* $Id: bsd-statvfs.h,v 1.1 2008/06/08 17:32:29 dtucker Exp $ */
      2 
      3 /*
      4  * Copyright (c) 2008 Darren Tucker <dtucker (at) 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 #include <sys/types.h>
     22 
     23 #ifdef HAVE_SYS_STATFS_H
     24 #include <sys/statfs.h>
     25 #endif
     26 
     27 #ifndef HAVE_STATVFS
     28 
     29 #ifndef HAVE_FSBLKCNT_T
     30 typedef unsigned long fsblkcnt_t;
     31 #endif
     32 #ifndef HAVE_FSFILCNT_T
     33 typedef unsigned long fsfilcnt_t;
     34 #endif
     35 
     36 #ifndef ST_RDONLY
     37 #define ST_RDONLY	1
     38 #endif
     39 #ifndef ST_NOSUID
     40 #define ST_NOSUID	2
     41 #endif
     42 
     43 	/* as defined in IEEE Std 1003.1, 2004 Edition */
     44 struct statvfs {
     45 	unsigned long f_bsize;	/* File system block size. */
     46 	unsigned long f_frsize;	/* Fundamental file system block size. */
     47 	fsblkcnt_t f_blocks;	/* Total number of blocks on file system in */
     48 				/* units of f_frsize. */
     49 	fsblkcnt_t    f_bfree;	/* Total number of free blocks. */
     50 	fsblkcnt_t    f_bavail;	/* Number of free blocks available to  */
     51 				/* non-privileged process.  */
     52 	fsfilcnt_t    f_files;	/* Total number of file serial numbers. */
     53 	fsfilcnt_t    f_ffree;	/* Total number of free file serial numbers. */
     54 	fsfilcnt_t    f_favail;	/* Number of file serial numbers available to */
     55 				/* non-privileged process. */
     56 	unsigned long f_fsid;	/* File system ID. */
     57 	unsigned long f_flag;	/* BBit mask of f_flag values. */
     58 	unsigned long f_namemax;/*  Maximum filename length. */
     59 };
     60 #endif
     61 
     62 #ifndef HAVE_STATVFS
     63 int statvfs(const char *, struct statvfs *);
     64 #endif
     65 
     66 #ifndef HAVE_FSTATVFS
     67 int fstatvfs(int, struct statvfs *);
     68 #endif
     69