rt-tests: oslat: print version string
PATCH 1/1 rt-tests: oslat: print version string
During the streamlining of the command line options something went awry with the version. The author of oslat wishes to always print the version string. This allows us to just exit in the case of -v
Fixes e411219d27b1
--- src/oslat/oslat.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
src/oslat/oslat.c +3 -4
@@ -512,7 +512,6 @@ static void handle_alarm(int code)static void usage (int error) { -printf ("oslat V %1.2f\n" ,VERSION );printf ("Usage:\n" "oslat <options>\n\n" "This is an OS latency detector by running busy loops on specified cores.\n"
@@ -657,8 +656,8 @@ static void parse_options(int argc, char *argv[])break ;case 'v' :/* -* Because we always dump the version even before parsing options, -* what we need to do is to quit.. +* We always print the version before parsing options +* so just exit */ exit (0 );break ;
@@ -736,7 +735,7 @@ int main(int argc, char *argv[]) g.workload_mem_size =WORKLOAD_MEM_SIZE ;/* Run the main thread on cpu0 by default */ g.cpu_main_thread =0 ; - +printf ("oslat V %1.2f\n" ,VERSION );parse_options (argc, argv);TEST (mlockall (MCL_CURRENT |MCL_FUTURE ) ==0 );
Signature · 1 line
2.26.2
src/oslat/oslat.c static void handle_alarm(int code) · line 515
Quoted 8 lines
src/oslat/oslat.c +0
-1@@ -512,7 +512,6 @@ static void handle_alarm(int code)static void usage (int error) { -printf ("oslat V %1.2f\n" ,VERSION ); printf("Usage:\n"
Why do you remove the version string in the usage output. Every other tool prints it?
Quoted 4 lines · Daniel Wagner
Quoted 4 lines
src/oslat/oslat.c +0
-0@@ -512,7 +512,6 @@ static void handle_alarm(int code)
Quoted 9 lines
src/oslat/oslat.c static void handle_alarm(int code) · line 515
Quoted 4 lines
src/oslat/oslat.c +0
-1static void usage (int error) { -printf ("oslat V %1.2f\n" ,VERSION ); printf("Usage:\n"Why do you remove the version string in the usage output. Every other tool prints it?
Because the version is printed out before the call to parse the options. If you don't remove it here, it gets printed out twice.
John
Quoted 2 lines · John Kacur
Because the version is printed out before the call to parse the options. If you don't remove it here, it gets printed out twice.
Ah, that makes sense.
Quoted 3 lines · John Kacur
During the streamlining of the command line options something went awry with the version. The author of oslat wishes to always print the version string. This allows us to just exit in the case of -v
Thanks. It's just that if we need to recover "-v" behavior it's simply to just add that print() back, imho. Sorry if I seemed to have made that request "stronger". :)
Quoted 7 lines
Fixes
e411219d27b1Reported-by Pradipta Kumar Sahoo <[email protected]>Reported-by Reported-by: Peter Xu <[email protected]>Signed-off-by John Kacur <[email protected]>
Signature · 1 line
Peter Xu