[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 04/98: utils: implement settrans --pid-file
From: |
Samuel Thibault |
Subject: |
[hurd] 04/98: utils: implement settrans --pid-file |
Date: |
Tue, 14 Jan 2014 01:59:57 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 38bd193c9908d88f26f36ed62298b0b1ad13d2cb
Author: Justus Winter <address@hidden>
Date: Thu Nov 7 17:23:47 2013 +0100
utils: implement settrans --pid-file
This switch makes settrans write the pid file of the active translator
it starts to a file. This makes the pid easily retrievable for test
suites.
* utils/settrans.c (options): Add --pid-file.
(main): Add variable pid_file.
(parse_opt): Handle --pid-file switch.
(open_node): Write pid file.
---
utils/settrans.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/utils/settrans.c b/utils/settrans.c
index a881401..d13e7c4 100644
--- a/utils/settrans.c
+++ b/utils/settrans.c
@@ -1,6 +1,6 @@
/* Set a file's translator.
- Copyright (C) 1995,96,97,98,2001,02 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,98,2001,02,13 Free Software Foundation, Inc.
Written by Miles Bader <address@hidden>
This program is free software; you can redistribute it and/or
@@ -49,6 +49,8 @@ static struct argp_option options[] =
{"passive", 'p', 0, 0, "Change NODE's passive translator record
(default)" },
{"create", 'c', 0, 0, "Create NODE if it doesn't exist" },
{"dereference", 'L', 0, 0, "If a translator exists, put the new one on top"},
+ {"pid-file", 'F', "FILENAME", 0, "When starting an active translator,"
+ " write its pid to this file"},
{"pause", 'P', 0, 0, "When starting an active translator, prompt and"
" wait for a newline on stdin before completing the startup handshake"},
{"timeout", 't',"SEC",0, "Timeout for translator startup, in seconds"
@@ -104,6 +106,7 @@ main(int argc, char *argv[])
/* Various option flags. */
int passive = 0, active = 0, keep_active = 0, pause = 0, kill_active = 0,
orphan = 0;
+ char *pid_file = NULL;
int excl = 0;
int timeout = DEFAULT_TIMEOUT * 1000; /* ms */
char **chroot_command = 0;
@@ -136,6 +139,12 @@ main(int argc, char *argv[])
case 'g': kill_active = 1; break;
case 'x': excl = 1; break;
case 'P': pause = 1; break;
+ case 'F':
+ pid_file = strdup (arg);
+ if (pid_file == NULL)
+ error(3, ENOMEM, "Failed to duplicate argument");
+ break;
+
case 'o': orphan = 1; break;
case 'C':
@@ -221,6 +230,17 @@ main(int argc, char *argv[])
getchar ();
}
+ if (pid_file != NULL)
+ {
+ FILE *h;
+ h = fopen (pid_file, "w");
+ if (h == NULL)
+ error (4, errno, "Failed to open pid file");
+
+ fprintf (h, "%i\n", task2pid (task));
+ fclose (h);
+ }
+
node = file_name_lookup (node_name, flags | lookup_flags, 0666);
if (node == MACH_PORT_NULL)
{
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 55/98: pflocal: improve the demuxer functions, (continued)
- [hurd] 55/98: pflocal: improve the demuxer functions, Samuel Thibault, 2014/01/13
- [hurd] 57/98: utils: improve the auth_demuxer function in fakeauth.c, Samuel Thibault, 2014/01/13
- [hurd] 66/98: trans: improve the performance of dir_lookup in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 41/98: libports: improve error handling in ports_reallocate_from_external, Samuel Thibault, 2014/01/13
- [hurd] 40/98: libports: improve error handling in ports_reallocate_port, Samuel Thibault, 2014/01/13
- [hurd] 58/98: trans: remove unused declaration from fakeroot.c, Samuel Thibault, 2014/01/13
- [hurd] 72/98: trans: fix reference counting bug in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 39/98: proc: update comments, Samuel Thibault, 2014/01/13
- [hurd] 26/98: Make sure created netfs nodes have stat validated, Samuel Thibault, 2014/01/13
- [hurd] 53/98: proc: improve the message_demuxer function, Samuel Thibault, 2014/01/13
- [hurd] 04/98: utils: implement settrans --pid-file,
Samuel Thibault <=
- [hurd] 59/98: trans: improve the netfs_demuxer function in fakeroot.c, Samuel Thibault, 2014/01/13
- [hurd] 48/98: libports: another right leak fix, Samuel Thibault, 2014/01/13
- [hurd] 73/98: trans: improve the error handling in fakeauth, Samuel Thibault, 2014/01/13
- [hurd] 06/98: proc: fix the declaraton of genpid, Samuel Thibault, 2014/01/13
- [hurd] 71/98: trans: fix locking in fakeroot's netfs_S_dir_lookup, Samuel Thibault, 2014/01/13
- [hurd] 70/98: trans: fix reference counting and destruction of fake nodes, Samuel Thibault, 2014/01/13
- [hurd] 77/98: trans/fakeroot: fix ownership of newly created files, Samuel Thibault, 2014/01/13
- [hurd] 64/98: libihash: remove dead code, Samuel Thibault, 2014/01/13
- [hurd] 74/98: trans: unlock nodes with faked attributes in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 75/98: console-client: remove spurious pthread_spin_unlocks, Samuel Thibault, 2014/01/13