2012-07-20 00:38:58 +00:00
|
|
|
/* Include appropriate headers for the OS, and define what will be used. */
|
2012-07-20 01:19:29 +00:00
|
|
|
#if defined (__FreeBSD__) || defined (__APPLE__)
|
2012-07-20 00:38:58 +00:00
|
|
|
# include <sys/param.h>
|
|
|
|
# include <sys/ucred.h>
|
|
|
|
# include <sys/mount.h>
|
2012-07-20 01:19:29 +00:00
|
|
|
# define GETMNTINFO
|
2012-07-20 00:38:58 +00:00
|
|
|
#else
|
2013-02-27 06:39:22 +00:00
|
|
|
#if defined __ANDROID__
|
2013-05-04 20:04:17 +00:00
|
|
|
/* Android is handled by the Haskell code, not here. */
|
2013-02-10 19:48:38 +00:00
|
|
|
# define UNKNOWN
|
|
|
|
#else
|
2012-07-20 00:38:58 +00:00
|
|
|
#if defined (__linux__) || defined (__FreeBSD_kernel__)
|
|
|
|
/* Linux or Debian kFreeBSD */
|
|
|
|
#include <mntent.h>
|
|
|
|
# define GETMNTENT
|
|
|
|
#else
|
|
|
|
# warning mounts listing code not available for this OS
|
|
|
|
# define UNKNOWN
|
|
|
|
#endif
|
|
|
|
#endif
|
2013-02-10 19:48:38 +00:00
|
|
|
#endif
|
2012-07-20 00:38:58 +00:00
|
|
|
|
2012-07-20 00:44:58 +00:00
|
|
|
#include <stdio.h>
|
2012-07-20 00:38:58 +00:00
|
|
|
|
|
|
|
#ifndef GETMNTENT
|
|
|
|
struct mntent {
|
|
|
|
char *mnt_fsname;
|
|
|
|
char *mnt_dir;
|
|
|
|
char *mnt_type;
|
|
|
|
char *mnt_opts; /* not filled in */
|
|
|
|
int mnt_freq; /* not filled in */
|
|
|
|
int mnt_passno; /* not filled in */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
FILE *mounts_start (void);
|
|
|
|
int mounts_end (FILE *fp);
|
|
|
|
struct mntent *mounts_next (FILE *fp);
|