FABORT(2,L) AIX Technical Reference FABORT(2,L)
-------------------------------------------------------------------------------
fabort
PURPOSE
Aborts or undoes file changes.
SYNTAX
int fabort (fildes)
int fildes
DESCRIPTION
The fabort system call aborts data changes made to the file specified by the
fildes parameter. The file must be a regular file, not a pipe or special file,
and the file descriptor must either be open for write and defer commit
(O_WRONLY | O_DEFERC) or read/write and defer commit (O_RDWR | O_DEFERC). If
the file has not changed since it was last committed (see "fsync, fcommit"),
the fabort system call has no effect.
The file's content is restored to the state of the file after the last fsync
system call. Changes made to the file's content since the last fsync are
undone. Changes made to the file's mode, owner, or access and modification
times are not undone, however, by this system call. The file remains open so
further changes may be made.
Note: The file offset pointer for this and any other of the file's open file
descriptors are unchanged by fabort and actually may point beyond the
end of the file since the file size is reset.
If the file is newly created (not just truncated), fabort undoes all of the
changes to the file, leaving a zero-length file, but does not undo the file
creation.
If the file is open for writing in defer-commit mode by more than one process,
fabort undoes the changes made to the file by all of the processes since the
last fsync performed by any one of the processes. Also, since commit
operations implied by the close system call are not done until the last close
of the file, fabort undoes any changes between the last fsync and a close that
is not the last close of the file. The use of the lockf system call is
recommended to coordinate multiple writers.
Warning: If the file is opened in defer-commit mode by some processes and
opened for write, but not in defer-commit mode, by other processes, the results
of the fabort system call are undefined.
RETURN VALUE
Processed November 7, 1990 FABORT(2,L) 1
FABORT(2,L) AIX Technical Reference FABORT(2,L)
Upon successful completion, a value of 0 is returned. If the fabort system
call fails, a value of -1 is returned, and errno is set to indicate the error.
ERROR CONDITIONS
The fabort system call fails and the file is not modified if one or more the
following are true:
EAGAIN Another process holds an enforced mode record lock on this file.
EBADF The fildes parameter is not a valid file descriptor for a regular
file.
EBADF The fildes parameter does not specify an open file.
EIO An I/O error occurred. The file content is still rolled back.
ENOSPC The file system ran out of space. The file content is still rolled
back.
ESITEDN1 The operation could not be done because contact with the storage site
is lost. The file content is still rolled back unless the problem is
only a network communication problem and there are other processes
with this file open for writing which have not lost contact with the
storage site.
ESITEDN2 The operation was terminated because a site failed.
RELATED INFORMATION
In this book: "chmod, fchmod," "chown, fchown," "close, closex," "exit,
_exit," "fsync, fcommit," "fcntl, flock, lockf," "open, openx, creat," and
"utime."
Processed November 7, 1990 FABORT(2,L) 2