HEX
Server: Apache
System: Linux hp3-stn-1011028.hostingp3.local 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: csh958633 (951153)
PHP: 8.3.30
Disabled: shell_exec,exec,system,popen,set_time_limit
Upload Files
File: //lib/python2.7/site-packages/rhn/rhnLockfile.pyo
�
�+Xc@s�ddlZddlZddlZddlmZmZddlmZddlZdefd��YZ	ddd��YZ
d�Zed	kr�ej
e�p�d
�ndS(i����N(tEWOULDBLOCKtEEXIST(tbstrtLockfileLockedExceptioncBseZdZRS(s$thrown ONLY when pid file is locked.(t__name__t
__module__t__doc__(((s3/usr/lib/python2.7/site-packages/rhn/rhnLockfile.pyRstLockfilecBs,eZdZdd�Zd�Zd�ZRS(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.
    cCstjjtjjtjj|���|_||_|jsQtj�|_ntjj|j�}tjj	|�s�ytj
|�Wq�tk
r�tj
�d}t|d�r�|jtkr�q��q�Xntj|jtjtjBtjB�|_|j�dS(slcreate (if need be), and acquire lock on lockfile

        lockfile example: '/var/run/up2date.pid'
        iterrnoN(tostpathtabspatht
expandusert
expandvarstlockfiletpidtgetpidtdirnametexiststmakedirstOSErrortsystexc_infothasattrRRtopentO_RDWRtO_CREATtO_SYNCtftacquire(tselfRRRte((s3/usr/lib/python2.7/site-packages/rhn/rhnLockfile.pyt__init__$s"				

)cCs�y!tj|jtjtjB�WnStk
rvtj�djt	krpt
d|jdtj�d��qw�nXtj|jtj
d�tj|jd�tj|jtt|j�d��dS(s5acquire the lock; else raise LockfileLockedException.iscannot acquire lock on %s.iis
N(tfcntltflockRtLOCK_EXtLOCK_NBtIOErrorRRRRRRtNonetF_SETFDR	t	ftruncatetwriteRtstrR(R((s3/usr/lib/python2.7/site-packages/rhn/rhnLockfile.pyREs!
#cCs:tj|j�tj|jtj�tj|j�dS(N(R	tunlinkRR!R"RtLOCK_UNtclose(R((s3/usr/lib/python2.7/site-packages/rhn/rhnLockfile.pytreleaseVsN(RRRR&R RR.(((s3/usr/lib/python2.7/site-packages/rhn/rhnLockfile.pyRs!	cCs�ytd�}Wn<tk
rNtjjdtj�d�tjd�n3XdGHdGHddl}|jd�|j	�d	GHdS(
s	test codes
./test.pids%s
ii����slock acquired s...sleeping for 10 secondsNi
slock released (
RRRtstderrR)RtexitttimetsleepR.(tLR1((s3/usr/lib/python2.7/site-packages/rhn/rhnLockfile.pytmain]s


t__main__i((R	RR!RRRtrhn.i18nRt	ExceptionRRR4RR0(((s3/usr/lib/python2.7/site-packages/rhn/rhnLockfile.pyt<module>sB