Add SCML for `flock` and `fallocate`

This commit is contained in:
Tao Su 2025-12-16 08:32:42 +00:00 committed by Tate, Hongliang Tian
parent dfe19e4f3c
commit 7c7dd47b9b
4 changed files with 27 additions and 2 deletions

View File

@ -93,7 +93,7 @@ which are summarized in the table below.
| 70 | msgrcv | ❌ | N/A |
| 71 | msgctl | ❌ | N/A |
| 72 | fcntl | ✅ | [⚠️](syscall-flag-coverage/file-descriptor-and-io-control/#fcntl) |
| 73 | flock | ✅ | |
| 73 | flock | ✅ | 💯 |
| 74 | fsync | ✅ | 💯 |
| 75 | fdatasync | ✅ | 💯 |
| 76 | truncate | ✅ | 💯 |
@ -305,7 +305,7 @@ which are summarized in the table below.
| 282 | signalfd | ✅ | 💯 |
| 283 | timerfd_create | ✅ | [⚠️](syscall-flag-coverage/signals-and-timers/#timerfd_create) |
| 284 | eventfd | ✅ | 💯 |
| 285 | fallocate | ✅ | |
| 285 | fallocate | ✅ | [⚠️](syscall-flag-coverage/file-and-directory-operations/#fallocate) |
| 286 | timerfd_settime | ✅ | [⚠️](syscall-flag-coverage/signals-and-timers/#timerfd_settime) |
| 287 | timerfd_gettime | ✅ | 💯 |
| 288 | accept4 | ✅ | [⚠️](syscall-flag-coverage/networking-and-sockets/#accept-and-accept4) |

View File

@ -140,3 +140,20 @@ Silently-ignored masks:
For more information,
see [the man page](https://man7.org/linux/man-pages/man2/statx.2.html).
### `fallocate`
Supported functionality in SCML:
```c
{{#include fallocate.scml}}
```
Unsupported modes:
* `FALLOC_FL_UNSHARE_RANGE`
* `FALLOC_FL_COLLAPSE_RANGE`
* `FALLOC_FL_ZERO_RANGE`
* `FALLOC_FL_INSERT_RANGE`
For more information,
see [the man page](https://man7.org/linux/man-pages/man2/fallocate.2.html).

View File

@ -0,0 +1,5 @@
// Allocate disk space within the range specified
fallocate(fd, mode = FALLOC_FL_KEEP_SIZE, offset, size);
// Deallocate space (create a hole) while keeping the file size unchanged
fallocate(fd, mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, offset, size);

View File

@ -118,3 +118,6 @@ fremovexattr(fd, name);
// Check user's permissions for a file
faccessat(dirfd, path, mode);
// Apply or remove an advisory lock on an open file
flock(fd, op = LOCK_SH | LOCK_EX | LOCK_UN | LOCK_NB);