guile-devel
[Top][All Lists]
Advanced

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

Re: getrlimit and setrlimit interface


From: Ludovic Courtès
Subject: Re: getrlimit and setrlimit interface
Date: Mon, 20 Jun 2016 10:48:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Andy Wingo <address@hidden> skribis:

> On Sat 21 Jun 2014 23:49, address@hidden (Ludovic Courtès) writes:
>
>> The ‘getrlimit’ and ‘setrlimit’ procedures are not documented in the
>> manual.  They’re supposed to be passed a symbol or a number:
>>
>>   (getrlimit 'nofile) == (getrlimit 7) ≍ getrlimit (RLIMIT_NOFILE, &lim)
>>
>> For most other POSIX functions with a similar interface, we instead
>> define Scheme variables with the same name as in C (like
>> ‘RLIMIT_NOFILE’) and these are then passed directly to the procedure.
>>
>> Here’s a proposal: define RLIMIT_* Scheme variables, document
>> ‘getrlimit’ and ‘setrlimit’ to accept those, and emit a deprecation
>> warning when the symbol is used.
>>
>> WDYT?
>
> Do you think the usual Guile strategy is a good one?  I find that all
> the constants in the default namespace are a bit distracting.  They do
> allow discovery of (some of the) available enumerated values, but they
> don't limit the enumerated values in any way.  You still have to check
> in the implementation that the value given is a valid value.  Dunno.

I think in an ideal world we’d use real enumerated value constructs
instead of defining all these variables.  But I think that (1) there’s
value in exposing the raw syscall API, and (2) “it’s too late to
change.”  So here I would value consistency over elegance.

> Andy, who apparently only processes mail during solstice weeks :P

:-)

Thanks!

Ludo’.



reply via email to

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