- /* Open output files */
- umask(00000);
- ret = mkdir(LTT_USERTRACE_ROOT, 0777);
- if(ret < 0 && errno != EEXIST) {
- perror("LTT Error in creating output (mkdir)");
- exit(-1);
- }
- ret = chdir(LTT_USERTRACE_ROOT);
- if(ret < 0) {
- perror("LTT Error in creating output (chdir)");
- exit(-1);
- }
- snprintf(identifier_name, PATH_MAX-1, "%lu.%lu.%llu",
- traced_tid, traced_pid, get_cycles());
- snprintf(outfile_name, PATH_MAX-1, "process-%s", identifier_name);
-
- /* Wait for the first signal before creating files */
- ret = sigsuspend(&oldset);
- if(ret != -1) {
- perror("LTT Error in sigsuspend\n");
- }
-
-#ifndef LTT_NULL_OUTPUT_TEST
- fd_process = creat(outfile_name, 0644);
-#else
- /* NULL test */
- ret = symlink("/dev/null", outfile_name);
- if(ret < 0) {
- perror("error in symlink");
- }
- fd_process = open(outfile_name, O_WRONLY);
- if(fd_process < 0) {
- perror("Error in open");
- }
-#endif //LTT_NULL_OUTPUT_TEST
-