An error returned by a Linx.Mount operation.
Built from a failed mount(2) / umount2(2) / pivot_root(2)
call against the kernel. The shape:
:path— the absolute filesystem path the operation targeted (thetargetargument ofmount/4, thetargetofumount/2, etc.).:operation— what we were trying to do, as an atom::mount,:umount,:pivot_root— the target syscall itself failed.:open_ns— couldn't open the target namespace file (target process is gone, BEAM lacks read access).:unshare— couldn't detach the worker thread'sfs_structfrom the BEAM's. Prerequisite forsetnson a mount namespace; extremely unlikely to fail.:setns— couldn't enter the target namespace (lacksCAP_SYS_ADMINin the right user namespace).:chdir— couldn'tchdirintonew_rootbeforepivot_root. Typically the path doesn't exist or isn't a directory.:thread— couldn't create the worker thread that does the cross-namespace dance. Rare; typicallyEAGAINfrom thread-creation pressure. The last three only appear when a cross-namespace:inoption was used.
:errno— the POSIX errno as an atom (:enoent,:eacces,:ebusy,:einval,:eperm, …).:code— the matching positive errno integer, ornilif we don't have a mapping for this atom. Included for symmetry withLinx.Cgroup.Error/Linx.Netlink.Errorand for callers unfamiliar with POSIX mnemonics.
Pattern-match on :errno and :operation to handle specific
failures:
case Linx.Mount.mount("tmpfs", "/mnt/x", "tmpfs") do
:ok -> :ok
{:error, %Linx.Mount.Error{errno: :eacces}} ->
# not enough privilege
:no_perm
endImplements Exception, so an error can be raised or rendered
with Exception.message/1.
Summary
Functions
Builds a %Linx.Mount.Error{} from a posix-atom errno, the
filesystem path that failed, and the operation we attempted.
Types
@type operation() ::
:mount
| :umount
| :pivot_root
| :open_ns
| :unshare
| :setns
| :chdir
| :thread
@type t() :: %Linx.Mount.Error{ __exception__: true, code: pos_integer() | nil, errno: atom(), operation: operation(), path: Path.t() }