Struct procfs::sys::fs::binfmt_misc::BinFmtFlags
source · pub struct BinFmtFlags { /* private fields */ }
Expand description
Various key flags
Implementations§
source§impl BinFmtFlags
impl BinFmtFlags
sourcepub const P: Self = _
pub const P: Self = _
Preserve Argv[0]
Legacy behavior of binfmt_misc is to overwrite the original argv[0] with the full path to the binary. When
this flag is included, binfmt_misc will add an argument to the argument vector for this purpose, thus
preserving the original argv[0]
.
For example, If your interp is set to /bin/foo
and you run blah
(which is in /usr/local/bin
),
then the kernel will execute /bin/foo
with argv[]
set to ["/bin/foo", "/usr/local/bin/blah", "blah"]
.
The interp has to be aware of this so it can execute /usr/local/bin/blah
with argv[]
set to ["blah"]
.
sourcepub const O: Self = _
pub const O: Self = _
Open Binary
Legacy behavior of binfmt_misc is to pass the full path of the binary to the interpreter as an argument. When this flag is included, binfmt_misc will open the file for reading and pass its descriptor as an argument, instead of the full path, thus allowing the interpreter to execute non-readable binaries. This feature should be used with care - the interpreter has to be trusted not to
sourcepub const C: Self = _
pub const C: Self = _
Credentials
Currently, the behavior of binfmt_misc is to calculate
the credentials and security token of the new process according to
the interpreter. When this flag is included, these attributes are
calculated according to the binary. It also implies the O
flag.
This feature should be used with care as the interpreter
will run with root permissions when a setuid binary owned by root
is run with binfmt_misc.
sourcepub const F: Self = _
pub const F: Self = _
Fix binary
The usual behaviour of binfmt_misc is to spawn the
binary lazily when the misc format file is invoked. However,
this doesn’t work very well in the face of mount namespaces and
changeroots, so the F
mode opens the binary as soon as the
emulation is installed and uses the opened image to spawn the
emulator, meaning it is always available once installed,
regardless of how the environment changes.
sourcepub const fn from_bits(bits: u8) -> Option<Self>
pub const fn from_bits(bits: u8) -> Option<Self>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
sourcepub const fn from_bits_truncate(bits: u8) -> Self
pub const fn from_bits_truncate(bits: u8) -> Self
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
sourcepub const unsafe fn from_bits_unchecked(bits: u8) -> Self
pub const unsafe fn from_bits_unchecked(bits: u8) -> Self
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Safety
The caller of the bitflags!
macro can chose to allow or
disallow extra bits for their bitflags type.
The caller of from_bits_unchecked()
has to ensure that
all bits correspond to a defined flag or that extra bits
are valid for this bitflags type.
sourcepub const fn intersects(&self, other: Self) -> bool
pub const fn intersects(&self, other: Self) -> bool
Returns true
if there are flags common to both self
and other
.
sourcepub const fn contains(&self, other: Self) -> bool
pub const fn contains(&self, other: Self) -> bool
Returns true
if all of the flags in other
are contained within self
.
sourcepub fn set(&mut self, other: Self, value: bool)
pub fn set(&mut self, other: Self, value: bool)
Inserts or removes the specified flags depending on the passed value.
sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
Returns the intersection between the flags in self
and
other
.
Specifically, the returned set contains only the flags which are
present in both self
and other
.
This is equivalent to using the &
operator (e.g.
ops::BitAnd
), as in flags & other
.
sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
Returns the union of between the flags in self
and other
.
Specifically, the returned set contains all flags which are
present in either self
or other
, including any which are
present in both (see Self::symmetric_difference
if that
is undesirable).
This is equivalent to using the |
operator (e.g.
ops::BitOr
), as in flags | other
.
sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
Returns the difference between the flags in self
and other
.
Specifically, the returned set contains all flags present in
self
, except for the ones present in other
.
It is also conceptually equivalent to the “bit-clear” operation:
flags & !other
(and this syntax is also supported).
This is equivalent to using the -
operator (e.g.
ops::Sub
), as in flags - other
.
sourcepub const fn symmetric_difference(self, other: Self) -> Self
pub const fn symmetric_difference(self, other: Self) -> Self
Returns the symmetric difference between the flags
in self
and other
.
Specifically, the returned set contains the flags present which
are present in self
or other
, but that are not present in
both. Equivalently, it contains the flags present in exactly
one of the sets self
and other
.
This is equivalent to using the ^
operator (e.g.
ops::BitXor
), as in flags ^ other
.
sourcepub const fn complement(self) -> Self
pub const fn complement(self) -> Self
Returns the complement of this set of flags.
Specifically, the returned set contains all the flags which are
not set in self
, but which are allowed for this type.
Alternatively, it can be thought of as the set difference
between Self::all()
and self
(e.g. Self::all() - self
)
This is equivalent to using the !
operator (e.g.
ops::Not
), as in !flags
.
Trait Implementations§
source§impl Binary for BinFmtFlags
impl Binary for BinFmtFlags
source§impl BitAnd<BinFmtFlags> for BinFmtFlags
impl BitAnd<BinFmtFlags> for BinFmtFlags
source§impl BitAndAssign<BinFmtFlags> for BinFmtFlags
impl BitAndAssign<BinFmtFlags> for BinFmtFlags
source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
Disables all flags disabled in the set.
source§impl BitOr<BinFmtFlags> for BinFmtFlags
impl BitOr<BinFmtFlags> for BinFmtFlags
source§fn bitor(self, other: BinFmtFlags) -> Self
fn bitor(self, other: BinFmtFlags) -> Self
Returns the union of the two sets of flags.
§type Output = BinFmtFlags
type Output = BinFmtFlags
|
operator.source§impl BitOrAssign<BinFmtFlags> for BinFmtFlags
impl BitOrAssign<BinFmtFlags> for BinFmtFlags
source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Adds the set of flags.
source§impl BitXor<BinFmtFlags> for BinFmtFlags
impl BitXor<BinFmtFlags> for BinFmtFlags
source§impl BitXorAssign<BinFmtFlags> for BinFmtFlags
impl BitXorAssign<BinFmtFlags> for BinFmtFlags
source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
Toggles the set of flags.
source§impl Clone for BinFmtFlags
impl Clone for BinFmtFlags
source§fn clone(&self) -> BinFmtFlags
fn clone(&self) -> BinFmtFlags
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BinFmtFlags
impl Debug for BinFmtFlags
source§impl Extend<BinFmtFlags> for BinFmtFlags
impl Extend<BinFmtFlags> for BinFmtFlags
source§fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl FromIterator<BinFmtFlags> for BinFmtFlags
impl FromIterator<BinFmtFlags> for BinFmtFlags
source§fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
source§impl Hash for BinFmtFlags
impl Hash for BinFmtFlags
source§impl LowerHex for BinFmtFlags
impl LowerHex for BinFmtFlags
source§impl Not for BinFmtFlags
impl Not for BinFmtFlags
source§impl Octal for BinFmtFlags
impl Octal for BinFmtFlags
source§impl Ord for BinFmtFlags
impl Ord for BinFmtFlags
source§fn cmp(&self, other: &BinFmtFlags) -> Ordering
fn cmp(&self, other: &BinFmtFlags) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<BinFmtFlags> for BinFmtFlags
impl PartialEq<BinFmtFlags> for BinFmtFlags
source§fn eq(&self, other: &BinFmtFlags) -> bool
fn eq(&self, other: &BinFmtFlags) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<BinFmtFlags> for BinFmtFlags
impl PartialOrd<BinFmtFlags> for BinFmtFlags
source§fn partial_cmp(&self, other: &BinFmtFlags) -> Option<Ordering>
fn partial_cmp(&self, other: &BinFmtFlags) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Sub<BinFmtFlags> for BinFmtFlags
impl Sub<BinFmtFlags> for BinFmtFlags
source§impl SubAssign<BinFmtFlags> for BinFmtFlags
impl SubAssign<BinFmtFlags> for BinFmtFlags
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Disables all flags enabled in the set.