int bindport = getIntConf(BINDPORT); //MJP BUG commandline option for address and port dont work this way going to have \r
int server_max_clients = getIntConf(MAX_CLIENTS); //to bring them across as prameters to Sharedmemory_init(void)\r
int shmptr_size = sizeof( shm_t ) + (sizeof( shmclient_t ) * server_max_clients);\r
- \r
-\r
\r
sprintf( shm_file_name, "umurmurd:%i", bindport );\r
+ Log_info("SHM_API: shm_fd=\"%s\"", shm_file_name );\r
\r
- Log_info("SHM_FD: %s", shm_file_name );\r
-\r
-shm_fd = shm_open( shm_file_name, O_CREAT | O_RDWR, 0666 );\r
-if(shm_fd == -1)\r
-{\r
- fprintf(stderr, "Open failed:%s\n", strerror(errno)); //MJP BUG make this Log_ calls once I get this working\r
- exit(1);\r
-} \r
-\r
-if( ftruncate( shm_fd, shmptr_size ) == -1 )\r
-{\r
- fprintf(stderr, "ftruncate : %s\n", strerror(errno)); //MJP BUG make this Log_ calls once I get this working\r
- exit(1);\r
-}\r
+ shm_fd = shm_open( shm_file_name, O_CREAT | O_RDWR, 0666 );\r
+ if(shm_fd == -1)\r
+ {\r
+ Log_fatal( "SHM_API: Open failed:%s\n", strerror(errno));\r
+ exit(1);\r
+ } \r
\r
- shmptr = mmap(0, shmptr_size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);\r
- if (shmptr == (void *) -1) \r
- {\r
- fprintf(stderr, "mmap failed : %s\n", strerror(errno)); //MJP BUG make this Log_ calls once I get this working\r
- exit(1);\r
- } \r
+ if( ftruncate( shm_fd, shmptr_size ) == -1 )\r
+ {\r
+ Log_fatal( "SHM_API: ftruncate : %s\n", strerror(errno)); \r
+ exit(1);\r
+ }\r
\r
+ shmptr = mmap(0, shmptr_size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);\r
+ if (shmptr == (void *) -1) \r
+ {\r
+ Log_fatal( "SHM_API: mmap failed : %s\n", strerror(errno));\r
+ exit(1);\r
+ } \r
\r
memset( shmptr, 0, shmptr_size );\r
\r