From 6021aff4de78c5d249c95cdddd2a13d19f157a37 Mon Sep 17 00:00:00 2001 From: Michael Ilseman Date: Mon, 10 Oct 2022 10:30:17 -0600 Subject: [PATCH 1/2] Add platform support and syscall mapping docs --- Documentation/PlatformSupport.md | 69 ++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Documentation/PlatformSupport.md diff --git a/Documentation/PlatformSupport.md b/Documentation/PlatformSupport.md new file mode 100644 index 00000000..022f1e07 --- /dev/null +++ b/Documentation/PlatformSupport.md @@ -0,0 +1,69 @@ + +# Platform Support + +Darwin platforms are binary and source stable. Linux platforms follow semantic versioning. Windows follows semantic versioning. + +### Windows concerns + +Trying to perfectly unify Windows with Darwin and Linux at the API level is ultimately a futile endeavor. However, in some specific cases, Windows does have directly corresponding syscalls or near-equivalents. + +Windows-specific details are open to reevaluation pending more Windows expertise for the project. + + +## API to syscall mapping + +### `Errno` + +#### Instance computed properties + +| API | Darwin | Linux | Windows | +|:-------------------|:-----------|:-----------|:-----------| +| `description` | `strerror` | `strerror` | `strerror` | +| `debugDescription` | `strerror` | `strerror` | `strerror` | + + +### `FileDescriptor` + +#### Instance methods + +| API | Darwin | Linux | Windows | +|:-----------------------------|:------------|:------------|:---------------------------------------------------| +| `open` | `open` | `open` | `_wsopen_s(..., _SH_DENYNO, _S_IREAD | _S_IWRITE)` | +| `close` | `close` | `close` | `_close` | +| `seek` | `lseek` | `lseek` | `_lseeki64` | +| `read` | `read` | `read` | `_read` | +| `read(fromAbsoluteOffset:)` | `pread` | `pread` | *custom* | +| `write` | `write` | `write` | `_write` | +| `write(fromAbsoluteOffset:)` | `pwrite` | `pwrite` | *custom* | +| `duplicate` | `dup` | `dup` | `_dup` | +| `duplicate(as:)` | `dup2` | `dup2` | `_dup2` | +| `resize` | `ftruncate` | `ftruncate` | *N/A* | + + +#### Static methods + +| API | Darwin | Linux | Windows | +|:-------|:-------|:-------|:--------| +| `pipe` | `pipe` | `pipe` | *N/A* | + +
*Windows notes* + +Windows has custom implementations for reading from or writing to an absolute offset within a file. + +File resizing and pipes are not available on Windows at this point. + +
+ + +## **Types** + +**TODO** + +## **Values** + +**TODO** + + + + + From 9b446dcacf732eed070c6d76885f6d4556b24def Mon Sep 17 00:00:00 2001 From: Michael Ilseman Date: Mon, 10 Oct 2022 14:52:52 -0600 Subject: [PATCH 2/2] Update PlatformSupport.md --- Documentation/PlatformSupport.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/PlatformSupport.md b/Documentation/PlatformSupport.md index 022f1e07..f0ef0a85 100644 --- a/Documentation/PlatformSupport.md +++ b/Documentation/PlatformSupport.md @@ -28,7 +28,7 @@ Windows-specific details are open to reevaluation pending more Windows expertise | API | Darwin | Linux | Windows | |:-----------------------------|:------------|:------------|:---------------------------------------------------| -| `open` | `open` | `open` | `_wsopen_s(..., _SH_DENYNO, _S_IREAD | _S_IWRITE)` | +| `open` | `open` | `open` | `_wsopen_s(..., _SH_DENYNO, _S_IREAD \| _S_IWRITE)` | | `close` | `close` | `close` | `_close` | | `seek` | `lseek` | `lseek` | `_lseeki64` | | `read` | `read` | `read` | `_read` |