Is there a way to get the name of the POSIX semaphore with the name ID (sem_t) in C ++?
Thanks to all and best wishes.
Unfortunately not. There is no sem_name function in the POSIX semaphore (or whatever you call it). There is also no workaround for Linux, since it does not provide sem_name , and it does not save the name in sem_t , which is defined in <bits/semaphore.h> as
sem_name
sem_t
<bits/semaphore.h>
typedef union { char __size[__SIZEOF_SEM_T]; long int __align; } sem_t;
The files /proc/sys/kernel/sem and /proc/sysvipc/sem do not contain this information either.
/proc/sys/kernel/sem
/proc/sysvipc/sem
So, your best option is to save the name yourself when executing sem_open , preferably in a wrapper class. See this answer for an example of a shell class.
sem_open
Source: https://habr.com/ru/post/1341421/More articles:about the power of the sizeof operator in C ++ - c ++how to check c # if input string is binary / hexadecimal. number? - c #UIGestureRecognizer in iOS 3.1.3? - iosImplementing a singleton class and (b) locking issues? - pythonPositioning a div or dialog in the center of a window - jqueryRegular actions between languages ββor libraries - regexUsing Object Oriented Semaphore in C ++ - c ++JQuery - no conflicts or closures - jqueryRunning .exe file from browser (in any way) - exeProblem with hiding floating divs inside parent div - htmlAll Articles