bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Guillem Jover
Subject: Re: Porting uptimed: Usage of daemon and replacement of NOFILE
Date: Fri, 4 Nov 2011 00:55:00 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

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 unlimited, where is this written? I
> thought it indicated an error.

  <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html>

> RETURN VALUE
>  The current limit on the number of open files per process.
> 
> ERRORS
>   On  Linux,  getdtablesize()  can return any of the errors described
> for getrlimit(2); see NOTES below.
> 
> I expected the gettablesize to return a value of -1 indicating an error.

Ah sorry, when I mentioned the unlimited case that was for sysconf(),
but then aborting on getdtablesize() error is still harsh and we can
default there to the extremely safe 3 standard file descriptors too
(although using _POSIX_OPEN_MAX as a fallback could also be a safe
option).

> Updated patch attached, OK now?

> diff -ur uptimed-0.3.16/configure.ac uptimed-0.3.16.modified/configure.ac
> --- uptimed-0.3.16/configure.ac       2009-01-02 00:46:00.000000000 +0100
> +++ uptimed-0.3.16.modified/configure.ac      2011-11-01 22:45:58.000000000 
> +0100
> @@ -31,6 +31,9 @@
>    *-darwin*)
>      AC_DEFINE(PLATFORM_BSD, 1, [Define if you are compiling for *BSD])
>      ;;
> +  *-gnu*)
> +    AC_DEFINE(PLATFORM_GNU, 1, [Define if you are compiling for *GNU])
> +    ;;
>    *)
>      AC_DEFINE(PLATFORM_UNKNOWN, 1, [Define if you are compiling for an 
> unknown system])
>      ;;

If you add this, no platform specific code is being used, so it should
not build as it stops using the fallback unknown platform one. You'll
have to complete the platform specific cases in the code, for example
in read_sysinfo(). grep'ing for PLATFORM_ will show you where.

The rest looks good.

thanks,
guillem



reply via email to

[Prev in Thread] Current Thread [Next in Thread]