truncate man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



TRUNCATE(2)							   TRUNCATE(2)

NAME
     truncate, ftruncate, truncate64, ftruncate64 - set a file to a specified
     length

C SYNOPSIS
     #include <unistd.h>

     int truncate (const char *path, off_t length);

     int ftruncate (int fildes, off_t length);

     int truncate64 (const char *path, off64_t length);

     int ftruncate64 (int fildes, off64_t length);

DESCRIPTION
     The file whose name is given by path or referenced by the descriptor
     fildes has its size set to length bytes.

     If the file was previously longer than length, bytes past length will no
     longer be accessible.  If it was shorter, bytes from the EOF before the
     call to the EOF after the call will be read in as zeros.  The effective
     user ID of the process must have write permission for the file, and for
     ftruncate and ftruncate64 the file must be open for writing.

     The only difference between the regular routines and the *64 routines is
     that length is a 64-bit value for the *64 routines, allowing files longer
     than 2 gigabytes in size to be truncated.	This is relevant only on
     certain filesystem types.

     truncate and truncate64 fail if one or more of the following are true:

     EACCES	       Search permission is denied on a component of the path
		       prefix.

     EACCES	       Write permission is denied for the file referred to by
		       path.

     EAGAIN	       The file exists, mandatory file/record locking is set,
		       and there are outstanding record locks on the file [see
		       chmod(2)].  This restriction is not currently enforced.

     EFAULT	       path points outside the process's allocated address
		       space.

     EFBIG	       An attempt is made to write a file that exceeds the
		       process's file size limit or the maximum file size [see
		       getrlimit(2) and ulimit(2)].

     EINTR	       A signal was caught during execution of the truncate or
		       truncate64 routine.

									Page 1

TRUNCATE(2)							   TRUNCATE(2)

     EINVAL	       path is not an ordinary file.

     EINVAL	       length is less than zero.

     EIO	       An I/O error occurred while reading from or writing to
		       the file system.

     EISDIR	       The file referred to by path is a directory.

     ELOOP	       Too many symbolic links were encountered in translating
		       path.

     ENAMETOOLONG      The length of a path component exceeds {NAME_MAX}
		       characters, or the length of path exceeds {PATH_MAX}
		       characters.

     ENOENT	       Either a component of the path prefix or the file
		       referred to by path does not exist.

     ENOTDIR	       A component of the path prefix of path is not a
		       directory.

     EROFS	       The file referred to by path resides on a read-only
		       file system.

     ETIMEDOUT	       The object of the write is located on a remote system
		       which is not available [see intro(2)].

     ftruncate and ftruncate64 fail if one or more of the following are true:

     EAGAIN	       The file exists, mandatory file/record locking is set,
		       and there are outstanding record locks on the file [see
		       chmod(2)].  This restriction is not currently enforced.

     EBADF	       fildes is not a file descriptor open for writing.

     EFBIG	       An attempt is made to write a file that exceeds the
		       process's file size limit or the maximum file size [see
		       getrlimit(2) and ulimit(2)].

     EINTR	       A signal was caught during execution of the ftruncate
		       or ftruncate64 routine.

     EINVAL	       length is less than zero.

     EINVAL	       fildes does not correspond to an ordinary file.

     EIO	       An I/O error occurred while reading from or writing to
		       the file system.

									Page 2

TRUNCATE(2)							   TRUNCATE(2)

     ETIMEDOUT	       The object of the write is located on a remote system
		       which is not available [see intro(2)].

SEE ALSO
     fcntl(2), getrlimit(2), open(2)

DIAGNOSTICS
     Upon successful completion, a value of 0 is returned.  Otherwise, a value
     of -1 is returned and errno is set to indicate the error.

BUGS
     Partial blocks discarded as the result of truncation are not zero filled;
     this can result in holes in files which do not read as zero.

     These calls should be generalized to allow ranges of bytes in a file to
     be discarded.

									Page 3

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net