The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Интерактивная система просмотра системных руководств (man-ов)

 ТемаНаборКатегория 
 
 [Cписок руководств | Печать]

truncate (2)
  • truncate (1) ( FreeBSD man: Команды и прикладные программы пользовательского уровня )
  • >> truncate (2) ( FreeBSD man: Системные вызовы )
  • truncate (2) ( Русские man: Системные вызовы )
  • truncate (2) ( Linux man: Системные вызовы )
  • truncate (3) ( Solaris man: Библиотечные вызовы )
  • truncate (3) ( POSIX man: Библиотечные вызовы )
  • truncate (7) ( Linux man: Макропакеты и соглашения )

  • BSD mandoc
     

    NAME

    
    
    truncate
    
     
    ftruncate
    
     - truncate or extend a file to a specified length
    
     
    

    LIBRARY

    Lb libc
    
     
    

    SYNOPSIS

       #include <unistd.h>
    int truncate (const char *path off_t length);
    int ftruncate (int fd off_t length);
     

    DESCRIPTION

    The truncate ();
    system call causes the file named by Fa path or referenced by Fa fd to be truncated or extended to Fa length bytes in size. If the file was larger than this size, the extra data is lost. If the file was smaller than this size, it will be extended as if by writing bytes with the value zero. With ftruncate (,);
    the file must be open for writing.  

    RETURN VALUES

    Rv -std If the file to be modified is not a directory or a regular file, the truncate ();
    call has no effect and returns the value 0.  

    ERRORS

    The truncate ();
    system call succeeds unless:

    Bq Er ENOTDIR
    A component of the path prefix is not a directory.
    Bq Er ENAMETOOLONG
    A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.
    Bq Er ENOENT
    The named file does not exist.
    Bq Er EACCES
    Search permission is denied for a component of the path prefix.
    Bq Er EACCES
    The named file is not writable by the user.
    Bq Er ELOOP
    Too many symbolic links were encountered in translating the pathname.
    Bq Er EPERM
    The named file has its immutable or append-only flag set, see the chflags(2) manual page for more information.
    Bq Er EISDIR
    The named file is a directory.
    Bq Er EROFS
    The named file resides on a read-only file system.
    Bq Er ETXTBSY
    The file is a pure procedure (shared text) file that is being executed.
    Bq Er EFBIG
    The Fa length argument was greater than the maximum file size.
    Bq Er EINVAL
    The Fa length argument was less than 0.
    Bq Er EIO
    An I/O error occurred updating the inode.
    Bq Er EFAULT
    The Fa path argument points outside the process's allocated address space.

    The ftruncate ();
    system call succeeds unless:

    Bq Er EBADF
    The Fa fd argument is not a valid descriptor.
    Bq Er EINVAL
    The Fa fd argument references a socket, not a file.
    Bq Er EINVAL
    The Fa fd descriptor is not open for writing.

     

    SEE ALSO

    chflags(2), open(2)  

    HISTORY

    The truncate ();
    system call appeared in BSD 4.2  

    BUGS

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

    Use of truncate ();
    to extend a file is not portable.


     

    Index

    NAME
    LIBRARY
    SYNOPSIS
    DESCRIPTION
    RETURN VALUES
    ERRORS
    SEE ALSO
    HISTORY
    BUGS


    Поиск по тексту MAN-ов: 




    Партнёры:
    PostgresPro
    Inferno Solutions
    Hosting by Hoster.ru
    Хостинг:

    Закладки на сайте
    Проследить за страницей
    Created 1996-2024 by Maxim Chirkov
    Добавить, Поддержать, Вебмастеру