static void setup(void) { tst_require_root(); check_newipc(); tst_tmpdir(); TST_CHECKPOINT_INIT(tst_rmdir); }
static void setup(void) { check_newuser(); ltp_syscall(__NR_setns, -1, 0); tst_tmpdir(); TST_CHECKPOINT_INIT(NULL); }
void dochild(void) { int fd; struct flock flocks; #ifdef UCLINUX TST_CHECKPOINT_INIT(NULL); #endif fd = SAFE_OPEN(NULL, filename, O_RDWR); tst_resm(TINFO, "Child locks file"); flocks.l_type = F_WRLCK; flocks.l_whence = SEEK_CUR; flocks.l_start = recstart; flocks.l_len = reclen; if (fcntl(fd, F_SETLKW, &flocks) < 0) tst_brkm(TFAIL, NULL, "child fcntl failed"); TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0); tst_resm(TINFO, "Child unlocks file"); tst_exit(); }
static void setup(void) { check_newuser(); tst_tmpdir(); TST_CHECKPOINT_INIT(NULL); }
static void setup(void) { const char *fs_opts[3] = {"-b", "1024", NULL}; tst_sig(FORK, DEF_HANDLER, NULL); tst_require_root(); TEST_PAUSE; tst_tmpdir(); TST_CHECKPOINT_INIT(tst_rmdir); page_size = getpagesize(); device = tst_acquire_device(cleanup); if (!device) tst_brkm(TCONF, cleanup, "Failed to obtain block device"); tst_mkfs(cleanup, device, fs_type, fs_opts, "10240"); SAFE_MKDIR(cleanup, MNTPOINT, 0755); /* * Disable ext4 delalloc feature, so block will be allocated * as soon as possible */ SAFE_MOUNT(cleanup, device, MNTPOINT, fs_type, 0, "nodelalloc"); mount_flag = 1; SAFE_CHDIR(cleanup, MNTPOINT); chdir_flag = 1; }
static void setup(void) { tst_require_root(); check_iproute(IP_TUNTAP_MIN_VER); check_netns(); tst_tmpdir(); TST_CHECKPOINT_INIT(tst_rmdir); }
static void setup(void) { check_newuser(); tst_tmpdir(); TST_CHECKPOINT_INIT(NULL); if (access("/proc/self/setgroups", F_OK) == 0) setgroupstag = false; }
static void setup(void) { tst_sig(FORK, DEF_HANDLER, NULL); tst_tmpdir(); TST_CHECKPOINT_INIT(tst_rmdir); TEST_PAUSE; }
int main(void) { TST_CHECKPOINT_INIT(NULL); TST_SAFE_CHECKPOINT_WAKE(NULL, 0); for (;;) { sleep(1); } return 0; }
static void setup(void) { tst_sig(FORK, DEF_HANDLER, cleanup); tst_tmpdir(); TST_CHECKPOINT_INIT(tst_rmdir); umask(0); TEST_PAUSE; }
static void setup(char *app) { tst_sig(FORK, DEF_HANDLER, cleanup); tst_tmpdir(); TST_RESOURCE_COPY(cleanup, TEST_APP, NULL); TST_CHECKPOINT_INIT(&checkpoint); TEST_PAUSE; }
void setup(void) { char path[PATH_MAX]; if (tst_get_path(TEST_APP, path, sizeof(path))) { tst_brkm(TBROK, NULL, "Couldn't found "TEST_APP" binary in $PATH"); } tst_tmpdir(); TST_CHECKPOINT_INIT(tst_rmdir); SAFE_CP(tst_rmdir, path, "."); }
static void setup(void) { tst_require_root(); /* Just a sanity check of the existence of syscall */ ltp_syscall(__NR_process_vm_writev, getpid(), NULL, 0UL, NULL, 0UL, 0UL); bufsz = sflag ? SAFE_STRTOL(NULL, sz_opt, 1, LONG_MAX - PADDING_SIZE * 2) : 100000; tst_tmpdir(); TST_CHECKPOINT_INIT(cleanup); TEST_PAUSE; }
static void do_child(void) { int fd; #ifdef UCLINUX TST_CHECKPOINT_INIT(NULL); #endif if ((fd = open(TEST_APP, O_WRONLY)) == -1) { perror("open failed"); exit(1); } TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0); exit(0); }
static void setup(void) { struct statvfs fs; srand(getpid()); tst_tmpdir(); SAFE_MKDIR(tst_rmdir, MOUNT_DIR, 0777); TST_CHECKPOINT_INIT(tst_rmdir); if (statvfs(".", &fs) == -1) tst_brkm(TFAIL | TERRNO, tst_rmdir, "statvfs failed"); if ((fs.f_flag & MS_MANDLOCK)) return; tst_resm(TINFO, "TMPDIR does not support mandatory locks"); fs_type = tst_dev_fs_type(); device = tst_acquire_device(cleanup); if (!device) tst_brkm(TCONF, cleanup, "Failed to obtain block device"); /* the kernel returns EPERM when CONFIG_MANDATORY_FILE_LOCKING is not * supported - to avoid false negatives, mount the fs first without * flags and then remount it as MS_MANDLOCK */ tst_mkfs(cleanup, device, fs_type, NULL, NULL); SAFE_MOUNT(cleanup, device, MOUNT_DIR, fs_type, 0, NULL); mount_flag = 1; if (mount(NULL, MOUNT_DIR, NULL, MS_REMOUNT|MS_MANDLOCK, NULL) == -1) { if (errno == EPERM) { tst_brkm(TCONF, cleanup, "Mandatory locking (likely) " "not supported by this system"); } else { tst_brkm(TBROK | TERRNO, cleanup, "Remount with MS_MANDLOCK failed"); } } }
void setup(void) { tst_sig(FORK, DEF_HANDLER, cleanup); TEST_PAUSE; tst_tmpdir(); TST_CHECKPOINT_INIT(tst_rmdir); /* get an IPC resource key */ semkey = getipckey(); /* create a semaphore set with read and alter permissions */ sem_id_1 = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA); if (sem_id_1 == -1) tst_brkm(TBROK, cleanup, "couldn't create semaphore in setup"); }
static void setup(void) { int fd; tst_sig(FORK, DEF_HANDLER, cleanup); TEST_PAUSE; tst_tmpdir(); TST_CHECKPOINT_INIT(tst_rmdir); fd = creat(FILE_NAME, 0666); if (fd < 0) { tst_resm(TBROK, "creating a new file failed"); cleanup(); } close(fd); }