/[LeafOK_CVS]/lbbs/src/section_list.c
ViewVC logotype

Diff of /lbbs/src/section_list.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.58 by sysadm, Mon Nov 17 11:56:11 2025 UTC Revision 1.59 by sysadm, Mon Nov 17 12:16:48 2025 UTC
# Line 240  int set_article_block_shm_readonly(void) Line 240  int set_article_block_shm_readonly(void)
240                  shmid = (p_article_block_pool->shm_pool + i)->shmid;                  shmid = (p_article_block_pool->shm_pool + i)->shmid;
241    
242                  // Remap shared memory in read-only mode                  // Remap shared memory in read-only mode
243    #if defined(__MSYS__) || defined(__MINGW32__)
244                    if (shmdt((p_article_block_pool->shm_pool + i)->p_shm) == -1)
245                    {
246                            log_error("shmdt(shmid = %d) error (%d)\n", (p_article_block_pool->shm_pool + i)->shmid, errno);
247                            return -2;
248                    }
249                    p_shm = shmat(shmid, (p_article_block_pool->shm_pool + i)->p_shm, SHM_RDONLY);
250    #else
251                  p_shm = shmat(shmid, (p_article_block_pool->shm_pool + i)->p_shm, SHM_RDONLY | SHM_REMAP);                  p_shm = shmat(shmid, (p_article_block_pool->shm_pool + i)->p_shm, SHM_RDONLY | SHM_REMAP);
252    #endif
253                  if (p_shm == (void *)-1)                  if (p_shm == (void *)-1)
254                  {                  {
255                          log_error("shmat(article_block_pool shmid = %d) error (%d)\n", shmid, errno);                          log_error("shmat(article_block_pool shmid = %d) error (%d)\n", shmid, errno);
# Line 552  int set_section_list_shm_readonly(void) Line 561  int set_section_list_shm_readonly(void)
561          shmid = p_section_list_pool->shmid;          shmid = p_section_list_pool->shmid;
562    
563          // Remap shared memory in read-only mode          // Remap shared memory in read-only mode
564    #if defined(__MSYS__) || defined(__MINGW32__)
565            if (shmdt(p_section_list_pool) == -1)
566            {
567                    log_error("shmdt(section_list_pool) error (%d)\n", errno);
568                    return -1;
569            }
570            p_shm = shmat(shmid, p_section_list_pool, SHM_RDONLY);
571    #else
572          p_shm = shmat(shmid, p_section_list_pool, SHM_RDONLY | SHM_REMAP);          p_shm = shmat(shmid, p_section_list_pool, SHM_RDONLY | SHM_REMAP);
573    #endif
574          if (p_shm == (void *)-1)          if (p_shm == (void *)-1)
575          {          {
576                  log_error("shmat(section_list_pool shmid = %d) error (%d)\n", shmid, errno);                  log_error("shmat(section_list_pool shmid = %d) error (%d)\n", shmid, errno);


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1