NAZWA¶
truncate, ftruncate - ustawienie długości pliku
SKŁADNIA¶
#include <unistd.h>
 
#include <sys/types.h>
 
int truncate(const char *path, off_t length);
 
int ftruncate(int fd, off_t length);
OPIS¶
 Uwaga! To tłumaczenie może być nieaktualne!
Funkcje 
truncate i 
ftruncate powodują ustawienie
  długości pliku wskazanego przez nazwę 
path lub
  wskazanego przez deskryptor 
fd na dokładnie 
length
  bajtów długości.
Jeżeli plik przed operacją był dłuższy to odcięte
  dane zostaną utracone. Jeżeli plik przed operacja był
  krótszy zostanie on wydłużony bajtami o wartości zero.
Bieżący wskaźnik pliku nie jest zmieniany.
Jeżeli zmienił się rozmiar pliku to ctime i mtime pliku są
  aktualizowane, a bity suid i sgid atrybutów pliku są kasowane.
Deskryptor pliku przekazywany do 
ftruncate, musi być otwarty do
  zapisu, a plik którego nazwa przekazywana jest do 
truncate, musi
  być dostępny do zapisu.
WARTOŚĆ ZWRACANA¶
Przy pomyślnym zakończeniu funkcje zwracają wartość
  zero. Przy wystąpieniu błędu zwracane jest -1 a
  właściwa informacja o błędzie jest w 
errno.
BŁĘDY¶
Dla 
truncate:
  - EACCES
 
  - Search permission is denied for a component of the path
      prefix, or the named file is not writable by the user.
 
  - EFAULT
 
  - Path points outside the process's allocated address
      space.
 
  - EFBIG
 
  - Argument length jest większy niż
      maksymalna długość pliku. (XSI)
 
  - EINTR
 
  - A signal was caught during execution.
 
  - EINVAL
 
  - The argument length is negative or larger than the
      maximum file size.
 
  - EIO
 
  - An I/O error occurred updating the inode.
 
  - EISDIR
 
  - Wskazana nazwa pliku jest nazwą katalogu.
 
  - ELOOP
 
  - Too many symbolic links were encountered in translating the
      pathname.
 
  - ENAMETOOLONG
 
  - A component of a pathname exceeded 255 characters, or an
      entire path name exceeded 1023 characters.
 
  - ENOENT
 
  - Plik wskazywany przez nazwę nie istnieje.
 
  - ENOTDIR
 
  - A component of the path prefix is not a directory.
 
  - EROFS
 
  - The named file resides on a read-only file system.
 
  - ETXTBSY
 
  - The file is a pure procedure (shared text) file that is
      being executed.
 
For 
ftruncate the same errors apply, but instead of things that can be
  wrong with 
path, we now have things that can be wrong with 
fd:
  - EBADF
 
  - The fd is not a valid descriptor.
 
  - EBADF or EINVAL
 
  - The fd is not open for writing.
 
  - EINVAL
 
  - The fd does not reference a regular file.
 
ZGODNE Z¶
4.4BSD, SVr4 (these function calls first appeared in BSD 4.2). POSIX 1003.1-1996
  has 
ftruncate. POSIX 1003.1-2001 also has 
truncate, as an XSI
  extension.
SVr4 documents additional 
truncate error conditions EMFILE, EMULTIHP,
  ENFILE, ENOLINK. SVr4 documents for 
ftruncate an additional EAGAIN
  error condition.
UWAGI¶
The above description is for XSI-compliant systems. For non-XSI-compliant
  systems, the POSIX standard allows two behaviours for 
ftruncate when
  
length exceeds the file length (note that 
truncate is not
  specified at all in such an environment): either returning an error, or
  extending the file. (Most Unices follow the XSI requirement.)
ZOBACZ TAKŻE¶
open(2)
Powyższe tłumaczenie pochodzi z nieistniejącego już Projektu
  Tłumaczenia Manuali i 
może nie być aktualne. W razie
  zauważenia różnic między powyższym opisem a
  rzeczywistym zachowaniem opisywanego programu lub funkcji, prosimy o
  zapoznanie się z oryginalną (angielską) wersją strony
  podręcznika za pomocą polecenia:
  
  - man --locale=C 2 truncate
 
Prosimy o pomoc w aktualizacji stron man - więcej informacji można
  znaleźć pod adresem
  
http://sourceforge.net/projects/manpages-pl/.