본문 바로가기

Linux

공유메모리 (shared memory)

// shared memory setting
int shmid;
void *shared_memory = (void *)0;

shmid = shmget((key_t)1234, sizeof(struct sharedMemory), 0666|IPC_CREAT);
if (shmid == -1)
    QMessageBox::information( this, "Success", "shmget() error");
        
shared_memory = shmat(shmid, (void *)0, 0);
if (shared_memory == (void *)-1)
    QMessageBox::information( this, "Success", "shmat() error");
        
shdObj = (struct sharedMemory *)shared_memory;

'Linux' 카테고리의 다른 글

리눅스용 계싼기 bc  (0) 2013.09.26
sleep, usleep  (0) 2013.09.26
공유메모리 (shared memory)  (0) 2013.09.26
procfs system  (0) 2013.09.26
procfs  (0) 2013.09.26