Funktionen deklariert und definiert
This commit is contained in:
parent
4d6678e0a4
commit
b0f99af8d7
|
@ -5,3 +5,25 @@ void shared-memory-init(){
|
|||
memmory-id = shmget(IPC_PRIVATE, SHMMAXSIZE, IPC_CREAT | IPC_EXCL);
|
||||
}
|
||||
|
||||
//Ein Shared-Memory-Segment abfragen, ändern oder löschen – shmctl()
|
||||
void delet-shared-memory(){
|
||||
int shmctl(memmory-id, IPC_RMID, 0);
|
||||
}
|
||||
|
||||
//Shared-Memory-Segment an einen Prozess anbinden (attach) – shmat()
|
||||
void attach-process(char *myProcess){
|
||||
if(( myProcess = shmat( memmory-id, (char *)0, 0 )) < (char *)0 ){
|
||||
perror("Fehler beim Ankoppeln des gemeinsamen Speicher Segments");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
//Ein Shared-Memory-Segment loslösen – shmdt()
|
||||
void release-memory‚(){
|
||||
int shmdt(void *myProcess);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -14,14 +14,13 @@
|
|||
//Shared-Memory-Segment erstellen oder öffnen – shmget()
|
||||
void shared-memory-init();
|
||||
|
||||
//Ein Shared-Memory-Segment abfragen, ändern oder löschen
|
||||
//Ein Shared-Memory-Segment abfragen, ändern oder löschen – shmctl()
|
||||
void delet-shared-memory();
|
||||
int shmctl(int shm_id, int kommando, struct shmid_ds *buf);
|
||||
|
||||
//Shared-Memory-Segment an einen Prozess anbinden (attach)
|
||||
void *shmat(int shm_id, const void *adresse, int flag);
|
||||
//Shared-Memory-Segment an einen Prozess anbinden (attach) – shmat()
|
||||
void attach-process(char *myProcess);
|
||||
|
||||
//Ein Shared-Memory-Segment loslösen – shmdt()
|
||||
int shmdt(void *adresse);
|
||||
void release-memory();
|
||||
|
||||
#endif //SHARED_MEMORY_H
|
||||
|
|
Loading…
Reference in New Issue