unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* getrlimit and setrlimit interface
@ 2014-06-21 21:49 Ludovic Courtès
  2016-06-20  7:56 ` Andy Wingo
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2014-06-21 21:49 UTC (permalink / raw)
  To: guile-devel

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?

Ludo’.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: getrlimit and setrlimit interface
  2014-06-21 21:49 getrlimit and setrlimit interface Ludovic Courtès
@ 2016-06-20  7:56 ` Andy Wingo
  2016-06-20  8:48   ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Wingo @ 2016-06-20  7:56 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

On Sat 21 Jun 2014 23:49, ludo@gnu.org (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.

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: getrlimit and setrlimit interface
  2016-06-20  7:56 ` Andy Wingo
@ 2016-06-20  8:48   ` Ludovic Courtès
  0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2016-06-20  8:48 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

Andy Wingo <wingo@pobox.com> skribis:

> On Sat 21 Jun 2014 23:49, ludo@gnu.org (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’.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-20  8:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-21 21:49 getrlimit and setrlimit interface Ludovic Courtès
2016-06-20  7:56 ` Andy Wingo
2016-06-20  8:48   ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).