Operating System - HP-UX
1832541 Members
6428 Online
110043 Solutions
New Discussion

Interrupt a system call in progress

 
Pankaj Agrawal
Occasional Advisor

Interrupt a system call in progress

I am trying to lock an open file using fcntl call.
Assuming all the parameters to the call are valid, the only way to fail the call ( for my testing purpose) is to generate an interrupt when the call is in progress(Let me knw in case there is any other way).
How can we ensure an interrupt generation when fcntl call is under progress ?

1 REPLY 1
A. Clay Stephenson
Acclaimed Contributor

Re: Interrupt a system call in progress

Actually, I don't think you can. If you do a man fcntl, you will find that none of the error conditions set errno = EINTR. This strongly suggests that fcntl() can't be interupted (or more properly, a signal can't be delivered to the process) because the process is then in a priority level higher than that where signals can be acted upon. This is rather common for i/o operations and is the reason that processes waiting on i/o can't be killed -- even with a kill -9. For your purposes, you would be better served to set up a situation where errno is set to EDEADLCK --- that should be a rigorous and realistic test scenario.
If it ain't broke, I can fix that.