-
-
Notifications
You must be signed in to change notification settings - Fork 698
Implement __zipos_dup #972
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
Conversation
ed1579c
to
7b4a032
Compare
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.
Looking good so far. Thanks for the early glance.
90bed99
to
b961f4d
Compare
Makes ZiposHandle reference-counted by an `rc` field in a union with its freelist `next` pointer. The functions `__zipos_free` and `__zipos_keep` function as incref/decref for it. Adds `__zipos_postdup` to fix metadata on file descriptors after dup-like operations, and adds zipos support to `sys_dup_nt` + `sys_close_nt`.
rc is never a zipos file because it is always a previously unused file descriptor. fd is never a zipos file because that case has been handled above by __zipos_fcntl.
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.
Looks good to me. This is an impressive change. I cloned your branch locally and ran it on my test fleet of VMs (freebsd rhel7 xnu win10 openbsd netbsd pi silicon) using runit and runitd. I was amazed to see it all green.
I've contacted you about the copyright thing. Once that happens, I'll merge this.
Sadly the commit message fell out of sync with the actual changes, and I had a couple more changes in flight (implementing atomic reads and seeks even though POSIX says they don't exist because why not). What's the best approach - put the new changes on a new branch or force-push to main? |
It's probably too late to force push at this point. I'll make a mental note of it for the release notes. |
* Implement __zipos_dup Makes ZiposHandle reference-counted by an `rc` field in a union with its freelist `next` pointer. The functions `__zipos_free` and `__zipos_keep` function as incref/decref for it. Adds `__zipos_postdup` to fix metadata on file descriptors after dup-like operations, and adds zipos support to `sys_dup_nt` + `sys_close_nt`. * Remove noop __zipos_postdup rc is never a zipos file because it is always a previously unused file descriptor. fd is never a zipos file because that case has been handled above by __zipos_fcntl.
Makes ZiposHandle reference-counted by an
rc
field in a union with itsfreelist
next
pointer. The functions__zipos_free
and__zipos_keep
function as incref/decref for it. Adds
__zipos_postdup
to fix metadataon file descriptors after dup-like operations, and adds zipos support to
sys_dup_nt
+sys_close_nt
.