::: °­ÁÂ/¼Ò½º/¹®¼­ :::

°­ÁÂ/¼Ò½º/¹®¼­ ¼º°Ý¿¡ ¸ÂÁö ¾Ê´Â ±¤°í,ºñ¹æ,Áú¹®ÀÇ ±ÛÀº Áï½Ã »èÁ¦Çϸç
³»¿ëÀ» º¹»çÇÏ¿© »ç¿ëÇÒ °æ¿ì ¹Ýµå½Ã ÀÌ°÷(http://www.howto.pe.kr)À» Ãâó·Î ¸í½ÃÇÏ¿© ÁÖ¼¼¿ä


Category

  ±è¿µ´ë(2003-03-17 02:38:25, Hit : 6376, Vote : 1593
 [System V IPC] msgget() function - ¸Þ¼¼ÁöÅ¥

/***************************************************
*   Creat  : 2001. 02. 10  (programed by Cori-Young)
*   Site: http://www.byoneself.co.kr
*   Update :
***************************************************/

#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>

extern void  exit();
extern void  perror();

main()
{
        key_t  key;
        int  msgflg;        
        int  msqid;

        (void) fprintf(stderr, "All numeric input is expected to follow C conventions:n");
         (void) fprintf(stderr,  "t0x... is interpreted as hexadecimal,n");
        (void) fprintf(stderr, "t0... is interpreted as octal,n");
        (void) fprintf(stderr, "totherwise, decimal.n");
        (void) fprintf(stderr, "IPC_PRIVATE == %#lxn", IPC_PRIVATE);
        (void) fprintf(stderr, "Enter key: ");

        (void) scanf("%li", &key);

        (void) fprintf(stderr, "nExpected flags for msgflg argumentare:n");
        (void) fprintf(stderr, "tIPC_EXCL =t%#8.8on", IPC_EXCL);
        (void) fprintf(stderr, "tIPC_CREAT =t%#8.8on", IPC_CREAT);
        (void) fprintf(stderr, "towner read =t%#8.8on", 0400);
        (void) fprintf(stderr, "towner write =t%#8.8on", 0200);
        (void) fprintf(stderr, "tgroup read =t%#8.8on", 040);
        (void) fprintf(stderr, "tgroup write =t%#8.8on", 020);
        (void) fprintf(stderr, "tother read =t%#8.8on", 04);
        (void) fprintf(stderr, "tother write =t%#8.8on", 02);
        (void) fprintf(stderr, "Enter msgflg value: ");
        
        (void) scanf("%i", &msgflg);

        (void) fprintf(stderr, "nmsgget: Calling msgget(%#lx,%#o)n",        key, msgflg);
        
        if (msqid = msgget(key, msgflg|0666) == -1)
        {
                perror("msgget: msgget failed");
                exit(1);
        }
        else {
                (void) fprintf(stderr,"msgget: msgget succeeded: msqid = %dn", msqid);
                exit(0);
        }
}





42   [Unix/Linux] [Thread] pthread_cond() function  ±è¿µ´ë 2003/03/17 6626 1688
41   [Unix/Linux] [System V IPC] shmop() function - °øÀ¯¸Þ¸ð¸®  ±è¿µ´ë 2003/03/17 6520 1580
40   [Unix/Linux] [System V IPC] msgctl() function - ¸Þ¼¼ÁöÅ¥  ±è¿µ´ë 2003/03/17 6474 1700
39   [Unix/Linux] [Thread] pthread_mutexattr_init() function  ±è¿µ´ë 2003/03/17 6445 1937
  [Unix/Linux] [System V IPC] msgget() function - ¸Þ¼¼ÁöÅ¥  ±è¿µ´ë 2003/03/17 6376 1593
37   [Unix/Linux] [System V IPC] semctl() function - ¼¼¸¶Æ÷¾î  ±è¿µ´ë 2003/03/17 6134 1411
36   [Unix/Linux] [Thread] pthread_once() function  ±è¿µ´ë 2003/03/17 6118 1602
35   [Unix/Linux] [Thread] »ý»êÀÚ/¼ÒºñÀÚ  ±è¿µ´ë 2003/03/17 6053 1548
34   [Unix/Linux] [Thread] pthread_cond_init() function  ±è¿µ´ë 2003/03/17 6010 1567
33   [Unix/Linux] [Thread] pthread_mutex_init() function  ±è¿µ´ë 2003/03/17 5920 1457
32   [Unix/Linux] [Thread] pthread_attr_setdetachstate() function  ±è¿µ´ë 2003/03/17 5919 1619
31   [Unix/Linux] [Thread] pthread_attr_destroy() function  ±è¿µ´ë 2003/03/17 5905 1556
30   [Unix/Linux] [Thread] pthread_detach() function  ±è¿µ´ë 2003/03/17 5828 1470
29   [Unix/Linux] [Thread] pthread_attr_setinheritsched() function  ±è¿µ´ë 2003/03/17 5808 1535
28   [Unix/Linux] [System V IPC] semop() function - ¼¼¸¶Æ÷¾î  ±è¿µ´ë 2003/03/17 5770 1436
27   [Unix/Linux] [Thread] pthread_key_create() function  ±è¿µ´ë 2003/03/17 5762 1419
26   [Unix/Linux] [Thread] pthread_muxtexcond() function  ±è¿µ´ë 2003/03/17 5725 1475
25   [Unix/Linux] [Thread] pthread_create() function  ±è¿µ´ë 2003/03/17 5682 1415
24   [Unix/Linux] [Thread] pthread_self() function  ±è¿µ´ë 2003/03/17 5588 1547
23   [Unix/Linux] [Thread] pthread_attr_getdetachstate() function  ±è¿µ´ë 2003/03/17 5533 1642

[1] 2 [3][4]
 

Copyright 1999-2024 Zeroboard / skin by zero