Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146025
b: refs/heads/master
c: 69abe6a
h: refs/heads/master
i:
  146023: 7e30cec
v: v3
  • Loading branch information
Avadh Patel authored and Ingo Molnar committed Apr 17, 2009
1 parent 0f44bf6 commit 88afbe7
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d1b182a8d49ed6416325b4e0a1cb0f17cd4e702a
refs/heads/master: 69abe6a5d18a9394baa325bab8f57748b037c517
53 changes: 53 additions & 0 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2421,6 +2421,56 @@ static const struct file_operations tracing_readme_fops = {
.read = tracing_readme_read,
};

static ssize_t
tracing_saved_cmdlines_read(struct file *file, char __user *ubuf,
size_t cnt, loff_t *ppos)
{
char *buf_comm;
char *file_buf;
char *buf;
int len = 0;
int pid;
int i;

file_buf = kmalloc(SAVED_CMDLINES*(16+TASK_COMM_LEN), GFP_KERNEL);
if (!file_buf)
return -ENOMEM;

buf_comm = kmalloc(TASK_COMM_LEN, GFP_KERNEL);
if (!buf_comm) {
kfree(file_buf);
return -ENOMEM;
}

buf = file_buf;

for (i = 0; i < SAVED_CMDLINES; i++) {
int r;

pid = map_cmdline_to_pid[i];
if (pid == -1 || pid == NO_CMDLINE_MAP)
continue;

trace_find_cmdline(pid, buf_comm);
r = sprintf(buf, "%d %s\n", pid, buf_comm);
buf += r;
len += r;
}

len = simple_read_from_buffer(ubuf, cnt, ppos,
file_buf, len);

kfree(file_buf);
kfree(buf_comm);

return len;
}

static const struct file_operations tracing_saved_cmdlines_fops = {
.open = tracing_open_generic,
.read = tracing_saved_cmdlines_read,
};

static ssize_t
tracing_ctrl_read(struct file *filp, char __user *ubuf,
size_t cnt, loff_t *ppos)
Expand Down Expand Up @@ -3973,6 +4023,9 @@ static __init int tracer_init_debugfs(void)
trace_create_file("trace_marker", 0220, d_tracer,
NULL, &tracing_mark_fops);

trace_create_file("saved_cmdlines", 0444, d_tracer,
NULL, &tracing_saved_cmdlines_fops);

#ifdef CONFIG_DYNAMIC_FTRACE
trace_create_file("dyn_ftrace_total_info", 0444, d_tracer,
&ftrace_update_tot_cnt, &tracing_dyn_info_fops);
Expand Down

0 comments on commit 88afbe7

Please sign in to comment.