extern structstd.c.freebsd.kinfo_file[src]

Fields

structsize: c_int

Size of this record. A zero value is for the sentinel record at the end of an array.

type: c_int

Descriptor type.

fd: fd_t

Array index.

ref_count: c_int

Reference count.

flags: c_int

Flags.

_pad0: c_int
offset: i64

Seek location.

un: extern union {
    socket: extern struct {
        /// Sendq size.
        sendq: u32,
        /// Socket domain.
        domain: c_int,
        /// Socket type.
        type: c_int,
        /// Socket protocol.
        protocol: c_int,
        /// Socket address.
        address: sockaddr.storage,
        /// Peer address.
        peer: sockaddr.storage,
        /// Address of so_pcb.
        pcb: u64,
        /// Address of inp_ppcb.
        inpcb: u64,
        /// Address of unp_conn.
        unpconn: u64,
        /// Send buffer state.
        snd_sb_state: u16,
        /// Receive buffer state.
        rcv_sb_state: u16,
        /// Recvq size.
        recvq: u32,
    },
    file: extern struct {
        /// Vnode type.
        type: i32,
        // Reserved for future use
        _spare1: [3]i32,
        _spare2: [30]u64,
        /// Vnode filesystem id.
        fsid: u64,
        /// File device.
        rdev: u64,
        /// Global file id.
        fileid: u64,
        /// File size.
        size: u64,
        /// fsid compat for FreeBSD 11.
        fsid_freebsd11: u32,
        /// rdev compat for FreeBSD 11.
        rdev_freebsd11: u32,
        /// File mode.
        mode: u16,
        // 64bit padding.
        _pad0: u16,
        _pad1: u32,
    },
    sem: extern struct {
        _spare0: [4]u32,
        _spare1: [32]u64,
        /// Semaphore value.
        value: u32,
        /// Semaphore mode.
        mode: u16,
    },
    pipe: extern struct {
        _spare1: [4]u32,
        _spare2: [32]u64,
        addr: u64,
        peer: u64,
        buffer_cnt: u32,
        // 64bit padding.
        kf_pipe_pad0: [3]u32,
    },
    proc: extern struct {
        _spare1: [4]u32,
        _spare2: [32]u64,
        pid: pid_t,
    },
    eventfd: extern struct {
        value: u64,
        flags: u32,
    },
}
status: u16

Status flags.

_pad1: u16
_spare: c_int
cap_rights: cap_rights

Capability rights.

_cap_spare: u64

Reserved for future cap_rights

path: [PATH_MAX - 1:0]u8

Path to file, if any.

Source Code

Source code
pub const kinfo_file = extern struct {
    /// Size of this record.
    /// A zero value is for the sentinel record at the end of an array.
    structsize: c_int,
    /// Descriptor type.
    type: c_int,
    /// Array index.
    fd: fd_t,
    /// Reference count.
    ref_count: c_int,
    /// Flags.
    flags: c_int,
    // 64bit padding.
    _pad0: c_int,
    /// Seek location.
    offset: i64,
    un: extern union {
        socket: extern struct {
            /// Sendq size.
            sendq: u32,
            /// Socket domain.
            domain: c_int,
            /// Socket type.
            type: c_int,
            /// Socket protocol.
            protocol: c_int,
            /// Socket address.
            address: sockaddr.storage,
            /// Peer address.
            peer: sockaddr.storage,
            /// Address of so_pcb.
            pcb: u64,
            /// Address of inp_ppcb.
            inpcb: u64,
            /// Address of unp_conn.
            unpconn: u64,
            /// Send buffer state.
            snd_sb_state: u16,
            /// Receive buffer state.
            rcv_sb_state: u16,
            /// Recvq size.
            recvq: u32,
        },
        file: extern struct {
            /// Vnode type.
            type: i32,
            // Reserved for future use
            _spare1: [3]i32,
            _spare2: [30]u64,
            /// Vnode filesystem id.
            fsid: u64,
            /// File device.
            rdev: u64,
            /// Global file id.
            fileid: u64,
            /// File size.
            size: u64,
            /// fsid compat for FreeBSD 11.
            fsid_freebsd11: u32,
            /// rdev compat for FreeBSD 11.
            rdev_freebsd11: u32,
            /// File mode.
            mode: u16,
            // 64bit padding.
            _pad0: u16,
            _pad1: u32,
        },
        sem: extern struct {
            _spare0: [4]u32,
            _spare1: [32]u64,
            /// Semaphore value.
            value: u32,
            /// Semaphore mode.
            mode: u16,
        },
        pipe: extern struct {
            _spare1: [4]u32,
            _spare2: [32]u64,
            addr: u64,
            peer: u64,
            buffer_cnt: u32,
            // 64bit padding.
            kf_pipe_pad0: [3]u32,
        },
        proc: extern struct {
            _spare1: [4]u32,
            _spare2: [32]u64,
            pid: pid_t,
        },
        eventfd: extern struct {
            value: u64,
            flags: u32,
        },
    },
    /// Status flags.
    status: u16,
    // 32-bit alignment padding.
    _pad1: u16,
    // Reserved for future use.
    _spare: c_int,
    /// Capability rights.
    cap_rights: cap_rights,
    /// Reserved for future cap_rights
    _cap_spare: u64,
    /// Path to file, if any.
    path: [PATH_MAX - 1:0]u8,

    comptime {
        assert(@sizeOf(@This()) == KINFO_FILE_SIZE);
        assert(@alignOf(@This()) == @sizeOf(u64));
    }
}