]> git.ipfire.org Git - thirdparty/systemd.git/commit
fileio: modernize get_proc_field()
authorMike Yuan <me@yhndnzj.com>
Thu, 13 Mar 2025 13:49:13 +0000 (14:49 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 1 May 2025 04:10:26 +0000 (13:10 +0900)
commit15036f855534b24296ea76709030e257d1eb82a9
tree670e258b9e8751d2d8bef16930f1054af3b4a2bc
parent2a2531b6c7536e6c1762d9139db7de82622aee0a
fileio: modernize get_proc_field()

- Drop effectively unused "terminator" param, imply whitespace
- Make ret param optional
- Return ENODATA if the requested key is not found, rather than
  ENOENT
- Turn ENOENT -> ENOSYS if /proc/ is not mounted
- Don't skip whitespaces before ':', nothing needs this handling
  anyways
- Remove the special treatment for all "0"s. We don't actually
  use this for capabilities given pidref_get_capability() exists
- Switch away from read_full_virtual_file() - files using "field"
  scheme under /proc/ seem all to be "seq_file"s (refer to
  da65941c3ee03495541c3bffbccc9012c8d9a5f8 for details on file types)
src/basic/fileio.c
src/basic/fileio.h
src/basic/process-util.c
src/basic/virt.c
src/oom/oomd.c
src/shared/hibernate-util.c
src/test/test-fileio.c
src/test/test-seccomp.c