Add memfd-related scml

This commit is contained in:
Wang Siyuan 2025-11-28 09:33:16 +00:00 committed by Tate, Hongliang Tian
parent 9aa36231dd
commit 1207f170a6
4 changed files with 38 additions and 3 deletions

View File

@ -338,7 +338,7 @@ which are summarized in the table below.
| 315 | sched_getattr | ✅ | [⚠️](syscall-flag-coverage/process-and-thread-management/#sched_getattr-and-sched_setattr) | | 315 | sched_getattr | ✅ | [⚠️](syscall-flag-coverage/process-and-thread-management/#sched_getattr-and-sched_setattr) |
| 316 | renameat2 | ✅ | [⚠️](syscall-flag-coverage/file-and-directory-operations/#renameat2) | | 316 | renameat2 | ✅ | [⚠️](syscall-flag-coverage/file-and-directory-operations/#renameat2) |
| 318 | getrandom | ✅ | [⚠️](syscall-flag-coverage/system-information-and-misc/#getrandom) | | 318 | getrandom | ✅ | [⚠️](syscall-flag-coverage/system-information-and-misc/#getrandom) |
| 319 | memfd_create | ✅ | | | 319 | memfd_create | ✅ | [⚠️](syscall-flag-coverage/file-descriptor-and-io-control/#memfd_create) |
| 322 | execveat | ✅ | ❓ | | 322 | execveat | ✅ | ❓ |
| 327 | preadv2 | ✅ | [⚠️](syscall-flag-coverage/file-and-directory-operations/#preadv2-and-pwritev2) | | 327 | preadv2 | ✅ | [⚠️](syscall-flag-coverage/file-and-directory-operations/#preadv2-and-pwritev2) |
| 328 | pwritev2 | ✅ | [⚠️](syscall-flag-coverage/file-and-directory-operations/#preadv2-and-pwritev2) | | 328 | pwritev2 | ✅ | [⚠️](syscall-flag-coverage/file-and-directory-operations/#preadv2-and-pwritev2) |

View File

@ -3,7 +3,7 @@
<!-- <!--
Put system calls such as Put system calls such as
dup, dup2, dup3, fcntl, ioctl, pipe, pipe2, splice, tee, vmsplice, sendfile, dup, dup2, dup3, fcntl, ioctl, pipe, pipe2, splice, tee, vmsplice, sendfile,
eventfd, and eventfd2 eventfd, eventfd2 and memfd_create
under this category. under this category.
--> -->
@ -22,7 +22,6 @@ Unsupported commands:
* `F_GETSIG` and `F_SETSIG` * `F_GETSIG` and `F_SETSIG`
* `F_SETLEASE` and `F_GETLEASE` * `F_SETLEASE` and `F_GETLEASE`
* `F_SETPIPE_SZ` and `F_GETPIPE_SZ` * `F_SETPIPE_SZ` and `F_GETPIPE_SZ`
* `F_ADD_SEALS` and `F_GET_SEALS`
* `F_GET_RW_HINT` and `F_SET_RW_HINT` * `F_GET_RW_HINT` and `F_SET_RW_HINT`
* `F_GET_FILE_RW_HINT` and `F_SET_FILE_RW_HINT` * `F_GET_FILE_RW_HINT` and `F_SET_FILE_RW_HINT`
@ -58,3 +57,31 @@ Silently-ignored flags:
For more information, For more information,
see [the man page](https://man7.org/linux/man-pages/man2/eventfd.2.html). see [the man page](https://man7.org/linux/man-pages/man2/eventfd.2.html).
### `memfd_create`
Supported functionality in SCML:
```c
{{#include memfd_create.scml}}
```
Silently-ignored flags:
* `MFD_HUGETLB`
Unsupported flags:
* `MFD_HUGE_64KB`
* `MFD_HUGE_512KB`
* `MFD_HUGE_1MB`
* `MFD_HUGE_2MB`
* `MFD_HUGE_8MB`
* `MFD_HUGE_16MB`
* `MFD_HUGE_32MB`
* `MFD_HUGE_256MB`
* `MFD_HUGE_512MB`
* `MFD_HUGE_1GB`
* `MFD_HUGE_2GB`
* `MFD_HUGE_16GB`
For more information,
see [the man page](https://man7.org/linux/man-pages/man2/memfd_create.2.html).

View File

@ -19,3 +19,9 @@ fcntl(fd, cmd = F_GETLK | F_SETLK | F_SETLKW, arg);
// Assign SIGIO/SIGURG owner process // Assign SIGIO/SIGURG owner process
fcntl(fd, cmd = F_SETOWN, arg); fcntl(fd, cmd = F_SETOWN, arg);
// Add seals to the inode referred to
fcntl(fd, cmd = F_ADD_SEALS, arg = F_SEAL_SEAL | F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_WRITE | F_SEAL_FUTURE_WRITE);
// Get seals from the inode referred to
fcntl(fd, cmd = F_GET_SEALS);

View File

@ -0,0 +1,2 @@
// Create an anonymous file and return a file descriptor that refers to it
memfd_create(name, flags = MFD_CLOEXEC | MFD_ALLOW_SEALING);