| 1 |
/* COVERAGE: mount oldumount umount */ |
| 2 |
#include <sys/types.h> |
| 3 |
#include <sys/mount.h> |
| 4 |
#include <sys/mman.h> |
| 5 |
|
| 6 |
#ifndef MNT_FORCE |
| 7 |
#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ |
| 8 |
#endif |
| 9 |
|
| 10 |
#ifndef MNT_DETACH |
| 11 |
#define MNT_DETACH 0x00000002 /* Just detach from the tree */ |
| 12 |
#endif |
| 13 |
|
| 14 |
#ifndef MNT_EXPIRE |
| 15 |
#define MNT_EXPIRE 0x00000004 /* Mark for expiry */ |
| 16 |
#endif |
| 17 |
|
| 18 |
int main() |
| 19 |
{ |
| 20 |
mlockall(MCL_CURRENT); |
| 21 |
|
| 22 |
mount ("mount_source", "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments"); |
| 23 |
//staptest// mount ("mount_source", "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = -NNNN (ENOENT) |
| 24 |
|
| 25 |
umount("umount_target"); |
| 26 |
//staptest// umount ("umount_target", 0x0) = -NNNN (ENOENT!!!!EPERM) |
| 27 |
|
| 28 |
umount2("umount2_target", MNT_FORCE); |
| 29 |
//staptest// umount ("umount2_target", MNT_FORCE) = -NNNN (ENOENT!!!!EPERM) |
| 30 |
|
| 31 |
umount2("umount2_target", MNT_DETACH); |
| 32 |
//staptest// umount ("umount2_target", MNT_DETACH) = -NNNN (ENOENT!!!!EPERM) |
| 33 |
|
| 34 |
umount2("umount2_target", MNT_EXPIRE); |
| 35 |
//staptest// umount ("umount2_target", MNT_EXPIRE) = -NNNN (ENOENT!!!!EPERM) |
| 36 |
|
| 37 |
// Limits testing. |
| 38 |
mount ((char *)-1, "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments"); |
| 39 |
#ifdef __s390__ |
| 40 |
//staptest// mount (0x[7]?[f]+, "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = NNNN |
| 41 |
#else |
| 42 |
//staptest// mount (0x[f]+, "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = NNNN |
| 43 |
#endif |
| 44 |
|
| 45 |
mount ("mount_source", (char *)-1, "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments"); |
| 46 |
#ifdef __s390__ |
| 47 |
//staptest// mount ("mount_source", 0x[7]?[f]+, "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = NNNN |
| 48 |
#else |
| 49 |
//staptest// mount ("mount_source", 0x[f]+, "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = NNNN |
| 50 |
#endif |
| 51 |
|
| 52 |
mount ("mount_source", "mount_target", (char *)-1, MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments"); |
| 53 |
#ifdef __s390__ |
| 54 |
//staptest// mount ("mount_source", "mount_target", 0x[7]?[f]+, MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = NNNN |
| 55 |
#else |
| 56 |
//staptest// mount ("mount_source", "mount_target", 0x[f]+, MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = NNNN |
| 57 |
#endif |
| 58 |
|
| 59 |
mount ("mount_source", "mount_target", "ext2", (unsigned long)-1, "some arguments"); |
| 60 |
// We've got a problem here. On a 32-bit kernel (i686 for instance), |
| 61 |
// MAXSTRINGLEN is only 256. Passing a -1 as the mount flags value |
| 62 |
// produces a string of around 225 characters on newer kernels. So, |
| 63 |
// the full argument output gets truncated. So, we'll make the end |
| 64 |
// of the arguments optional. |
| 65 |
// |
| 66 |
//staptest// mount ("mount_source", "mount_target", "ext2", MS_[^ ]+[[[[|XXXX, "some arguments"]]]]?) = NNNN |
| 67 |
|
| 68 |
mount ("mount_source", "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, (void *)-1); |
| 69 |
#ifdef __s390__ |
| 70 |
//staptest// mount ("mount_source", "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, 0x[7]?[f]+) = NNNN |
| 71 |
#else |
| 72 |
//staptest// mount ("mount_source", "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, 0x[f]+) = NNNN |
| 73 |
#endif |
| 74 |
|
| 75 |
umount2((char *)-1, MNT_FORCE); |
| 76 |
#ifdef __s390__ |
| 77 |
//staptest// umount (0x[7]?[f]+, MNT_FORCE) = NNNN |
| 78 |
#else |
| 79 |
//staptest// umount (0x[f]+, MNT_FORCE) = NNNN |
| 80 |
#endif |
| 81 |
|
| 82 |
umount2("umount2_target", -1); |
| 83 |
//staptest// umount ("umount2_target", MNT_[^ ]+|XXXX) = NNNN |
| 84 |
|
| 85 |
return 0; |
| 86 |
} |