summaryrefslogtreecommitdiff
path: root/debian/patches/procfs-update.patch
blob: fc5cb4a7847c5d30ccc4807b1b40c0dea8c18cea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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.
---
 procfs/main.c |   93 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 65 insertions(+), 28 deletions(-)

diff --git a/procfs/main.c b/procfs/main.c
index 1b19c01..ba74e87 100644
--- a/procfs/main.c
+++ b/procfs/main.c
@@ -109,45 +109,82 @@ argp_parser (int key, char *arg, struct argp_state *state)
   return 0;
 }
 
+struct argp_option common_options[] = {
+  { "clk-tck", 'h', "HZ", 0,
+      "Unit used for the values expressed in system clock ticks "
+      "(default: sysconf(_SC_CLK_TCK))" },
+  { "stat-mode", 's', "MODE", 0,
+      "The [pid]/stat file publishes information which on Hurd is only "
+      "available to the process owner.  "
+      "You can use this option to override its mode to be more permissive "
+      "for compatibility purposes.  "
+      "(default: 0400)" },
+  { "fake-self", 'S', "PID", OPTION_ARG_OPTIONAL,
+      "Provide a fake \"self\" symlink to the given PID, for compatibility "
+      "purposes.  If PID is omitted, \"self\" will point to init.  "
+      "(default: no self link)" },
+  { "kernel-process", 'k', "PID", 0,
+      "Process identifier for the kernel, used to retreive its command "
+      "line, as well as the global up and idle times. "
+      "(default: 2)" },
+  { "compatible", 'c', NULL, 0,
+      "Try to be compatible with the Linux procps utilities.  "
+      "Currently equivalent to -h 100 -s 0444 -S 1." },
+  { "anonymous-owner", 'a', "USER", 0,
+      "Make USER the owner of files related to processes without one.  "
+      "Be aware that USER will be granted access to the environment and "
+      "other sensitive information about the processes in question.  "
+      "(default: use uid 0)" },
+  {}
+};
+
 struct argp argp = {
-  .options = (struct argp_option []) {
-    { "clk-tck", 'h', "HZ", 0,
-	"Unit used for the values expressed in system clock ticks "
-	"(default: sysconf(_SC_CLK_TCK))" },
-    { "stat-mode", 's', "MODE", 0,
-	"The [pid]/stat file publishes information which on Hurd is only "
-	"available to the process owner.  "
-	"You can use this option to override its mode to be more permissive "
-	"for compatibility purposes.  "
-	"(default: 0400)" },
-    { "fake-self", 'S', "PID", OPTION_ARG_OPTIONAL,
-	"Provide a fake \"self\" symlink to the given PID, for compatibility "
-	"purposes.  If PID is omitted, \"self\" will point to init.  "
-	"(default: no self link)" },
-    { "kernel-process", 'k', "PID", 0,
-	"Process identifier for the kernel, used to retreive its command "
-	"line, as well as the global up and idle times. "
-	"(default: 2)" },
-    { "compatible", 'c', NULL, 0,
-	"Try to be compatible with the Linux procps utilities.  "
-	"Currently equivalent to -h 100 -s 0444 -S 1." },
-    { "anonymous-owner", 'a', "USER", 0,
-	"Make USER the owner of files related to processes without one.  "
-	"Be aware that USER will be granted access to the environment and "
-	"other sensitive information about the processes in question.  "
-	"(default: use uid 0)" },
+  .options = common_options,
+  .parser = argp_parser,
+  .doc = "A virtual filesystem emulating the Linux procfs.",
+  .children = (struct argp_child []) {
+    { &netfs_std_startup_argp, },
     {}
   },
+};
+
+static error_t
+runtime_argp_parser (int key, char *arg, struct argp_state *state)
+{
+  switch (key)
+  {
+    case 'u':
+      /* do nothing */
+      break;
+
+    default:
+      return ARGP_ERR_UNKNOWN;
+  }
+
+  return 0;
+}
+
+struct argp runtime_argp = {
+  .options = (struct argp_option []) {
+    { "update", 'u', NULL, 0, "remount; for procfs this does nothing" },
+    {},
+  },
+  .parser = runtime_argp_parser,
+};
+
+struct argp netfs_runtime_argp_ = {
+  .options = common_options,
   .parser = argp_parser,
   .doc = "A virtual filesystem emulating the Linux procfs.",
   .children = (struct argp_child []) {
-    { &netfs_std_startup_argp, },
+    { &runtime_argp, },
+    { &netfs_std_runtime_argp, },
     {}
   },
 };
 
 /* Used by netfs_set_options to handle runtime option parsing.  */
-struct argp *netfs_runtime_argp = &argp;
+struct argp *netfs_runtime_argp = &netfs_runtime_argp_;
 
 error_t
 root_make_node (struct ps_context *pc, struct node **np)
-- 
1.7.10.4