[Contents]
[Prev] [Next] [Limbo Basics] [Limbo Programming] [Language Definition]

File Descriptors

In Inferno files are identified by a file desciptor, or fd. A reference to a file descriptor is required as a parameter of the read, write, fprint, and stream functions. The file descriptor is obtained through the open, create, and fildes functions. These I/O functions return a reference to an ADT in the Sys module, called FD, that contains the integer-valued fd.

When a file is opened, a Sys->FD is allocated and returned. When the Sys->FD is deallocated, the file is closed. Limbo does not have an explicit close function. Inferno's garbage collector immediate and automatically deallocates an Sys->FD when all references have gone out of scope. If there are no other references to the Sys->FD, the file can be explicitly closed setting the reference to the Sys->FD to nil.



[Contents]
[Prev] [Next] [Limbo Basics] [Limbo Programming] [Language Definition]

Copyright © 1998, Lucent Technologies, Inc. All rights reserved.