Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  pidfd_getfd.rs

  Sprache: Rust
 

//! The [`pidfd_getfd`] function and supporting types.

#![allow(unsafe_code)]
use crate::fd::OwnedFd;
use crate::{backend, io};
use backend::fd::{AsFd, RawFd};

/// Raw file descriptor in another process.
///
/// A distinct type alias is used here to inform the user that normal file
/// descriptors from the calling process should not be used. The provided file
/// descriptor is used by the kernel as the index into the file descriptor
/// table of an entirely different process.
pub type ForeignRawFd = RawFd;

bitflags::bitflags! {
    /// All flags are reserved for future use.
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
    pub struct PidfdGetfdFlags: backend::c::c_uint {
        /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
        const _ = !0;
    }
}

/// `syscall(SYS_pidfd_getfd, pidfd, flags)`—Obtain a duplicate of another
/// process' file descriptor.
///
/// # References
///  - [Linux]
///
/// # Warning
///
/// This function is generally safe for the calling process, but it can impact
/// the target process in unexpected ways. If you want to ensure that Rust I/O
/// safety assumptions continue to hold in the target process, then the target
/// process must have communicated the file description number to the calling
/// process from a value of a type that implements `AsRawFd`, and the target
/// process must not drop that value until after the calling process has
/// returned from `pidfd_getfd`.
///
/// When `pidfd_getfd` is used to debug the target, or the target is not a Rust
/// application, or `pidfd_getfd` is used in any other way, then extra care
/// should be taken to avoid unexpected behaviour or crashes.
///
/// For further details, see the references above.
///
/// [Linux]: https://man7.org/linux/man-pages/man2/pidfd_getfd.2.html
#[inline]
pub fn pidfd_getfd<Fd: AsFd>(
    pidfd: Fd,
    targetfd: ForeignRawFd,
    flags: PidfdGetfdFlags,
) -> io::Result<OwnedFd> {
    backend::process::syscalls::pidfd_getfd(pidfd.as_fd(), targetfd, flags)
}

Messung V0.5 in Prozent
C=87 H=98 G=92

¤ Dauer der Verarbeitung: 0.23 Sekunden  (vorverarbeitet am  2026-06-23) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik