diff --git a/common/utils/T/T.c b/common/utils/T/T.c index 818f741a991ed73e812a37651e0cc7c33c1dc7eb..8d9f3d2aa0389a5c9b3d5ae12fb7988c131f89ff 100644 --- a/common/utils/T/T.c +++ b/common/utils/T/T.c @@ -59,6 +59,7 @@ printf("got mess %d\n", t); l--; } break; + case 2: break; /* do nothing, this message is to wait for local tracer */ } } diff --git a/common/utils/T/tracer/local.c b/common/utils/T/tracer/local.c index 6c1368cc13cec596cbac7d6780179d7d84709934..8f60eca34098529fe23e6ad23b7a09efd7add016 100644 --- a/common/utils/T/tracer/local.c +++ b/common/utils/T/tracer/local.c @@ -98,7 +98,9 @@ void usage(void) "tracer - local side\n" "options:\n" " -r <IP address> <port> forwards packets to remote IP:port\n" -" (default %s:%d)\n", +" (default %s:%d)\n" +" -nowait don't wait for remote tracer,\n" +" start tracee immediately\n", DEFAULT_REMOTE_IP, DEFAULT_REMOTE_PORT ); exit(1); @@ -111,20 +113,27 @@ int main(int n, char **v) char *remote_ip = DEFAULT_REMOTE_IP; int remote_port = DEFAULT_REMOTE_PORT; int port = 2020; + int dont_wait = 0; void *f; for (i = 1; i < n; i++) { if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage(); if (!strcmp(v[i], "-r")) { if (i > n-3) usage(); remote_ip = v[++i]; remote_port = atoi(v[++i]); continue; } + if (!strcmp(v[i], "-nowait")) { dont_wait = 1; continue; } printf("ERROR: unknown option %s\n", v[i]); usage(); } - f = forwarder(remote_ip, remote_port); init_shm(); s = get_connection("127.0.0.1", port); + if (dont_wait) { + char t = 2; + if (write(s, &t, 1) != 1) abort(); + } + + f = forwarder(remote_ip, remote_port); forward_start_client(f, s); /* read messages */