diff options
author | Jeremie Koenig <jk@jk.fr.eu.org> | 2010-08-22 20:46:54 +0000 |
---|---|---|
committer | Jeremie Koenig <jk@jk.fr.eu.org> | 2010-08-30 14:29:51 +0200 |
commit | a22115eca05fd87748aed2ffde8caeb5b71f1c6d (patch) | |
tree | fabcf56e29fefbcb6763d2dcf6f0100275c42a0f /process.c | |
parent | 9ab114b6a7e0723135555ed202886f47c032f511 (diff) |
Add --stat-mode to override the perms for [pid]/stat
* main.c (argp_parser, main): Add the --stat-mode option.
* process.c (process_lookup_pid): Use it.
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -206,6 +206,7 @@ static struct procfs_dir_entry entries[] = { }, }, { + /* Beware of the hack below, which requires this to be entries[2]. */ .name = "stat", .make_node = process_file_make_node, .hook = & (struct process_file_desc) { @@ -235,6 +236,10 @@ process_lookup_pid (struct ps_context *pc, pid_t pid, struct node **np) if (err || ! (proc_stat_flags (ps) & PSTAT_OWNER_UID)) return EIO; + /* FIXME: have a separate proc_desc structure for each file, so this can be + accessed in a more robust and straightforward way. */ + ((struct process_file_desc *) entries[2].hook)->mode = opt_stat_mode; + *np = procfs_dir_make_node (entries, ps, (void (*)(void *)) _proc_stat_free); if (! *np) return ENOMEM; |