From f7ca998abbd24a9713e884a0c05c2cb37f927292 Mon Sep 17 00:00:00 2001 From: Tonghao Zhang Date: Fri, 25 Aug 2017 00:05:09 -0700 Subject: [PATCH 1/2] redis: Fix the bug which parsing arg ERRO. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For using the redis, we should allow users to configure theirs configure file. Now fstack uses the options as below: —-conf config.ini --proc-type= --proc-id= And we should skip 4 args(including program name arg), not 3. Use the redis-config-file: bin/redis-server --conf config.ini \ --proc-type=primary --proc-id=0 redis-3.2.8/redis.conf Signed-off-by: Tonghao Zhang --- app/redis-3.2.8/src/server.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/redis-3.2.8/src/server.c b/app/redis-3.2.8/src/server.c index 5b962a6f0..835b18688 100644 --- a/app/redis-3.2.8/src/server.c +++ b/app/redis-3.2.8/src/server.c @@ -3957,17 +3957,17 @@ int main(int argc, char **argv) { int rc = ff_init(argc, argv); assert(0 == rc); ff_mod_init(); - //split fstack arguments. - int new_argc = argc - 3; + int new_argc = argc - 4; if (new_argc <= 0) { new_argc = 1; } - char **new_argv = zmalloc(sizeof(char *) * new_argc); + + char **new_argv = zmalloc(sizeof(char *) * new_argc); new_argv[0] = argv[0]; - int i; - for (i = 1; i < new_argc; i++) { - new_argv[i] = argv[i + 3]; - } + int i; + for (i = 1; i < new_argc; i++) { + new_argv[i] = argv[i + 4]; + } argv = new_argv; argc = new_argc; #endif From a7b42f3d8073b13e0b8c1093c3464469d035c4aa Mon Sep 17 00:00:00 2001 From: Tonghao Zhang Date: Fri, 25 Aug 2017 00:11:21 -0700 Subject: [PATCH 2/2] start: Support others args to apps. Other arg is mostly configure file. And this patch will support it. User can use the configure file specified. Signed-off-by: Tonghao Zhang --- start.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/start.sh b/start.sh index c8f78f6f2..60b4d0df2 100755 --- a/start.sh +++ b/start.sh @@ -5,6 +5,7 @@ function usage() { echo "Options:" echo " -c [conf] Path of config file" echo " -b [N] Path of binary" + echo " -o [N] Other ARGs for app" echo " -h show this help" exit } @@ -12,7 +13,7 @@ function usage() { conf=config.ini bin=./example/helloworld -while getopts "c:b:h" args +while getopts "c:b:o:h" args do case $args in c) @@ -21,6 +22,9 @@ do b) bin=$OPTARG ;; + o) + others=$OPTARG + ;; h) usage exit 0 @@ -47,11 +51,11 @@ for((proc_id=0; proc_id<${num_procs}; ++proc_id)) do if ((proc_id == 0)) then - echo "${bin} --conf ${conf} --proc-type=primary --proc-id=${proc_id}" - ${bin} --conf ${conf} --proc-type=primary --proc-id=${proc_id} & + echo "${bin} --conf ${conf} --proc-type=primary --proc-id=${proc_id} ${others}" + ${bin} --conf ${conf} --proc-type=primary --proc-id=${proc_id} ${others} & sleep 5 else - echo "${bin} --conf ${conf} --proc-type=secondary --proc-id=${proc_id}" - ${bin} --conf ${conf} --proc-type=secondary --proc-id=${proc_id} & + echo "${bin} --conf ${conf} --proc-type=secondary --proc-id=${proc_id} ${others}" + ${bin} --conf ${conf} --proc-type=secondary --proc-id=${proc_id} ${others} & fi done