FD_WRITE(3H) — Pixar Programmer’s Manual — libfd
NAME
fd_write− write to the fast-disk filesystem
SYNOPSIS
cc = fd_write(d, buf, nbytes)
int cc, d;
char ∗buf;
int nbytes;
DESCRIPTION
Fd_write attempts to write nbytes of data to the Fast-Disk file referenced by the descriptor d from the buffer pointed to by buf.
Writing starts at the file position given by the pointer associated with d (see fd_lseek(3H)). Upon return from fd_write, the pointer is incremented by the number of bytes actually written.
Unlike UNIX write(2), fd_write writes its data immediately to disk. If fd_write returns successfully, the user program can conclude that the returned number of bytes were written successfully to the Fast-Disk.
RETURN VALUE
Upon successful completion, fd_write returns the number of bytes actually written; this number may be less than nbytes if end-of-file is encountered before the requested number of bytes have been written. If the returned value is 0, then the file’s pointer was at or beyond end-of-file when fd_write was called.
On failure, a −1 is returned and the global variable errno is set to indicate the error.
ERRORS
Fd_write will fail and the file pointer will remain unchanged if one or more of the following are true:
[EBADF] D is not a valid descriptor open for writing.
[EIO] An I/O error occurred while accessing the Fast-Disk.
SEE ALSO
fd_create(3H), fd_open(3H), fd_read(3H), fd(5)
Release β — Last change: 10/12/88