plars | 8505e2a | 2005-02-01 15:01:42 +0000 | [diff] [blame] | 1 | /* |
| 2 | * AUTHOR |
| 3 | * Ricky Ng-Adam <rngadam@yahoo.com>, 2005-01-01 |
| 4 | * |
| 5 | * DESCRIPTION |
| 6 | * Check if current directory is on a tmpfs filesystem |
| 7 | * If current directory is tmpfs, return 1 |
| 8 | * If current directory is NOT tmpfs, return 0 |
| 9 | * |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | #include <sys/vfs.h> |
| 14 | |
| 15 | #define TMPFS_MAGIC 0x01021994 /* man 2 statfs */ |
| 16 | |
subrata_modak | 88c166c | 2009-06-09 16:01:20 +0000 | [diff] [blame^] | 17 | int tst_is_cwd_tmpfs(void) |
plars | 8505e2a | 2005-02-01 15:01:42 +0000 | [diff] [blame] | 18 | { |
| 19 | struct statfs sf; |
| 20 | statfs(".", &sf); |
| 21 | |
| 22 | /* Verify that the file is not on a tmpfs (in-memory) filesystem */ |
| 23 | return sf.f_type == TMPFS_MAGIC?1:0; |
| 24 | } |