blob: 837242b4dae92651c70e1f3b9af9d9b41dbb81e4 [file] [log] [blame]
The Android Open Source Project10e23ee2009-03-03 19:30:30 -08001/**
2 * @file op_config.c
3 * Oprofile configuration parameters.
4 *
5 * @remark Copyright 2002 OProfile authors
6 * @remark Read the file COPYING
7 *
8 * @author Nathan Tallent
9 * @Modifications Daniel Hansel
10 */
11
12#include "op_config.h"
13#include "op_config_24.h"
14
15#include <limits.h>
16#include <stdlib.h>
17#include <stdio.h>
18#include <string.h>
19#include <assert.h>
20
21/* paths in op_config.h */
22char op_session_dir[PATH_MAX];
23char op_samples_dir[PATH_MAX];
24char op_samples_current_dir[PATH_MAX];
25char op_lock_file[PATH_MAX];
26char op_log_file[PATH_MAX];
27char op_pipe_file[PATH_MAX];
28char op_dump_status[PATH_MAX];
29
30/* paths in op_config_24.h */
31char op_device[PATH_MAX];
32char op_note_device[PATH_MAX];
33char op_hash_device[PATH_MAX];
34
35void
36init_op_config_dirs(char const * session_dir)
37{
38 int session_dir_len;
39
40 assert(session_dir);
41 session_dir_len = strlen(session_dir);
42
43 if (session_dir_len + strlen("/samples/oprofiled.log") > PATH_MAX) {
44 fprintf(stderr, "Session_dir string \"%s\" is too large.\n",
45 session_dir);
46 exit(EXIT_FAILURE);
47 }
48
49 strcpy(op_session_dir, session_dir);
50
51 strcpy(op_samples_dir, op_session_dir);
52 strcat(op_samples_dir, "/samples/");
53
54 strcpy(op_samples_current_dir, op_samples_dir);
55 strcat(op_samples_current_dir, "/current/");
56
57 strcpy(op_lock_file, op_session_dir);
58 strcat(op_lock_file, "/lock");
59
60 strcpy(op_pipe_file, op_session_dir);
61 strcat(op_pipe_file, "/opd_pipe");
62
63 strcpy(op_log_file, op_samples_dir);
64 strcat(op_log_file, "oprofiled.log");
65
66 strcpy(op_dump_status, op_session_dir);
67 strcat(op_dump_status, "/complete_dump");
68
69 strcpy(op_device, op_session_dir);
70 strcat(op_device, "/opdev");
71
72 strcpy(op_note_device, op_session_dir);
73 strcat(op_note_device, "/opnotedev");
74
75 strcpy(op_hash_device, op_session_dir);
76 strcat(op_hash_device, "/ophashmapdev");
77}