From: Alexey Chernobaev Date: Tue, 28 Aug 2018 20:03:27 +0000 (+0300) Subject: Add data port X-Git-Tag: submit/tizen/20180911.125435~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba1a3b1fe8f2958d76af91637b5b13e74fb06ee7;p=sdk%2Ftools%2Fprofctl.git Add data port --- diff --git a/README.md b/README.md index 1253f7f..2a2fe73 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,9 @@ profctl [options...] waiting timeout in seconds * `-w, --pipe-owner` make profctl responsible on pipe management (create/unlink) -* `-s, --server=port` - server port for control and data output -* `-S, --stat=port` +* `-c, --control=port` + server port for control +* `-d, --data=port` + server port for data output +* `-s, --stat=port` server port for statistic output diff --git a/profctl.c b/profctl.c index 0df6dd3..26f2173 100644 --- a/profctl.c +++ b/profctl.c @@ -49,8 +49,10 @@ static char *oname = NULL; static int isPipeOwner = 0; static int controlPort = -1; +static int dataPort = -1; static int statPort = -1; static FILE *ctrl_file_in = NULL; +static FILE *ctrl_file_out = NULL; static FILE *data_file_out = NULL; static FILE *stat_file_out = NULL; @@ -64,9 +66,10 @@ static struct option long_options[] = { {"list", no_argument, 0, 'l'}, {"info", no_argument, 0, 'i'}, {"pipe-owner", no_argument, 0, 'w'}, - {"server", required_argument, 0, 's'}, - {"stat", required_argument, 0, 'S'}, - {0, 0, 0, 0} + {"control", required_argument, 0, 'c'}, + {"data", required_argument, 0, 'd'}, + {"stat", required_argument, 0, 's'}, + {0, 0, 0, 0} }; static void log_current_time() @@ -399,7 +402,7 @@ static int process_option(int argc, char **argv) { int option_index; - switch(getopt_long(argc, argv, "-a:p:vle:o:it:ws:S:", + switch(getopt_long(argc, argv, "-a:p:vle:o:it:wc:d:s:", long_options, &option_index)) { case 1: if (appid == NULL) { @@ -420,8 +423,9 @@ static int process_option(int argc, char **argv) case 'i': doinfo = 1; break; case 't': timeoutMicrosec = atoi(optarg) * 1000; break; case 'w': isPipeOwner = 1; break; - case 's': controlPort = atoi(optarg); break; - case 'S': statPort = atoi(optarg); break; + case 'c': controlPort = atoi(optarg); break; + case 'd': dataPort = atoi(optarg); break; + case 's': statPort = atoi(optarg); break; default: return -1; } @@ -679,7 +683,7 @@ int main(int argc, char **argv) } #if TIZEN - if (controlPort < 0 && statPort < 0) { + if (controlPort < 0 && dataPort < 0 && statPort < 0) { /* stty */ tcgetattr(0, &term); sterm = term; @@ -699,6 +703,14 @@ int main(int argc, char **argv) } } + if (dataPort > 0) { + int s = openPort(dataPort); + data_file_out = fdopen(s, "w"); + if (data_file_out == NULL) { + log_system_error_and_exit("fdopen(data,w)"); + } + } + if (doinfo && (statPort > 0)) { int s = openPort(statPort); stat_file_out = fdopen(s, "w");