diff options
Diffstat (limited to 'debian')
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | debian/patches/procfs-default.patch | 48 | ||||
-rw-r--r-- | debian/patches/procfs-get-options.patch | 73 | ||||
-rw-r--r-- | debian/patches/procfs-update.patch | 131 | ||||
-rw-r--r-- | debian/patches/series | 3 |
5 files changed, 257 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 0cd38792..92161bc2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ hurd (20130620-1.1) UNRELEASED; urgency=low * patches/mount-{f,n,remount}.patch: New patches from Justus Winter to make mount more compatible with Linux'. * patches/mount-loop.patch: New patch to ignore loop option. + * patches/procfs-{update,default,get-options}.patch: New patches from Justus + Winter to make procfs behave as sysvinit desires. -- Samuel Thibault <sthibault@debian.org> Wed, 19 Jun 2013 23:32:07 +0000 diff --git a/debian/patches/procfs-default.patch b/debian/patches/procfs-default.patch new file mode 100644 index 00000000..62cd7b95 --- /dev/null +++ b/debian/patches/procfs-default.patch @@ -0,0 +1,48 @@ +Define a macro for the default value of each command line +parameter. This allows one to generate a minimal response to +fsys_get_options requests. + +* procfs/main.c: New macro definitions for default values. +--- + procfs/main.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/procfs/main.c b/procfs/main.c +index ba74e87..3e53307 100644 +--- a/procfs/main.c ++++ b/procfs/main.c +@@ -37,6 +37,13 @@ pid_t opt_fake_self; + pid_t opt_kernel_pid; + uid_t opt_anon_owner; + ++/* Default values */ ++#define OPT_CLK_TCK sysconf(_SC_CLK_TCK) ++#define OPT_STAT_MODE 0400 ++#define OPT_FAKE_SELF -1 ++#define OPT_KERNEL_PID 2 ++#define OPT_ANON_OWNER 0 ++ + static error_t + argp_parser (int key, char *arg, struct argp_state *state) + { +@@ -211,11 +218,11 @@ int main (int argc, char **argv) + mach_port_t bootstrap; + error_t err; + +- opt_clk_tck = sysconf(_SC_CLK_TCK); +- opt_stat_mode = 0400; +- opt_fake_self = -1; +- opt_kernel_pid = 2; +- opt_anon_owner = 0; ++ opt_clk_tck = OPT_CLK_TCK; ++ opt_stat_mode = OPT_STAT_MODE; ++ opt_fake_self = OPT_FAKE_SELF; ++ opt_kernel_pid = OPT_KERNEL_PID; ++ opt_anon_owner = OPT_ANON_OWNER; + err = argp_parse (&argp, argc, argv, 0, 0, 0); + if (err) + error (1, err, "Could not parse command line"); +-- +1.7.10.4 + + diff --git a/debian/patches/procfs-get-options.patch b/debian/patches/procfs-get-options.patch new file mode 100644 index 00000000..99104177 --- /dev/null +++ b/debian/patches/procfs-get-options.patch @@ -0,0 +1,73 @@ +Implement our own netfs_append_args function that provides the +appropriate command line flags if the current values differ from the +default values. + +* procfs/main.c (netfs_append_args): New function. +--- + procfs/main.c | 42 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + +diff --git a/procfs/main.c b/procfs/main.c +index 3e53307..bcf9590 100644 +--- a/procfs/main.c ++++ b/procfs/main.c +@@ -22,6 +22,7 @@ + #include <unistd.h> + #include <error.h> + #include <argp.h> ++#include <argz.h> + #include <hurd/netfs.h> + #include <ps.h> + #include "procfs.h" +@@ -193,6 +194,47 @@ struct argp netfs_runtime_argp_ = { + /* Used by netfs_set_options to handle runtime option parsing. */ + struct argp *netfs_runtime_argp = &netfs_runtime_argp_; + ++/* Return an argz string describing the current options. Fill *ARGZ ++ with a pointer to newly malloced storage holding the list and *LEN ++ to the length of that storage. */ ++error_t ++netfs_append_args (char **argz, size_t *argz_len) ++{ ++ char buf[80]; ++ error_t err = 0; ++ ++#define FOPT(opt, default, fmt, args...) \ ++ do { \ ++ if (! err && opt != default) \ ++ { \ ++ snprintf (buf, sizeof buf, fmt, ## args); \ ++ err = argz_add (argz, argz_len, buf); \ ++ } \ ++ } while (0) ++ ++ FOPT (opt_clk_tck, OPT_CLK_TCK, ++ "--clk-tck=%d", opt_clk_tck); ++ ++ FOPT (opt_stat_mode, OPT_STAT_MODE, ++ "--stat-mode=%o", opt_stat_mode); ++ ++ FOPT (opt_fake_self, OPT_FAKE_SELF, ++ "--fake-self=%d", opt_fake_self); ++ ++ FOPT (opt_anon_owner, OPT_ANON_OWNER, ++ "--anonymous-owner=%d", opt_anon_owner); ++ ++ FOPT (opt_kernel_pid, OPT_KERNEL_PID, ++ "--kernel-process=%d", opt_kernel_pid); ++ ++#undef FOPT ++ ++ if (! err) ++ err = netfs_append_std_options (argz, argz_len); ++ ++ return err; ++} ++ + error_t + root_make_node (struct ps_context *pc, struct node **np) + { +-- +1.7.10.4 + + diff --git a/debian/patches/procfs-update.patch b/debian/patches/procfs-update.patch new file mode 100644 index 00000000..fc5cb4a7 --- /dev/null +++ b/debian/patches/procfs-update.patch @@ -0,0 +1,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 + + diff --git a/debian/patches/series b/debian/patches/series index d902bd8e..52ff2b98 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -45,3 +45,6 @@ mount-n.patch mount-f.patch mount-remount.patch mount-loop.patch +procfs-update.patch +procfs-default.patch +procfs-get-options.patch |