module public import VmMemory.FunsExternal @[expose] public section open Aeneas Aeneas.Std Result /-! Flag constants for `memfd_create(2)` and the `fcntl(2)` seal commands, and the `ftruncate(2)` contract. The system calls themselves are modeled in `VmMemory/FunsExternal.lean` by opaque return values. -/ namespace Syscalls.Memfd /-- Set the close-on-exec flag on the new descriptor (`0x0001`). -/ abbrev MFD_CLOEXEC : U32 := 0x0001#u32 /-- Allow seals to be added to the file (`0x0002`). -/ abbrev MFD_ALLOW_SEALING : U32 := 0x0002#u32 /-- Make the file non-executable and seal its mode (`0x0008`). -/ abbrev MFD_NOEXEC_SEAL : U32 := 0x0008#u32 /-- `fcntl` command to add file seals (`F_LINUX_SPECIFIC_BASE + 9`). -/ abbrev F_ADD_SEALS : I32 := 1033#i32 /-- Seal preventing further seals (`0x0001`). -/ abbrev F_SEAL_SEAL : I32 := 0x0001#i32 /-- Seal preventing the file from shrinking (`0x0002`). -/ abbrev F_SEAL_SHRINK : I32 := 0x0002#i32 /-- Seal preventing the file from growing (`0x0004`). -/ abbrev F_SEAL_GROW : I32 := 0x0004#i32 /-- Invalid argument (`EINVAL`). -/ abbrev EINVAL : I32 := 22#i32 /-- System-level specification of `ftruncate64(2)`: a negative length fails with `EINVAL`, so every successful (non-negative) return comes with a non-negative length. -/ def FtruncateSpec : Prop := ∀ fd length, 0 ≤ (_root_.libc_1.unix.linux_like.ftruncate64_status fd length).val → 0 ≤ length.val end Syscalls.Memfd