20 #include <ndb_global.h> 
   22 #include "SHM_Transporter.hpp" 
   23 #include "TransporterInternalDefinitions.hpp" 
   24 #include <TransporterCallback.hpp> 
   31 void SHM_Transporter::make_error_info(
char info[], 
int sz)
 
   33   snprintf(info,sz,
"Shm key=%d sz=%d id=%d",
 
   34            shmKey, shmSize, shmId);
 
   38 SHM_Transporter::ndb_shm_create()
 
   40   shmId = shmget(shmKey, shmSize, IPC_CREAT | 960);
 
   49 SHM_Transporter::ndb_shm_get()
 
   51   shmId = shmget(shmKey, shmSize, 0);
 
   60 SHM_Transporter::ndb_shm_attach()
 
   62   shmBuf = (
char *)shmat(shmId, 0, 0);
 
   73   const int res = shmctl(shmId, IPC_STAT, &info);
 
   76     int r= snprintf(buf, 
sizeof(buf),
 
   77                     "shmctl(%d, IPC_STAT) errno: %d(%s). ", shmId,
 
   78                     errno, strerror(errno));
 
   79     make_error_info(buf+r, 
sizeof(buf)-r);
 
   80     DBUG_PRINT(
"error",(
"%s", buf));
 
   84       report_error(TE_SHM_IPC_PERMANENT, buf);
 
   87       report_error(TE_SHM_IPC_STAT, buf);
 
   93   if(info.shm_nattch != 2){
 
   95     make_error_info(buf, 
sizeof(buf));
 
   96     report_error(TE_SHM_DISCONNECT);
 
   97     DBUG_PRINT(
"error", (
"Already connected to node %d",
 
  107     const int res = shmdt(shmBuf);
 
  109       perror(
"shmdelete: ");
 
  113     if(!isServer && _shmSegCreated)
 
  114       _shmSegCreated = 
false;
 
  117   if(isServer && _shmSegCreated){
 
  118     const int res = shmctl(shmId, IPC_RMID, 0);
 
  121       make_error_info(buf, 
sizeof(buf));
 
  122       report_error(TE_SHM_UNABLE_TO_REMOVE_SEGMENT);
 
  125     _shmSegCreated = 
false;
 
  127   setupBuffersDone=
false;