Created
July 26, 2018 19:52
-
-
Save NattyNarwhal/470158b4817cba60f5cb898ef290d97c to your computer and use it in GitHub Desktop.
mntctl/statfs congruency
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <sys/types.h> | |
#include <sys/mntctl.h> | |
#include <sys/vmount.h> | |
#include <sys/statfs.h> | |
int main(void) { | |
int needsize, ret; | |
struct vmount *mounts; | |
struct statfs64 fs; | |
mntctl (MCTL_QUERY, sizeof(needsize), &needsize); | |
mounts = malloc(needsize); | |
ret = mntctl (MCTL_QUERY, needsize, mounts); | |
for (int i = 0; i < ret; i++) { | |
statfs64 (vmt2dataptr(mounts, VMT_STUB), &fs); | |
printf ("FS mounted on %s has a vmount.vmt_gfstype %d and statfs64.f_vfstype of %d\n", vmt2dataptr(mounts, VMT_STUB), mounts->vmt_gfstype, fs.f_vfstype); | |
mounts = (void*)mounts + mounts->vmt_length; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment