truncate

TRUNCATE(2)                Linux Programmer's Manual               TRUNCATE(2)



åå
       truncate, ftruncate - æå®ããé·ãã«ãã¡ã¤ã«ãåãè©°ãã

æ¸å¼
       #include <unistd.h>

       int truncate(const char *path, size_t length);
       int ftruncate(int fd, size_t length);

説æ
       truncate 㯠path ã§æå®ããããã¡ã¤ã«ãã ftruncate 㯠fd ã§ç¤ºããããã¡ã¤ã«ã
       length ãã¤ãã®é·ãã«ãªãããã«å»¶é·ããããããã¯åãè©°ãããããåãè©°ããå ã®ãã¡ã¤ã«ã
       length ããé·ããã°ãlength ãã¤ããè¶ããé¨åã®ãã¼ã¿ã¯å¤±ãããã ftruncate
       ã§ã¯ãã¡ã¤ã«ã¯æ¸ãè¾¼ã¿ç¨ã«ãªã¼ãã³ããã¦ããå¿è¦ãããã

       (訳注:延é·ãããé¨åãèªãå ´å0ãè¿ã)


è¿ãå¤
       æåããå ´å 0 ãè¿ãã失æããå ´å -1 ãè¿ãã errno ãã¨ã©ã¼ã®å容ã«å¾ã£ã¦è¨å®ãããã

ã¨ã©ã¼
       truncate ã§ã¯

       ENOTDIR path ä¸ã®é ç®ã«ãã£ã¬ã¯ããªã§ã¯ãªããã®ãå¥ã£ã¦ããã

       EINVAL  ãã¹åä¸ã®æåã«ä¸ä½ããããã»ããããã¦ãããã®ãããã
               (訳注:ããã®ãã¡ã¤ã«ã·ã¹ãã ã«ã¦å¯¾å¿ã§ããªãååã使ããã¦ããã)

       ENAMETOOLONG
               ãã¹åä¸ã®ãã£ã¬ã¯ããªåã 255 æåãè¶ãã¦ããããããã¯ãã¹åå¨ä½ã 1023 æå‐
               ãè¶ãã¦ããã

       ENOENT  æå®ãããååã®ãã¡ã¤ã«ãåå¨ããªãã

       EACCES  ãã¹ã§æå®ããã¦ãããã£ã¬ã¯ããªã« search 許å¯ã®ãªããã®ãããã (訳注:x
               ããããç«ã£ã¦ããªã)

       EACCES  æå®ããããã¡ã¤ã«ã«å¯¾ããæ¸ãè¾¼ã¿è¨±å¯ãæã£ã¦ããªãã

       ELOOP   ãã¹åã解éããéã«ã·ã³ããªãã¯ãªã³ã¯ãå¤ãããã

       EISDIR  æå®ããããã¡ã¤ã«ã¯ãã£ã¬ã¯ããªã§ããã

       EROFS   æå®ããããã¡ã¤ã«ã¯èªã¿åºãå°ç¨ã®ãã¡ã¤ã«ã·ã¹ãã ä¸ã«ããã

       ETXTBSY æå®ããããã¡ã¤ã«ã¯å®è¡ããã¦ãããã¡ã¤ã«ã§ããã

       EIO     inode ã®æ´æ°æã« I/O ã¨ã©ã¼ãçºçããã

       EFAULT  path ãããã»ã¹ã«å²ãå½ã¦ããã¦ããã¢ãã¬ã¹ç©ºéã®å¤ãæãã¦ããã

       ftruncate ã«å¯¾ãã¦

       EBADF   fd ãç¡å¹ãªãã£ã¹ã¯ãªãã¿ã¼(descripter)ã§ããã

       EINVAL  fd ã§æããã¦ãããã®ã¯ãã¡ã¤ã«ã§ã¯ãªãã½ã±ããã§ããã

       EINVAL  fd ã§æããã¦ãããã¡ã¤ã«ãæ¸ãè¾¼ã¿ç¨ã«ãªã¼ãã³ããã¦ããªãã

æºæ
       4.4BSD, SVr4 (ãããã®é¢æ°ã¯ BSD 4.2 ã«å§ãã¦ä½¿ããã)ãSVr4 ã«ã¯ä»ã®
       ã¨ã©ã¼ã³ã¼ãã¨ãã¦ã truncate ã«ã¯ EINTR, EMFILE, EMULTIHP, ENAMETOOLONG,
       ENFILE, ENOLINK, ENOTDIR ãã ftruncate ã«ã¯ EAGAIN 㨠EINTR
       ãããããè¨è¿°ããã¦ããã

ãã°
       ãããã®é¢æ°ã¯ããã¡ã¤ã«ããåãæ¨ã¦ããã¤ãæ°ãæå®ã§ããããã« ä¸è¬åãã¹ãã§ããã

é¢é£é ç®
       open(2)



BSD Man Page                     24 July 1993                      TRUNCATE(2)