/usr/lib/python2.6/site-packages/rhn
Edit: /usr/lib/python2.6/site-packages/rhn/rhnLockfile.pyo (3238B)
Ñò
˜auKc @ s¤ d d k Z d d k Z d d k Z d d k l Z l Z d d k Z d e f d „ ƒ YZ d d
d „ ƒ YZ d „ Z e
d j o e i e ƒ p d ƒ n d S( iÿÿÿÿN( t EWOULDBLOCKt EEXISTt LockfileLockedExceptionc B s e Z d Z RS( s$ thrown ONLY when pid file is locked.( t __name__t
__module__t __doc__( ( ( s3 /usr/lib/python2.6/site-packages/rhn/rhnLockfile.pyR s t Lockfilec B s, e Z d Z d d „ Z d „ Z d „ Z RS( sï class that provides simple access to a PID-style lockfile.
methods: __init__(lockfile), acquire(), and release()
NOTE: currently acquires upon init
The *.pid file will be acquired, or an LockfileLockedException is raised.
c C s t i i t i i t i i | ƒ ƒ ƒ | _ | | _ | i p t i ƒ | _ n t i i | i ƒ } t i i | ƒ pT y t i
| ƒ WqÏ t j
o0 } t | d ƒ o | i
t j o qË ‚ qÏ Xn t i | i t i t i Bt i Bƒ | _ | i ƒ d S( sl create (if need be), and acquire lock on lockfile
lockfile example: '/var/run/up2date.pid'
t errnoN( t ost patht abspatht
expandusert
expandvarst lockfilet pidt getpidt dirnamet existst makedirst OSErrort hasattrR R t opent O_RDWRt O_CREATt O_SYNCt ft acquire( t selfR
R R t e( ( s3 /usr/lib/python2.6/site-packages/rhn/rhnLockfile.pyt __init__# s
)c C s³ y! t i | i t i t i Bƒ Wn? t j
o3 } | i t j o t d | i ƒ ‚ qc ‚ n Xt i | i t i
d ƒ t i | i d ƒ t i
| i t | i ƒ d ƒ d S( s5 acquire the lock; else raise LockfileLockedException.s cannot acquire lock on %s.i i s
N( t fcntlt flockR t LOCK_EXt LOCK_NBt IOErrorR R R R
t F_SETFDR t ftruncatet writet strR ( R R ( ( s3 /usr/lib/python2.6/site-packages/rhn/rhnLockfile.pyR C s !c C s: t i | i ƒ t i | i t i ƒ t i | i ƒ d S( N( R t unlinkR
R R R t LOCK_UNt close( R ( ( s3 /usr/lib/python2.6/site-packages/rhn/rhnLockfile.pyt releaseT s N( R R R t NoneR R R* ( ( ( s3 /usr/lib/python2.6/site-packages/rhn/rhnLockfile.pyR s c C s y t d ƒ } Wn6 t j
o* } t i i d | ƒ t i d ƒ n4 Xd GHd GHd d k } | i d ƒ | i ƒ d GHd S( s test codes
./test.pids %s
iÿÿÿÿs lock acquired s ...sleeping for 10 secondsNi
s lock released ( R R t syst stderrR% t exitt timet sleepR* ( t LR R/ ( ( s3 /usr/lib/python2.6/site-packages/rhn/rhnLockfile.pyt main[ s
t __main__i ( ( R R, R R R R t ExceptionR R R2 R R. ( ( ( s3 /usr/lib/python2.6/site-packages/rhn/rhnLockfile.pyt
s A