read or write the child sub-reaper flag of the current process

        This property behaves in the following manner:

        * If a read is attempted and a prior read or write has determined that
          this feature is unavailable (status is equal to ``SR_UNSUPPORTED``)
          then no further attempts are made and the outcome is ``False``.
        * If a read is attempted and the current status is ``SR_UNKNOWN`` then
          a ``prctl(PR_GET_CHILD_SUBREAPER, ...)`` call is made and the outcome
          depends on the returned value. If prctl fails then status is set to
          ``SR_UNSUPPORTED`` and the return value is ``False``. If the prctl
          call succeeds then status is set to either ``SR_ENABLED`` or
          ``SR_DISABLED`` and ``True`` or ``False`` is returned, respectively.
         * If a write is attempted and a prior read or write has determined
           that this feature is unavailable (status is equal to
           ``SR_UNSUPPORTED``) *and* the write would have enabled the flag, a
           ValueError is raised with an appropriate message. Otherwise a write
           is attempted. If the attempt to enable the flag fails a ValueError
           is raised, just as in the previous case.
         * If a write intending to disable the flag fails then this failure is
           silently ignored but status is set to ``SR_UNSUPPORTED``.
         * If a write succeeds then the status is set accordingly to
           ``SR_ENABLED`` or ``SR_DISABLED``, depending on the value written
           ``True`` or ``False`` respectively.

        In other words, this property behaves as if it was really calling
        prctl() but it is not going to repeat operations that will always fail.
        Nor will it ignore failures silently where that matters.

def enabled(self):
        """
        read or write the child sub-reaper flag of the current process

        This property behaves in the following manner:

        * If a read is attempted and a prior read or write has determined that
          this feature is unavailable (status is equal to ``SR_UNSUPPORTED``)
          then no further attempts are made and the outcome is ``False``.
        * If a read is attempted and the current status is ``SR_UNKNOWN`` then
          a ``prctl(PR_GET_CHILD_SUBREAPER, ...)`` call is made and the outcome
          depends on the returned value. If prctl fails then status is set to
          ``SR_UNSUPPORTED`` and the return value is ``False``. If the prctl
          call succeeds then status is set to either ``SR_ENABLED`` or
          ``SR_DISABLED`` and ``True`` or ``False`` is returned, respectively.
         * If a write is attempted and a prior read or write has determined
           that this feature is unavailable (status is equal to
           ``SR_UNSUPPORTED``) *and* the write would have enabled the flag, a
           ValueError is raised with an appropriate message. Otherwise a write
           is attempted. If the attempt to enable the flag fails a ValueError
           is raised, just as in the previous case.
         * If a write intending to disable the flag fails then this failure is
           silently ignored but status is set to ``SR_UNSUPPORTED``.
         * If a write succeeds then the status is set accordingly to
           ``SR_ENABLED`` or ``SR_DISABLED``, depending on the value written
           ``True`` or ``False`` respectively.

        In other words, this property behaves as if it was really calling
        prctl() but it is not going to repeat operations that will always fail.
        Nor will it ignore failures silently where that matters.
        """
        if self._status == self.SR_UNSUPPORTED:
            return False
        status = c_int()
        try:
            prctl(PR_GET_CHILD_SUBREAPER, addressof(status), 0, 0, 0)
        except OSError:
            self._status = self.SR_UNSUPPORTED
        else:
            self._status = self.SR_ENABLED if status else self.SR_DISABLED
            return self._status == self.SR_ENABLED