Skip to content

Commit 8d06ed0

Browse files
authored
Document why there is no path_filestat_set_size (#180)
* Document why there is no path_filestat_set_size * Address review feedback. * Rephrase the rationale
1 parent b827aa0 commit 8d06ed0

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

phases/ephemeral/docs.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,13 @@ The right to invoke `path_rename` with the file descriptor as the target directo
358358
The right to invoke `path_filestat_get`.
359359

360360
- <a href="#rights.path_filestat_set_size" name="rights.path_filestat_set_size"></a> `path_filestat_set_size`
361-
The right to change a file's size (there is no `path_filestat_set_size`).
361+
The right to change a file's size.
362362
If `path_open` is set, includes the right to invoke `path_open` with [`oflags::trunc`](#oflags.trunc).
363+
Note: there is no function named `path_filestat_set_size`. This follows POSIX design,
364+
which only has `ftruncate` and does not provide `ftruncateat`.
365+
While such function would be desirable from the API design perspective, there are virtually
366+
no use cases for it since no code written for POSIX systems would use it.
367+
Moreover, implementing it would require multiple syscalls, leading to inferior performance.
363368

364369
- <a href="#rights.path_filestat_set_times" name="rights.path_filestat_set_times"></a> `path_filestat_set_times`
365370
The right to invoke `path_filestat_set_times`.

phases/ephemeral/witx/typenames.witx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,13 @@
247247
$path_rename_target
248248
;;; The right to invoke `path_filestat_get`.
249249
$path_filestat_get
250-
;;; The right to change a file's size (there is no `path_filestat_set_size`).
250+
;;; The right to change a file's size.
251251
;;; If `path_open` is set, includes the right to invoke `path_open` with `oflags::trunc`.
252+
;;; Note: there is no function named `path_filestat_set_size`. This follows POSIX design,
253+
;;; which only has `ftruncate` and does not provide `ftruncateat`.
254+
;;; While such function would be desirable from the API design perspective, there are virtually
255+
;;; no use cases for it since no code written for POSIX systems would use it.
256+
;;; Moreover, implementing it would require multiple syscalls, leading to inferior performance.
252257
$path_filestat_set_size
253258
;;; The right to invoke `path_filestat_set_times`.
254259
$path_filestat_set_times

0 commit comments

Comments
 (0)