{"thread":{"id":"32712","subject":"[PATCH] don't use timers if NO_SETITIMER is set","startedAt":"2013-01-24T01:38:18Z","lastAt":"2013-01-24T01:38:18Z","messageCount":1,"participants":["Sébastien Boisvert"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"207658","messageId":"1358991498-14371-1-git-send-email-sebastien.boisvert@calculquebec.ca","threadId":"32712","inReplyTo":null,"subject":"[PATCH] don't use timers if NO_SETITIMER is set","fromName":"Sébastien Boisvert","fromEmail":"sebastien.boisvert@calculquebec.ca","sentAt":"2013-01-24T01:38:18Z","receivedAt":"2013-01-24T01:38:18Z","isPatch":true,"sender":{"key":"sebastien.boisvert@calculquebec.ca","avatar":null},"body":"With NO_SETITIMER, the user experience on legacy Lustre is fixed,\nbut there is no early progress.\n\nThe patch has no effect on the resulting git executable if NO_SETITIMER is\nnot set (the default). So by default this patch has no effect at all, which\nis good.\n\ngit tests:\n\n$ make clean\n$ make NO_SETITIMER=YesPlease\n$ make test NO_SETITIMER=YesPlease &> make-test.log\n\n$ grep \"^not ok\" make-test.log |grep -v \"# TODO known breakage\"|wc -l\n0\n$ grep \"^ok\" make-test.log |wc -l\n9531\n$ grep \"^not ok\" make-test.log |wc -l\n65\n\nNo timers with NO_SETITIMER:\n\n$ objdump -d ./git|grep setitimer|wc -l\n0\n$ objdump -d ./git|grep alarm|wc -l\n0\n\nTimers without NO_SETITIMER:\n\n$ objdump -d /software/apps/git/1.8.1/bin/git|grep setitimer|wc -l\n5\n$ objdump -d /software/apps/git/1.8.1/bin/git|grep alarm|wc -l\n0\n\nSigned-off-by: Sébastien Boisvert <sebastien.boisvert@calculquebec.ca>\n---\n builtin/log.c |    7 +++++++\n daemon.c      |    6 ++++++\n progress.c    |    8 ++++++++\n upload-pack.c |    2 ++\n 4 files changed, 23 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 8f0b2e8..f8321c7 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -198,7 +198,9 @@ static void show_early_header(struct rev_info *rev, const char *stage, int nr)\n \tprintf(_(\"Final output: %d %s\\n\"), nr, stage);\n }\n \n+#ifndef NO_SETITIMER\n static struct itimerval early_output_timer;\n+#endif\n \n static void log_show_early(struct rev_info *revs, struct commit_list *list)\n {\n@@ -240,9 +242,12 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)\n \t * trigger every second even if we're blocked on a\n \t * reader!\n \t */\n+\n+\t#ifndef NO_SETITIMER\n \tearly_output_timer.it_value.tv_sec = 0;\n \tearly_output_timer.it_value.tv_usec = 500000;\n \tsetitimer(ITIMER_REAL, &early_output_timer, NULL);\n+\t#endif\n }\n \n static void early_output(int signal)\n@@ -274,9 +279,11 @@ static void setup_early_output(struct rev_info *rev)\n \t *\n \t * This is a one-time-only trigger.\n \t */\n+\t#ifndef NO_SETITIMER\n \tearly_output_timer.it_value.tv_sec = 0;\n \tearly_output_timer.it_value.tv_usec = 100000;\n \tsetitimer(ITIMER_REAL, &early_output_timer, NULL);\n+\t#endif\n }\n \n static void finish_early_output(struct rev_info *rev)\ndiff --git a/daemon.c b/daemon.c\nindex 4602b46..eb82c19 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -611,9 +611,15 @@ static int execute(void)\n \tif (addr)\n \t\tloginfo(\"Connection from %s:%s\", addr, port);\n \n+\t#ifndef NO_SETITIMER\n \talarm(init_timeout ? init_timeout : timeout);\n+\t#endif\n+\n \tpktlen = packet_read_line(0, line, sizeof(line));\n+\n+\t#ifndef NO_SETITIMER\n \talarm(0);\n+\t#endif\n \n \tlen = strlen(line);\n \tif (pktlen != len)\ndiff --git a/progress.c b/progress.c\nindex 3971f49..b84ccc7 100644\n--- a/progress.c\n+++ b/progress.c\n@@ -45,7 +45,10 @@ static void progress_interval(int signum)\n static void set_progress_signal(void)\n {\n \tstruct sigaction sa;\n+\n+\t#ifndef NO_SETITIMER\n \tstruct itimerval v;\n+\t#endif\n \n \tprogress_update = 0;\n \n@@ -55,16 +58,21 @@ static void set_progress_signal(void)\n \tsa.sa_flags = SA_RESTART;\n \tsigaction(SIGALRM, &sa, NULL);\n \n+\t#ifndef NO_SETITIMER\n \tv.it_interval.tv_sec = 1;\n \tv.it_interval.tv_usec = 0;\n \tv.it_value = v.it_interval;\n \tsetitimer(ITIMER_REAL, &v, NULL);\n+\t#endif\n }\n \n static void clear_progress_signal(void)\n {\n+\t#ifndef NO_SETITIMER\n \tstruct itimerval v = {{0,},};\n \tsetitimer(ITIMER_REAL, &v, NULL);\n+\t#endif\n+\n \tsignal(SIGALRM, SIG_IGN);\n \tprogress_update = 0;\n }\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 95d8313..e0b8b32 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -47,7 +47,9 @@ static int stateless_rpc;\n \n static void reset_timeout(void)\n {\n+\t#ifndef NO_SETITIMER\n \talarm(timeout);\n+\t#endif\n }\n \n static int strip(char *line, int len)\n-- \n1.7.4.1\n"}]}