diff options
author | Miles Bader <miles@gnu.org> | 1995-10-31 18:36:41 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-10-31 18:36:41 +0000 |
commit | a373deb4e898d4e83fe5114b5afc77a50f861ee7 (patch) | |
tree | 4f1ab6fa80e0a7595340f8acbcafcdcbabb33b08 /utils/settrans.c | |
parent | 31d2ef03bb923ed6a18330bc7c0d427833a8f62d (diff) |
(options):
Change --force/-f to --goaway/-g.
Add flags for killing translators: --recurse/-r, --force/-f, --nosync/-S.
(doc): New variable.
(main): Support new flags. Have some of the options update flag words
instead of setting variables.
Diffstat (limited to 'utils/settrans.c')
-rw-r--r-- | utils/settrans.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/utils/settrans.c b/utils/settrans.c index ff18fee1..c0c21d15 100644 --- a/utils/settrans.c +++ b/utils/settrans.c @@ -37,11 +37,16 @@ static struct argp_option options[] = {"keep-active", 'k', 0, 0, "Keep any currently running active translator" " when setting the passive translator"}, {"create", 'c', 0, 0, "Create NODE if it doesn't exist"}, - {"force", 'f', 0, 0, "Set the translator even if one already exists"}, + {"goaway", 'g', 0, 0, "Make any existing translator go away"}, + {"recursive", 'R', 0, 0, "When killing an old translator, shutdown its children too"}, + {"force", 'f', 0, 0, "If an old active translator doesn't want to die, force it"}, + {"nosync", 'S', 0, 0, "Don't sync any existing translator's state before killing it"}, {"dereference", 'L', 0, 0, "If a translator exists, put the new one on top"}, {0, 0} }; static char *args_doc = "NODE [TRANSLATOR ARG...]"; +static char *doc = "By default, the passive translator is set, and any \ +active translator told to just go away."; /* ---------------------------------------------------------------- */ @@ -64,10 +69,11 @@ main(int argc, char *argv[]) /* Flags to pass to file_set_translator. By default we only set a translator if there's no existing one. */ int flags = FS_TRANS_SET | FS_TRANS_EXCL; + int lookup_flags = O_NOTRANS; + int goaway_flags = 0; /* Various option flags. */ - int passive = 0, active = 0; - int create = 0, force = 0, deref = 0, keep_active = 0; + int passive = 0, active = 0, keep_active = 0; /* Parse our options... */ error_t parse_opt (int key, char *arg, struct argp_state *state) @@ -87,27 +93,30 @@ main(int argc, char *argv[]) case 'a': active = 1; break; case 'p': passive = 1; break; - case 'f': force = 1; break; case 'k': keep_active = 1; break; - case 'c': create = 1; break; - case 'L': deref = 1; break; + + case 'c': lookup_flags |= O_CREAT; break; + case 'L': lookup_flags &= ~O_NOTRANS; break; + + case 'g': flags &= ~FS_TRANS_EXCL; break; + + case 'R': goaway_flags |= FSYS_GOAWAY_RECURSE; break; + case 'S': goaway_flags |= FSYS_GOAWAY_NOSYNC; break; + case 'f': goaway_flags |= FSYS_GOAWAY_FORCE; break; default: return EINVAL; } return 0; } - struct argp argp = {options, parse_opt, args_doc}; + struct argp argp = {options, parse_opt, args_doc, doc}; argp_parse (&argp, argc, argv, 0, 0); if (!active && !passive) passive = 1; - node = - file_name_lookup(node_name, - (deref ? 0 : O_NOTRANS) | (create ? O_CREAT : 0), - 0666); + node = file_name_lookup(node_name, lookup_flags, 0666); if (node == MACH_PORT_NULL) error(1, errno, "%s", node_name); @@ -120,15 +129,11 @@ main(int argc, char *argv[]) error(4, err, "%s", argz); } - if (force) - /* Kill any existing translators. */ - flags &= ~FS_TRANS_EXCL; - err = file_set_translator(node, passive ? flags : 0, (active || !keep_active) ? flags : 0, - 0, + goaway_flags, argz, argz_len, active_control, MACH_MSG_TYPE_MOVE_SEND); if (err) |