1262566Sdes/* $Id: bsd-statvfs.h,v 1.3 2014/01/17 07:48:22 dtucker Exp $ */ 2180750Sdes 3180750Sdes/* 4262566Sdes * Copyright (c) 2008,2014 Darren Tucker <dtucker@zip.com.au> 5180750Sdes * 6180750Sdes * Permission to use, copy, modify, and distribute this software for any 7180750Sdes * purpose with or without fee is hereby granted, provided that the above 8180750Sdes * copyright notice and this permission notice appear in all copies. 9180750Sdes * 10180750Sdes * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11180750Sdes * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12180750Sdes * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13180750Sdes * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14180750Sdes * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER 15180750Sdes * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 16180750Sdes * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17180750Sdes */ 18180750Sdes 19180750Sdes#include "includes.h" 20180750Sdes 21262566Sdes#if !defined(HAVE_STATVFS) || !defined(HAVE_FSTATVFS) 22262566Sdes 23180750Sdes#include <sys/types.h> 24180750Sdes 25262566Sdes#ifdef HAVE_SYS_MOUNT_H 26262566Sdes#include <sys/mount.h> 27262566Sdes#endif 28180750Sdes#ifdef HAVE_SYS_STATFS_H 29180750Sdes#include <sys/statfs.h> 30180750Sdes#endif 31180750Sdes 32180750Sdes#ifndef HAVE_FSBLKCNT_T 33180750Sdestypedef unsigned long fsblkcnt_t; 34180750Sdes#endif 35180750Sdes#ifndef HAVE_FSFILCNT_T 36180750Sdestypedef unsigned long fsfilcnt_t; 37180750Sdes#endif 38180750Sdes 39180750Sdes#ifndef ST_RDONLY 40180750Sdes#define ST_RDONLY 1 41180750Sdes#endif 42180750Sdes#ifndef ST_NOSUID 43180750Sdes#define ST_NOSUID 2 44180750Sdes#endif 45180750Sdes 46180750Sdes /* as defined in IEEE Std 1003.1, 2004 Edition */ 47180750Sdesstruct statvfs { 48180750Sdes unsigned long f_bsize; /* File system block size. */ 49180750Sdes unsigned long f_frsize; /* Fundamental file system block size. */ 50180750Sdes fsblkcnt_t f_blocks; /* Total number of blocks on file system in */ 51180750Sdes /* units of f_frsize. */ 52180750Sdes fsblkcnt_t f_bfree; /* Total number of free blocks. */ 53180750Sdes fsblkcnt_t f_bavail; /* Number of free blocks available to */ 54180750Sdes /* non-privileged process. */ 55180750Sdes fsfilcnt_t f_files; /* Total number of file serial numbers. */ 56180750Sdes fsfilcnt_t f_ffree; /* Total number of free file serial numbers. */ 57180750Sdes fsfilcnt_t f_favail; /* Number of file serial numbers available to */ 58180750Sdes /* non-privileged process. */ 59180750Sdes unsigned long f_fsid; /* File system ID. */ 60180750Sdes unsigned long f_flag; /* BBit mask of f_flag values. */ 61180750Sdes unsigned long f_namemax;/* Maximum filename length. */ 62180750Sdes}; 63180750Sdes#endif 64180750Sdes 65180750Sdes#ifndef HAVE_STATVFS 66180750Sdesint statvfs(const char *, struct statvfs *); 67180750Sdes#endif 68180750Sdes 69180750Sdes#ifndef HAVE_FSTATVFS 70180750Sdesint fstatvfs(int, struct statvfs *); 71180750Sdes#endif 72