[MLton-devel] Posix.FileSys.pathconf

John Reppy jhr@cs.uchicago.edu
Mon, 8 Sep 2003 15:34:58 -0500


I think that given the desire to have an open-ended implementation 
framework
that we have to view NONE as false when applied to boolean variables.

The POSIX spec says that

	If the variable corresponding to name has no limit for the path or file
     descriptor, the pathconf() and fpathconf() functions shall return 
-1 without
     changing errno.

In this case, Posix.FileSys.pathconf should return NONE.

It is also the case that if the name was invalid or the POSIX 
implementation does not
support an association with the name for the file, then errno will be 
set
to EINVAL.  In this case, Posix.FileSys.pathconf should raise a the 
SysErr exception.

	- John

On Saturday, September 6, 2003, at 05:23  PM, Jesper Louis Andersen 
wrote:

> Quoting Stephen Weeks (sweeks@sweeks.com):
>>
>> The spec for Posix.FileSys.pathconf says that boolean values should be
>> encoded as SOME 0 or SOME 1.  This implies that
>>
>> 	pathconf (..., "SYNC_IO")
>>
>> should never return NONE.  However, on Linux, Poly/ML, SML/NJ, and
>> (the latest internal version of) MLton do return NONE for such a call.
>> This happens because pathconf returns -1 and leaves errno alone.
>> Maybe this should be considered as a bug in Linux?  Or is the correct
>> thing to change the spec to encode true as SOME 1 and false as NONE?
>
> Am I totally wrong when I think the original intention was to have a 
> map
> between:
>
> true 	=== 	SOME 1
> false	===	SOME 0
> __!__	===	NONE
>
> where __!__ is the domain-theoretic bottom. It will have the advantage
> that it enables the ML-part of the interface to cope with undefined
> behaviour in the Posix semantics. I expect there to be at least a 
> couple
> without even having looked at it. Choosing int option as the type does
> not create a 1-1 correspondance, but choosing bool option does.
>
> As I read the NetBSD documentation they specifically say that upon
> returning -1, there will be situations in which the errno is not set[1]
>
> Though it does also specify that setting _PC_SYNC_IO should return 0 or
> 1 respectively.
>
> [1] http://netbsd.gw.com/cgi-bin/man-cgi?pathconf++NetBSD-current
> -- 
> j.
>