Provided by:
manpages-pl-dev_20060617-3_all 
NAZWA
truncate, ftruncate - ustawienie dlugoci pliku
SK/LADNIA
#include <unistd.h>
#include <sys/types.h>
int truncate(const char *path, off_t length);
int ftruncate(int fd, off_t length);
OPIS
Funkcje truncate i ftruncate powoduj ustawienie dlugoci pliku
wskazanego przez nazw path lub wskazanego przez deskryptor fd na
dokladnie length bajtow dlugoci.
Jeeli plik przed operacj byl dluszy to odcite dane zostan utracone.
Jeeli plik przed operacja byl krotszy zostanie on wydluony bajtami o
wartoci zero.
Biecy wskanik pliku nie jest zmieniany.
Jeeli zmienil si rozmiar pliku to ctime i mtime pliku s aktualizowane,
a bity suid i sgid atrybutow pliku s kasowane.
Deskryptor pliku przekazywany do ftruncate, musi by otwarty do zapisu,
a plik ktorego nazwa przekazywana jest do truncate, musi by dostpny do
zapisu.
WARTO ZWRACANA
Przy pomylnym zakoczeniu funkcje zwracaj warto zero. Przy wystpieniu
bldu zwracane jest -1 a wlaciwa informacja o bldzie jest w errno.
B/LDY
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 wikszy ni maksymalna dlugo 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 TAKE
open(2)
INFORMACJE O T/LUMACZENIU
Powysze tlumaczenie pochodzi z nieistniejcego ju Projektu Tlumaczenia
Manuali i moe nie by aktualne. W razie zauwaenia ronic midzy powyszym
opisem a rzeczywistym zachowaniem opisywanego programu lub funkcji,
prosimy o zapoznanie si z oryginaln (angielsk) wersj strony podrcznika.
1998-12-21 TRUNCATE(2)