´ÙÀ½ À§·Î ÀÌÀü ¸ñÂ÷ ¸®´ª½º ÇÁ·Î±×·¡¸Ó¸¦ À§ÇÑ °¡À̵å

10.3 ´Ü¸»±â I/O (Terminal I/O)

½ÅÈ£¿¡¼­ ó·³, ´Ü¸»±â ÀÔÃâ·Â ÅëÁ¦ (terminal I/O control)´Â SVR4,BSD¿Í POSIX.1¿¡¼­ ¼¼°¡Áö ´Ù¸¥ ±¸ÇöµéÀ» °®´Â´Ù.

SVR4´Â ´Ü¸»±â ÀåÄ¡»ó¿¡¼­ termio ±¸Á¶Ã¼¸¦ °¡Áö°í ÆĶó¹ÌÅ͵é(parameters)À» ÁöÁ¤ÇÏ°í ¾ò±âÀ§ÇØ (TCSETA,TCGETA µî°ú °°Àº) ´Ù¾çÇÑ ioctl È£Ãâµé°ú termio ±¸Á¶Ã¼¸¦ »ç¿ëÇÑ´Ù. ÀÌ ±¸Á¶Ã¼¸¦ »ìÆ캸ÀÚ.:

  struct termio {
    unsigned short c_iflag;  /* Input modes */
    unsigned short c_oflag;  /* Output modes */
    unsigned short c_cflag;  /* Control modes */
    unsigned short c_lflag;  /* Line discipline modes */
    char c_line;             /* Line discipline */
    unsigned char c_cc[NCC]; /* Control characters */
  };

BSD¿¡¼­, sgtty ±¸Á¶Ã¼´Â TIOCGETP,TIOCSETP µî°ú °°Àº ´Ù¾çÇÑ ioctl È£ÃâÀ» °¡Áö°í »ç¿ëµÈ´Ù.

POSIX¿¡¼­, termios ±¸Á¶´Â tcsetattr, tcgetattr°ú °°ÀÌ POSIX.1¿¡ ÀÇÇØ Á¤ÀÇµÈ ´Ù¾çÇÑ ÇÔ¼öµé¿¡ µû¶ó »ç¿ëµÈ´Ù. termios ±¸Á¶Ã¼´Â SVR4¿¡ ÀÇÇØ »ç¿ëµÇ´Â struct termio¿Í µ¿ÀÏÇÏÁö¸¸, ±× ŸÀÔµéÀº (unsigned short ´ë½ÅÀÇ tcflag_t¿Í °°ÀÌ) Àç¸í¸í(rename)µÇ°í NCCS´Â c_cc ¹è¿­ÀÇ Å©±â¸¦ À§ÇØ »ç¿ëµÈ´Ù.

¸®´ª½º¿¡¼­, POSIX.1 termios¿Í SVR4 termio µÎ°¡Áö ¸ðµÎ Ä¿³Î¿¡ ÀÇÇØ Á÷Á¢ÀûÀ¸·Î Áö¿øµÈ´Ù. ÀÌ°ÍÀº ´ç½ÅÀÇ ÇÁ·Î±×·¥ÀÌ ´Ü¸»±â ÀÔÃâ·Â Á¢±Ù(terminal I/O accessing)À» À§ÇÑ ÀÌ·¯ÇÑ ¹æ¹ýµé Áß Çϳª¸¦ »ç¿ëÇÑ´Ù¸é, ¸®´ª½º¿¡¼­ Á÷Á¢ ÄÄÆÄÀÏÇؾßÇÔÀ» ÀǹÌÇÑ´Ù. Àǽɽº·´´Ù¸é, termiosÀ» »ç¿ëÇϱâ À§ÇØ termio¸¦ »ç¿ëÇÏ´Â Äڵ带 µÎ ¹æ¹ýÀÇ ÀÛÀº Áö½ÄÀ» »ç¿ëÇÏ¿© ½±°Ô ¼öÁ¤ÇÒ ¼ö ÀÖ´Ù. Àߵȴٸé, ÀÌ°ÍÀº ²À ÇÊ¿äÇÏÁö´Â ¾ÊÁö¸¸, ÇÁ·Î±×·¥ÀÌ termio ±¸Á¶Ã¼ ¾È¿¡ c_line ÇʵåÀ» »ç¿ëÇϱ⸦ ½ÃµµÇÑ´Ù¸é ÁÖÀǸ¦ ±â¿ï¿©¶ó. °ÅÀÇ ¸ðµç ÀÀ¿ëÇÁ·Î±×·¥À» À§ÇØ ÀÌ°ÍÀº N_TTYÀÌ¿©¾ß ÇÏ°í, ÇÁ·Î±×·¥ÀÌ ¸î¸î ´Ù¸¥ ÁÙ ±ÔÀ²(line discipline)ÀÌ »ç¿ë°¡´ÉÇÏ´Ù°í °¡Á¤ÇÑ´Ù¸é ¹®Á¦°¡ »ý±æÁöµµ ¸ð¸¥´Ù.

´ç½ÅÀÇ ÇÁ·Î±×·¥ÀÌ BSD sgtty ±¸ÇöÀ» »ç¿ëÇÑ´Ù¸é, À§¿¡¼­ ¼³¸íÇÑ °Íó·³ libbsd.a¿¡ ´ëÇÏ¿© ¸µÅ©¸¦ »ç¿ëÇÒ ¼ö ÀÖ´Ù. ÀÌ°ÍÀº ioctl¸¦ À§ÇØ ´ëü¹°À» Á¦°øÇÒ °ÍÀÌ°í ±×°ÍÀº Ä¿³Î¿¡ ÀÇÇØ »ç¿ëµÇ´Â POSIX termios È£Ãâ¿¡ °üÇÏ¿© ´Ü¸»±â ÀÔÃâ·Â(terminal I/O) ¿äûµéÀ» ´Ù½Ã Á¦ÃâÇÒ °ÍÀÌ´Ù. ¾î¶² ÇÁ·Î±×·¥À» ÄÄÆÄÀÏÇÒ ¶§, TIOCGETP¿Í °°Àº »ó¡µé(symbols)ÀÌ Á¤ÀǵǾî ÀÖÁö ¾Ê´Ù¸é, libbsd¿¡ ´ëÇØ ¿¬°á(link)ÇؾßÇÒ ÇÊ¿ä°¡ ÀÖÀ» °ÍÀÌ´Ù.


ÀÌÀü:10.2.4 ¸®´ª½º¿¡¼­ Áö¿øµÇ´Â ½ÅÈ£µé ´ÙÀ½:10.4 ÇÁ·Î¼¼½º Á¤º¸¿Í ÅëÁ¦

Copyright (c) 1996,1997 by Euibeom.Hwang & SangEun.Oh All Rights Reserved

Email To:Webmaster , Another address
LAST UPDATE Dec 19,1997
Created Dec 19,1997