Age | Commit message (Collapse) | Author |
|
* rootdir.c: Include <mach/gnumach.h> and <mach/vm_cache_statistics.h>.
(rootdir_gc_meminfo): Call vm_cache_statistics and return the VM cache size.
|
|
Initial implementation of statfs reply, just returning the filesystem type and its id.
* netfs.c: Include <sys/statvfs.h> and <unistd.h>.
(netfs_attempt_statfs): Implement.
|
|
|
|
jkoenig/master
|
|
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.
|
|
This branch supersedes the previous one.
|
|
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.
|
|
This reverts commit d9fc76bd4e8c9a459fad7152135b738496318415, as it breaks
/proc/pid/stat
|
|
* process.c (process_lookup_pid): Set PSTAT_NO_MSGPORT flag.
* rootdir.c (get_boottime, get_idletime, rootdir_gc_cmdline): Set
PSTAT_NO_MSGPORT flag.
|
|
* rootdir.c (rootdir_gc_meminfo): Add Buffers and Cached, set to 0.
|
|
* procfs.c (procfs_make_ino): Use 2 rather than 42 as a temporary hack,
since 2 is the root's inode with ext2fs.
|
|
* rootdir.c (get_boottime, get_idletime): replace KERNEL_PID with the
opt_kernel_pid command-line option.
* main.c (argp): Document the change.
|
|
* 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.
|
|
* rootdir.c: Add page breaks to separate sections and add header
comments for them.
|
|
* rootdir.c (rootdir_gc_meminfo): Add swap information.
* TODO: Update.
|
|
* Makefile: Change FOOFLAGS defaults to appropriate values when
$(PROFILE) is defined.
* rootdir.c: Add an "exit" file, which causes exit to be called
when looked up, so that profiling data can be written to disk.
|
|
* process.c (process_lookup_pid): Fix leak in error case.
|
|
This is necessary for top, for instance, which keeps some files open and
re-reads them regularly. As an extra bonus we can drop the refresh hack.
* procfs.c, procfs.h: Remove the refresh hack.
(procfs_refresh): New function, invalidates the cached contents.
* netfs.c (netfs_attempt_read, netfs_get_dirents): Call
procfs_refresh when the read is from offset 0.
* proclist.c (proclist_make_node): Remove the refresh hack.
* dircat.c (dircat_make_node): Likewise.
(dircat_get_contents): Use procfs_refresh to avoid keeping old data
from the component nodes.
|
|
* 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.
|
|
* rootdir.c: Replace INIT_PID by KERNEL_PID, for boot time and
idle time purposes. (get_idletime): New function, queries the
kernel's idle thread. (rootdir_gc_uptime, rootdir_gc_stat): Use the
new function and provide the real idle time.
|
|
* 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.
|
|
* 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.
|
|
* dircat.c, dircat.h (dircat_make_node): Use an explicit
array size for DIRS, fail with ENOMEM is any of them is NULL, and
release the reference on the non-NULL nodes on any error.
* main.c (root_make_node): Use the new interface.
|
|
* 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.
|
|
* 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.
|
|
* procfs_file.c, procfs_file.h: Remove.
* Makefile: Remove procfs_file.
|
|
* 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.
|
|
* proclist.c, proclist.h (proclist_create_node): Use a
ps_context passed by the caller; errors are no longer possible, rename
to proclist_make_node and change the signature accordingly.
* rootdir.c, rootdir.h (rootdir_create_node): Likewise.
* main.c (main): Create the ps_context here and pass it to
root_make_node. (root_make_node): Pass it to proclist_make_node and
rootdir_make_node.
|
|
* main.c: Don't call netfs_server_loop repeatedly; it should
never return.
|
|
* main.c (main): Handle errors from argp_parse and
root_make_node.
|
|
* main.c (argp_parser): Add --compatible, which sets the options
required for compatibility with the procps tools.
|
|
* process.c: Add a status file.
|
|
* process.c: Add the statm file.
|
|
* main.c (argp_parser, main): Add the --kernel-pid option.
* main.h: Publish it.
* rootdir.c (rootdir_gc_cmdline): New function.
|
|
* rootdir.c: Add a (non-empty) meminfo and a vmstat file.
|
|
* main.c (argp_parse, main): Add the --fake-self option.
* main.h: Publish it.
* rootdir.c (rootdir_gc_fakeself, rootdir_entries,
rootdir_create_node): Use it.
|
|
* main.c (argp_parser, main): Add the --stat-mode option.
* process.c (process_lookup_pid): Use it.
|
|
* 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.
|
|
* rootdir.c (rootdir_gc_uptime, rootdir_gc_stat): assume a
completely idle rather than completely busy system, so that the idle
seconds can be meaningfully divided by the idle jiffies by procps.
|
|
* rootdir.c: Add "meminfo", empty for now.
|
|
* rootdir.c: Add a fake "self" symlink which always points to
init.
|
|
* rootdir.c: Add the root file "loadavg".
|
|
* rootdir.c, rootdir.h: New files.
* main.c: Use rootdir_create_node.
* Makefile: Add the rootdir module.
|
|
* process.c (process_file_make_node, entries): Set the environ
and stat files as readable only by the owner of the process.
|
|
* 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.
|
|
* netfs.c (netfs_validate_stat): For symlinks, fetch the contents
and propagate their length into the nn_stat.st_size field.
(netfs_attempt_readlink): Implement using procfs_get_contents.
|
|
* 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.
|
|
* netfs.c (netfs_node_norefs): Handle the reference counters
spinlock so as to avoid deadlocking on reentry.
|
|
* procfs.h, procfs.c (procfs_make_ino): New function,
invents an inode number by hashing the parent's and the name of an
entry. (procfs_lookup): Use it to assign an inode number to child
nodes at lookup time.
* main.c (root_make_node): Assign an arbitrary inode number to
the root directory.
|
|
* procfs.c (procfs_lookup): Keep track of the parent directory,
implement the lookup of the dot-directories. (procfs_cleanup):
Release the reference to the parent node, if applicable.
* procfs.h: Add a comment about the parent reference.
* netfs.c (netfs_attempt_lookup): Lock the looked up node after
the directory has been unlocked, in case they are the same.
|