[Box Backup-dev] Moving trunk to release
Martin Ebourne
boxbackup-dev at fluffy.co.uk
Wed Jan 18 01:21:46 GMT 2006
On Tue, 2006-01-17 at 23:27 +0000, Chris Wilson wrote:
> I take it that the safest (perhaps the only safe thing) to do in a signal
> handler is to set a flag?
>From signal(2) on linux:
The routine handler must be very careful, since processing elsewhere
was interrupted at some arbitrary point. POSIX has the concept of "safe
function". If a signal interrupts an unsafe function, and handler
calls an unsafe function, then the behavior is undefined. Safe func-
tions are listed explicitly in the various standards. The POSIX
1003.1-2003 list is
_Exit() _exit() abort() accept() access() aio_error() aio_return()
aio_suspend() alarm() bind() cfgetispeed() cfgetospeed() cfsetispeed()
cfsetospeed() chdir() chmod() chown() clock_gettime() close() connect()
creat() dup() dup2() execle() execve() fchmod() fchown() fcntl() fdata-
sync() fork() fpathconf() fstat() fsync() ftruncate() getegid()
geteuid() getgid() getgroups() getpeername() getpgrp() getpid() getp-
pid() getsockname() getsockopt() getuid() kill() link() listen()
lseek() lstat() mkdir() mkfifo() open() pathconf() pause() pipe()
poll() posix_trace_event() pselect() raise() read() readlink() recv()
recvfrom() recvmsg() rename() rmdir() select() sem_post() send()
sendmsg() sendto() setgid() setpgid() setsid() setsockopt() setuid()
shutdown() sigaction() sigaddset() sigdelset() sigemptyset() sig-
fillset() sigismember() signal() sigpause() sigpending() sigprocmask()
sigqueue() sigset() sigsuspend() sleep() socket() socketpair() stat()
symlink() sysconf() tcdrain() tcflow() tcflush() tcgetattr() tcgetp-
grp() tcsendbreak() tcsetattr() tcsetpgrp() time() timer_getoverrun()
timer_gettime() timer_settime() times() umask() uname() unlink()
utime() wait() waitpid() write().
One thing you can do is sem_post (and sem_wait outside) which can be
handy, though not really appropriate in this instance because the
program will be active.
> Would it be OK to modify the diffing algorithm to either (1) check a
> global flag, or (2) check wall time periodically, and to call a callback
> function which would send a keepalive to the server?
Both sound fine by me. I kind of prefer the latter because it is
simpler, but if it is called a lot then the overhead of the syscall
might be expensive, so (1) could be more optimal.
> Also, does someone want to take the lead for applying this to (a copy
> of) the trunk, or should I?
Please go ahead!
Cheers,
Martin.
More information about the Boxbackup-dev
mailing list