Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ chsize(2) — Dell System V Release 4 Issue 2.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat(2)

dup(2)

lseek(2)

open(2)

pipe(2)

ulimit(2)



chsize(2)      UNIX System V(Application Compatibility Package)       chsize(2)


NAME
      chsize - change the size of a file

SYNOPSIS
      cc [flag . . .] file . . . -lx
      int chsize (int fildes, long size);

DESCRIPTION
      fildes is a file descriptor obtained from a create, open, dup, fcntl, or
      pipe system call.  chsize changes the size of the file associated with
      the file descriptor fildes to be exactly size bytes in length.  The
      routine either truncates the file, or pads it with an appropriate number
      of bytes.  If size is less than the initial size of the file, then all
      allocated disk blocks between size and the initial file size are freed.

      The maximum file size as set by ulimit(2) is enforced when chsize is
      called, rather than on subsequent writes.  Thus chsize fails, and the
      file size remains unchanged if the new changed file size would exceed the
      ulimit.

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

SEE ALSO
      creat(2), dup(2), lseek(2), open(2), pipe(2), ulimit(2)

NOTES
      In general if chsize is used to expand the size of a file, when data is
      written to the end of the file, intervening blocks are filled with zeros.
      In a some cases, reducing the file size may not remove the data beyond
      the new end-of-file.






















10/89                                                                    Page 1





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