ei_rpc_from speedup?

Per Hedeland per@REDACTED
Sun Aug 31 18:52:20 CEST 2003


Vance Shipley <vances@REDACTED> wrote:
>
>File descriptors are opaque data types.  You shouldn't make 
>any assumptions about what values they take other than that
>they fit in an int.  That file descriptors are assigned 
>incrementally increasing from stdio is only a well known
>practice not a guarantee.

POSIX requires not only that file descriptors are "small integers", and
not only that they are assigned incrementally, but that any system call
returning a file descriptor will return the lowest-numbered free one.
Thus e.g.

  close(0);
  fd = open("/dev/null", O_RDWR);

is guaranteed to set fd to 0 (or -1 in case /dev/null couldn't be
opened:-). And there is *lots* of "core" Unix code that depends on this
behaviour.

>  I'm currently working with devices
>which start at 257 and assign incrementally from there.

I guess they're not POSIX-compliant then. And of course "file
descriptor" can be taken in an "abstract" sense, but then it's not
something you can pass to select() (or poll()).

--Per Hedeland
per@REDACTED



More information about the erlang-questions mailing list