这篇教程C++ tst_sig函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tst_sig函数的典型用法代码示例。如果您正苦于以下问题:C++ tst_sig函数的具体用法?C++ tst_sig怎么用?C++ tst_sig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tst_sig函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: setup/* * setup() * performs all ONE TIME setup for this test */void setup(void){ /* capture signals */ tst_sig(FORK, DEF_HANDLER, cleanup); /* Set up the expected error numbers for -e option */ TEST_EXP_ENOS(exp_enos); /* Pause if that option was specified. * TEST_PAUSE contains the code to fork the test with the -i option. * You want to make sure you do this before you create your temporary * directory. */ TEST_PAUSE; /* Create a unique temporary directory and chdir() to it. */ tst_tmpdir(); strcpy(name, DATA_FILE);#if 0 /* This doesn't work in the simulator due to floating point instructions */ sprintf(f_name, "%s.%d", name, getpid());#else /* This works fine -- no floating point instructions executed */ strcpy(f_name, name); strcat(f_name, "."); sprintf(f_name+strlen(f_name), "%d", getpid());#endif bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0); if (bad_addr == MAP_FAILED) { printf("mmap failed/n"); } wr_iovec[7].iov_base = bad_addr;}
开发者ID:alexjohn1362,项目名称:rose,代码行数:41,
示例2: setupvoid setup(void){ struct passwd *ltpuser; char *bad_addr; tst_sig(NOFORK, DEF_HANDLER, cleanup); tst_require_root(NULL); ltpuser = SAFE_GETPWNAM(cleanup, "nobody"); SAFE_SETEUID(cleanup, ltpuser->pw_uid); TEST_PAUSE; tst_tmpdir(); SAFE_TOUCH(cleanup, TEST_FILE1, NEW_MODE, NULL); SAFE_TOUCH(cleanup, "t_file", FILE_MODE, NULL);#if !defined(UCLINUX) test_cases[2].pathname = (char *)get_high_address(); bad_addr = SAFE_MMAP(cleanup, 0, 1, PROT_NONE, MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0); test_cases[3].pathname = bad_addr;#endif memset(long_pathname, 'a', PATH_MAX + 1); SAFE_MKDIR(cleanup, TEST_DIR1, DIR_MODE); SAFE_TOUCH(cleanup, TEST_FILE3, FILE_MODE, NULL); SAFE_SYMLINK(cleanup, TEST_SYM1, TEST_SYM2); SAFE_SYMLINK(cleanup, TEST_SYM2, TEST_SYM1);}
开发者ID:cjp0209,项目名称:ltp,代码行数:37,
示例3: setupvoid setup(void){ char tst_buff[BUF_SIZE]; int wbytes; int write_len = 0; tst_sig(NOFORK, DEF_HANDLER, cleanup); ltpuser = getpwnam(nobody_uid); if (ltpuser == NULL) tst_brkm(TBROK | TERRNO, NULL, "getpwnam failed"); if (setuid(ltpuser->pw_uid) == -1) tst_brkm(TBROK | TERRNO, NULL, "setuid failed"); TEST_PAUSE; tst_tmpdir(); fildes = open(TESTFILE, O_WRONLY | O_CREAT, FILE_MODE); if (fildes == -1) tst_brkm(TBROK | TERRNO, cleanup, "open failed"); /* Fill the test buffer with the known data */ memset(tst_buff, 'a', BUF_SIZE - 1); /* Write to the file 1k data from the buffer */ while (write_len < FILE_SIZE) { if ((wbytes = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) tst_brkm(TBROK | TERRNO, cleanup, "write failed"); else write_len += wbytes; } user_id = getuid(); group_id = getgid();}
开发者ID:MohdVara,项目名称:ltp,代码行数:37,
示例4: setup/* * void * setup() - Performs setup function for the test. * Creat a temporary directory and chdir to it. * Creat a test file and write some data into it. * Get the user/group id info. of test process. */void setup(){ char tst_buff[BUF_SIZE]; /* data buffer */ int wbytes; /* no. of bytes written */ int write_len = 0; /* data length */ tst_require_root(NULL); ltpuser = getpwnam(nobody_uid); if (ltpuser == NULL) tst_brkm(TBROK|TERRNO, NULL, "getpwnam failed"); if (setuid(ltpuser->pw_uid) == -1) tst_brkm(TBROK|TERRNO, NULL, "setuid failed"); tst_sig(NOFORK, DEF_HANDLER, cleanup); TEST_PAUSE; tst_tmpdir(); fildes = open(TESTFILE, O_RDWR | O_CREAT, FILE_MODE); if (fildes == -1) tst_brkm(TBROK|TERRNO, cleanup, "open failed"); memset(tst_buff, 'a', BUF_SIZE-1); while (write_len < FILE_SIZE) { if ((wbytes = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) tst_brkm(TBROK|TERRNO, cleanup, "write failed"); else write_len += wbytes; } user_id = getuid(); group_id = getgid();}
开发者ID:joyforu,项目名称:android-ltp-ndk,代码行数:44,
示例5: setup/* * void * setup() - performs all ONE TIME setup for this test. * Initialise signal set with the list that includes/excludes * all system-defined signals. * Set the signal handler to catch SIGALRM signal. * Get the current signal mask of test process using sigprocmask(). */void setup(void){ tst_sig(FORK, DEF_HANDLER, cleanup); TEST_PAUSE; /* * Initialise the signal sets with the list that * excludes/includes all system-defined signals. */ if (sigemptyset(&sigset) == -1) { tst_brkm(TFAIL, cleanup, "sigemptyset() failed, errno=%d : %s", errno, strerror(errno)); } if (sigfillset(&sigset2) == -1) { tst_brkm(TFAIL, cleanup, "sigfillset() failed, errno=%d : %s", errno, strerror(errno)); } /* Set the signal handler function to catch the signal */ sa_new.sa_handler = sig_handler; if (sigaction(SIGALRM, &sa_new, 0) == -1) { tst_brkm(TFAIL, cleanup, "sigaction() failed, errno=%d : %s", errno, strerror(errno)); } /* Read the test process's current signal mask. */ if (sigprocmask(SIG_UNBLOCK, 0, &sigset1) == -1) { tst_brkm(TFAIL, cleanup, "sigprocmask() Failed, errno=%d : %s", errno, strerror(errno)); }}
开发者ID:AbhiramiP,项目名称:ltp,代码行数:45,
示例6: setup/* * void * setup() - performs all ONE TIME setup for this test. * Create a temporary directory and change directory to it. * Create a test directory under temporary directory and open it */void setup(){ tst_sig(NOFORK, DEF_HANDLER, cleanup); /* Switch to nobody user for correct error code collection */ if (geteuid() != 0) { tst_brkm(TBROK, NULL, "Test must be run as root"); } ltpuser = getpwnam(nobody_uid); if (setuid(ltpuser->pw_uid) == -1) { tst_resm(TINFO, "setuid failed to " "to set the effective uid to %d", ltpuser->pw_uid); perror("setuid"); } /* * Pause if that option was specified */ TEST_PAUSE; tst_tmpdir(); /* * create a new directory and open it */ if ((r_val = mkdir(TEST_DIR, MODES)) == -1) { tst_brkm(TBROK, cleanup, "%s - mkdir() in main() " "failed", TCID); } if ((fd = open(TEST_DIR, O_RDONLY)) == -1) { tst_brkm(TBROK, cleanup, "open of directory failed"); }}
开发者ID:piet-delaney,项目名称:android-ltp-ndk,代码行数:43,
示例7: setupvoid setup(void){ struct passwd *ltpuser; int i; tst_require_root(NULL); tst_sig(NOFORK, DEF_HANDLER, cleanup); ltpuser = SAFE_GETPWNAM(cleanup, "nobody"); SAFE_SETEUID(cleanup, ltpuser->pw_uid); TEST_PAUSE; tst_tmpdir(); SAFE_MKDIR(cleanup, DIR_TEMP, MODE_RWX); SAFE_TOUCH(cleanup, TEST_FILE1, 0666, NULL); SAFE_SYMLINK(cleanup, TEST_FILE1, SYM_FILE1); SAFE_CHMOD(cleanup, DIR_TEMP, FILE_MODE); SAFE_TOUCH(cleanup, TEST_FILE2, 0666, NULL); SAFE_SYMLINK(cleanup, TEST_FILE2, SYM_FILE2); memset(longpathname, 'a', PATH_MAX + 1); SAFE_TOUCH(cleanup, TEST_FILE3, 0666, NULL); /* * NOTE: the ELOOP test is written based on that the consecutive * symlinks limit in kernel is hardwired to 40. */ SAFE_MKDIR(cleanup, "test_eloop", MODE_RWX); SAFE_SYMLINK(cleanup, "../test_eloop", "test_eloop/test_eloop"); for (i = 0; i < 43; i++) strcat(elooppathname, ELOOPFILE);}
开发者ID:qyxia,项目名称:ltp,代码行数:37,
示例8: setup/* * void * setup() - performs all ONE TIME setup for this test. * Create a temporary directory and change directory to it. * Create a test file under temporary directory and write some * data into it. */void setup(){ /* capture signals */ tst_sig(NOFORK, DEF_HANDLER, cleanup); /* Pause if that option was specified * TEST_PAUSE contains the code to fork the test with the -i option. * You want to make sure you do this before you create your temporary * directory. */ TEST_PAUSE; /* make a temp directory and cd to it */ tst_tmpdir(); /* Copy some data into data buffer */ strcpy(write_buffer, "abcdefghijklmnopqrstuvwxyz"); /* Creat a temporary file under above directory */ if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { tst_brkm(TBROK, cleanup, "open(%s, O_RDWR | O_CREAT, %#o) Failed, errno=%d :%s", TEMP_FILE, FILE_MODE, errno, strerror(errno)); /*NOTREACHED*/ } /* Write the buffer data into file */ if (write(fildes, write_buffer, strlen(write_buffer)+1) != / strlen(write_buffer)+1) { tst_brkm(TBROK, cleanup, "write() failed to write buffer data to %s", TEMP_FILE); /*NOTREACHED*/ } } /* End setup() */
开发者ID:CSU-GH,项目名称:okl4_3.0,代码行数:44,
示例9: setup/* * void * setup() - performs all ONE TIME setup for this test. * Create a temporary directory and change directory to it. * Call test specific setup functions. */void setup(void){ int ind; tst_sig(NOFORK, DEF_HANDLER, cleanup); /* Pause if that option was specified * TEST_PAUSE contains the code to fork the test with the -i option. * You want to make sure you do this before you create your temporary * directory. */ TEST_PAUSE; /* Switch to nobody user for correct error code collection */ if (geteuid() != 0) { tst_brkm(TBROK, NULL, "Test must be run as root"); } ltpuser = getpwnam(nobody_uid); if (setuid(ltpuser->pw_uid) == -1) tst_resm(TINFO | TERRNO, "setuid(%d) failed", ltpuser->pw_uid); tst_tmpdir();#if !defined(UCLINUX) bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0); if (bad_addr == MAP_FAILED) { tst_brkm(TBROK, cleanup, "mmap failed"); } Test_cases[3].link = bad_addr;#endif /* call individual setup functions */ for (ind = 0; Test_cases[ind].desc != NULL; ind++) { Test_cases[ind].setupfunc(); }}
开发者ID:dacongy,项目名称:ltp,代码行数:43,
示例10: setup/* * setup(void) - performs all ONE TIME setup for this test. * Exit the test program on receipt of unexpected signals. * Create a temporary directory and change directory to it. * Invoke individual test setup functions according to the order * set in struct. definition. */void setup(){ int ind; /* Capture unexpected signals */ tst_sig(FORK, DEF_HANDLER, cleanup); /* Switch to nobody user for correct error code collection */ if (geteuid() != 0) { tst_brkm(TBROK, NULL, "Test must be run as root"); } ltpuser = getpwnam(nobody_uid); if (setuid(ltpuser->pw_uid) == -1) { tst_resm(TINFO, "setuid failed to " "to set the effective uid to %d", ltpuser->pw_uid); perror("setuid"); } TEST_PAUSE; /* Make a temp dir and cd to it */ tst_tmpdir();#if !defined(UCLINUX) bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0); if (bad_addr == MAP_FAILED) { tst_brkm(TBROK, cleanup, "mmap failed"); } Test_cases[2].pathname = bad_addr;#endif /* call individual setup functions */ for (ind = 0; Test_cases[ind].desc != NULL; ind++) { Test_cases[ind].setupfunc(); }}
开发者ID:shubmit,项目名称:shub-ltp,代码行数:44,
示例11: setupvoid setup(char *argv0){ char *cmd, *pwd = NULL; char test_path[MAXPATHLEN]; tst_require_root(NULL); if (test_app[0] == '/') strncpy(test_path, test_app, sizeof(test_path)); else { if ((pwd = get_current_dir_name()) == NULL) tst_brkm(TBROK|TERRNO, NULL, "getcwd failed"); snprintf(test_path, sizeof(test_path), "%s/%s", pwd, basename(test_app)); free(pwd); } cmd = malloc(strlen(test_path) + strlen("cp -p /"") + strlen("/" .") + 1); if (cmd == NULL) tst_brkm(TBROK|TERRNO, NULL, "Cannot alloc command string"); tst_sig(FORK, DEF_HANDLER, cleanup); tst_tmpdir(); sprintf(cmd, "cp -p /"%s/" .", test_path); if (system(cmd) != 0) tst_brkm(TBROK, NULL, "command failed: %s", cmd); free(cmd); umask(0); ltpuser1 = my_getpwnam(user1name);}
开发者ID:shubmit,项目名称:shub-ltp,代码行数:37,
示例12: setup/* * setup() * performs all ONE TIME setup for this test */void setup(void){ tst_sig(FORK, DEF_HANDLER, cleanup); if (getpwnam("nobody") == NULL) { tst_brkm(TBROK, NULL, "nobody must be a valid user."); tst_exit(); } if (getpwnam("bin") == NULL) { tst_brkm(TBROK, NULL, "bin must be a valid user."); tst_exit(); } /* Check that the test process id is root */ if (geteuid() != 0) { tst_brkm(TBROK, NULL, "Must be root for this test!"); tst_exit(); } root = *(getpwnam("root")); root_pw_uid = root.pw_uid; nobody = *(getpwnam("nobody")); nobody_pw_uid = nobody.pw_uid; bin = *(getpwnam("bin")); bin_pw_uid = bin.pw_uid; /* Pause if that option was specified * TEST_PAUSE contains the code to fork the test with the -i option. * You want to make sure you do this before you create your temporary * directory. */ TEST_PAUSE;}
开发者ID:dacongy,项目名称:ltp,代码行数:41,
示例13: setupvoid setup(void){ tst_sig(NOFORK, DEF_HANDLER, cleanup); tst_tmpdir(); char *abs_path = tst_get_tmpdir(); int p = getpid(); /* Initialize test dir and file names */ sprintf(pathname, "faccessattestdir%d", p); sprintf(testfile, "faccessattestfile%d.txt", p); sprintf(testfile2, "%s/faccessattestfile%d.txt", abs_path, p); sprintf(testfile3, "faccessattestdir%d/faccessattestfile%d.txt", p, p); free(abs_path); SAFE_MKDIR(cleanup, pathname, 0700); fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY); fds[1] = fds[4] = fds[0]; SAFE_OPEN(cleanup, testfile, O_CREAT | O_RDWR, 0600); SAFE_OPEN(cleanup, testfile2, O_CREAT | O_RDWR, 0600); fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600); fds[3] = 100; fds[5] = AT_FDCWD; filenames[0] = filenames[2] = filenames[3] = filenames[4] = testfile; filenames[1] = testfile2; filenames[5] = testfile3; TEST_PAUSE;}
开发者ID:JanyHuang,项目名称:ltp,代码行数:37,
示例14: setup/*************************************************************** * setup() - performs all ONE TIME setup for this test. ***************************************************************/void setup(){ tst_sig(NOFORK, DEF_HANDLER, cleanup); TEST_PAUSE; tst_tmpdir(); sprintf(fname, "tfile_%d", getpid()); if ((fd = open(fname, O_RDWR | O_CREAT, 0700)) == -1) { tst_brkm(TBROK, cleanup, "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, errno, strerror(errno)); } /* write the TCID to the file */ if (write(fd, TCID, strlen(TCID)) == -1) { tst_brkm(TBROK, cleanup, "write(fd, TCID, strlen(TCID))Failed, errno=%d : %s", errno, strerror(errno)); } close(fd);}
开发者ID:shubmit,项目名称:shub-ltp,代码行数:27,
示例15: setup/*************************************************************** * setup() - performs all ONE TIME setup for this test. ***************************************************************/void setup(void){ int ind; tst_sig(NOFORK, DEF_HANDLER, cleanup); TEST_PAUSE; tst_tmpdir();#if !defined(UCLINUX) bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0); if (bad_addr == MAP_FAILED) { tst_brkm(TBROK, cleanup, "mmap failed"); } Test_cases[6].pathname = bad_addr;#endif for (ind = 0; Test_cases[ind].desc != NULL; ind++) { Test_cases[ind].setupfunc(); }}
开发者ID:ruanzhengwang,项目名称:ltp,代码行数:27,
示例16: setupvoid setup(void){ long hpage_size; tst_require_root(NULL); tst_sig(FORK, DEF_HANDLER, cleanup); tst_tmpdir(); orig_hugepages = get_sys_tune("nr_hugepages"); set_sys_tune("nr_hugepages", hugepages, 1); hpage_size = read_meminfo("Hugepagesize:") * 1024; shm_size = hpage_size * hugepages / 2; update_shm_size(&shm_size); shmkey = getipckey(); shm_id_1 = shmget(shmkey, shm_size, SHM_HUGETLB | SHM_RW | IPC_CREAT | IPC_EXCL); if (shm_id_1 == -1) tst_brkm(TBROK | TERRNO, cleanup, "shmget"); ltp_uid = getuserid(ltp_user); TEST_PAUSE;}
开发者ID:MohdVara,项目名称:ltp,代码行数:24,
示例17: setup/* * setup() - performs all ONE TIME setup for this test. */voidsetup(){ /* capture signals */ tst_sig(NOFORK, DEF_HANDLER, cleanup); /* Pause if that option was specified */ TEST_PAUSE; /* make a temporary directory and cd to it */ tst_tmpdir(); /* * create a file and use it to test whether chroot() is setting * ENOTDIR if the argument is not a directory. */ (void) sprintf(fname, "tfile_%d", getpid()); if ((fd = creat(fname, 0777)) == -1) { tst_brkm(TBROK, cleanup, "Failed to creat a temp file"); } /* * set up good_dir to test whether chroot() is setting ENOENT if the * directory does not exist. */ (void)sprintf(good_dir, "%s.%d", good_dir, getpid()); bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE_EXCEPT_UCLINUX|MAP_ANONYMOUS, 0, 0); if (bad_addr == MAP_FAILED) { tst_brkm(TBROK, cleanup, "mmap failed"); }#if !defined(UCLINUX) TC[3].dir = bad_addr;#endif}
开发者ID:CSU-GH,项目名称:okl4_3.0,代码行数:39,
示例18: setup/* * setup() - performs all one time setup for this test. */void setup(){ int ret; /* set up expected error numbers */ TEST_EXP_ENOS(exp_enos); /* capture the signals */ tst_sig(NOFORK, DEF_HANDLER, cleanup); /* Test should be executed as root user */ if (geteuid() != 0) { tst_brkm(TBROK, NULL, "Test must be run as root"); } /* Keep the host name before starting the test */ if ((ret = gethostname(hname, sizeof(hname))) < 0) { tst_brkm(TBROK, NULL, "gethostname() failed while" " getting current host name"); } /* Pause if the option was specified */ TEST_PAUSE;}
开发者ID:shubmit,项目名称:shub-ltp,代码行数:27,
示例19: setup/* * setup() - performs all ONE TIME setup for this test. * * Initialize/allocate write buffer. * Call individual setup function. */void setup(){ int i; /* counter for setup functions */ /* capture signals */ tst_sig(NOFORK, DEF_HANDLER, cleanup); /* see the comment in the sighandler() function */ /* call signal() to trap the signal generated */ if (signal(SIGXFSZ, sighandler) == SIG_ERR) { tst_brkm(TBROK, cleanup, "signal() failed"); } /* Pause if that option was specified */ TEST_PAUSE; /* Allocate/Initialize the write buffer with known data */ init_buffers(); /* Call individual setup functions */ for (i = 0; Test_cases[i].desc != NULL; i++) { Test_cases[i].setupfunc(); }}
开发者ID:ystk,项目名称:debian-ltp,代码行数:30,
示例20: setupvoid setup(void){ int sem_q; tst_sig(NOFORK, DEF_HANDLER, cleanup); TEST_PAUSE; tst_tmpdir(); while ((sem_q = semget(IPC_PRIVATE, PSEMS, IPC_CREAT | IPC_EXCL)) != -1) { sem_id_arr[num_sems++] = sem_q; if (num_sems == MAXIDS) { tst_brkm(TBROK, cleanup, "The maximum number of " "semaphore ID's has been/n/t reached. Please " "increase the MAXIDS value in the test."); } } if (errno != ENOSPC) { tst_brkm(TBROK, cleanup, "Didn't get ENOSPC in test setup" " - errno = %d : %s", errno, strerror(errno)); }}
开发者ID:1587,项目名称:ltp,代码行数:24,
示例21: setup/* * setup() - performs all ONE TIME setup for this test. */void setup(){ tst_sig(NOFORK, DEF_HANDLER, cleanup); TEST_PAUSE; /* Create a temporary directory and make it current. */ tst_tmpdir(); sprintf(fname, "./tfile_%d", getpid()); do_file_setup(fname);#if !defined(UCLINUX) bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0); if (bad_addr == MAP_FAILED) { tst_brkm(TBROK, cleanup, "mmap failed"); } TC[0].fd2 = bad_addr; TC[1].fd = bad_addr;#endif}
开发者ID:Mellanox,项目名称:arc_ltp,代码行数:27,
示例22: setup/* * setup() - performs all ONE TIME setup for this test. */void setup(void){ tst_sig(NOFORK, DEF_HANDLER, cleanup); TEST_PAUSE; /* make a temporary directory and cd to it */ tst_tmpdir(); /* * create a new directory and open it */ if ((r_val = mkdir(TEST_DIR, MODES)) == -1) { tst_brkm(TBROK, cleanup, "%s - mkdir() in main() " "failed", TCID); } if ((fd = open(TEST_DIR, O_RDONLY)) == -1) { tst_brkm(TBROK, cleanup, "open of directory failed"); }}
开发者ID:1587,项目名称:ltp,代码行数:27,
示例23: setup/*************************************************************** * setup() - performs all ONE TIME setup for this test. ***************************************************************/void setup(char *path){ search_path(path, subprog_path, X_OK, 1); tst_sig(FORK, DEF_HANDLER, cleanup); TEST_PAUSE; /* create a temporary directory and go to it */ tst_tmpdir(); /* set up a named pipe (write side gets CLOSE-ON-EXEC) */ if (mkfifo(FIFONAME, 0666) == -1) { tst_brkm(TBROK, cleanup, "mkfifo of named pipe %s failed errno %d (%s)", FIFONAME, errno, strerror(errno)); } if ((npipe_fd = open(FIFONAME, O_RDWR, 0666)) == -1) { tst_brkm(TBROK, cleanup, "Open of named pipe %s failed errno %d (%s)", File1, errno, strerror(errno)); }}
开发者ID:Altiscale,项目名称:sig-core-t_ltp,代码行数:27,
示例24: setupvoid setup(void){ tst_sig(NOFORK, DEF_HANDLER, cleanup); tst_require_root(); ltpuser = getpwnam(nobody_uid); if (ltpuser == NULL) tst_brkm(TBROK | TERRNO, NULL, "getpwnam failed"); SAFE_SETEUID(NULL, ltpuser->pw_uid); TEST_PAUSE; tst_tmpdir(); /* * Create a test file under temporary directory with specified * mode permissios and set the ownership of the test file to the * uid/gid of guest user. */ if ((fd = open(TESTFILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) tst_brkm(TBROK | TERRNO, cleanup, "open failed");}
开发者ID:kraj,项目名称:ltp,代码行数:24,
示例25: setupstatic void setup(void){ tst_sig(FORK, DEF_HANDLER, cleanup); tst_require_root(); tst_timer_check(CLOCK_MONOTONIC); /* Backup and set the lease-break-time. */ SAFE_FILE_SCANF(NULL, PATH_LS_BRK_T, "%d", &ls_brk_t); SAFE_FILE_PRINTF(NULL, PATH_LS_BRK_T, "%d", 45); tst_tmpdir(); switch ((type = tst_fs_type(cleanup, "."))) { case TST_NFS_MAGIC: case TST_RAMFS_MAGIC: case TST_TMPFS_MAGIC: tst_brkm(TCONF, cleanup, "Cannot do fcntl(F_SETLEASE, F_WRLCK) " "on %s filesystem", tst_fs_type_name(type)); default: break; } SAFE_TOUCH(cleanup, "file", FILE_MODE, NULL); sigemptyset(&newset); sigaddset(&newset, SIGIO); if (sigprocmask(SIG_SETMASK, &newset, &oldset) < 0) tst_brkm(TBROK | TERRNO, cleanup, "sigprocmask() failed"); TEST_PAUSE;}
开发者ID:CSRedRat,项目名称:ltp,代码行数:36,
示例26: setup/* * setup() - performs all the ONE TIME setup for this test. */void setup(void){ tst_sig(FORK, sighandler, cleanup); TEST_PAUSE; /* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. * See ../lib/libipc.c for more information. */ tst_tmpdir(); /* get an IPC resource key */ semkey = getipckey(); /* create a semaphore set with read and alter permissions */ /* and PSEMS "primitive" semaphores */ if ((sem_id_1 = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA)) == -1) { tst_brkm(TBROK, cleanup, "couldn't create semaphore in setup"); }}
开发者ID:Nan619,项目名称:ltp,代码行数:27,
示例27: setup/* * setup() - performs all ONE TIME setup for this test */voidsetup(){ /* * capture signals */ tst_sig(FORK, DEF_HANDLER, cleanup); umask(0); /* * Pause if that option was specified */ TEST_PAUSE; /* * make a temp directory and cd to it */ tst_tmpdir(); strcpy(fnamebuf, "fork07."); sprintf(pbuf, "%d", getpid()); strcat(fnamebuf, pbuf);}
开发者ID:CSU-GH,项目名称:okl4_3.0,代码行数:27,
示例28: setup/* setup() - performs all ONE TIME setup for this test */void setup(void){ tst_require_root(NULL); tim_save.modes = 0; tst_sig(NOFORK, DEF_HANDLER, cleanup); /* set the expected errnos... */ TEST_EXP_ENOS(exp_enos); /* set the HZ from sysconf */ hz = sysconf(_SC_CLK_TCK); if (hz == -1) { tst_brkm(TBROK, NULL, "Failed to read the HZ from sysconf/n"); } TEST_PAUSE; /* Save current parameters in tim_save */ if ((adjtimex(&tim_save)) == -1) { tst_brkm(TBROK, NULL, "Failed to save current parameters"); }}
开发者ID:MohdVara,项目名称:ltp,代码行数:25,
示例29: setup/* * setup() - performs all the ONE TIME setup for this test. */void setup(void){ tst_sig(NOFORK, DEF_HANDLER, cleanup); TEST_PAUSE; /* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. * See ../lib/libipc.c for more information. */ tst_tmpdir(); msgkey = getipckey(); /* create a message queue with read/write permissions */ if ((msg_q_1 = msgget(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW)) == -1) { tst_brkm(TBROK, cleanup, "Can't create message queue"); } /* initialize the message buffer */ init_buf(&msg_buf, MSGTYPE, MSGSIZE);}
开发者ID:Mellanox,项目名称:arc_ltp,代码行数:27,
注:本文中的tst_sig函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tstate_definition函数代码示例 C++ tst_rmdir函数代码示例 |