[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] tools/console: introduce --start-notify-fd option for console client
commit 373f99d2eafd084073731486a20a3a5a2e120548 Author: Wei Liu <wei.liu2@xxxxxxxxxx> AuthorDate: Fri Jul 29 18:24:25 2016 +0100 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Mon Aug 8 11:41:27 2016 +0100 tools/console: introduce --start-notify-fd option for console client The console client will write 0x00 to that fd before entering console loop to indicate its readiness. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- tools/console/client/main.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tools/console/client/main.c b/tools/console/client/main.c index be39700..977779f 100644 --- a/tools/console/client/main.c +++ b/tools/console/client/main.c @@ -77,6 +77,7 @@ static void usage(const char *program) { " -h, --help display this help and exit\n" " -n, --num N use console number N\n" " --type TYPE console type. must be 'pv' or 'serial'\n" + " --start-notify-fd N file descriptor used to notify parent\n" , program); } @@ -327,10 +328,12 @@ int main(int argc, char **argv) int ch; unsigned int num = 0; int opt_ind=0; + int start_notify_fd = -1; struct option lopt[] = { { "type", 1, 0, 't' }, { "num", 1, 0, 'n' }, { "help", 0, 0, 'h' }, + { "start-notify-fd", 1, 0, 's' }, { 0 }, }; @@ -364,6 +367,9 @@ int main(int argc, char **argv) exit(EINVAL); } break; + case 's': + start_notify_fd = atoi(optarg); + break; default: fprintf(stderr, "Invalid argument\n"); fprintf(stderr, "Try `%s --help' for more information.\n", @@ -462,6 +468,22 @@ int main(int argc, char **argv) init_term(STDIN_FILENO, &stdin_old_attr); atexit(restore_term_stdin); /* if this fails, oh dear */ } + + if (start_notify_fd != -1) { + /* Write 0x00 to notify parent about client's readiness */ + static const char msg[] = { 0x00 }; + int r; + + do { + r = write(start_notify_fd, msg, 1); + } while ((r == -1 && errno == EINTR) || r == 0); + + if (r == -1) + err(errno, "Could not notify parent with fd %d", + start_notify_fd); + close(start_notify_fd); + } + console_loop(spty, xs, path, interactive); free(path); -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |