1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
/*
Device Free
Gets listing of devices and their current capacities.
*/
#ifndef DF_H
#define DF_H
#include <stdio.h>
#include <db.h>
#include <sys/types.h>
#include <limits.h>
/*
* Command to run the df program:
*
* Should include required arguments.
*/
#if defined(__FreeBSD__)
# define DF_CMD "df -k"
#endif
#if defined(__HPUX__)
# define DF_CMD "df -Pk"
#endif
#if defined(__linux__)
# define DF_CMD "df -P --no-sync"
#endif
#if defined(__SOLARIS__)
# define DF_CMD "df -k"
#endif
/* All else, assume POSIX responsive. */
#ifndef DF_CMD
# define DF_CMD "df -P"
#endif
typedef struct {
char mounted_on[NAME_MAX + PATH_MAX];
char filesystem[NAME_MAX + PATH_MAX];
/* Size stats, in multiples of 1024 bytes. */
off_t total;
off_t used;
off_t available;
} df_stat_struct;
extern df_stat_struct **DiskFreeGetListing(int *total);
extern void DiskFreeDeleteListing(df_stat_struct **df_stat, int total);
#endif /* DF_H */
|