php IHDR w Q )Ba pHYs sRGB gAMA a IDATxMk\U s&uo,mD )Xw+e?tw.oWp;QHZnw`gaiJ9̟灙a=nl[ ʨ G;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ y H@E7j 1j+OFRg}ܫ;@Ea~ j`u'o> j- $_q?qS XzG'ay
files >> /usr/lib/mailman/Mailman/ |
files >> //usr/lib/mailman/Mailman/LockFile.pyc |
Pc @ s d Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k l Z l Z d Z d Z y e e f Wn e j o d Z d Z n Xe a d Z d e f d YZ d e f d YZ d e f d YZ d e f d YZ d f d YZ d Z d Z d Z d Z d Z e d j o3 d d k Z d d k Z e e e i d n d S( sI Portable, NFS-safe file locking with timeouts. This code implements an NFS-safe file-based locking algorithm influenced by the GNU/Linux open(2) manpage, under the description of the O_EXCL option. From RH6.1: [...] O_EXCL is broken on NFS file systems, programs which rely on it for performing locking tasks will contain a race condition. The solution for performing atomic file locking using a lockfile is to create a unique file on the same fs (e.g., incorporating hostname and pid), use link(2) to make a link to the lockfile. If link() returns 0, the lock is successful. Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful. The assumption made here is that there will be no `outside interference', e.g. no agent external to this code will have access to link() to the affected lock files. LockFile objects support lock-breaking so that you can't wedge a process forever. This is especially helpful in a web environment, but may not be appropriate for all applications. Locks have a `lifetime', which is the maximum length of time the process expects to retain the lock. It is important to pick a good number here because other processes will not break an existing lock until the expected lifetime has expired. Too long and other processes will hang; too short and you'll end up trampling on existing process locks -- and possibly corrupting data. In a distributed (NFS) environment, you also need to make sure that your clocks are properly synchronized. Locks can also log their state to a log file. When running under Mailman, the log file is placed in a Mailman-specific location, otherwise, the log file is called `LockFile.log' and placed in the temp directory (calculated from tempfile.mktemp()). iN( t ST_NLINKt ST_MTIMEi i i i c C s t d j o y d d k l } | d a Wq t j oc d d k } t i i | i d } t i i | d } d d d Y} | | a q Xn t S( Ni( t StampedLoggert locksi s LockFile.logt SimpleUserFilec B s e Z d Z d Z RS( c S s, t | d d | _ d t i | _ d S( Nt ai s (%d) ( t opent _SimpleUserFile__fpt ost getpidt _SimpleUserFile__prefix( t selft path( ( sY /builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt __init__c s c S s3 d t i } | i i | i | d | d S( Ns %.3ft ( t timeR t writeR ( R t msgt now( ( sY /builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyR f s ( t __name__t __module__R R ( ( ( sY /builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyR b s ( ( t _logfilet Nonet Mailman.Logging.StampedLoggerR t ImportErrort tempfileR R t splitt mktempt join( R R t dirR R ( ( sY /builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt _get_logfileV s t LockErrorc B s e Z d Z RS( s- Base class for all exceptions in this module.( R R t __doc__( ( ( sY /builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyR o s t AlreadyLockedErrorc B s e Z d Z RS( s4 An attempt is made to lock an already locked object.( R R R ( ( ( sY /builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyR! r s t NotLockedErrorc B s e Z d Z RS( s9 An attempt is made to unlock an object that isn't locked.( R R R ( ( ( sY /builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyR"