|
Lines 30-41
Link Here
|
| 30 |
#endif |
30 |
#endif |
| 31 |
/* Required for getting system parameters */ |
31 |
/* Required for getting system parameters */ |
| 32 |
#if defined __linux__ |
32 |
#if defined __linux__ |
| 33 |
#include <linux/unistd.h> |
33 |
#include <sys/ipc.h> |
| 34 |
#include <linux/types.h> |
34 |
#include <sys/shm.h> |
| 35 |
#include <linux/sysctl.h> |
35 |
|
| 36 |
#include <sys/syscall.h> |
36 |
#ifndef IPC_INFO |
| 37 |
#include <unistd.h> |
37 |
#define IPC_INFO 3 |
| 38 |
#else |
38 |
#endif |
| 39 |
#endif |
39 |
#endif |
| 40 |
|
40 |
|
| 41 |
int myGlobalSock = -1; |
41 |
int myGlobalSock = -1; |
|
Lines 53-60
Link Here
|
| 53 |
* defined max value or not. If the requested size is more than system defined |
53 |
* defined max value or not. If the requested size is more than system defined |
| 54 |
* size, change the requested size to a value lower than system defined max |
54 |
* size, change the requested size to a value lower than system defined max |
| 55 |
* value. |
55 |
* value. |
| 56 |
* NOTE: This code is not ported for EM64T Linux and hence not being invoked |
|
|
| 57 |
* at this time |
| 58 |
* |
56 |
* |
| 59 |
* @param size - the requested shared memory segment size |
57 |
* @param size - the requested shared memory segment size |
| 60 |
*************************************************************************/ |
58 |
*************************************************************************/ |
|
Lines 102-113
Link Here
|
| 102 |
|
100 |
|
| 103 |
#elif __linux__ |
101 |
#elif __linux__ |
| 104 |
int rc; |
102 |
int rc; |
| 105 |
int name[] = { CTL_KERN, KERN_SHMMAX }; |
103 |
struct shminfo info; |
| 106 |
size_t shmmaxlen = sizeof(int); |
104 |
|
| 107 |
struct __sysctl_args args = { name, sizeof(name), &shmmax, &shmmaxlen, 0, 0 }; |
105 |
rc = shmctl(0, IPC_INFO, (struct shmid_ds *) (void*) &info); // to make compiler happy |
| 108 |
|
106 |
if (rc >= 0) |
| 109 |
rc = syscall(SYS__sysctl, &args); |
107 |
shmmax = info.shmmax; |
| 110 |
if(rc || (shmmax == 0)) { |
108 |
|
|
|
109 |
if(shmmax <= 0) { |
| 111 |
TPTP_LOG_ERROR_MSG("Cannot get system shared memory setting"); |
110 |
TPTP_LOG_ERROR_MSG("Cannot get system shared memory setting"); |
| 112 |
shmmax = 33554432; // default for Linux systems |
111 |
shmmax = 33554432; // default for Linux systems |
| 113 |
} |
112 |
} |
|
Lines 357-368
Link Here
|
| 357 |
if (shmBufSize < RA_SHM_BUF_SIZE_MIN) |
356 |
if (shmBufSize < RA_SHM_BUF_SIZE_MIN) |
| 358 |
shmBufSize = RA_SHM_BUF_SIZE_MIN ; |
357 |
shmBufSize = RA_SHM_BUF_SIZE_MIN ; |
| 359 |
|
358 |
|
| 360 |
#ifndef __x86_64__ |
|
|
| 361 |
// The validateSystemShmMax is not ported to work on Linux EM64T platform |
| 362 |
// Hence invoking this function only for other platforms. For things to work on |
| 363 |
// Linux EM64T, the default shared mem chunk size is set to 8MB |
| 364 |
shmBufSize = validateSystemShmMax(shmBufSize); |
359 |
shmBufSize = validateSystemShmMax(shmBufSize); |
| 365 |
#endif |
360 |
|
| 366 |
TPTP_LOG_DEBUG_MSG2("Shared mem name(%s) size(%d) \n", pMemName, shmBufSize) ; |
361 |
TPTP_LOG_DEBUG_MSG2("Shared mem name(%s) size(%d) \n", pMemName, shmBufSize) ; |
| 367 |
shmerr = ra_createShm((char*) pMemName, shmBufSize, pShmHdl) ; |
362 |
shmerr = ra_createShm((char*) pMemName, shmBufSize, pShmHdl) ; |
| 368 |
|
363 |
|