AgeCommit message (Collapse)Author
2014-06-15Prepare the procfs translator to be merged into the Hurd sourcesHEADmasterJustus Winter
Move the procfs translator to its own subdirectory 'procfs'. This is the last commit to this repository. Development of the procfs translator will continue in the main Hurd repository. * procfs/Makefile: Replace the standalone Makefile with the one from the Debian packaging repository.
2014-05-28Do not include the terminating zero in /proc/slabinfoJustus Winter
* rootdir.c (rootdir_gc_slabinfo): Do not zero-terminate the generated content.
2014-05-24Implement /proc/slabinfoJustus Winter
Add a node 'slabinfo' to the root directory that contains information about the slab allocator used in GNU Mach. The formatting code has been taken from Richard Braun's standalone client available here: git:// * rootdir.c (rootdir_gc_slabinfo): New function. (rootdir_entries): Add node 'slabinfo'. * Makefile (OBJS): Add mach_debugUser.o. (rootdir.o): Add an explicit dependency on mach_debug_U.h. Furthermore, add rules to create both functions.
2013-10-05Fix mtab translator leakRichard Braun
The node structure for the `mounts' entry is created and destroyed on each access, despite the fact a translator is activated on it. Fix the issue by caching it. * rootdir.c (rootdir_mounts_node): New variable. (rootdir_mounts_node_lock): Likewise. (rootdir_mounts_make_node): New function. (rootdir_translator_make_node): Remove function. (rootdir_entries): Replace `rootdir_translator_make_node' with `rootdir_mounts_make_node'.
2013-09-15Serve mounts node with a passive translator recordJustus Winter
Make mounts a node with a passive translator record so that the mtab translator is started on access if it is available. * rootdir.c (MTAB_TRANSLATOR): New macro. (rootdir_mounts_get_translator): New function. (rootdir_mounts_exists): New function. (rootdir_translator_make_node): Likewise. (rootdir_entries): Add "mounts" node.
2013-09-15Make start_code and end_code available in /proc/*/statJustus Winter
This makes killall5 actually kill any processes not marked as important. * process.c (process_file_gc_stat): Fix {start,end}_code.
2013-08-28procfs: provide a more meaningful response to fsys_get_optionsJustus Winter
Implement our own netfs_append_args function that provides the appropriate command line flags if the current values differ from the default values. * procfs/main.c (netfs_append_args): New function.
2013-08-28procfs: define macros for the default argument valuesJustus Winter
Define a macro for the default value of each command line parameter. This allows one to generate a minimal response to fsys_get_options requests. * procfs/main.c: New macro definitions for default values.
2013-08-28procfs: handle the --update parameterJustus Winter
Split the argument handling into a common part and one for fsys_update_options. Handle the --update parameter; for procfs this is a no-op. * procfs/main.c (common_options): New variable. (runtime_argp_parser): Handle --update. (startup_argp): New variable. (netfs_runtime_argp_): New variable.
2013-08-27Fix argument parsingJustus Winter
The switch statement was missing the default case returning ARGP_ERR_UNKNOWN. This patch adds that. * main.c (argp_parser): Add default case.
2013-07-22rootdir.c: Fix declaration of rootdir_fakeself_exists.Justus Winter
* rootdir.c (rootdir_fakeself_exists): Use the correct arguments for this kind of function.
2013-07-22rootdir.c: Fix compiler warningJustus Winter
* rootdir.c (rootdir_gc_meminfo): Use unsigned long constant.
2013-07-22Makefile: add -lpthreadJustus Winter
* Makefile (LIBS): Link with libpthread.
2013-07-22Fix profile linkSamuel Thibault
* Makefile [PROFILE] (LIBS): Replace -lthreads with -lpthread
2013-07-20Add the necessary infrastructure to serve passive translatorsJustus Winter
* netfs.c (netfs_get_translator): New function. * procfs.c (procfs_get_translator): Likewise. * procfs.h (struct procfs_node_ops): New field get_translator. (procfs_get_translator): New function declaration.
2013-07-20Fix default file ownershipJustus Winter
Formerly all nodes were created so that they were owned by root:root by default. This causes problems if the procfs translator is running as unprivileged user and serves passive translator records, because the file ownership is being used as credentials for starting translators. This obviously fails if the procfs translator is not root but is trying to acquire credentials including uid/gid 0. Fix this by using the uid/gid of the procfs translator by default. procfs.c (procfs_make_node): Fix default node ownership.
2013-07-20Fix procfs_node_chmodJustus Winter
Formerly only the mode_t bits cut out by S_IFMT were preserved, but this does not include S_IPTRANS. Fix this by preserving everything but the permission bits. * procfs.c (procfs_node_chmod): Fix bitmask.
2013-07-20procfs: Ignore arguments for compatibility with Linux' procfs.Justus Winter
Ignore the --nodev, --noexec and --nosuid arguments. * procfs/main.c (argp_parser): Ignore some arguments for compatibility.
2013-06-29procfs: enable fsys_set_optionsJustus Winter
Make procfs translators handle fsys_set_options requests by pointing netfs_runtime_argp to our argp struct. * procfs/main.c (netfs_runtime_argp): New variable.
2013-06-29procfs: keep old config values if the parsing failsJustus Winter
Previously if strtol failed the previous configuration value would get overwritten. Prevent this by storing the result in a temporary variable and update the configuration if the argument was parsed correctly and passed the sanity checks. * procfs/main.c (argp_parser): Keep old configuration in case a malformed value is encountered.
2013-06-29procfs: fix the error handling in argp_parserSamuel Thibault
Do not exit using error (1, ..) but gracefully handle the error using argp_error. Also fix a typo ("the a user") while touching these lines. * procfs/main.c (argp_parser): Proper error handling. (argp_parser): Fix typo.
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.
2013-01-12Report VM cache size in meminfoRichard Braun
* 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.
2012-12-06Simple implementation of statfsPino Toscano
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.
2012-11-27Move procfs to pthreadsRichard Braun
2012-10-19Fix procfs linkCyril Roelandt
Makefile (LIBS): Add -lfshelp
2012-09-11Merge branch 'master' of into ↵Samuel Thibault
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-07-12Merge jkoenig/master into master.Thomas Schwinge
This branch supersedes the previous one.
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.
2011-02-22Add Buffers and Cached to /proc/meminfoSamuel Thibault
* rootdir.c (rootdir_gc_meminfo): Add Buffers and Cached, set to 0.
2010-09-14Use 2 instead of 42 as the parent inode numberJeremie Koenig
* procfs.c (procfs_make_ino): Use 2 rather than 42 as a temporary hack, since 2 is the root's inode with ext2fs.
2010-09-14Use the user-provided kernel PID for uptimeJeremie Koenig
* rootdir.c (get_boottime, get_idletime): replace KERNEL_PID with the opt_kernel_pid command-line option. * main.c (argp): Document the change.
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-30Update the to-do list.Jeremie Koenig
* TODO: Add more entries.
2010-08-30Add some comments in rootdir.cJeremie Koenig
* rootdir.c: Add page breaks to separate sections and add header comments for them.
2010-08-30Add swap information to the top-level stat fileJeremie Koenig
* rootdir.c (rootdir_gc_meminfo): Add swap information. * TODO: Update.
2010-08-30Add a PROFILE modeJeremie Koenig
* 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.
2010-08-30Fix leak in error caseJeremie Koenig
* process.c (process_lookup_pid): Fix leak in error case.
2010-08-30Refresh nodes when they're read from the start.Jeremie Koenig
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.
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-30Fix the global idle timeJeremie Koenig
* 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.
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-30Improve the interface for dircat_make_nodeJeremie Koenig
* 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.
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-30Remove the unused procfs_file moduleJeremie Koenig
* procfs_file.c, procfs_file.h: Remove. * Makefile: Remove procfs_file.