On Mon, Sep 28, 2009 at 1:48 PM, Dustin J. Mitchell <dus...@zmanda.com> wrote: > Option 1 would be temporary -- eventually, I would like to be able to > use threads on clients, to support compression and encryption, for > example. Option 1 is also harder than it sounds -- futzing with the > build process is like playing whack-a-mole, where any change causes > problems on another platform.
Apologies for replying to myself, but while putting together the patch (attached), I noticed that this will affect the server, too -- amandad is the gateway for amrecover to get access to data for recoveries. So option 1 is not really feasible. Dustin -- Open Source Storage Engineer http://www.zmanda.com
help out OpenBSD's pthreads (f369fd11620b09b5efb71eb05ce088fa326b4082) client-src/noop.c | 1 + client-src/selfcheck.c | 1 + client-src/sendbackup.c | 1 + client-src/sendsize.c | 1 + common-src/util.c | 12 ++++++++++++ common-src/util.h | 10 ++++++++++ restore-src/amidxtaped.c | 1 + server-src/amindexd.c | 1 + 8 files changed, 28 insertions(+), 0 deletions(-) diff --git a/client-src/noop.c b/client-src/noop.c index 1edf46f..e9b6270 100644 --- a/client-src/noop.c +++ b/client-src/noop.c @@ -65,6 +65,7 @@ main( signal(SIGPIPE, SIG_IGN); safe_fd(-1, 0); + openbsd_fd_inform(); check_running_as(RUNNING_AS_CLIENT_LOGIN); diff --git a/client-src/selfcheck.c b/client-src/selfcheck.c index 1f22717..ba1ee50 100644 --- a/client-src/selfcheck.c +++ b/client-src/selfcheck.c @@ -108,6 +108,7 @@ main( textdomain("amanda"); safe_fd(-1, 0); + openbsd_fd_inform(); safe_cd(); set_pname("selfcheck"); diff --git a/client-src/sendbackup.c b/client-src/sendbackup.c index fca1f98..219ebf6 100644 --- a/client-src/sendbackup.c +++ b/client-src/sendbackup.c @@ -137,6 +137,7 @@ main( textdomain("amanda"); safe_fd(DATA_FD_OFFSET, DATA_FD_COUNT*2); + openbsd_fd_inform(); safe_cd(); diff --git a/client-src/sendsize.c b/client-src/sendsize.c index e4d589d..165c363 100644 --- a/client-src/sendsize.c +++ b/client-src/sendsize.c @@ -151,6 +151,7 @@ main( textdomain("amanda"); safe_fd(-1, 0); + openbsd_fd_inform(); safe_cd(); set_pname("sendsize"); diff --git a/common-src/util.c b/common-src/util.c index 9ccd9fb..d173e34 100644 --- a/common-src/util.c +++ b/common-src/util.c @@ -1282,3 +1282,15 @@ get_pcontext(void) return pcontext; } +#ifdef __OpenBSD__ +void +openbsd_fd_inform(void) +{ + int i; + for (i = DATA_FD_OFFSET; i < DATA_FD_OFFSET + DATA_FD_COUNT*2; i++) { + /* a simple fcntl() will cause the library to "look" at this file + * descriptor, which is good enough */ + (void)fcntl(i, F_GETFL); + } +} +#endif diff --git a/common-src/util.h b/common-src/util.h index 8604cf1..f74910a 100644 --- a/common-src/util.h +++ b/common-src/util.h @@ -348,4 +348,14 @@ void proplist_add_to_argv(gpointer key_p, gpointer user_data_p); +/* Inform the OpenBSD pthread library about the high-numbered file descriptors + * that an amandad service inherits. This won't be necessary once the new + * threading library is availble (OpenBSD 5.0?), but won't hurt anyway. See the + * thread "Backup issues with OpenBSD 4.5 machines" from September 2009. */ +#ifdef __OpenBSD__ +void openbsd_fd_inform(void); +#else +#define openbsd_fd_inform() +#endif + #endif /* UTIL_H */ diff --git a/restore-src/amidxtaped.c b/restore-src/amidxtaped.c index 3b5b904..42aa369 100644 --- a/restore-src/amidxtaped.c +++ b/restore-src/amidxtaped.c @@ -261,6 +261,7 @@ main( textdomain("amanda"); safe_fd(DATA_FD_OFFSET, 4); + openbsd_fd_inform(); safe_cd(); /* Don't die when child closes pipe */ diff --git a/server-src/amindexd.c b/server-src/amindexd.c index e2d56d5..98e3c28 100644 --- a/server-src/amindexd.c +++ b/server-src/amindexd.c @@ -1251,6 +1251,7 @@ main( textdomain("amanda"); safe_fd(DATA_FD_OFFSET, 2); + openbsd_fd_inform(); safe_cd(); /*