global
This commit is contained in:
parent
8e4060bc99
commit
db73a8c70e
|
@ -5,7 +5,7 @@
|
|||
|
||||
#define MAX_NAME 16
|
||||
|
||||
int _MSGQID;
|
||||
extern int _MSGQID;
|
||||
|
||||
#define MSG 1
|
||||
#define MOVE 2
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
#ifndef SEMAPHORE_H
|
||||
#define SEMAPHORE_H
|
||||
|
||||
#include <sys/ipc.h>
|
||||
|
||||
#define CLIENT0 0
|
||||
#define CLIENT1 1
|
||||
#define SERVER 2
|
||||
|
||||
int _SEMID;
|
||||
extern int _SEMID;
|
||||
|
||||
void setupServerSem();
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <structures.h>
|
||||
|
||||
int _SHMID;
|
||||
extern int _SHMID;
|
||||
|
||||
int getShmid(int row, int col);
|
||||
tile_t * shmServerAt(int shmid);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#define TIME_TO_RESET 2
|
||||
|
||||
pid_t _PIDS[2];
|
||||
extern pid_t _PIDS[2];
|
||||
|
||||
void sigHandlerServer(int sig);
|
||||
void setupServerSignalHandler();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define DIAGONAL _COLLUMS - 1
|
||||
#define DIAGONAL_INV _COLLUMS + 1
|
||||
|
||||
tile_t *_BOARD;
|
||||
extern tile_t *_BOARD;
|
||||
|
||||
// global variable
|
||||
static int _ROWS;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <structures.h>
|
||||
|
||||
input_server_t _INPUT_S;
|
||||
extern input_server_t _INPUT_S;
|
||||
|
||||
input_server_t check_input(int argc, char *argv[]);
|
||||
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
|
||||
#include <custom_msgq.h>
|
||||
#include <errExit.h>
|
||||
#include <server.h> //FIXME: da togliere poi
|
||||
|
||||
int _MSGQID;
|
||||
|
||||
void msgRcv(void *msgp, size_t size, long mtype);
|
||||
void msgSnd(void *msgp, size_t size);
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include <structures.h>
|
||||
#include <errExit.h>
|
||||
|
||||
int _SEMID;
|
||||
|
||||
void resetServerSem(int semid);
|
||||
|
||||
void setupServerSem() {
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include <errExit.h>
|
||||
|
||||
int _SHMID;
|
||||
|
||||
int getShmid(int row, int col) {
|
||||
int shmid = shmget(ftok(KEYFILE, 'z'), row * col * sizeof(tile_t), IPC_CREAT | S_IRUSR | S_IWUSR);
|
||||
if (shmid == -1) {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <custom_shm.h>
|
||||
#include <forza4.h>
|
||||
|
||||
static int sigint_count = 2;
|
||||
pid_t _PIDS[2];
|
||||
|
||||
void setSignal(int sig);
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include <errExit.h>
|
||||
#include <structures.h>
|
||||
|
||||
tile_t *_BOARD;
|
||||
|
||||
void setRows(int rows) {
|
||||
_ROWS = rows;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include <errExit.h>
|
||||
|
||||
input_server_t _INPUT_S;
|
||||
|
||||
input_server_t check_input(int argc, char *argv[]){
|
||||
if (argc < 5) {
|
||||
printf("\033[92m<Help>\033[39m ./F4Server ROW COL PLAYER1 PLAYER2\n"
|
||||
|
|
Loading…
Reference in New Issue