tmp
This commit is contained in:
parent
0f2fac98cf
commit
857c119213
|
@ -1,5 +1,6 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
#include <server.h>
|
||||
#include <structures.h>
|
||||
|
@ -8,7 +9,10 @@
|
|||
int main(int argc, char *argv[]){
|
||||
input_server_t input = check_input(argc, argv);
|
||||
|
||||
int shmid = getShmid();
|
||||
int shmBoardid = getShmid(sizeof(int) * input.collums * input.rows);
|
||||
shm_t *shm = shmat(shmBoardid, NULL, 0);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -4,12 +4,12 @@
|
|||
#include <structures.h>
|
||||
#include <errExit.h>
|
||||
|
||||
int getShmid() {
|
||||
int result = shmget(ftok(KEYFILE, 'a'), SHM_SIZE, IPC_CREAT | S_IRUSR | S_IWUSR);
|
||||
int getShmid(size_t size) {
|
||||
int shmid = shmget(ftok(KEYFILE, 'a'), size, IPC_CREAT | S_IRUSR | S_IWUSR);
|
||||
if (result == -1) {
|
||||
errExit("shmget", "getShmid");
|
||||
}
|
||||
|
||||
return result;
|
||||
return shmid;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <server.h>
|
||||
|
||||
#include <errExit.h>
|
||||
|
||||
input_server_t check_input(int argc, char *argv[]){
|
||||
|
|
Loading…
Reference in New Issue