Index: distinfo =================================================================== --- distinfo (revision 175) +++ distinfo (working copy) @@ -12,3 +12,6 @@ SHA1 (patch-ag) = a6c586cdfbad923a3497fa4ab0c73840dc035737 SHA1 (patch-ah) = d60b5304109f64f70146a222f6eb1deeb58dd6ac SHA1 (patch-ai) = 56b63d4790a11f5eb128186ad5efdd1bcf102f2e +SHA1 (patch-aj) = 51049d69f037dee0c153ee0f8ec8dbf68ce6443b +SHA1 (patch-ak) = d75c013f016b5577ff2f92b480279fa72025620e +SHA1 (patch-al) = 31fe24108f05b68bebc8835d292d6f842accbfc1 Index: options.mk =================================================================== --- options.mk (revision 175) +++ options.mk (working copy) @@ -20,3 +20,5 @@ .else CONFIGURE_ARGS+= --without-tcltk .endif + +MAKE_ENV+= NO_R_TO_GCC_LINKER=1 Index: patches/patch-aj =================================================================== --- patches/patch-aj (revision 0) +++ patches/patch-aj (revision 0) @@ -0,0 +1,49 @@ +--- progress.c.orig 2009-05-04 16:27:58.000000000 +0000 ++++ progress.c 2009-06-07 21:33:22.000000000 +0000 +@@ -35,6 +35,16 @@ + struct throughput *throughput; + }; + ++#ifdef __QNXNTO__ ++# include "compat/qnx.h" ++static pthread_t* tid; ++ ++static void* sa_restart_thread(void* arg) ++{ ++ qnx_signal_thread(); ++} ++#endif ++ + static volatile sig_atomic_t progress_update; + + static void progress_interval(int signum) +@@ -52,8 +62,15 @@ + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = progress_interval; + sigemptyset(&sa.sa_mask); ++ ++#ifdef __QNXNTO__ ++ sa.sa_flags = 0; ++ qnx_create_signal_thread(tid, sa_restart_thread); ++ qnx_sigaction(tid, SIGALRM, &sa); ++#else + sa.sa_flags = SA_RESTART; + sigaction(SIGALRM, &sa, NULL); ++#endif + + v.it_interval.tv_sec = 1; + v.it_interval.tv_usec = 0; +@@ -65,7 +82,13 @@ + { + struct itimerval v = {{0,},}; + setitimer(ITIMER_REAL, &v, NULL); ++ ++#ifdef __QNXNTO__ ++ qnx_destroy_signal_thread(tid); ++#endif ++ + signal(SIGALRM, SIG_IGN); ++ + progress_update = 0; + } + Index: patches/patch-ak =================================================================== --- patches/patch-ak (revision 0) +++ patches/patch-ak (revision 0) @@ -0,0 +1,45 @@ +--- builtin-log.c.orig 2009-05-04 16:27:58.000000000 +0000 ++++ builtin-log.c 2009-06-07 21:33:09.000000000 +0000 +@@ -18,6 +18,16 @@ + #include "shortlog.h" + #include "remote.h" + ++#ifdef __QNXNTO__ ++# include "compat/qnx.h" ++static pthread_t* tid; ++ ++static void* sa_restart_thread(void* arg) ++{ ++ qnx_signal_thread(); ++} ++#endif ++ + /* Set a default date-time format for git log ("log.date" config variable) */ + static const char *default_date_mode = NULL; + +@@ -158,8 +168,14 @@ + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = early_output; + sigemptyset(&sa.sa_mask); ++#ifdef __QNXNTO__ ++ sa.sa_flags = 0; ++ qnx_create_signal_thread(tid, sa_restart_thread); ++ qnx_sigaction(tid, SIGALRM, &sa); ++#else + sa.sa_flags = SA_RESTART; + sigaction(SIGALRM, &sa, NULL); ++#endif + + /* + * If we can get the whole output in less than a +@@ -176,6 +192,10 @@ + static void finish_early_output(struct rev_info *rev) + { + int n = estimate_commit_count(rev, rev->commits); ++ ++#ifdef __QNXNTO__ ++ qnx_destroy_signal_thread(tid); ++#endif + signal(SIGALRM, SIG_IGN); + show_early_header(rev, "done", n); + } Index: patches/patch-al =================================================================== --- patches/patch-al (revision 0) +++ patches/patch-al (revision 0) @@ -0,0 +1,79 @@ +--- /dev/null 2009-06-07 22:24:00.000000000 +0000 ++++ compat/qnx.h 2009-06-07 22:23:41.000000000 +0000 +@@ -0,0 +1,76 @@ ++#include ++ ++/* ++ * QNX does not support SA_RESTART, so we delegate the ++ * signal processing to a seperate handler thread. ++ * Otherwise I/O-syscalls (read, write,...) could be ++ * interrupted by SIGALRM. ++ */ ++static void qnx_create_signal_thread(pthread_t* tid, void*(*start_routine)(void*)) ++{ ++ int ret; ++ sigset_t set, oset; ++ sigfillset(&set); ++ ++ // Let the handler thread inherit a signal mask ++ // with all signals blocked ++ pthread_sigmask(SIG_BLOCK, &set, &oset); ++ ++ // Start the thread ++ ret = pthread_create(tid, NULL, start_routine, NULL); ++ if(ret != EOK) { ++ die("pthread_create: %s", strerror(ret)); ++ return; ++ } ++ ++ // And reset the signal mask ++ pthread_sigmask(SIG_SETMASK, &oset, NULL); ++} ++ ++static void qnx_destroy_signal_thread(pthread_t* ptid) ++{ ++ sigset_t set; ++ ++ // Block all signals ++ sigfillset(&set); ++ SignalProcmask_r(0, ptid, SIG_BLOCK, &set, NULL); ++ ++ // And stop thread ++ pthread_cancel(*ptid); ++} ++ ++static inline void qnx_signal_thread(void) ++{ ++ sigset_t set; ++ ++ // SignalWaitinfo_r should block until one or more signals ++ // in set become pending or until interrupted by an unblocked, ++ // caught signal ++ sigemptyset(&set); ++ ++ while(1) { ++ SignalWaitinfo_r(&set, NULL); ++ } ++} ++ ++static void qnx_sigaction(pthread_t* ptid, int signal, struct sigaction* sa) ++{ ++ int ret; ++ sigset_t set, oset; ++ ++ // Create a new signal mask blocking SIGALRM fo ++ // this thread ++ sigemptyset(&set); ++ sigaddset(&set, signal); ++ pthread_sigmask(SIG_BLOCK, &set, &oset); ++ ++ // Register the signal handler ++ ret = sigaction(signal, sa, NULL); ++ if(ret < 0) { ++ pthread_sigmask(SIG_SETMASK, &oset, NULL); ++ return; ++ } ++ ++ // And delegate the signal handling to sa_restart_thread! ++ SignalProcmask_r(0, ptid, SIG_UNBLOCK, &set, NULL); ++}