From b8d41218d5f4cdf174cdf28d2eaefd5177b86f72 Mon Sep 17 00:00:00 2001 From: franklahm Date: Fri, 20 Mar 2009 09:10:25 +0000 Subject: [PATCH] autoconf option --enable-debugging to disable SIGALRM. See #2694606 --- configure.in | 21 ++++++++++++++++++++- etc/afpd/afp_dsi.c | 6 +++++- libatalk/dsi/dsi_tcp.c | 9 ++++++--- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/configure.in b/configure.in index aa843839..dde99636 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -dnl $Id: configure.in,v 1.212 2009-02-27 09:14:40 franklahm Exp $ +dnl $Id: configure.in,v 1.213 2009-03-20 09:10:25 franklahm Exp $ dnl configure.in for netatalk AC_INIT(etc/afpd/main.c) @@ -299,6 +299,25 @@ AC_ARG_ENABLE(debug, ] ) +AC_MSG_CHECKING([whether to enable debugging with debuggers]) +AC_ARG_ENABLE(debugging, + [ --enable-debugging disable SIGALRM timers and DSI tickles (eg for debugging with gdb/dbx/...)],[ + if test "$enableval" != "no"; then + if test "$enableval" = "yes"; then + AC_DEFINE(DEBUGGING, 1, [Define if you want to disable SIGALRM timers and DSI tickles]) + else + AC_DEFINE_UNQUOTED(DEBUGGING, $enableval, [Define if you want to disable SIGALRM timers and DSI tickles]) + fi + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ],[ + AC_MSG_RESULT([no]) + ] +) + + afp3=no afp3set=no AC_MSG_CHECKING([whether AFP 3.x calls should be enabled]) diff --git a/etc/afpd/afp_dsi.c b/etc/afpd/afp_dsi.c index 673afe77..7ccdb10f 100644 --- a/etc/afpd/afp_dsi.c +++ b/etc/afpd/afp_dsi.c @@ -1,5 +1,5 @@ /* - * $Id: afp_dsi.c,v 1.34 2009-02-27 09:14:40 franklahm Exp $ + * $Id: afp_dsi.c,v 1.35 2009-03-20 09:10:25 franklahm Exp $ * * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu) * Copyright (c) 1990,1993 Regents of The University of Michigan. @@ -288,6 +288,7 @@ void afp_over_dsi(AFPObj *obj) afp_dsi_die(EXITERR_SYS); } +#ifndef DEBUGGING /* tickle handler */ action.sa_handler = alarm_handler; sigemptyset(&action.sa_mask); @@ -302,6 +303,7 @@ void afp_over_dsi(AFPObj *obj) (setitimer(ITIMER_REAL, &dsi->timer, NULL) < 0)) { afp_dsi_die(EXITERR_SYS); } +#endif /* DEBUGGING */ #ifdef DEBUG1 fault_setup((void (*)(void *))afp_dsi_die); @@ -323,7 +325,9 @@ void afp_over_dsi(AFPObj *obj) dsi_tickle(dsi); continue; } else if (!(child.flags & CHILD_DIE)) { /* reset tickle timer */ +#ifndef DEBUGGING setitimer(ITIMER_REAL, &dsi->timer, NULL); +#endif } switch(cmd) { case DSIFUNC_CLOSE: diff --git a/libatalk/dsi/dsi_tcp.c b/libatalk/dsi/dsi_tcp.c index a54d7f35..9e7f93c5 100644 --- a/libatalk/dsi/dsi_tcp.c +++ b/libatalk/dsi/dsi_tcp.c @@ -1,5 +1,5 @@ /* - * $Id: dsi_tcp.c,v 1.12 2007-03-25 15:51:50 didg Exp $ + * $Id: dsi_tcp.c,v 1.13 2009-03-20 09:10:25 franklahm Exp $ * * Copyright (c) 1997, 1998 Adrian Sun (asun@zoology.washington.edu) * All rights reserved. See COPYRIGHT. @@ -131,10 +131,11 @@ static int dsi_tcp_open(DSI *dsi) struct sigaction newact, oldact; u_int8_t block[DSI_BLOCKSIZ]; size_t stored; - + /* reset signals */ server_reset_signal(); +#ifndef DEBUGGING /* install an alarm to deal with non-responsive connections */ newact.sa_handler = timeout_handler; sigemptyset(&newact.sa_mask); @@ -148,6 +149,7 @@ static int dsi_tcp_open(DSI *dsi) LOG(log_error, logtype_default, "dsi_tcp_open: %s", strerror(errno)); exit(EXITERR_SYS); } +#endif /* read in commands. this is similar to dsi_receive except * for the fact that we do some sanity checking to prevent @@ -201,10 +203,11 @@ static int dsi_tcp_open(DSI *dsi) } /* stop timer and restore signal handler */ +#ifndef DEBUGGING memset(&timer, 0, sizeof(timer)); setitimer(ITIMER_REAL, &timer, NULL); sigaction(SIGALRM, &oldact, NULL); - +#endif LOG(log_info, logtype_default,"ASIP session:%u(%d) from %s:%u(%d)", ntohs(dsi->server.sin_port), dsi->serversock, inet_ntoa(dsi->client.sin_addr), ntohs(dsi->client.sin_port), -- 2.39.2