tempnam

TEMPNAM(3)                 Linux Programmer's Manual                TEMPNAM(3)



åå
       tempnam - ãã³ãã©ãªãã¡ã¤ã«ã®ååãä½æãã

æ¸å¼
       #include <stdio.h>

       char *tempnam(const char *dir, const char *pfx);

   glibc åãã®æ©è½æ¤æ»ãã¯ãã®è¦ä»¶ (feature_test_macros(7)  åç§):

       tempnam(): _BSD_SOURCE || _SVID_SOURCE

説æ
       tempnam()  é¢æ°ã¯ãã¡ã¤ã«åã¨ãã¦æ£ããæååã¸ã®ãã¤ã³ã¿ãè¿ãã
       ãã®ãã¡ã¤ã«åãæã¤ãã¡ã¤ã«ã¯ã tempnam() ããã§ãã¯ããæç¹ã«ããã¦ã¯åå¨ããªã
       (ããªãã£ã)ã pfx ã NULL ã§ãªã 5 ãã¤ã以åã®æååã§ããã°ã
       çæããããã¹åã®ãã¡ã®ãã¡ã¤ã«åã®é¨å㯠pfx ããå§ã¾ããã®ã«ãªãã
       çæããããã£ã¬ã¯ããªã®é¨åã¯ããé©åãã§ãªããã°ãªããªã
       (大æµã®å ´åããé©åãã§ããããã«ã¯ã¾ãå°ãªãã¨ã æ¸ãè¾¼ã¿å¯è½ã§ãªããã°ãªããªã)ã

       é©åãªãã£ã¬ã¯ããªã®æ¢ç´¢ã¯ã以ä¸ã®æé ã«ãããã£ã¦è¡ãããã

       a) ç°å¢å¤æ° TMPDIR ãè¨å®ããã¦ãã¦ã
          ãã®å容ãé©åãªãã£ã¬ã¯ããªã®ååãªãããããç¨ããã

       b) ãã以å¤ã®å ´åã dir å¼ãæ°ã NULL ã§ãªãæååã§ãã¤é©åãªãããããç¨ããã

       c) ãã以å¤ã®å ´åã (<stdio.h> ã§å®ç¾©ããã¦ãã)  P_tmpdir ãé©åãªãããããç¨ããã

       d) æå¾ã«å®è£ã§å®ç¾©ããããã£ã¬ã¯ããªãç¨ãããããã¨ã«ãªãã

       tempnam()  ãè¿ãæåå㯠malloc(3)  ã使ã£ã¦ç¢ºä¿ãããããã®ããã free(3)
       ã§è§£æ¾ãã¹ãã§ããã

è¿ãå¤
       tempnam()  é¢æ°ã¯ä»ã¨éãªããªããã³ãã©ãªãã¡ã¤ã«åã¸ã®ãã¤ã³ã¿ãè¿ãã
       ä»ã¨éãªããªãååãçæã§ããªããã° NULL ãè¿ãã

ã¨ã©ã¼
       ENOMEM ä¿åé åã®å²ãå½ã¦ã«å¤±æããã

æºæ
       SVr4, 4.3BSD, POSIX.1-2001.  POSIX.1-2008 㯠tempnam()  ãå»æ‐
       ¢äºå®ã¨ãã¦ããã

注æ
       tempnam()  ã¯æ¨æ¸¬ãé£ããååãçæããããããã«ããããããã tempnam() ããã¹åãè¿ãã¦ããããã‐
       ã°ã©ã ããã®ãã¡ã¤ã«ããªã¼ãã³ãã ã¾ã§ã®éã«ãå¥ã®ããã°ã©ã ãåããã¹åã§ããã¡ã¤ã«ã
       open(2) ã§ä½æããããã·ã³ããªãã¯ãªã³ã¯ãä½æãããããå¯è½æ§ãããã ããã¯ã»ã‐
       ã¥ãªãã£ãã¼ã«ã«ã¤ãªããå¯è½æ§ãããã ãã®ãããªå¯è½æ§ãåé¿ããããã«ã¯ã open(2)  ã®
       O_EXCL ãã©ã°ã使ã£ã¦ãã¹åããªã¼ãã³ããã°ããã ãã£ã¨ããã®ã¯ã mkstemp(3)  ã
       tmpfile(3)  ã使ããã¨ã§ããã

       SUSv2 ã§ã¯ TMPDIR ã«ä»ãã¦è¨åããã¦ããªãã glibc ã¯ãããã°ã©ã ã set-user-ID
       ããã¦ããªãå ´åã«éã£ã¦ãããç¨ããã SVr4 ã§ã¯ d) ã§ä½¿ç¨ããããã£ã¬ã¯ããªã /tmp
       ã¨å®ãã¦ãã (glibc ããã®éãã§ãã)ã

       ãã¹åãè¿ãã®ã«ä½¿ç¨ããã¡ã¢ãªãåçã«ç¢ºä¿ããã®ã§ã tmpnam(3)  ã¨éãã tempnam()
       ã¯ãªã¨ã³ãã©ã³ãã§ãããã¹ã¬ããã»ã¼ãã§ããã

       tempnam()  é¢æ°ã¯æ大 TMP_MAX åã¾ã§ãå¼ã³åºããã度ã«ç°ãªãæååãä½æãã
       (TMP_MAX 㯠<stdio.h> ã§å®ç¾©ããã¦ãã)ã ãã TMP_MAX
       å以ä¸å¼ã³åºãããå ´åãåä½ã¯å®è£ä¾åã§ããã

       tempnam()  ã¯æ大㧠pfx ã®åé  5 ãã¤ãã使ç¨ããã

       ä»ã¨éãªããªãååãè¦ã¤ããããªãã£ãå ´åãglibc ã® tempnam()  ã®å®è£ã¯ã¨ã©ã¼
       EEXIST ã§å¤±æããã

ãã°
       ãé©åãã¨ããè¨èã®æ£ç¢ºãªæå³ã¯å®ç¾©ããã¦ããªãã
       ãã£ã¬ã¯ããªã«å¯¾ãã¦ã©ã®ç¨åº¦ã®ã¢ã¯ã»ã¹æ¨©éãå¿è¦ãªã®ãã¯æå®ããã¦ããªãã

       決ãã¦ãã®é¢æ°ã使ã£ã¦ã¯ãªããªãã代ããã« mkstemp(3)  ã tmpfile(3)
       ã使ããã¨ã

é¢é£é ç®
       mkstemp(3), mktemp(3), tmpfile(3), tmpnam(3)

ãã®ææ¸ã«ã¤ãã¦
       ãã® man ãã¼ã¸ã¯ Linux man-pages ããã¸ã§ã¯ãã®ãªãªã¼ã¹ 3.51 ã®ä¸é¨
       ã§ãããããã¸ã§ã¯ãã®èª¬æã¨ãã°å ±åã«é¢ããæå ±ã¯
       http://www.kernel.org/doc/man-pages/ ã«æ¸ããã¦ããã



                                  2008-08-06                        TEMPNAM(3)