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

Diff of /lbbs/src/user_list.c

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

Revision 1.35 by sysadm, Mon Nov 17 12:16:48 2025 UTC Revision 1.36 by sysadm, Mon Nov 17 14:01:13 2025 UTC
# Line 26  Line 26 
26  #include <sys/sem.h>  #include <sys/sem.h>
27  #include <sys/shm.h>  #include <sys/shm.h>
28    
29  #if defined(_SEM_SEMUN_UNDEFINED) || defined(__MSYS__) || defined(__MINGW32__)  #if defined(_SEM_SEMUN_UNDEFINED) || defined(__CYGWIN__)
30  union semun  union semun
31  {  {
32          int val;                           /* Value for SETVAL */          int val;                           /* Value for SETVAL */
# Line 531  int set_user_list_pool_shm_readonly(void Line 531  int set_user_list_pool_shm_readonly(void
531          shmid = p_user_list_pool->shmid;          shmid = p_user_list_pool->shmid;
532    
533          // Remap shared memory in read-only mode          // Remap shared memory in read-only mode
534  #if defined(__MSYS__) || defined(__MINGW32__)  #if defined(__CYGWIN__)
535          if (shmdt(p_user_list_pool) == -1)          if (shmdt(p_user_list_pool) == -1)
536          {          {
537                  log_error("shmdt(user_list_pool) error (%d)\n", errno);                  log_error("shmdt(user_list_pool) error (%d)\n", errno);
# Line 652  cleanup: Line 652  cleanup:
652  int user_list_try_rd_lock(int semid, int wait_sec)  int user_list_try_rd_lock(int semid, int wait_sec)
653  {  {
654          struct sembuf sops[2];          struct sembuf sops[2];
655  #if !defined(__MSYS__) && !defined(__MINGW32__)  #if !defined(__CYGWIN__)
656          struct timespec timeout;          struct timespec timeout;
657  #endif  #endif
658          int ret;          int ret;
# Line 665  int user_list_try_rd_lock(int semid, int Line 665  int user_list_try_rd_lock(int semid, int
665          sops[1].sem_op = 1;                     // lock          sops[1].sem_op = 1;                     // lock
666          sops[1].sem_flg = SEM_UNDO; // undo on terminate          sops[1].sem_flg = SEM_UNDO; // undo on terminate
667    
668  #if defined(__MSYS__) || defined(__MINGW32__)  #if defined(__CYGWIN__)
669          ret = semop(semid, sops, 2);          ret = semop(semid, sops, 2);
670  #else  #else
671          timeout.tv_sec = wait_sec;          timeout.tv_sec = wait_sec;
# Line 684  int user_list_try_rd_lock(int semid, int Line 684  int user_list_try_rd_lock(int semid, int
684  int user_list_try_rw_lock(int semid, int wait_sec)  int user_list_try_rw_lock(int semid, int wait_sec)
685  {  {
686          struct sembuf sops[3];          struct sembuf sops[3];
687  #if !defined(__MSYS__) && !defined(__MINGW32__)  #if !defined(__CYGWIN__)
688          struct timespec timeout;          struct timespec timeout;
689  #endif  #endif
690          int ret;          int ret;
# Line 701  int user_list_try_rw_lock(int semid, int Line 701  int user_list_try_rw_lock(int semid, int
701          sops[2].sem_op = 0;      // wait until unlocked          sops[2].sem_op = 0;      // wait until unlocked
702          sops[2].sem_flg = 0;          sops[2].sem_flg = 0;
703    
704  #if defined(__MSYS__) || defined(__MINGW32__)  #if defined(__CYGWIN__)
705          ret = semop(semid, sops, 3);          ret = semop(semid, sops, 3);
706  #else  #else
707          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