Status of POSIX semaphores and shared memory

Post Reply

Topic author
saprykin
Member
Posts: 9
Joined: Tue May 14, 2024 5:17 pm
Reputation: 0
Status: Offline

Status of POSIX semaphores and shared memory

Post by saprykin » Thu May 16, 2024 6:17 pm

A while ago (well, like 8 years :) ), there was a discussion about POSIX semaphores in OpenVMS Alpha. It seems to be that some progress to fix the issue has been made recently. Did the fix end up in the current community version of 9.2-2? I'm running the same tests of the same library on x86 now, and the situation is no better.


pustovetov
VSI Expert
Contributor
Posts: 24
Joined: Thu Sep 14, 2023 1:26 am
Reputation: 0
Status: Offline

Re: Status of POSIX semaphores and shared memory

Post by pustovetov » Fri May 17, 2024 1:25 am

saprykin wrote:
Thu May 16, 2024 6:17 pm
A while ago (well, like 8 years :) ), there was a discussion about POSIX semaphores in OpenVMS Alpha. It seems to be that some progress to fix the issue has been made recently. Did the fix end up in the current community version of 9.2-2? I'm running the same tests of the same library on x86 now, and the situation is no better.
Hi. It seems that the error has been fixed.

Code: Select all

$ sho sys
OpenVMS V9.2-2  on node X86   17-MAY-2024 07:20:52.80   Uptime  1 11:43:08
.....
$ r sem_create
[OK] Semaphore created
$ r sem_create
[OK] Semaphore exists
$ r sem_open
[OK] Semaphore opened
$ r sem_unlink
[OK] Semaphore unlinked


Topic author
saprykin
Member
Posts: 9
Joined: Tue May 14, 2024 5:17 pm
Reputation: 0
Status: Offline

Re: Status of POSIX semaphores and shared memory

Post by saprykin » Fri May 17, 2024 6:04 pm

Hi Vitaly,

I'm using plibsys library on OpenVMS, which also provides cross-platform API for IPC, including semaphores and shared memory. Back then, 8 years ago, I was porting it to OpenVMS on Alpha and IA64, and faced the mentioned problems. The library is now ported to OpenVMS x86, but the tests for IPC are still failing. These tests are passing on many operating systems, so I assume they use POSIX API related to IPC in a correct way (there are still a few specific cases like on HP-UX related to process address space). Now, I'm trying to understand why they are still failing on OpenVMS.

The library and the tests are very easy to build using the build_vms.com script in the platforms/vms-general directory. The same directory also contains instructions on how to build and run tests. Could you please take a look if the code was built correctly and nothing specific to POSIX IPC has been used in a wrong way? I can also dig the next week what exactly fails inside the tests if you can help with the fixes.


pustovetov
VSI Expert
Contributor
Posts: 24
Joined: Thu Sep 14, 2023 1:26 am
Reputation: 0
Status: Offline

Re: Status of POSIX semaphores and shared memory

Post by pustovetov » Sat May 18, 2024 4:02 pm

saprykin wrote:
Fri May 17, 2024 6:04 pm
Now, I'm trying to understand why they are still failing on OpenVMS.

Because here the sem_open call is with a 64-bit string address. And inside sem_open, operations are performed with it as with 32-bit. Oops!

Code: Select all

	while ((sem->sem_hdl = sem_open (sem->platform_key, <<<< the 64-bit string address
					 O_CREAT | O_EXCL,
I've fixed the issue in the CRTL.

Code: Select all

$ r [.X86_64]PSEMAPHORE_TEST
Running test case: psemaphore_nomem_test
Running test case: psemaphore_general_test
Running test case: psemaphore_thread_test
Test passed


Topic author
saprykin
Member
Posts: 9
Joined: Tue May 14, 2024 5:17 pm
Reputation: 0
Status: Offline

Re: Status of POSIX semaphores and shared memory

Post by saprykin » Wed May 22, 2024 5:32 pm

Thanks for fixing it! That actually explains why compiling in 32-bits pointers make semaphore test working, although only once, and each next time it was failing.

Did you try pshm_test and pshmbuffer_test as well? They use POSIX shared memory and semaphores as well. These have been never working for me.

Post Reply