Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
sys/kern/kern_descrip.c | ||
---|---|---|
917 | fp may be shared among multiple FDs. Why is it safe to mutate the file handle this way, without any synchronization? |
sys/kern/kern_descrip.c | ||
---|---|---|
917 | I do not see why it is unsafe, to begin with. I change the fileops. If any thread is already in the previous method, nothing is changed for it. |
sys/kern/kern_descrip.c | ||
---|---|---|
917 | It might be indeed unsafe for tmpfs. Then either I can keep f_data, or perhaps better, implement the dup-like behavior. |
sys/kern/kern_descrip.c | ||
---|---|---|
918 | oh, the type is already right; sorry. |
For posterity: @kib noted that we can probably accomplish the same with openat(fd, "", O_EMPTY_PATH | O_PATH);, which seems to work in my testing (also, just re-opening my tty fd with O_EMPTY_PATH | O_RDONLY seems to work as well) -- so we probably don't need this with that kind of flexibility already functional today.
Should dup3() also permit O_PATH? There, I believe it should behave like F_DUP_OPATH but also allows the caller to choose the target fd.
This is missing a man page entry and ideally some simple tests in tests/sys/file/path_test.c.
sys/kern/kern_descrip.c | ||
---|---|---|
916 | Should we do anything special if the fp is already an O_PATH file? | |
923 | In openflags() we clear the mode flags for O_PATH files, but here we are preserving FREAD and FWRITE, which is inconsistent. |
I do not thin that dup3 flag is very useful. Also dup3 is implemented in a way that makes adding flags a pain.
Instead I propose to add a simple recipe how to convert any fd to O_PATH-like, see D50519. From there, dup3 can put it into desired index.
sys/kern/kern_descrip.c | ||
---|---|---|
916 | I do not think so. At least, I do not see what useful could we do differently. |