next up previous
Next: 3.4.1 Augmenting System Calls Up: 3 Components of a Previous: 3.3.2 Restoring Mapped Segments

3.4 Files

Any files which are held open by a process at checkpoint time should be re-opened with the same ``attributes'' at restart time. The attributes of an open file include its file descriptor number, the mode in which it is opened, (e.g. read, write, or read-write), the offset to which it is positioned, and whether or not it is a duplicate of another file descriptor. Since much of this information is not made available to user code by the kernel, we record several attributes at the time the file descriptor is created via an open() or dup() system call. Information recorded includes the pathname of the file, the file descriptor number, the mode, and (if it is a dup) the base file descriptor number. The offset to which the file is positioned is captured at checkpoint time by use of the lseek() system call. All of this information is kept in a table in the process's data space, which is of course restored early in the restart process. Later in the restart process, we walk through the table and re-open and re-position all the files as they were at checkpoint time. Of course an important part of a file's state is its content - we assume that that this is stored safely in the file system, and that nobody tampers with it between checkpoint and restart times.