Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ftruncate(2) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fclear

ftruncate

Purpose

     Makes a file shorter.

Syntax

     int ftruncate (fildes, length)
     int fildes;
     unsigned long length;

Description

     The ftruncate system call  removes all data beyond length
     bytes from the beginning of the  file that is open on the
     file descriptor  fildes. Full blocks are  returned to the
     file system so that they can  be used again, and the file
     size is changed to the value of the length parameter.  If
     Distributed Services  is installed  on your  system, this
     file can reside on another node.

     The ftruncate subroutine does not modify the seek pointer
     of the file.

Return Value

     Upon successful completion, ftruncate  returns a value of
     0.  If  ftruncate fails,  a value of  -1 is  returned and
     errno is set to indicate the error.

Diagnostics

     The ftruncate  system call  fails if one  or more  of the
     following are true:

     EIO        I/O error.

     EBADF      fildes is not a valid file descriptor open for
                writing.

     EINVAL     The  file is  a  directory,  FIFO, or  special
                file.

     EMFILE     The  file is  mapped copy-on-write  by one  or
                more processes.

     EAGAIN     The write operation in ftruncate failed due to
                an enforced write lock on the file.

     If  Distributed Services  is  installed  on your  system,
     ftruncate can also  fail if one or more  of the following
     are true:

     EDIST         The   server   has  blocked   new   inbound
                   requests.

     EDIST         Outbound requests are currently blocked.

     EAGAIN        The  server  is  too  busy  to  accept  the
                   request.

     ENOMEM        Either  this node  or the  server does  not
                   have enough memory available to service the
                   request.

     EBADCONNECT   An attempt to use  an existing network con-
                   nection with a remote node failed.

Related Information

     In this book:  "fclear."

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026