-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File control: fcntl raw and higher-level support. #44
base: main
Are you sure you want to change the base?
Conversation
In light of the.... poorly imagined aspects of POSIX |
Sources/System/FileControlRaw.swift
Outdated
/// | ||
/// The corresponding C constant is `F_FULLFSYNC`. | ||
@_alwaysEmitIntoClient | ||
public static var fullFsync: Command { Command(F_FULLFSYNC) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are we going to call fsync(2)
? I think I'd suggest FileDescriptor.sync
or synchronize
. We should use the same name here.
Sources/System/FileControlRaw.swift
Outdated
@_alwaysEmitIntoClient | ||
public static var append: StatusFlags { StatusFlags(O_APPEND) } | ||
|
||
/// Enable the SIGIO signal to be sent to the process |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does anybody still use this? Do we really want to offer it?
4c5e883
to
e8eb2ed
Compare
Rebased on top of #111 and closer to being merge-worthy. Needs some simple tests, some differences between Linux and Darwin dissected, and version annotations. |
Also, we need to probably figure out some kind of |
@swift-ci please test |
Early draft of API doc: https://gist.github.com/milseman/2e59c10299f04c682c4090c4d2ecc0e0 |
Add in support for fcntl and all the raw commands and flags it supports. Add in Swiftier representations of common and important invocations.
System Sketch
New design patterns:
FileDescriptor.fcntl()
andFileDescriptor.Command
interfaces and wrappers.FileDescriptor.FileLock
is our first RR wrapper of a real C struct.Externals:
flock
to coordinate design withget/setLock()
.fsync
to coordinate design withF_FULLFSYNC
etc.Unknowns:
Errno.resourceTemporarilyUnavailable
too removed fromEAGAIN
? Should we introduceErrno.again
alias?Testing needs: