| Server IP : 138.197.176.125 / Your IP : 216.73.217.54 Web Server : Apache/2.4.41 (Ubuntu) System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/lib/python3/dist-packages/twisted/python/__pycache__/ |
Upload File : |
U
W[ � @ s: d Z ddlmZmZ dgZddlmZ G dd� de�ZdS )z�
Integration with systemd.
Currently only the minimum APIs necessary for using systemd's socket activation
feature are supported.
� )�division�absolute_import� ListenFDs)�getpidc @ s2 e Zd ZdZdZdd� Zed
dd��Zdd � ZdS )r af
L{ListenFDs} provides access to file descriptors inherited from systemd.
Typically L{ListenFDs.fromEnvironment} should be used to construct a new
instance of L{ListenFDs}.
@cvar _START: File descriptors inherited from systemd are always
consecutively numbered, with a fixed lowest "starting" descriptor. This
gives the default starting descriptor. Since this must agree with the
value systemd is using, it typically should not be overridden.
@type _START: C{int}
@ivar _descriptors: A C{list} of C{int} giving the descriptors which were
inherited.
� c C s
|| _ dS )z
@param descriptors: The descriptors which will be returned from calls to
C{inheritedDescriptors}.
N)�_descriptors)�self�descriptors� r
�8/usr/lib/python3/dist-packages/twisted/python/systemd.py�__init__% s zListenFDs.__init__Nc C s� |dkrddl m} |dkr"| j}g }zt|d �}W n ttfk
rN Y nPX |t� kr�zt|d �}W n ttfk
r� Y nX t||| �}|d= |d= | |�S )a�
@param environ: A dictionary-like object to inspect to discover
inherited descriptors. By default, L{None}, indicating that the
real process environment should be inspected. The default is
suitable for typical usage.
@param start: An integer giving the lowest value of an inherited
descriptor systemd will give us. By default, L{None}, indicating
the known correct (that is, in agreement with systemd) value will be
used. The default is suitable for typical usage.
@return: A new instance of C{cls} which can be used to look up the
descriptors which have been inherited.
Nr )�environZ
LISTEN_PIDZ
LISTEN_FDS)�osr
�_START�int�KeyError�
ValueErrorr �range)�clsr
�startr �pid�countr
r
r �fromEnvironment- s"