summaryrefslogtreecommitdiff
path: root/main.c
AgeCommit message (Collapse)Author
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-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.
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-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-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-30Use a global ps_contextJeremie Koenig
* 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.
2010-08-30netfs_server_loop never returnsJeremie Koenig
* main.c: Don't call netfs_server_loop repeatedly; it should never return.
2010-08-30Handle errors in mainJeremie Koenig
* main.c (main): Handle errors from argp_parse and root_make_node.
2010-08-30Add a --compatible optionJeremie Koenig
* main.c (argp_parser): Add --compatible, which sets the options required for compatibility with the procps tools.
2010-08-30Add a global cmdline fileJeremie Koenig
* main.c (argp_parser, main): Add the --kernel-pid option. * main.h: Publish it. * rootdir.c (rootdir_gc_cmdline): New function.
2010-08-30Add a fake-self option to control the self symlinkJeremie Koenig
* 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.
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-30New root files: version, uptime, statJeremie Koenig
* rootdir.c, rootdir.h: New files. * main.c: Use rootdir_create_node. * Makefile: Add the rootdir module.
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-30Invent path-based inode numbersJeremie Koenig
* 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.
2010-08-30Fuse the proclist into the root nodeJeremie Koenig
* dircat.c, dircat.h: New files, merge directories. * Makefile: Add the dircat module. * main.c: Use dircat to merge the proclist into the root directory, instead of having it as a stand-alone one. * procfs.h, procfs.c: Add a "refresh hack" to have the contents of the root directory recreated on each request. * proclist.c (proclist_make_node): Enable the hack in question.
2010-08-30More cleanup possibilitiesJeremie Koenig
* procfs.c, procfs.h: Extend the signature of the cleanup_contents callback in the procfs_node_ops structure to include the hook and contents_len. (cleanup_contents_with_free, cleanup_contents_with_vm_deallocate): New functions, can be used as a cleanup_contents callback for simple cases. * procfs_dir.c, procfs_dir.h (procfs_dir_make_node): Update, add a cleanup callback, make sure the cleanup callback is invoked if there is an error. * proclist.c (proclist_make_node), main.c (main): Update to match the new interfaces.
2010-08-30Add the list of processes as a directoryJeremie Koenig
* proclist.h, proclist.c: New files. * main.c: Add a proclist directory based on them. * Makefile: Include the proclist module.
2010-08-30Implement simple directoriesJeremie Koenig
* procfs_dir.h: New file; declare the procfs_dir_make_node function, based on the procfs_dir_entry structure. * procfs_dir.c: New file; implement simple directories. * Makefile: Add the procfs_dir module. * main.c: Use it.
2010-08-30Add a helper module for simple regular filesJeremie Koenig
* procfs_file.h: New file, declares procfs_file_make_node. * procfs_file.c: New file, implements procfs_file_make_node. * main.c: Use them. * Makefile: Add the procfs_file module.
2010-08-30Basic infrastructureJeremie Koenig
* procfs.h: New file; basic interfaces for procfs nodes. * procfs.c: New file; implement the basic infrastructure. * netfs.c: New file; bridge libnetfs and the procfs interfaces. * main.c: New file; mostly a "Hello, World!" for now. * Makefile: New file; standalone for now.