Operating System - HP-UX
1836460 Members
2442 Online
110101 Solutions
New Discussion

deletion semaphore from semaphore table

 
Sup
Advisor

deletion semaphore from semaphore table

Hi,
Is it a way to not allow the deletion semaphore from semaphore table which process is using/running ?
thanks,
7 REPLIES 7
Dietmar Konermann
Honored Contributor

Re: deletion semaphore from semaphore table

I'm afraid there is nothing to prevent root or the sem owner to use semctl(2) with IPC_RMID.

However, you may try to wrap the ipcrm(1) command with some more restrictive shell script. Not bullet-proof, of course... but root should be careful anyway.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Sup
Advisor

Re: deletion semaphore from semaphore table

Just I want to clear my question some more, here the deletion means it may be manually one or because of some system resource failure. I am mainly concerns about because of some system resource failure.
Dietmar Konermann
Honored Contributor

Re: deletion semaphore from semaphore table

Sorry, I never heard about implicite semaphore deletion due to some system resource shortage. What specifically do you mean?

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Sup
Advisor

Re: deletion semaphore from semaphore table

While running a process, its semaphore was disappeared from semaphore table( we don't no exactly why it disappeared) because of this it start printing this messages in log file "semop() failed: Invalid argument".
When this happened we had around some 300 semaphores in semaphore table.
thanks.
Dietmar Konermann
Honored Contributor

Re: deletion semaphore from semaphore table

I doubt that the semaphore really disappered without being explicitely removed.

If the problem happens not only occasionally then you could try to catch the culprit using auditing (see audit(5)). There you have the chance to track processes that use semctl() for removal.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Vincente Fernandes
Valued Contributor

Re: deletion semaphore from semaphore table

Either the semaphore have been removed by someone having root access using "ipcrm -s semaphoreid" or the application may have removed it. Otherwise i doubt there is any way the semaphore will disappear by itself.
Rajeev  Shukla
Honored Contributor

Re: deletion semaphore from semaphore table

use
ipcs -acps to see all the shared memory with the creator name. Then grep for the process to see if its active, if its not active use
ipcrm -s
this will delete the shared memory for the corresponding shared memory ID.

Have a look at the man pages of ipcs and ipcrm for more details.

Cheers
Rajeev