From mboxrd@z Thu Jan 1 00:00:00 1970 From: Philipp Hahn Subject: Re: [PATCH v2] no-fork option for tapdisk2 debugging Date: Tue, 21 Jun 2011 17:12:07 +0200 Message-ID: <201106211712.11205.hahn@univention.de> References: <201106211529.39113.hahn@univention.de> <19968.43712.196951.660273@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0938580063==" Return-path: In-Reply-To: <19968.43712.196951.660273@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: Xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============0938580063== Content-Type: multipart/signed; boundary="nextPart3151877.5kIZ5qOVWT"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart3151877.5kIZ5qOVWT Content-Type: multipart/mixed; boundary="Boundary-01=_HTLAO7jmSXv61Mh" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_HTLAO7jmSXv61Mh Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello Ian, Am Dienstag 21 Juni 2011 16:29:20 schrieb Ian Jackson: > That should be folded into the first patch, which otherwise leaves the > indentation wrong. Done. I submitted it as an extra patch only for simplifying review of the=20 additional implementation. > Also, you to add a Signed-off-by line to your patch to signify its > copyright status (see below). The original patch already contained the Signed-off-line, since I knew you = (or=20 somebody else) would be asking for it ;-) If more is needed, please ask=20 again. Sincerely Philipp Hahn =2D-=20 Philipp Hahn Open Source Software Engineer hahn@univention.de Univention GmbH Linux for Your Business fon: +49 421 22 232- 0 Mary-Somerville-Str.1 D-28359 Bremen fax: +49 421 22 232-99 http://www.univention.de/ --Boundary-01=_HTLAO7jmSXv61Mh Content-Type: text/x-diff; charset="iso-8859-15"; name="tapdisk2.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="tapdisk2.diff" no-fork option for tapdisk2 debugging. To simplify running tapdisk2 from a debugger, add an opttion "-n" to disabl= e foring into the background. Signed-off-by: Philipp Hahn =2D- [v2] fold extra indention patch into patch. =2D-- xen-4.0.1.orig/tools/blktap2/drivers/tapdisk2.c 2010-08-25 12:22:07.0= 00000000 +0200 +++ xen-4.0.1/tools/blktap2/drivers/tapdisk2.c 2011-06-17 17:37:35.00000000= 0 +0200 @@ -402,7 +402,7 @@ tapdisk2_wait_for_device(void) static void usage(const char *app, int err) { =2D fprintf(stderr, "usage: %s <-n file>\n", app); + fprintf(stderr, "usage: %s [-f] -n driver:file\n", app); exit(err); } =20 @@ -411,10 +411,11 @@ main(int argc, char *argv[]) { int c; char *params; + int do_fork =3D 1; =20 params =3D NULL; =20 =2D while ((c =3D getopt(argc, argv, "n:s:h")) !=3D -1) { + while ((c =3D getopt(argc, argv, "n:s:fh")) !=3D -1) { switch (c) { case 'n': params =3D optarg; @@ -430,6 +431,9 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); #endif break; + case 'f': + do_fork =3D 0; + break; default: usage(argv[0], EINVAL); } @@ -438,12 +442,17 @@ main(int argc, char *argv[]) if (!params || optind !=3D argc) usage(argv[0], EINVAL); =20 =2D if (pipe(channel) =3D=3D -1) { =2D printf("pipe failed: %d\n", errno); =2D return errno; =2D } + if (do_fork) { + if (pipe(channel) =3D=3D -1) { + printf("pipe failed: %d\n", errno); + return errno; + } + } else { + channel[0] =3D dup(STDIN_FILENO); + channel[1] =3D dup(STDERR_FILENO); + } =20 =2D switch (fork()) { + switch (do_fork ? fork() : 0) { case -1: printf("fork failed: %d\n", errno); return errno; --Boundary-01=_HTLAO7jmSXv61Mh-- --nextPart3151877.5kIZ5qOVWT Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEABECAAYFAk4AtMcACgkQYPlgoZpUDjkibQCfT1SmLejikQe0cAaTLLq9BPUU 3TsAoJotkV4km22u7fAEOUcG/uWEEet4 =t3FA -----END PGP SIGNATURE----- --nextPart3151877.5kIZ5qOVWT-- --===============0938580063== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0938580063==--