cfgetispeed

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



åå
       termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow,
       cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed,
       cfsetspeed - ã¿ã¼ããã«å±æ§ã®åå¾ã»è¨å®ãã©ã¤ã³å¶å¾¡ããã¼ã¬ã¼ãã®åå¾ã»è¨å®

æ¸å¼
       #include <termios.h>
       #include <unistd.h>

       int tcgetattr(int fd, struct termios *termios_p);

       int tcsetattr(int fd, int optional_actions,
                     const struct termios *termios_p);

       int tcsendbreak(int fd, int duration);

       int tcdrain(int fd);

       int tcflush(int fd, int queue_selector);

       int tcflow(int fd, int action);

       void cfmakeraw(struct termios *termios_p);

       speed_t cfgetispeed(const struct termios *termios_p);

       speed_t cfgetospeed(const struct termios *termios_p);

       int cfsetispeed(struct termios *termios_p, speed_t speed);

       int cfsetospeed(struct termios *termios_p, speed_t speed);

       int cfsetspeed(struct termios *termios_p, speed_t speed);

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

       cfsetspeed(), cfmakeraw(): _BSD_SOURCE

説æ
       termios é¢æ°ç¾¤ã¯ãéåæéä¿¡ãã¼ããå¶å¾¡ããããã®æ±ç¨
       ã¿ã¼ããã«ã¤ã³ã¿ã¼ãã§ã¼ã¹ã§ããã

   termios æ§é ä½
       ããã«ç¤ºããã¦ããé¢æ°ã®å¤ãã¯ãå¼ãæ°ã« termios_p ãç¨ããã ãã®å¼ãæ°ã¯ termios
       æ§é ä½ã¸ã®ãã¤ã³ã¿ã¼ã§ããã ãã®æ§é ä½ã«ã¯å°ãªãã¨ã以ä¸ã«ç¤ºãã¡ã³ããå«ã¾ãã:

           tcflag_t c_iflag;      /* input modes */
           tcflag_t c_oflag;      /* output modes */
           tcflag_t c_cflag;      /* control modes */
           tcflag_t c_lflag;      /* local modes */
           cc_t     c_cc[NCCS];   /* special characters */

       以ä¸ã«ããããã®ãã£ã¼ã«ãã«å²ãå½ã¦å¯è½ãªå¤ã«ã¤ãã¦èª¬æããã æåã® 4
       ã¤ã®ããããã¹ã¯ãã£ã¼ã«ãã§ã¯ã
       é¢ä¿ãããã©ã°ã®å®ç¾©ã®ããã¤ãã¯ãç¹å®ã®æ©è½æ¤æ»ãã¯ã (feature_test_macros(7)
       åç§) ãå®ç¾©ãããå ´åã«ã®ã¿å¬éãããã å¿è¦ãªæ©è½æ¤æ»ãã¯ãã¯è§æ¬å¼§ ("[]")
       åã«æ¸ããã¦ããã

       以ä¸ã®èª¬æã§ã "POSIX ã«ã¯ãªã" 㯠ãã®å¤ã POSIX.1-2001
       ã§è¦å®ããã¦ããªããã¨ãæå³ãã "XSI" ã¯ãã®å¤ã POSIX.1-2001 ã® XSI æ¡å¼µã§
       è¦å®ããã¦ãããã¨ãæå³ããã

       c_iflag ãã©ã°ã«ã¯ä»¥ä¸ã®è¦ç´ ãæå®ã§ãã:

       IGNBRK å¥åä¸ã® BREAK ä¿¡å·ãç¡è¦ããã

       BRKINT IGNBRK ãè¨å®ããã¦ããå ´åã¯ãBREAK ä¿¡å·ã¯ç¡è¦ãããã IGNBRK ãè¨‐
              å®ããã¦ããªãããBRKINT ãè¨å®ããã¦ããå ´åã¯ã BREAK ä¿¡å·ã«ãã£ã¦å¥åºåã‐
              ã¥ã¼ããã©ãã·ã¥ããã ããã«ã端æ«ããã©ã¢ã°ã©ã¦ã³ããã‐
              ã»ã¹ã°ã«ã¼ãã®å¶å¾¡ç«¯æ«ã®å ´åã¯ã ãã©ã¢ã°ã©ã¦ã³ãããã»ã¹ã°ã«ã¼ãã«
              SIGINT ãéãããã IGNBRK ã BRKINT ãè¨å®ããã¦ããªãå ´åã BREAK ããã«ãã¤ã
              ('\0') ã¨ãã¦èªã¿è¾¼ãã ãã ããPARMRK ãè¨å®ããã¦ããå ´å㯠\377 \0 \0
              ã®ã·ã¼ã±ã³ã¹ã¨ã㦠èªã¿è¾¼ãã

       IGNPAR ãã¬ã¼ã ã¨ã©ã¼ããã³ããªãã£ã¨ã©ã¼ãç¡è¦ããã

       PARMRK IGNPAR ãè¨å®ããã¦ããªãå ´åãããªãã£ã¨ã©ã¼ãããã¯ãã¬ã¼ã ã¨ã©ã¼
              ã®çºçããæåã®åã« \377 \0 ãä»å ãããIGNPAR ã PARMRK ã è¨‐
              å®ããã¦ããªãå ´åãããªãã£ã¨ã©ã¼ãããã¯ãã¬ã¼ã ã¨ã©ã¼ã®çºçããæåã \0
              ã¨ãã¦èªã¿è¾¼ãã

       INPCK  å¥åã®ããªãã£ãã§ãã¯ãæå¹ã«ããã

       ISTRIP 8 ãããç®ãè½ã¨ãã

       INLCR  å¥åã® NL (New Line: æ¹è¡æå) ã CR (Carriage Return: 復帰æå) ã«
              ç½®ãæããã

       IGNCR  å¥åã® CR ãç¡è¦ããã

       ICRNL  (IGNCR ãè¨å®ããã¦ããªãå ´å) å¥åã® CR ã NL ã«ç½®ãæããã

       IUCLC  (POSIX ã«ã¯ãªã) å¥åã®å¤§æåãå°æåã«ç½®ãæããã

       IXON   åºåã® XON/XOFF ããã¼å¶å¾¡ãæå¹ã«ããã

       IXANY  (XSI) ä»»æã®æåãå¥åããã¨ãåæ¢ãã¦ããåºåãåéãã (ããã©ã«ãã§ã¯ãSTART æå‐
              ã§ã®ã¿åºåãåéããã)ã

       IXOFF  å¥åã® XON/XOFF ããã¼å¶å¾¡ãæå¹ã«ããã

       IMAXBEL
              (POSIX ã«ã¯ãªã) å¥åãã¥ã¼ãä¸æ¯ã®æã«ãã«ãé³´ããã Linux
              ã§ã¯ãã®ãããã¯å®è£ããã¦ãããã 常ã«ã»ããããã¦ãããã®ããã«æ¯èãã

       IUTF8 (Linux 2.6.4 以é)
              (POSIX ã«ã¯ãªã) å¥åã UTF8 ã§ãã; ããã«ãã cooked mode ã§æååé¤
              (character-erase) ã æ£ããæ©è½ããããã¨ãã§ããã

       c_oflag ãã©ã°ã«ã¯ä»¥ä¸ã®è¦ç´ ãæå®ã§ãã:

       OPOST  å®è£ã«ä¾åããåºåå¦çãæå¹ã«ããã

       OLCUC  (POSIX ã«ã¯ãªã) åºåæã«å°æåã大æåã«å¤æããã

       ONLCR  (XSI) åºåã® NL ã CR-NL ã«ç½®ãæããã

       OCRNL  åºåã® CR ã NL ã«ç½®ãæããã

       ONOCR  0 æ¡ç®ã§ CR ãåºåããªãã

       ONLRET CR ãåºåããªãã

       OFILL  転éæéãéãããã®ã§ã¯ãªããè£å¡«æå (fill character) ãéãã
              (訳注:ç¹å®ã®æåã«å¯¾ãã¦ã端æ«å´ã®å¦çãå¾ã¤ããã«è»¢éãä¸å®æé
              éããããã¨ãã§ãããã¾ãã OFILL ãæå®ãã㨠転éãéããã代ããã«è£å¡«æåãéãã)

       OFDEL  è£å¡«æåã ASCII DEL ã«ããã ãã®ãã©ã°ãè¨å®ããã¦ããªãå ´å㯠ASCII NUL
              ('\0') ã«ãªãã (Linux ã§ã¯å®è£ããã¦ããªã)

       NLDLY  NL ã®é延ãè¨å®ãããå¤ã¯ NL0 (é延ãªã) ããã³ NL1 ã§ããã [_BSD_SOURCE
              ã _SVID_SOURCE ã _XOPEN_SOURCE ãå¿è¦]

       CRDLY  CR ã®é延ãè¨å®ãããå¤ã¯ CR0 (é延ãªã), CR1, CR2,CR3 ã§ããã
              [_BSD_SOURCE ã _SVID_SOURCE ã _XOPEN_SOURCE ãå¿è¦]

       TABDLY æ°´å¹³ã¿ã (horizontal tab) ã®é延ãè¨å®ããã å¤ã¯ TAB0 (é延ãªã),
              TAB1, TAB2, TAB3 (XTABS) ã§ããã [_BSD_SOURCE ã _SVID_SOURCE ã
              _XOPEN_SOURCE ãå¿è¦] XTAB3 (ãã㯠XTABS ã¨åãã§ãã)
              ã®å¤ã¯ã¿ããã¹ãã¼ã¹ä½åã«å¤æãããã示ã (ã¿ã㯠8 æ¡æ¯ã«æ¢ã¾ã)ã

       BSDLY  å¾é (backspace) ã®é延ãè¨å®ããã å¤ã¯ BS0 (é延ãªã) ããã㯠BS1
              ã§ããã (å®è£ããããã¨ã¯ãªã) [_BSD_SOURCE ã _SVID_SOURCE ã
              _XOPEN_SOURCE ãå¿è¦]

       VTDLY  åç´ã¿ã (vertical tab) ã®é延ãè¨å®ããã å¤ã¯ VT0 (é延ãªã) ãããã¯
              VT1 ã§ããã

       FFDLY  é éã (form feed) ã®é延ãè¨å®ããã å¤ã¯ FF0 (é延ãªã) ããã㯠FF1
              ã§ããã [_BSD_SOURCE ã _SVID_SOURCE ã _XOPEN_SOURCE ãå¿è¦]

       c_cflag ãã©ã°ã¯ä»¥ä¸ã®éã:

       CBAUD  (POSIX ã«ã¯ãªã) ãã¼ã¬ã¼ããã¹ã¯ (4+1 ããã)ã [_BSD_SOURCE ã
              _SVID_SOURCE ãå¿è¦]

       CBAUDEX
              (POSIX ã«ã¯ãªã) 追å ã®ãã¼ã¬ã¼ããã¹ã¯ (1 ããã)ã CBAUD ã«å«ã¾ãã¦ããã
              [_BSD_SOURCE ã _SVID_SOURCE ãå¿è¦]

              (POSIX ã§ã¯ã termios æ§é ä½ã«æ ¼ç´ããããã¼ã¬ã¼ãã¯æ‐
              £ç¢ºãªãã®ã§ã¯ãªãã ãã¼ã¬ã¼ããæä½ããããã« cfgetispeed()  ã¨
              cfsetispeed()  ãæä¾ããã¦ããã c_cflag åã® CBAUD
              ã§é¸æããããããã使ãã·ã¹ãã ãããã°ã sg_ispeed ã sg_ospeed
              ã¨ãã£ãç¬ç«ãããã£ã¼ã«ãã使ããã®ãããã)

       CSIZE  æåãµã¤ãºãè¨å®ããã å¤ã¯ CS5, CS6, CS7, CS8 ã§ããã

       CSTOPB ã¹ããããããã 1 ã§ã¯ãªã 2 ã«ããã

       CREAD  åä¿¡ãæå¹ã«ããã

       PARENB åºåã«ããªãã£ãä»å ããå¥åã®ããªãã£ãã§ãã¯ãè¡ãã

       PARODD è¨å®ãããã¨ãå¥åããã³åºåã«å¯¾ããããªãã£ãå¥æ°ããªãã£ã¨ãªãã è¨‐
              å®ãããªãå ´åãå¶æ°ããªãã£ã使ç¨ãããã

       HUPCL  æå¾ã®ããã»ã¹ãããã¤ã¹ãã¯ãã¼ãºããå¾ãã¢ãã ã®å¶å¾¡ç·ã low ã«ãã (åæãã)ã

       CLOCAL ã¢ãã ã®å¶å¾¡ç·ãç¡è¦ããã

       LOBLK  (POSIX ã«ã¯ãªã) ç¾å¨ã®ã·ã§ã«å±¤ä»¥å¤ããã®åºåãæå¶ããã
               shl (ã·ã§ã«å±¤) ã§ç¨ããããã(Linux ã§ã¯å®è£ããã¦ããªã)

       CIBAUD (POSIX ã«ã¯ãªã) å¥åé度ã®ãã¹ã¯ã CIBAUD ãããã®ããã®å¤ã¯ CBAUD
              ãããã®ããã®å¤ã¨åãã§ããã 左㫠IBSHIFT ãããã·ãããããã®ã§ããã
              [_BSD_SOURCE ã _SVID_SOURCE ãå¿è¦] (Linux ã§ã¯å®è£ããã¦ããªã)

       CMSPAR (POSIX ã«ã¯ãªã)  (ä¸é¨ã®ã·ãªã¢ã«ããã¤ã¹ã§ãµãã¼ãããã¦ãã)  ãã¹ãã£ãã¯
              (stick)ãããªã㣠(ãã¼ã¯/ã¹ãã¼ã¹ ããªãã£)ã使ç¨ããã PARODD ãè¨‐
              å®ãããå ´åããªãã£ãããã¯å¸¸ã« 1 ã¨ãªãã è¨å®ãããªãå ´åã¯å¸¸ã« 0 ã¨ãªãã
              [_BSD_SOURCE ã _SVID_SOURCE ãå¿è¦]

       CRTSCTS
              (POSIX ã«ã¯ãªã) RTS/CTS (ãã¼ãã¦ã§ã¢) ããã¼å¶å¾¡ãæå¹ã«ããã
              [_BSD_SOURCE ã _SVID_SOURCE ãå¿è¦]

       c_lflag ãã©ã°ã¯ä»¥ä¸ã®éã:

       ISIG   INTR, QUIT, SUSP, DSUSP ã®æåãåä¿¡ããæã対å¿ããã·ã°ãã«ã çºçãããã

       ICANON ã«ããã«ã«ã¢ã¼ããæå¹ã«ãã (ä¸è¨åç§)ã

       XCASE  (POSIX ã«ã¯ãªã; Linux ã§ã¯å¯¾å¿ãã¦ããªã)  ICANON ãåæã«è¨‐
              å®ãããå ´åã端æ«ã¯å¤§æåã®ã¿ãæå¹ã§ããã å¥åãããæå㯠\ ãä»ããæå‐
              ãé¤ãã¦å°æåã«å¤æãããã åºåæã¯ã大æåã®åã« \ ãä»ããå°æåã¯å¤§æå‐
              ã«å¤æãããã [_BSD_SOURCE ã _SVID_SOURCE ã _XOPEN_SOURCE ãå¿è¦]

       ECHO   å¥åãããæåãã¨ã³ã¼ããã

       ECHOE  ICANON ãåæã«è¨å®ãããå ´åãERASE æåã¯åã®æåãåé¤ãã WERASE æå‐
              ã¯åã®åèªãåé¤ããã

       ECHOK  ICANON ãåæã«è¨å®ãããå ´åãKILL æåã¯ç¾å¨ã®è¡ãåé¤ããã

       ECHONL ICANON ãåæã«è¨å®ãããå ´åã ECHO ãè¨å®ããã¦ããªãã¦ã NL æåãã¨ã³ã¼ããã

       ECHOCTL
              (POSIX ã«ã¯ãªã) ECHO ãåæã«è¨å®ãããå ´åãTAB, NL, START, STOP
              以å¤ã® 端æ«ç¹æ®æåã ^X ã¨ãã¦ã¨ã³ã¼ãããã X ã¯ç¹æ®æåã« ASCII
              ã³ã¼ã㧠0x40 ã足ããæåã§ããã ä¾ãã°æå 0x08 (BS) 㯠^H ã¨ã¨ã³ã¼ãããã
              [_BSD_SOURCE ã _SVID_SOURCE ãå¿è¦]

       ECHOPRT
              (POSIX ã«ã¯ãªã) ICANON ããã³ ECHO ãåæã«è¨å®ããã¦ããå ´åã åé¤ãããæå‐
              ã表示ãããã [_BSD_SOURCE ã _SVID_SOURCE ãå¿è¦]

       ECHOKE (POSIX ã«ã¯ãªã) ICANON ãè¨å®ãããå ´åã KILL ãè¡ã®åæå‐
              ãæ¶å»ãã代ããã«ã¨ã³ã¼ãããã ãã㯠ECHOE ããã³ ECHOPRT ãæå®ãããã¨ã¨çããã
              [_BSD_SOURCE ã _SVID_SOURCE ãå¿è¦]

       DEFECHO
              (POSIX ã«ã¯ãªã) ããã»ã¹ãèªã¿è¾¼ãã ã¨ãã«ã ãã¨ã³ã¼ããã (Linux
              ã§ã¯å®è£ããã¦ããªã)

       FLUSHO (POSIX ã«ã¯ãªã; Linux ã§ã¯å¯¾å¿ãã¦ããªã)
              åºåããã©ãã·ã¥ããããã®ãã©ã°ã¯ DISCARD æåãå¥åãããã¨ã§åæ¿ããããã
              [_BSD_SOURCE ã _SVID_SOURCE ãå¿è¦]

       NOFLSH INT, QUIT, SUSP æåã«å¯¾å¿ããã·ã°ãã«ãçºçããéã® å¥åã»åºåã‐
              ã¥ã¼ã®ãã©ãã·ã¥ãç¡å¹ã«ããã

       TOSTOP ããã¯ã°ã©ã¦ã³ãããã»ã¹ã®ããã»ã¹ã°ã«ã¼ãã§å¶å¾¡ç«¯æ«ã¸ æå‐
              ãåºåãããã¨ãã¦ããããã»ã¹ã«å¯¾ã㦠SIGTTOU ã·ã°ãã«ãéãã

       PENDIN (POSIX ã«ã¯ãªã; Linux ã§ã¯å¯¾å¿ãã¦ããªã)  次ã®æåãèª‐
              ã¿è¾¼ãã æãå¥åãã¥ã¼ä¸ã®å¨æåãå表示ããã (bash(1)
              ã¯å¥åè¡ããã®ããã«å¦çãã¦ããã)  [_BSD_SOURCE ã _SVID_SOURCE ãå¿è¦]

       IEXTEN å®è£ä¾åã®å¥åå¦çãæå¹ã«ããã ãã®ãã©ã°ã¯ãç¹æ®æåã§ãã EOL2, LNEXT,
              REPRINT, WERASE ãã IUCLC ãã©ã°ãæå¹ã«ããããã«å¿è¦ã§ããã

       c_cc éåã¯ç«¯æ«ç¹æ®æåãå®ç¾©ãã¦ããã ã·ã³ãã«ã®ä¸è¦§ (åæå¤)
       ã¨æå³ã¯ä»¥ä¸ã®éãã

       VDISCARD
              (POSIX ã«ã¯ãªã; Linux ã§ã¯å¯¾å¿ãã¦ããªã; 017, SI, Ctrl-O)
              æªéä¿¡ãããã¡ã¼ã®å容ã®ç ´æ£/ä¿åãåãæ¿ããã IEXTEN
              ãã»ããããã¦ããå ´åã«èªèããå¥åã«ã¯æ¸¡ãããªãã

       VDSUSP (POSIX ã«ã¯ãªã; Linux ã§ã¯å¯¾å¿ãã¦ããªã; 031, EM, Ctrl-Y)
              é延ä¸ææå (DSUSP)ã ã¦ã¼ã¶ã¼ããã°ã©ã ããæåãèªã¿è¾¼ã¾ããæã« SIGTSTP
              ã·ã°ãã«ãéãã IEXTEN 㨠ISIG
              ãã»ããããã¦ãã¦ãã·ã¹ãã ãã¸ã§ãå¶å¾¡ã«å¯¾å¿ãã¦ãã å ´åã« èªè‐
              ããå¥åã«ã¯æ¸¡ãããªãã

       VEOF   (004, EOT, Ctrl-D)  ãã¡ã¤ã«çµç«¯æå (EOF)ã ããæ£ç¢ºã«ã¯ãtty
              ãããã¡ã¼ã®å容ãè¡æ«ãå¾ããã«ã¦ã¼ã¶ã¼ããã°ã©ã ã«éãã ãããè¡ã®æåã®æå‐
              ã ã£ãå ´åãã¦ã¼ã¶ã¼ããã°ã©ã ã® read(2) 㯠0 ã è¿ãã
              ãã¡ã¤ã«çµç«¯ã§ãããã¨ãç¥ãããã ICANON ãã»ããããã¦ããå ´åã«èªèãã
              å¥åã«ã¯æ¸¡ãããªãã

       VEOL   (0, NUL)  追å ã®è¡æ«æå (EOL)ã ICANON ãã»ããããã¦ããå ´åã«èªèããã

       VEOL2  (POSIX ã«ã¯ãªã; 0, NUL)  追å ã®è¡æ«æå (EOL2)ã ICANON
              ãã»ããããã¦ããå ´åã«èªèããã

       VERASE (0177, DEL, rubout ã 010, BS, Ctrl-H ã #)  æ¶å»æå (ERASE)ã
              ããã«ãããç´åã®æªæ¶å»æåãæ¶å»ããã ããããEOF ãè¡é ãè¶ãã¦ã¯æ¶å»ããªãã
              ICANON ãã»ããããã¦ããå ´åã«èªèããå¥åã«ã¯æ¸¡ãããªãã

       VINTR  (003, ETX, Ctrl-C ã 0177, DEL, rubout)  å²ãè¾¼ã¿æå (INTR)ã
              SIGINT ã·ã°ãã«ãéãã ISIG ãã»ããããã¦ããå ´åã«èªèããå¥åã«ã¯æ¸¡ãããªãã

       VKILL  (025, NAK, Ctrl-U ã Ctrl-X ã @)  å®å¨æ¶å»æå (KILL)ã ç´åã® EOF
              ãè¡é 以éã®å¨ã¦ã®å¥åãæ¶å»ããã ICANON ãã»ããããã¦ããå ´åã«èªè‐
              ããå¥åã«ã¯æ¸¡ãããªãã

       VLNEXT (POSIX ã«ã¯ãªã; 026, SYN Ctrl-V)  ãªãã©ã« (LNEXT)ã 次ã®å¥åæå‐
              ãã¨ã¹ã±ã¼ãããç¹å¥ãªæå³ããã£ã¦ã解éããªãã IEXTEN
              ãã»ããããã¦ããå ´åã«èªèããå¥åã«ã¯æ¸¡ãããªãã

       VMIN   éã«ããã«ã«èªã¿è¾¼ã¿æã®æå°æåæ° (MIN)ã

       VQUIT  (034, FS, Ctrl-\)  çµäºæå (QUIT)ã SIGQUIT ã·ã°ãã«ãéãã ISIG
              ãã»ããããã¦ããå ´åã«èªèããå¥åã«ã¯æ¸¡ãããªãã

       VREPRINT
              (POSIX ã«ã¯ãªã; 022, DC2, Ctrl-R) ã¾ã èªã¿è¾¼ãã§ããªãæå‐
              åãå表示ãã (REPRINT)ã ICANON 㨠IEXTEN ãã»ããããã¦ããå ´åã«èªè‐
              ããå¥åã«ã¯æ¸¡ãããªãã

       VSTART (021, DC1, Ctrl-Q)  éå§æå (START)ãåæ¢æåã§åæ¢ããåºåãåéããã IXON
              ãã»ããããã¦ããå ´åã«èªèããå¥åã«ã¯æ¸¡ãããªãã

       VSTATUS
              (POSIX ã«ã¯ãªã; Linux ã§ã¯å¯¾å¿ãã¦ããªã; ç¶æè¦æ±: 024, DC4,
              Ctrl-T) ç¶ææå (STATUS)ã端æ«ã§ã®ç¶ææå ±ã表示ããã
              表示ãããæå ±ã«ã¯ããã©ã¢ã°ã©ã¦ã³ãããã»ã¹ã®ç¶æããã®ããã»ã¹ãæ¶è²»ãã
              CPU æéã®ç·è¨ãå«ã¾ããã ã¾ãããã©ã¢ã°ã©ã¦ã³ãããã»ã¹ã°ã«ã¼ãã«ã·ã°ãã«
              SIGINFO ãéä¿¡ãã (Linux ã§ã¯ãµãã¼ãããã¦ããªã)ã

       VSTOP  (023, DC3, Ctrl-S)  åæ¢æå (STOP)ã éå§æåãå¥åãããã¾ã§åºåãåæ¢ããã
              IXON ãè¨å®ããã¦ããå ´åã«èªèããå¥åã«ã¯æ¸¡ãããªãã

       VSUSP  (032, SUB, Ctrl-Z)  ä¸ææå (SUSP)ã SIGTSTP ã·ã°ãã«ãéãã ISIG
              ãã»ããããã¦ããå ´åã«èªèããå¥åã«ã¯æ¸¡ãããªãã

       VSWTCH (POSIX ã«ã¯ãªã; Linux ã§ã¯å¯¾å¿ãã¦ããªã; 0, NUL)  ã¹ã¤ããæå
              (SWTCH)ã System V 㧠(ã·ã§ã«ã®ã¸ã§ãå¶å¾¡ã®åã«ãã£ã) shell layers
              ã§ã® ã·ã§ã«ã®åãæ¿ãã«ç¨ããããã

       VTIME  éã«ããã«ã«èªã¿è¾¼ã¿æã®ã¿ã¤ã ã¢ã¦ãæé (1/10 ç§åä½) (TIME)ã

       VWERASE
              (POSIX ã«ã¯ãªã; 027, ETB, Ctrl-W)  åèªæ¶å» (WERASE)ã ICANON ã¨
              IEXTEN ãã»ããããã¦ããå ´åã«èªèããå¥åã«ã¯æ¸¡ãããªãã

       対å¿ãã c_cc è¦ç´ ã®å¤ã _POSIX_VDISABLE ã«è¨å®ãããã¨ã§ã
       ããããã®ç«¯æ«å¶å¾¡æåãç¡å¹ã«ãããã¨ãã§ããã

       ä¸è¨ã®ã·ã³ãã«ã®ç¤ºãå¤ã¯å¨ã¦ç°ãªãããã ãã VTIME, VMIN ã¯ãããã VEOL, VEOF
       ã¨åãå¤ã§ããã éã«ããã«ã«ã¢ã¼ãã§ã¯ãç¹æ®æåã®æå³ã¯ ã¿ã¤ã ã¢ã¦ãã®æå³ã«å¤ããã
       VMIN 㨠VTIME ã®èª¬æã«ã¤ãã¦ã¯ã ä¸è¨ã®éã«ããã«ã«ã¢ã¼ãã®èª¬æãåç§ã®ãã¨ã

   端æ«ã®è¨å®ã®åå¾ã¨å¤æ´
       tcgetattr()  㯠fd ã«é¢ãããã©ã¡ã¼ã¿ã¼ãåå¾ããtermios_p ãåç§ããæ§ é ä½
       termios ã«è¨å®ããããã®é¢æ°ã¯ããã¯ã°ã©ã¦ã³ãããã»ã¹ãã
       å¼ã°ãããã¨ããããããã®å ´åã端æ«ã®å±æ§ã¯ãã©ã¢ã°ã©ã¦ã³ãããã»ã¹
       ã«ãã£ã¦å¤åãããã¨ãããã

       tcsetattr()  ã¯ç«¯æ«ã«é¢é£ãããã©ã¡ã¼ã¿ã¼ãè¨å®ãã (ãã¼ãã¦ã§ã¢ã®è¨‐
       å®ã«å¿è¦ã§ããã㧠è¨å®ã§ããªããã®ãé¤ã)ãè¨å®ã«ã¯ termios_p ãåç§ãã termios
       æ§é ä½ãç¨ããã optional_actions ã«ã¯å¤æ´ãæå¹ã¨ãªãã¿ã¤ãã³ã°ãè¨å®ãã:

       TCSANOW
              ãã ã¡ã«å¤æ´ãæå¹ã¨ãªãã

       TCSADRAIN
              fd ã¸ã®åºåããã¹ã¦è»¢éãããå¾ã«å¤æ´ãæå¹ã«ãªãããã®ãªãã·ã§ã³ã¯
              åºåã«å½±é¿ãããã©ã¡ã¼ã¿ã¼ãå¤æ´ããæã«ä½¿ç¨ããã¹ãã§ããã

       TCSAFLUSH
              ãã©ã¡ã¼ã¿ã¼ãå¤æ´ããåã«ã fd ã¸ã®åºåããã¹ã¦è»¢éãããåä¿¡ãããã¾ã èª‐
              ã¿è¾¼ãã§ããªããã¹ã¦ã® å¥åãç ´æ£ãããã

   ã«ããã«ã«ã¢ã¼ãã¨éã«ããã«ã«ã¢ã¼ã
       c_lflag ã® ICANON ãã©ã°ã®è¨å®ã«ããã端æ«ãã«ããã«ã«ã¢ã¼ãã§åä½ãããã決å®ãããã
       ICANON ãã»ãããããå ´åãã«ããã«ã«ã¢ã¼ã (canonical mode) ã¨ãªãã
       ã»ãããããªãå ´åãéã«ããã«ã«ã¢ã¼ã (noncanonical mode) ã¨ãªãã ããã©ã«ãã§ã¯ã
       ICANON ã¯ã»ãããããã

       ã«ããã«ã«ã¢ã¼ãã§ã¯ã以ä¸ã®ãããªåä½ã¨ãªãã

       * å¥åã¯è¡åä½ã«è¡ãããã è¡åºåãæåãæã¡è¾¼ã¾ããæç¹ã§ãå¥åè¡ãå©ç¨å¯è½ã¨ãªãã
         è¡åºåãæå㯠NL, EOL, EOL2 ããã³è¡é ã§ã® EOF ã§ããã EOF 以å¤ã®å ´åã
         read(2)  ãè¿ããããã¡ã¼ã«è¡åºåãæåãå«ããããã

       * è¡ç·¨éãæå¹ã¨ãªã (ERASE, KILL ãå¹æãæã¤ã IEXTEN ãã©ã°ãè¨å®ãããå ´åã¯ã
         WERASE, REPRINT, LNEXT ãå¹æãæã¤)ã read(2)  ã¯æ大ã§ã
         1è¡ã®å¥åããè¿ããªãã read(2)
         ãè¦æ±ãããã¤ãæ°ãç¾å¨ã®å¥åè¡ã®ãã¤ãæ°ãããå°ãªãå ´åã
         è¦æ±ããã®ã¨åããã¤ãæ°ã ããèªã¿è¾¼ã¾ãã æ®ãã®æåã¯æ¬¡åã® read(2) ã§èª‐
         ã¿è¾¼ã¾ããã

       éã«ããã«ã«ã¢ã¼ãã§ã¯ãå¥åã¯å³åº§ã«å©ç¨å¯è½ã¨ãªã (ã¦ã¼ã¶ã¼ã¯è¡åºåãæå‐
       ãæã¡è¾¼ãå¿è¦ã¯ãªã)ãå¥åå¦çã¯å®è¡ããããè¡ç·¨éã¯ç¡å¹ã¨ãªãã MIN (c_cc[VMIN])
       㨠TIME (c_cc[VTIME]) ã®è¨å®ã«ããã read(2)
       ãå®äºããæ¡ä»¶ã決å®ãããã4種é¡ã®å ´åããã:

       MIN == 0, TIME == 0 (ãã¼ãªã³ã°ãªã¼ã)
              ãã¼ã¿ãå©ç¨å¯è½ã§ããã°ã read(2)
              ã¯ããã«è¿ãããã®ã¨ãã®è¿ãå¤ã¯ããã®ã¨ãå©ç¨å¯è½ãªãã¤ãæ°ã read(2)
              ã®è¦æ±ãã¤ãæ°ã®ãã¡å°ããæ¹ã¨ãªãã å©ç¨å¯è½ãªãã¼ã¿ããªãå ´å read(2) ã¯
              0 ãè¿ãã

       MIN > 0, TIME == 0 (ããããã³ã°ãªã¼ã)
              read(2)  ã¯ãå©ç¨å¯è½ãªãã¼ã¿ã MIN ãã¤ãã«éããã¾ã§åæ‐
              ¢ãããè¿ãå¤ã¯æ大ã§ãè¦æ±ãã¤ãæ°ã§ããã

       MIN == 0, TIME > 0 (ã¿ã¤ã ã¢ã¦ãä»ãã®èªã¿è¾¼ã¿)
              TIME ã¯ã¿ã¤ãã¼ã®ä¸éãè¦å®ããåä½ã¯ 1/10 ç§ã§ããã ã¿ã¤ãã¼ã¯ read(2)
              ãå¼ã°ããæç¹ã§éå§ãããã read(2) ãè¿ãã®ã¯ãå°ãªãã¨ã
              1ãã¤ãã®ãã¼ã¿ãå©ç¨å¯è½ã¨ãªã£ãæç¹ã
              ã¾ãã¯ã¿ã¤ãã¼ãæéåãã¨ãªã£ãæç¹ã§ããã
              å¥åãå¨ããªãã¿ã¤ãã¼ãæéåãã¨ãªã£ãå ´åã read(2)  㯠0 ãè¿ãã read(2)
              ã®å¼ã³åºãæã«ãã§ã«å©ç¨å¯è½ãªãã¼ã¿ãããå ´åã
              ãã®å¼ã³åºãã¯å¼ã³åºãç´å¾ã«ãã®ãã¼ã¿ãå°çãããã®ããã«æ¯ãèãã

       MIN > 0, TIME > 0 (ãã¤ãéã®ã¿ã¤ã ã¢ã¦ãä»ãã®èªã¿åºã)
              TIME ã¯ã¿ã¤ãã¼ã®ä¸éãè¦å®ããåä½ã¯ 1/10 ç§ã§ããã
              å¥åã®æåã®ãã¤ããå©ç¨å¯è½ã«ãªã£ãå¾ã¯ã æ°ãã«
              1ãã¤ãåä¿¡ãã度ã«ã¿ã¤ãã¼ããªã»ãããããã read(2)
              ã¯ä»¥ä¸ã®æ¡ä»¶ã®ãããããæºãããå ´åã«è¿ãã

              *  MIN ãã¤ãã®ãã¼ã¿ãåä¿¡ããã

              *  ãã¤ãéã¿ã¤ãã¼ãæéåãã«ãªã£ãã

              *  read(2) ã§è¦æ±ããããã¤ãæ°ã®ãã¼ã¿ãåä¿¡ãã (POSIX
                 ã§ã¯ãã®çµäºæ¡ä»¶ã¯è¦å®ããã¦ãããã ä»ã®ããã¤ãã®å®è£ã§ã¯ read(2)
                 ã¯ãã®æ¡ä»¶ã§ã¯è¿ããªã)ã

              ã¿ã¤ãã¼ã¯æåã®ãã¤ããå©ç¨å¯è½ã«ãªã£ãæç¹ã§éå§ãããã®ã§ã å°ãªãã¨ã 1
              ãã¤ãã¯èªã¿åºãããã read() ã®å¼ã³åºãæã«ãã§ã«å©ç¨å¯è½ãªãã¼ã¿ãããå ´åã
              ãã®å¼ã³åºãã¯å¼ã³åºãç´å¾ã«ãã®ãã¼ã¿ãå°çãããã®ããã«æ¯ãèãã

       POSIX ã§ã¯ã O_NONBLOCK ãã¡ã¤ã«ç¶æãã©ã°ã MIN ã TIME ã®è¨‐
       å®ãããåªåããããã¯è¦å®ããã¦ããªãã O_NONBLOCK ãè¨å®ãããå ´åã éã«ããã«ã«ã¢ã¼ãã®
       read(2) 㯠MIN ã TIME ã®è¨å®ã«é¢ãããããã«è¿ãã
       ã¾ããå©ç¨å¯è½ãªãã¼ã¿ããªãå ´åã POSIX ã§ã¯ãã¯éã«ããã«ã«ã¢ã¼ãã® read(2) ã 0
       ãè¿ãæ¹æ³ãã errno ã« EAGAIN ãè¨å®ã㦠-1 ãè¿ããã¨ãèªãããã¦ããã

   Raw mode
       cfmakeraw()  ã¯ã端æ«ãæã® Version 7 端æ«ãã©ã¤ãã® "raw" ã¢ã¼ãã®ããã«è¨‐
       å®ããã å¥åã¯æååä½ã«å¯è½ã§ãããã¨ã³ã¼ãç¡å¹ã¨ãªãã 端æ«ã®å¥åºåæå‐
       ã«å¯¾ããç¹æ®å¦çã¯ãã¹ã¦ç¡å¹ã¨ãªãã 端æ«ã®å±æ§ã¯ä»¥ä¸ã®ããã«è¨å®ããã:

           termios_p->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP
                           | INLCR | IGNCR | ICRNL | IXON);
           termios_p->c_oflag &= ~OPOST;
           termios_p->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
           termios_p->c_cflag &= ~(CSIZE | PARENB);
           termios_p->c_cflag |= CS8;

   ã©ã¤ã³å¶å¾¡
       tcsendbreak()  ã¯ç«¯æ«ãéåæã®ã·ãªã¢ã«ãã¼ã¿è»¢éãç¨ãã¦ããå ´åã«ã
       é£ç¶ãã0ã®ãããåãä¸å®ééã§è»¢éããã duration ã 0 ã®å ´åã¯ã0 ã®ãããã 0.25
       ç§ä»¥ä¸ã 0.5 ç§ä»¥ä¸ã®ééã§è»¢éããã duration ã 0 ã§ãªãå ´åã¯ã 0
       ã®ããããå®è£ä¾åã®æéééã§éãã

       端æ«ãéåæã®ã·ãªã¢ã«ãã¼ã¿è»¢éã¢ã¼ãã§ãªãå ´åã tcsendbreak()
       ã¯ä½ãè¡ããã«æ»ãã

       tcdrain()  㯠fd ãè¡ã£ã¦ããåºåã®è»¢éãå®äºããã¾ã§å¾ã¤ã

       tcflush()  㯠fd ãè¡ã£ã¦ãããã¼ã¿ã®åºåã§ã¾ã 転éããã¦ããªããã®ããããã¯åä¿¡ã
       ããã¾ã å¥åãã¦ããªããã®ãç ´æ£ãããããããè¡ãã㯠queue_selector ã®å¤ã§å®ãã:

       TCIFLUSH
              åä¿¡ãããèªãã§ããªããã¼ã¿ããã©ãã·ã¥ããã

       TCOFLUSH
              æ¸ãããéä¿¡ãã¦ããªããã¼ã¿ããã©ãã·ã¥ããã

       TCIOFLUSH
              åä¿¡ãããèªãã§ããªããã¼ã¿ã»æ¸ãããéä¿¡ãã¦ããªããã¼ã¿ä¸¡æ¹ ããã©ãã·ã¥ããã

       tcflow()  㯠fd ã§æå®ããããªãã¸ã§ã¯ãã«ããããã¼ã¿ã®éä¿¡ãããã¯åä¿¡ãä¸æçã«ä¸æ‐
       ããã éä¿¡ã¨åä¿¡ã®ã©ã¡ããã¯ã actionã§æ±ºã¾ã:

       TCOOFF åºåã®ä¸æã

       TCOON  ä¸æããåºåã®åéã

       TCIOFF STOP æåã®éä¿¡ã STOP æåã¯ç«¯æ«ããã¤ã¹ããã·ã¹ãã ã¸ã®ãã¼ã¿éä¿¡ãåæ¢ããã

       TCION  START æåã®éä¿¡ã START æå‐
              ã¯ç«¯æ«ããã¤ã¹ããã·ã¹ãã ã¸ã®ãã¼ã¿éä¿¡ãéå§ããã

       端æ«ãã¡ã¤ã«ããªã¼ãã³ãããã¨ãã®ããã©ã«ãã§ã¯ã å¥åãåºåãä¸æããã¦ããªãã

   ã©ã¤ã³é度
       ãã¼ã¬ã¼ãé¢æ°ã¯ termios æ§é ä½ä¸ã®å¥åºåãã¼ã¬ã¼ãã åå¾ãè¨å®ããããã«æä¾ãããã
       è¨å®ãããå¤ã¯ tcsetattr() ã®å¼ã³åºããæåããã¾ã§ã¯æå¹ã§ã¯ãªãã

       é度ã B0 ã«è¨å®ããå ´åãã¢ãã ã¯åæ¢ (hang up) ããã B38400
       ã«è©²å½ããå®éã®ãããã¬ã¼ã㯠setserial(8)  㧠å¤æ´ã§ããã

       å¥åããã³åºåãã¼ã¬ã¼ã㯠termios æ§é ä½ã«æ ¼ç´ãããã

       cfgetospeed()  㯠termios_p ã示ãã¦ãã termios æ§é ä½ã«æ ¼ç´ããã¦ãã
       åºåãã¼ã¬ã¼ããè¿ãã

       cfsetospeed()  㯠termios_p ã§ç¤ºããã¦ãã termios æ§é ä½ä¸ã®åºåãã¼ã¬ã¼ãã
       speed ã«è¨å®ãããå¤ã¯ä»¥ä¸ã®ããããã§ãªããã°ãªããªã:

            B0
            B50
            B75
            B110
            B134
            B150
            B200
            B300
            B600
            B1200
            B1800
            B2400
            B4800
            B9600
            B19200
            B38400
            B57600
            B115200
            B230400

       0ãã¼ (B0) ã¯æ¥ç¶ã®ä¸æã«ç¨ããããã
       B0ãæå®ãããå ´åãã¢ãã ã®å¶å¾¡ç·ã¯ä½¿ç¨ãããªãç¶æã«ãªããä¸è¬ã«ã¯ãã㧠æ¥ç¶ãåæ‐
       ãããã CBAUDEX ã¯POSIX.1ã§å®ç¾©ããã¦ããé度ã®ç¯å²å¤ (57600 ããã³ãã以ä¸)
       ãè¨å®ãããããªãã¡ä¾ãã° B57600 & CBAUDEX 㯠0 ã§ãªãã

       cfgetispeed()  㯠termios æ§é ä½ä¸ã®å¥åãã¼ã¬ã¼ããè¿ãã

       cfsetispeed()  㯠termios æ§é ä½ä¸ã®å¥åãã¼ã¬ã¼ãã speed ã«è¨å®ããã speed
       ã«ã¯ãä¸è¿°ã® cfsetospeed()  ã®ãã¼ã¬ã¼ãå®æ° Bnnn
       ã®ããããä¸ã¤ãæå®ããªããã°ãªããªãã å¥åãã¼ã¬ã¼ãã 0 ã«è¨‐
       å®ãããå ´åãå¥åãã¼ã¬ã¼ãã¯åºåãã¼ã¬ã¼ã ã¨åãå¤ã¨ãªãã

       cfsetspeed()  㯠4.4BSD ã«ããæ¡å¼µã§ããããã®é¢æ°ã¯ cfsetispeed()
       ã¨åãå¼ãæ°ãã¨ããå¥åºå両æ¹ã®é度ãè¨å®ããã

è¿ãå¤
       cfgetispeed()  㯠termios æ§é ä½ä¸ã®å¥åãã¼ã¬ã¼ããè¿ãã

       cfgetospeed()  㯠termios æ§é ä½ä¸ã®åºåãã¼ã¬ã¼ããè¿ãã

       ä»ã®ãã¹ã¦ã®é¢æ°ã®æ»ãå¤:

       0      å®è¡æåã

       -1     å®è¡å¤±æã errno ãã¨ã©ã¼ã®ç¨®é¡ã示ãã

       tcsetattr()  㯠ãªãããã® å¤æ´è¦æ±ãæåããå ´åã«æåãè¿ããã¨ã«æ³¨æã
       å¾ã£ã¦ãè¤æ°ã®å¤æ´ãè¡ã£ãå ´åã«ã¯ãå¼ãç¶ã㦠tcgetattr()
       ãå¼ã³åºãã¦å¨ã¦ã®å¤æ´ãå®è¡ããã¦ãããã確èªããå¿è¦ããããããããªãã

å±æ§
   ãã«ãã¹ã¬ããã£ã³ã° (pthreads(7) åç§)
       é¢æ° tcgetattr(), tcsetattr(), tcsendbreak(), tcdrain(), tcflush(),
       tcflow(), cfmakeraw(), cfgetispeed(), cfgetospeed(), cfsetispeed(),
       cfsetospeed(), cfsetspeed() ã¯ã¹ã¬ããã»ã¼ãã§ããã

æºæ
       tcgetattr(), tcsetattr(), tcsendbreak(), tcdrain(), tcflush(),
       tcflow(), cfgetispeed(), cfgetospeed(), cfsetispeed(), cfsetospeed()
       㯠POSIX.1-2001 ã§è¦å®ããã¦ããã

       cfmakeraw()  㨠cfsetspeed()  ã¯éæ¨æºã ããBSD ã§ã¯å©ç¨å¯è½ã§ããã

注æ
       UNIX V7 ã¨ãã®å¾ã®ããã¤ãã®ã·ã¹ãã ã§ã¯ããã¼ã¬ã¼ãã® 14 åã®ãªã¹ãã§ãã B0, ...,
       B9600 ã®å¾ãã« EXTA, EXTB ("External A" 㨠"External B") ã® 2 ã¤ã
       追å ãã¦ããã å¤ãã®ã·ã¹ãã ã§ã¯ããã«é«éãªãã¼ã¬ã¼ãã®ããã«ãªã¹ããæ¡å¼µãã¦ããã

       tcsendbreak()  㧠duration ã« 0 以å¤ãæå®ããå ´åã®å¹æã¯æ§ãã§ããã SunOS ã¯
       duration*N ç§ã®ãã¬ã¼ã¯ãè¦å®ãã¦ããããã㧠N 㯠0.25 ä»¥ä¸ 0.5 æªæºã§ããã
       Linux, AIX, DU, Tru64 㯠duration ããªç§ã®ãã¬ã¼ã¯ãéä¿¡ããã FreeBSD,
       NetBSD, HP-UX, MacOS 㯠duration ã®å¤ãç¡è¦ããã Solaris 㨠UnixWare
       ã§ã¯ãéã¼ãã® duration ãæå®ãã tcsendbreak()  ã®æ¯ãèã㯠tcdrain()
       ã¨åæ§ã§ããã

é¢é£é ç®
       reset(1), setterm(1), stty(1), tput(1), tset(1), console_ioctl(4),
       tty_ioctl(4), setserial(8)

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



Linux                             2015-02-01                        TERMIOS(3)