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

½Ã½ºÅÛ È£Ãâ:shmat() (SYSTEM CALL:shmat())


  SYSTEM CALL: shmat();                                                          

  PROTOTYPE: int shmat ( int shmid, char *shmaddr, int shmflg);
    RETURNS: address at which segment was attached to the process, or
             -1 on error: errno = EINVAL (Invalid IPC ID value or attach address passed)
                                  ENOMEM (Not enough memory to attach segment)
                                  EACCES (Permission denied)
  NOTES:

addr ¾Æ±Ô¸ÕÆ®°¡ Á¦·Î(0)À̸é, Ä¿³ÎÀº ¸ÅÇεÇÁö ¾ÊÀº Áö¿ªÀ» ãÀ¸·Á°í ÇÑ´Ù. ÀÌ°ÍÀº Ãßõ¹æ¹ýÀÌ´Ù. ÁÖ¼Ò´Â ÁöÁ¤µÉ ¼ö ÀÖÁö¸¸, ÀüÅëÀûÀ¸·Î µ¶Á¡ÀûÀ¸·Î Çϵå¿þ¾î¸¦ ÀÌ¿ëÇϰųª ´Ù¸¥ ÀÀ¿ëÇÁ·Î±×·¥°úÀÇ Ãæµ¹À» ÇÇÇϱâ À§ÇØ »ç¿ëµÈ´Ù. SHM_RND Ç÷¡±×´Â ³Ñ°ÜÁø ÁÖ¼Ò¿¡ ÆäÀÌÁö¸¦ Á¤·Ä(align)½ÃÅ°´Â ù¹ø° ¾Æ±Ô¸ÕÆ®¿¡ ORµÉ ¼ö ÀÖ´Ù.(°¡Àå ±ÙÁ¢ÇÑ ÆäÀÌÁö Å©±â·Î ÁÙ¿©¼­)

°Ô´Ù°¡, SHM_RDONLY Ç÷¡±×°¡ Ç÷¡±× ¾Æ±Ô¸ÕÆ®¿¡ ORµÇ¸é, °øÀ¯ ¸Þ¸ð¸® ¼¼±×¸ÕÆ®´Â ¸ÅÇεǾîÁöÁö¸¸, ÀбâÀü¿ë(readonly)·Î Ç¥½ÃµÈ´Ù.

ÀÌ È£ÃâÀº ¾Æ¸¶µµ »ç¿ëÇϱ⿡ °¡Àå ½¬¿ï °ÍÀÌ´Ù. ¼¼±×¸ÕÆ®¸¦ À§ÇÑ À¯È¿ÇÑ IPC È®ÀÎÀÚ°¡ ³Ñ°ÜÁö°í ¼¼±×¸ÕÆ®°¡ ºÙ¿©Áø ÁÖ¼Ò¸¦ ¹ÝȯÇÏ´Â wrapper ÇÔ¼ö¸¦ »ý°¢ÇØ º¸ÀÚ.


char *attach_segment( int shmid )
{
        return(shmat(shmid, 0, 0));
}

¼¼±×¸ÕÆ®°¡ Àû´çÇÏ°Ô ºÙ¿©Áø(attached) ´ÙÀ½, ÇÁ·Î¼¼½º´Â ±× ¼¼±×¸ÕÆ®ÀÇ ½ÃÀÛÁ¡À» °¡¸®Å°´Â Æ÷ÀÎÅ͸¦ °®´Â´Ù. ¼¼±×¸ÕÆ®¿¡ ´ëÇÑ Àбâ¿Í ¾²±â´Â °£´ÜÈ÷ Æ÷ÀÎÅ͸¦ ÂüÁ¶Çϰųª ÂüÁ¶µÇ¾îÁö´Â °Íó·³ ½±°Ô ÀÌ·ç¾î Áø´Ù. ¿ø·¡ÀÇ Æ÷ÀÎÅÍ °ªÀ» ÀÒ¾î¹ö¸®Áö ¾Êµµ·Ï ÁÖÀÇÇضó! ¸¸¾à ±×·± ÀÏÀÌ ¹ß»ýÇÑ´Ù¸é, ¼¼±×¸ÕÆ®ÀÇ ±âÃÊ(½ÃÀÛÁ¡)¿¡ Á¢±ÙÇÏ´Â ¹æ¹ýÀÌ ¾ø°Ô µÈ´Ù.


ÀÌÀü:½Ã½ºÅÛ È£Ãâ:shmget() ´ÙÀ½:½Ã½ºÅÛ È£Ãâ:shmctl()

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

Email To:Webmaster , Another address
LAST UPDATE Nov 28,1997
Created Nov 28,1997