aboutsummaryrefslogtreecommitdiff
path: root/procfs/rootdir.c
Commit message (Collapse)AuthorAgeFilesLines
* procfs: Fix coding styleSamuel Thibault2025-01-271-22/+22
|
* Add partial /proc/cpuinfo implementationDiego Nieto Cid2025-01-271-0/+219
| | | | | | | * procfs/rootdir.c: (rootdir_gc_cpuinfo) new function (rootdir_entries) add entry for cpuinfo file (cpuinfo_x86, cpuinfo_aarch64) implementations for x86 and aarch64 respectively.
* procfs: remove unused rootdir_symlink_make_nodeFlavio Cruz2024-09-081-8/+0
| | | | | Not needed since b2c97e251bb470e6f967c716081675a96dbde59c Message-ID: <20240121210757.1900938-2-flaviocruz@gmail.com>
* procfs: fix MemTotal 4G memory clamp on 32bit systemsSamuel Thibault2024-03-061-1/+4
| | | | Using vmstats allows to get up to 16T.
* Homogeneize [gs]et_translator and get_dire[nc]ts into mach_msg_type_number_tSamuel Thibault2023-08-081-1/+1
| | | | | | | | | | | | | | | | | This makes netfs_[gs]et_translator use mach_msg_type_number_t like the RPC and diskfs. This also makes the fshelp_fetch_root_callback1_t for fshelp_fetch_root use mach_msg_type_number_t. This also makes procfs_get_translator and the get_translator proc method use mach_msg_type_number_t. This makes diskfs_get_directs use mach_msg_type_number_t like the dir_readdir RPC Also get rid of u_int. This notably fixes _diskfs_translator_callback1_fn's bogus cast of size_t *argz_len into (u_int *).
* Style tweaksSergey Bugaev2023-05-101-2/+2
| | | | Message-Id: <20230508213136.608575-42-bugaevc@gmail.com>
* procfs: Port to x86_64Sergey Bugaev2023-05-101-4/+4
| | | | Message-Id: <20230508213136.608575-36-bugaevc@gmail.com>
* Use default pager MiG stubs from Hurd instead of gnumachFlavio Cruz2023-04-071-1/+0
| | | | | | | | | | | | Hurd code relies on gnumach default_pager.defs headers when making calls using the default pager RPC. Those stubs were checked in back in the 90s and are essentially unused because gnumach does not implement or use that interface. Instead use the Hurd interface directly. This is safe since the Hurd stubs are a super set of the gnumach stubs. Later, we won't need to install the gnumach stubs anymore through glibc. Message-Id: <ZC5WqPKfCCiE8D29@jupiter.tail36e24.ts.net>
* procfs: Avoid fclosing NULL on memory shortageSamuel Thibault2023-01-011-1/+2
|
* procfs: Populate /proc/route with network routesDamien Zammit2022-09-201-0/+77
|
* procfs: Fix use-after-freeSergey Bugaev2021-05-241-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix several issues with reference counting in rootdir_make_translated_node (): * Grab an additional reference while still holding the lock. * Give the node an additional reference for being pointed to by the ops. * Reference the existing node if we find it on the second try, not only if we find it on the first try. * Dereference, not just clean, the created node if it turns out to be unneeded. Fixes a crash with the following backtrace: #2 0x010855c8 in __assert_fail_backtrace ( assertion=0x1051148 "! (r.hard == 1 && r.weak == 0) || !\"refcount detected use-after-free!\"", file=0x1050cec "../../libshouldbeinlibc/refcount.h", line=170, function=0x1051220 <__PRETTY_FUNCTION__.3> "refcounts_ref") at ../../libshouldbeinlibc/assert-backtrace.c:64 #3 0x01050358 in refcounts_ref (result=0x0, ref=0x15009a0) at ../../libshouldbeinlibc/refcount.h:170 #4 netfs_nref (np=0x15008f0) at ../../libnetfs/nref.c:26 #5 0x0804c9f4 in rootdir_make_translated_node (dir_hook=0x10001990, entry_hook=0x8055180 <__compound_literal.8>) at ../../procfs/rootdir.c:674 #6 0x0804ace3 in procfs_dir_lookup (hook=0x10001c10, name=0x2857efc "mounts", np=0x2855d68) at ../../procfs/procfs_dir.c:88 #7 0x0804a410 in procfs_lookup (np=0x10001c40, name=0x2857efc "mounts", npp=0x2855d68) at ../../procfs/procfs.c:185 #8 0x0804cae5 in dircat_lookup (hook=0x10001d50, name=0x2857efc "mounts", np=0x2855d68) at ../../procfs/dircat.c:76 #9 0x0804a410 in procfs_lookup (np=0x10001d80, name=0x2857efc "mounts", npp=0x2855d68) at ../../procfs/procfs.c:185 #10 0x0804a96f in netfs_attempt_lookup (user=0x1401c60, dir=0x10001d80, name=0x2857efc "mounts", np=0x2855d68) at ../../procfs/netfs.c:212 #11 0x0103fd5b in netfs_S_dir_lookup (dircred=<optimized out>, filename=<optimized out>, flags=<optimized out>, mode=<optimized out>, do_retry=<optimized out>, retry_name=<optimized out>, retry_port=<optimized out>, retry_port_type=<optimized out>) at ../../libnetfs/dir-lookup.c:175 Message-Id: <20210524154340.264885-2-bugaevc@gmail.com>
* Use our own variant of 'assert' and 'assert_perror'.Justus Winter2017-08-051-2/+2
| | | | | Our variants print stack traces on failures. This will make locating errors much easier.
* procfs: Provide 'hostinfo'.Justus Winter2017-08-051-1/+59
| | | | | * procfs/rootdir.c (rootdir_gc_hostinfo): New function. (rootdir_entries): New entry 'hostinfo'.
* procfs: Remove superfluous calls.Justus Winter2017-06-031-8/+0
| | | | | * procfs/rootdir.c (rootdir_gc_vmstat): Remove superfluous 'host_info' calls.
* procfs: provide magic retry response for /proc/selfJustus Winter2016-12-191-19/+4
| | | | | | | | | * hurd/hurd_types.h: Document the magic retry string `pid'. * hurd/paths.h (_HURD_MAGIC): New macro. * procfs/main.c: Remove all code related to faking /proc/self. * procfs/main.h: Likewise. * procfs/rootdir.c: Likewise. Instead, return the magic retry response `pid' for the `self' node.
* procfs: Gracefully degrade meminfo.Justus Winter2016-10-151-12/+32
| | | | | * procfs/rootdir.c (rootdir_gc_meminfo): Just omit the swap information if the default pager is unreachable.
* Use swapon path as pager partition pathSamuel Thibault2016-03-241-1/+1
| | | | | | | | | | | When /dev/hd* entries are parted-partition storeio, the store name is only the disk name, thus not unique. We should just use the path being used instead. * sutils/swapon.c (swaponoff): Use `file' instead of `store->name' to default_pager_paging_file. (main): Drop hardcoded "/dev/". * procfs/rootdir.c (rootdir_gc_swaps): Drop hardcoded "/dev/".
* Fix swap information numbersSamuel Thibault2016-03-241-1/+1
| | | | | | * procfs/rootdir.c (rootdir_gc_swaps): Fix default_pager_storage_info call parameter order. * sutils/swapon.c (main): Likewise.
* Add getting swap information from swapon and procfsSamuel Thibault2016-03-161-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | * hurd/default_pager.defs (default_pager_storage_info): New RPC. * hurd/default_pager_reply.defs: Skip default_pager_storage_info RPC. * hurd/default_pager_types.h: Include <mach/machine/vm_types.h>. (vm_size_array_t): New type. * mach-defpager/priv.h (part): Add `name' field. * mach-defpager/default_pager.c (new_partition): Allocate and fill `part->name' field. Free it on error. (destroy_paging_partition): Free `part->name' field. (S_default_pager_storage_info): New function. * procfs/Makefile (SRCS): Add default_pagerUser.c. * procfs/rootdir.c: Include "default_pager_U.h". (rootdir_gc_swaps): New function. (rootdir_entries): Add "swaps" entry. * sutils/swapon.c: Include <argz.h> (show): New variable. (options): Add --show/-S option. (def_pager, dev_master): New variables (swaponoff): Move getting `def_pager' to... (get_def_pager): ... new function. (main): Support 'S' option. * trans/proxy-defpager.c (S_default_pager_storage_info): New function.
* procfs: adapt to kernel interface changeJustus Winter2016-02-231-5/+4
| | | | | | | procfs makes use of the debug interface which is subject to change. * procfs/rootdir.c (rootdir_gc_slabinfo): The flag CACHE_FLAGS_NO_RECLAIM is no longer used.
* fix compiler warnings in hurd/procfsFlavio Cruz2015-12-291-5/+5
| | | | | | | | procfs: Fix compiler warnings. * include/sys/procfs.h: Change uintptr_t to vm_address_t. * procfs/process.c: Fix format strings. * procfs/rootdir.c: Add missing casts.
* procfs: reorganize rootdir.cJustus Winter2014-09-291-76/+77
| | | | | * procfs/rootdir.c: Move the translator linkage code to the appropriate location.
* procfs: generalize the translator linkage codeJustus Winter2014-09-291-20/+42
| | | | | | | | | | | | | | | | | Generalize the translator linkage code previously introduced for the `mounts' node. * procfs/rootdir.c (struct procfs_translated_node_ops): New specialized node operations structure for translated nodes. (rootdir_mounts_make_node): Generalize and rename to rootdir_make_translated_node. Also, pass the entry_hook to procfs_make_node so that... (rootdir_mounts_get_translator): ... can be generalized to rootdir_translated_node_get_translator and read the argz vector from the hooked structure. (ROOTDIR_DEFINE_TRANSLATED_NODE): New convenience macro to define translated nodes. (rootdir_entries): Use the new code for the `mounts' node.
* procfs: do not test whether /hurd/mtab existsJustus Winter2014-09-291-10/+0
| | | | | | | | Now that procfs is merged into the Hurd repository we can just assume that the mtab translator exists. * procfs/rootdir.c (rootdir_mounts_exists): Drop function. (rootdir_entries): Adjust accordingly.
* procfs: implement /proc/filesystemsJustus Winter2014-09-291-1/+60
| | | | | * procfs/rootdir.c (rootdir_gc_filesystems): New function. (rootdir_entries): Use the new function to implement /proc/filesystems.
* hurd: add symbolic name for the mtab translatorJustus Winter2014-09-221-5/+2
| | | | | | * hurd/paths.h (_HURD_MTAB): New macro. * procfs/rootdir.c (rootdir_mounts_get_translator): Use the new macro. (rootdir_mounts_exists): Likewise.
* Prepare the procfs translator to be merged into the Hurd sourcesJustus Winter2014-06-151-0/+661
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.