]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/afp_dsi.c
remove most sparse warning 'symbol 'xxx' was not declared. Should it be static?'
[netatalk.git] / etc / afpd / afp_dsi.c
index a38bc99004de041a82fd232f5bfd26da14057424..2803236379b1c4113d28ab878860b455df0ec7f5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_dsi.c,v 1.33 2008-12-03 18:35:44 didg Exp $
+ * $Id: afp_dsi.c,v 1.39 2009-10-14 01:38:28 didg Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -43,8 +43,6 @@
 #include "uid.h"
 #endif /* FORCE_UIDGID */
 
-extern struct oforks   *writtenfork;
-
 #define CHILD_DIE         (1 << 0)
 #define CHILD_RUNNING     (1 << 1)
 #define CHILD_SLEEPING    (1 << 2)
@@ -64,9 +62,6 @@ static void afp_dsi_close(AFPObj *obj)
     if (obj->logout)
         (*obj->logout)();
 
-    /* UAM had syslog control; afpd needs to reassert itself */
-    set_processname("afpd");
-    syslog_setup(log_debug, logtype_default, logoption_ndelay | logoption_pid, logfacility_daemon);
     LOG(log_info, logtype_afpd, "%.2fKB read, %.2fKB written",
         dsi->read_count/1024.0, dsi->write_count/1024.0);
 
@@ -111,7 +106,7 @@ static void afp_dsi_sleep(void)
 }
 
 /* ------------------- */
-static void afp_dsi_timedown()
+static void afp_dsi_timedown(int sig _U_)
 {
     struct sigaction   sv;
     struct itimerval   it;
@@ -159,7 +154,7 @@ static void afp_dsi_timedown()
 */
 volatile int reload_request = 0;
 
-static void afp_dsi_reload()
+static void afp_dsi_reload(int sig _U_)
 {
     reload_request = 1;
 }
@@ -173,7 +168,7 @@ static void afp_dsi_getmesg (int sig _U_)
 }
 #endif /* SERVERTEXT */
 
-static void alarm_handler()
+static void alarm_handler(int sig _U_)
 {
     int err;
 
@@ -220,6 +215,7 @@ void afp_over_dsi(AFPObj *obj)
     u_int32_t err, cmd;
     u_int8_t function;
     struct sigaction action;
+    const char *afpcmpstr;
 
     obj->exit = afp_dsi_die;
     obj->reply = (int (*)()) dsi_cmdreply;
@@ -291,6 +287,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);
@@ -305,6 +302,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);
@@ -326,7 +324,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:
@@ -363,12 +363,17 @@ void afp_over_dsi(AFPObj *obj)
                 dsi->datalen = DSI_DATASIZ;
                 child.flags |= CHILD_RUNNING;
 
+                afpcmpstr = AfpNum2name(function);
+                LOG(log_debug, logtype_afpd, "=> Start AFP command: %s", afpcmpstr);
+
                 err = (*afp_switch[function])(obj,
                                               dsi->commands, dsi->cmdlen,
                                               dsi->data, &dsi->datalen);
+
+                LOG(log_debug, logtype_afpd, "=> Finished AFP command: %s", afpcmpstr);
 #ifdef FORCE_UIDGID
                /* bring everything back to old euid, egid */
-               if (obj->force_uid)
+                if (obj->force_uid)
                    restore_uidgid ( &obj->uidgid );
 #endif /* FORCE_UIDGID */
                 child.flags &= ~CHILD_RUNNING;