Linux, fcntl, F_SETLEASE and signals

Chris Green cmg at dok.org
Wed Jul 21 18:27:57 CEST 2004


Hey folks,

Is there anyway for a signal handler in python to get the information
from a 3 argument signal handler rather than just the signal number
and stack frame?

I've got an application where I have to check for F_SETLEASE on a file
in python on Linux 2.4.  What this does is tells the kernel to notify
the current process with SIGIO that a particular file descriptor is being
modified by another process.

>>> import fcntl
>>> f = open(".zshrc", "r+")
>>> fcntl.fcntl(f, fcntl.F_SETLEASE, fcntl.F_WRLCK)
0

Now, when another process opens ".zshrc", I get a SIGIO saying
something happened.  The kernel provides the information on what
descriptor changed in a siginfo_t's si_fd field.

Is there anyway to get this from python?

Thanks,
Chris
-- 
Chris Green <cmg at dok.org>
You now have 14 minutes to reach minimum safe distance.



More information about the Python-list mailing list