Re: Porting uptimed: Usage of daemon and replacement of NOFILE

2011-11-04 Thread Svante Signell
On Fri, 2011-11-04 at 00:55 +0100, Guillem Jover wrote: > Hi! ... > > + *-gnu*) > > +AC_DEFINE(PLATFORM_GNU, 1, [Define if you are compiling for *GNU]) > > +;; ... > If you add this, no platform specific code is being used, so it should > not build as it stops using the fallback unknown pl

Re: Porting uptimed: Usage of daemon and replacement of NOFILE

2011-11-03 Thread Guillem Jover
Hi! On Tue, 2011-11-01 at 23:25:13 +0100, Svante Signell wrote: > On Tue, 2011-11-01 at 22:30 +0100, Guillem Jover wrote: > > and then use HAVE_GETDTABLESIZE. Also if there's no limit (-1) it's a > > bit harsh to exit(1). I'd code this for example like: > > I did not realize that -1 meant unlimit

Re: Porting uptimed: Usage of daemon and replacement of NOFILE

2011-11-01 Thread Svante Signell
On Tue, 2011-11-01 at 22:30 +0100, Guillem Jover wrote: > On Tue, 2011-11-01 at 15:57:53 +0100, Svante Signell wrote: .. > __USE_BSD is an internal macro used by glibc and should not be relied > on. Add a check to configure.ac instead, something like this: > > AC_CHECK_FUNCS([getdtablesize]) Ok,

Re: Porting uptimed: Usage of daemon and replacement of NOFILE

2011-11-01 Thread Guillem Jover
On Tue, 2011-11-01 at 15:57:53 +0100, Svante Signell wrote: > Updated code snippet below, OK? > > void bg(void) > { > int i, fdmax; [...] > /* Close probably all file descriptors */ > #ifdef __USE_BSD > if ((fdmax = getdtablesize()) == -1) exit(1); > #else > if ((fd

Re: Porting uptimed: Usage of daemon and replacement of NOFILE

2011-11-01 Thread Svante Signell
On Tue, 2011-11-01 at 13:34 +0100, Guillem Jover wrote: > On Tue, 2011-11-01 at 11:49:48 +0100, Svante Signell wrote: > > In package uptimed-0.3.16 the following function is defined: > > void bg(void) Updated code snippet below, OK? void bg(void) { int i, fdmax; /* Simple fork to

Re: Porting uptimed: Usage of daemon and replacement of NOFILE

2011-11-01 Thread Michael Banck
Hi, On Tue, Nov 01, 2011 at 11:49:48AM +0100, Svante Signell wrote: > In package uptimed-0.3.16 the following function is defined: BTW, I had a look at uptimed before, and the main problem I faced (IIRC), was making it crash safe. uptimed is writing the current uptime into a file, and even on GN

Re: Porting uptimed: Usage of daemon and replacement of NOFILE

2011-11-01 Thread Guillem Jover
On Tue, 2011-11-01 at 11:49:48 +0100, Svante Signell wrote: > In package uptimed-0.3.16 the following function is defined: > void bg(void) > { [...] > /* Close probably all file descriptors */ > for (i = 0; i close(i); [...] > } > Two questions arrives after discuss