op_config.c

Go to the documentation of this file.
00001 
00012 #include "op_config.h"
00013 #include "op_config_24.h"
00014 
00015 #include <limits.h>
00016 #include <stdlib.h>
00017 #include <stdio.h>
00018 #include <string.h>
00019 #include <assert.h>
00020 
00021 /* paths in op_config.h */
00022 char op_session_dir[PATH_MAX];
00023 char op_samples_dir[PATH_MAX];
00024 char op_samples_current_dir[PATH_MAX];
00025 char op_lock_file[PATH_MAX];
00026 char op_log_file[PATH_MAX];
00027 char op_pipe_file[PATH_MAX];
00028 char op_dump_status[PATH_MAX];
00029 
00030 /* paths in op_config_24.h */
00031 char op_device[PATH_MAX];
00032 char op_note_device[PATH_MAX];
00033 char op_hash_device[PATH_MAX];
00034 
00035 void
00036 init_op_config_dirs(char const * session_dir)
00037 {
00038     int session_dir_len;
00039 
00040     assert(session_dir);    
00041     session_dir_len = strlen(session_dir);
00042 
00043     if (session_dir_len + strlen("/samples/oprofiled.log") > PATH_MAX) {
00044         fprintf(stderr, "Session_dir string \"%s\" is too large.\n", 
00045             session_dir);
00046         exit(EXIT_FAILURE);
00047     }
00048     
00049     strcpy(op_session_dir, session_dir);
00050     
00051     strcpy(op_samples_dir, op_session_dir);
00052     strcat(op_samples_dir, "/samples/");
00053     
00054     strcpy(op_samples_current_dir, op_samples_dir);
00055     strcat(op_samples_current_dir, "/current/");
00056 
00057     strcpy(op_lock_file, op_session_dir);
00058     strcat(op_lock_file, "/lock");
00059 
00060     strcpy(op_pipe_file, op_session_dir);
00061     strcat(op_pipe_file, "/opd_pipe");
00062 
00063     strcpy(op_log_file, op_samples_dir);
00064     strcat(op_log_file, "oprofiled.log");
00065 
00066     strcpy(op_dump_status, op_session_dir);
00067     strcat(op_dump_status, "/complete_dump");
00068 
00069     strcpy(op_device, op_session_dir);
00070     strcat(op_device, "/opdev");
00071 
00072     strcpy(op_note_device, op_session_dir);
00073     strcat(op_note_device, "/opnotedev");
00074 
00075     strcpy(op_hash_device, op_session_dir);
00076     strcat(op_hash_device, "/ophashmapdev");
00077 }

Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1