summaryrefslogtreecommitdiff
path: root/process.c
AgeCommit message (Collapse)Author
2013-03-02Remove old hack for the "stat" permissionsPino Toscano
7550343b09a94dc1c659ad74dc75b3b77e7ab0bc added a better way to set the permissions of that file, so this old hack is not needed anymore. * process.c (process_lookup_pid): Do not change the mode of ENTRIES[2].hook.
2012-09-11PID stat/status: show only the first wordPino Toscano
If a process changed its title to a multiword string, show only the first word of it. * process.c (args_filename_length): New function. (process_file_gc_stat): Use args_filename_length. (process_file_gc_status): Likewise.
2012-01-14PID stat/status: show only the file name of processesPino Toscano
The Linux /proc fs shows only the file name of processes in the `stat' and `status' files of every process directory, so adapt also procfs to show process file names. Add a new `args_filename` function, much similar to GNU's `basename' but returning the original string also when the resulting file name is an empty string. * process.c (args_filename): New function. (process_file_gc_stat): Wrap the `proc_stat_args' result with `args_filename'. (process_file_gc_status): Likewise.
2011-12-27Revert "Do not use msgport information"Samuel Thibault
This reverts commit d9fc76bd4e8c9a459fad7152135b738496318415, as it breaks /proc/pid/stat
2011-12-27Do not use msgport informationSamuel Thibault
* process.c (process_lookup_pid): Set PSTAT_NO_MSGPORT flag. * rootdir.c (get_boottime, get_idletime, rootdir_gc_cmdline): Set PSTAT_NO_MSGPORT flag.
2010-09-14Add copyright noticesJeremie Koenig
* dircat.c, dircat.h, main.c, main.h, netfs.c, process.c, process.h, procfs.c, procfs.h, procfs_dir.c, procfs_dir.h, proclist.c, proclist.h, rootdir.c, rootdir.h: Add copyright notices.
2010-08-30Fix leak in error caseJeremie Koenig
* process.c (process_lookup_pid): Fix leak in error case.
2010-08-30Make sure the clock never runs backwards.Jeremie Koenig
* process.c, rootdir.c: When converting timeval structures into seconds or jiffies, make sure that floating point rounding errors don't make the clock the result jump backwards on second boundaries.
2010-08-30Cleanup pass on process.cJeremie Koenig
* process.c: Reorder some of the code. Improve comments. Jiffies and clock tick are the same thing, right? Replace the stat mode and cleanup hacks by more straightforward solutions.
2010-08-30Revamp procfs_dirJeremie Koenig
* procfs_dir.c, procfs_dir.h: Revamp the interface to make the more complicated use cases somewhat less hackish. * process.c: Update, specify a default make_node function. * rootdir.c: Likewise; make this optional "self" link use case somewhat less hackish.
2010-08-30Detect asprintf's ENOMEM in procfs.c rather than everywhereJeremie Koenig
* procfs.h: Make CONTENTS_LEN an ssize_t rather than a size_t, and document the change. * procfs.c (procfs_get_contents): Initialize CONTENTS_LEN to a negative value, and fail with ENOMEM if it's still negative after the callback returns. (everywhere): Update to ssize_t. * dircat.c, netfs.c, process.c, procfs_dir.c, proclist.c, rootdir.c: Update to ssize_t and the new GET_CONTENTS semantics.
2010-08-30Make contents a char* to avoid typecasts all over the placeJeremie Koenig
* procfs.h (procfs_cleanup_contents_with_free, procfs_cleanup_contents_with_vm_deallocate, procfs_get_contents, struct procfs_ops): Change CONTENTS from a void pointer to a char one. * dircat.c, netfs.c, process.c, procfs.c, procfs_dir.c, proclist.c, rootdir.c: Update.
2010-08-30Fix the handling of processes without an ownerJeremie Koenig
* main.c (argp_parser): New option --anonymous-owner. * main.h: Publish it. * process.c (process_lookup_pid): Use it to set the file owner uid of non-owned processes.
2010-08-30Add a status file to process directoriesJeremie Koenig
* process.c: Add a status file.
2010-08-30Add statm to process directoriesJeremie Koenig
* process.c: Add the statm file.
2010-08-30Add --stat-mode to override the perms for [pid]/statJeremie Koenig
* main.c (argp_parser, main): Add the --stat-mode option. * process.c (process_lookup_pid): Use it.
2010-08-30Add --clk-tck to set the clock unitJeremie Koenig
* main.c (argp_parser, main): Add and parse the --clk-tck option. * main.h: Publish opt_clk_tck. * process.c (sc_tc): Use the user-provided clock frequency. * rootdir.c (rootdir_gc_stat): Likewise.
2010-08-30Set a restrictive mode on some sensitive filesJeremie Koenig
* process.c (process_file_make_node, entries): Set the environ and stat files as readable only by the owner of the process.
2010-08-30Encapsulate access to node->nn_statJeremie Koenig
* procfs.c, procfs.h (procfs_node_chown, procfs_node_chmod, procfs_node_chtype): New functions, encapsulate access to some nn_stat fields. * process.c (process_lookup_pid): Use procfs_node_chown instead of direct access.
2010-08-30Use libps and enhance [pid]/statJeremie Koenig
* Makefile: Add libps to the $(LIBS). * proclist.c, proclist.h: Embed the proc server port in a ps_context structure. (proclist_make_node): Change to prototype to allow for the possibility of error. Rename to proclist_create_node to reflect the change and non-triviality. * process.c, process.h: Revamp. Use a full-blown procstat structure instead of just the procinfo fetched from the process server. Use the additional data to complement [pid]/stat. (process_lookup_pid): Get a ps_context structure instead of a port to the process server. * main.c (root_make_node): Convert to the new interface for proclist_create_node.
2010-08-30Add a basic [pid]/stat fileJeremie Koenig
* process.c: Add a basic stat file.
2010-08-30Set the owner of process directories.Jeremie Koenig
* process.c (process_make_node): Use the owner_uid from the procinfo structure to set the owner of the created directory.
2010-08-30Fetch process information and reject the non-existing onesJeremie Koenig
* process.c, process.h (process_make_node): Make static, include a procinfo structure into the node information. (process_lookup_pid): New function, replaces process_make_node as the outer interface, returns an error for non-existing processes. * proclist.c (proclist_lookup): Convert to the new interface.
2010-08-30Add real process nodesJeremie Koenig
* process.c, process.h: New files, implement a process directory with cmdline and environ files. * Makefile: Add the process module. * proclist.c: Replace stub pid files with the real thing.