aboutsummaryrefslogtreecommitdiff
path: root/procfs/rootdir.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2016-12-19 02:13:06 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-12-19 02:13:06 +0100
commitb2c97e251bb470e6f967c716081675a96dbde59c (patch)
treeaa159f1f6d44959c40a3739515c4c6ae3ab9f3e7 /procfs/rootdir.c
parent5add1f4c531639b6247c827566ae55426c1182d7 (diff)
downloadhurd-b2c97e251bb470e6f967c716081675a96dbde59c.tar.gz
hurd-b2c97e251bb470e6f967c716081675a96dbde59c.tar.bz2
hurd-b2c97e251bb470e6f967c716081675a96dbde59c.zip
procfs: provide magic retry response for /proc/self
* 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.
Diffstat (limited to 'procfs/rootdir.c')
-rw-r--r--procfs/rootdir.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/procfs/rootdir.c b/procfs/rootdir.c
index 748805e7..4f4a1426 100644
--- a/procfs/rootdir.c
+++ b/procfs/rootdir.c
@@ -416,19 +416,7 @@ out:
return err;
}
-static int
-rootdir_fakeself_exists (void *dir_hook, const void *entry_hook)
-{
- return opt_fake_self >= 0;
-}
-
-static error_t
-rootdir_gc_fakeself (void *hook, char **contents, ssize_t *contents_len)
-{
- *contents_len = asprintf (contents, "%d", opt_fake_self);
- return 0;
-}
-
+static struct node *rootdir_self_node;
static struct node *rootdir_mounts_node;
static error_t
@@ -694,13 +682,10 @@ rootdir_translated_node_get_translator (void *hook, char **argz,
static const struct procfs_dir_entry rootdir_entries[] = {
{
.name = "self",
- .hook = & (struct procfs_node_ops) {
- .get_contents = rootdir_gc_fakeself,
- .cleanup_contents = procfs_cleanup_contents_with_free,
- },
+ .hook = ROOTDIR_DEFINE_TRANSLATED_NODE (&rootdir_self_node,
+ _HURD_MAGIC "\0pid"),
.ops = {
- .make_node = rootdir_symlink_make_node,
- .exists = rootdir_fakeself_exists,
+ .make_node = rootdir_make_translated_node,
}
},
{