Changeset 2157


Ignore:
Timestamp:
Aug 23, 2012, 3:31:29 PM (7 years ago)
Author:
matthijs
Message:

mountd: Change the timer implementation.

Instead of relying on SIGALRM and doing lots of work in the signal
handler, we call the timer proc every now and then from the autofs loop.
This should in theory make mountd more robust, preventing problems when
the timer proc is triggered halfway through a mount attempt, for
example.

Location:
trunk/fon/mountd/src/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/fon/mountd/src/lib/autofs.c

    r2156 r2157  
    148148extern int ntfy;
    149149extern void ntfy_read(void);
     150extern void timer_proc(void);
    150151
    151152static int autofs_in(union autofs_v5_packet_union *pkt)
     
    161162        while(1)
    162163        {
     164                /* Don't change this poll timeout, that breaks the
     165                 * timer_proc below */
    163166                if(poll(fds, 2, 1000) == -1)
    164167                {
     
    173176                if(fds[1].revents & POLLIN)
    174177                        ntfy_read();
     178                else /* poll timed out, run any pending timers */
     179                        timer_proc();
    175180        }
    176181}
  • trunk/fon/mountd/src/lib/timer.c

    r1 r2157  
    4747                }
    4848        }
    49         alarm(1);
     49        //alarm(1);
    5050}
    5151
     
    5454        struct sigaction s;
    5555        INIT_LIST_HEAD(&timers);
     56        /*
     57         * Instead of using SIGALRM, we get autofs_loop to call
     58         * timer_proc every second or so
    5659        s.sa_handler = timer_proc;
    5760        s.sa_flags = 0;
    5861        sigaction(SIGALRM, &s, NULL);
    5962        alarm(1);
     63        */
    6064}
Note: See TracChangeset for help on using the changeset viewer.