/[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.59 by sysadm, Mon Nov 17 12:16:48 2025 UTC Revision 1.60 by sysadm, Mon Nov 17 14:01:13 2025 UTC
# Line 25  Line 25 
25  #include <sys/sem.h>  #include <sys/sem.h>
26  #include <sys/shm.h>  #include <sys/shm.h>
27    
28  #if defined(_SEM_SEMUN_UNDEFINED) || defined(__MSYS__) || defined(__MINGW32__)  #if defined(_SEM_SEMUN_UNDEFINED) || defined(__CYGWIN__)
29  union semun  union semun
30  {  {
31          int val;                           /* Value for SETVAL */          int val;                           /* Value for SETVAL */
# 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__)  #if defined(__CYGWIN__)
244                  if (shmdt((p_article_block_pool->shm_pool + i)->p_shm) == -1)                  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);                          log_error("shmdt(shmid = %d) error (%d)\n", (p_article_block_pool->shm_pool + i)->shmid, errno);
# Line 561  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__)  #if defined(__CYGWIN__)
565          if (shmdt(p_section_list_pool) == -1)          if (shmdt(p_section_list_pool) == -1)
566          {          {
567                  log_error("shmdt(section_list_pool) error (%d)\n", errno);                  log_error("shmdt(section_list_pool) error (%d)\n", errno);
# Line 1627  int section_list_try_rd_lock(SECTION_LIS Line 1627  int section_list_try_rd_lock(SECTION_LIS
1627  {  {
1628          int index;          int index;
1629          struct sembuf sops[4];          struct sembuf sops[4];
1630  #if !defined(__MSYS__) && !defined(__MINGW32__)  #if !defined(__CYGWIN__)
1631          struct timespec timeout;          struct timespec timeout;
1632  #endif  #endif
1633          int ret;          int ret;
# Line 1660  int section_list_try_rd_lock(SECTION_LIS Line 1660  int section_list_try_rd_lock(SECTION_LIS
1660                  sops[3].sem_flg = SEM_UNDO;                        // undo on terminate                  sops[3].sem_flg = SEM_UNDO;                        // undo on terminate
1661          }          }
1662    
1663  #if defined(__MSYS__) || defined(__MINGW32__)  #if defined(__CYGWIN__)
1664          ret = semop(p_section_list_pool->semid, sops, (index == BBS_max_section ? 2 : 4));          ret = semop(p_section_list_pool->semid, sops, (index == BBS_max_section ? 2 : 4));
1665  #else  #else
1666          timeout.tv_sec = wait_sec;          timeout.tv_sec = wait_sec;
# Line 1680  int section_list_try_rw_lock(SECTION_LIS Line 1680  int section_list_try_rw_lock(SECTION_LIS
1680  {  {
1681          int index;          int index;
1682          struct sembuf sops[3];          struct sembuf sops[3];
1683  #if !defined(__MSYS__) && !defined(__MINGW32__)  #if !defined(__CYGWIN__)
1684          struct timespec timeout;          struct timespec timeout;
1685  #endif  #endif
1686          int ret;          int ret;
# Line 1703  int section_list_try_rw_lock(SECTION_LIS Line 1703  int section_list_try_rw_lock(SECTION_LIS
1703          sops[2].sem_op = 0;                                                        // wait until unlocked          sops[2].sem_op = 0;                                                        // wait until unlocked
1704          sops[2].sem_flg = 0;          sops[2].sem_flg = 0;
1705    
1706  #if defined(__MSYS__) || defined(__MINGW32__)  #if defined(__CYGWIN__)
1707          ret = semop(p_section_list_pool->semid, sops, 3);          ret = semop(p_section_list_pool->semid, sops, 3);
1708  #else  #else
1709          timeout.tv_sec = wait_sec;          timeout.tv_sec = wait_sec;


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

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