Page MenuHomeFreeBSD

D58403.diff
No OneTemporary

D58403.diff

diff --git a/lib/libsys/pdfork.2 b/lib/libsys/pdfork.2
--- a/lib/libsys/pdfork.2
+++ b/lib/libsys/pdfork.2
@@ -195,6 +195,8 @@
The
.Fa flags
argument is reserved and must be zero.
+Certain file descriptor types cannot be copied this way, namely
+kqueues.
.Pp
The following system calls also have effects specific to process descriptors:
.Pp
@@ -350,6 +352,10 @@
is not a valid file descriptor in the specified process.
.It Bq Er ENOENT
The specified process does not have a file descriptor table.
+.It Bq Er EOPNOTSUPP
+.Fa remotefd
+refers to a file that cannot be duplicated across a process boundary,
+such as a kqueue.
.El
.Sh SEE ALSO
.Xr close 2 ,
diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c
--- a/sys/kern/sys_procdesc.c
+++ b/sys/kern/sys_procdesc.c
@@ -796,9 +796,13 @@
PROC_UNLOCK(p);
error = fget_remote(td, p, fd, &fcaps, &fd_flags, &fp);
if (error == 0) {
- error = finstall_refed(td, fp, &fdr, O_CLOEXEC |
- ((fd_flags & FD_RESOLVE_BENEATH) != 0 ?
- O_RESOLVE_BENEATH : 0), &fcaps);
+ if ((fp->f_ops->fo_flags & DFLAG_PASSABLE) == 0) {
+ error = EOPNOTSUPP;
+ } else {
+ error = finstall_refed(td, fp, &fdr, O_CLOEXEC |
+ ((fd_flags & FD_RESOLVE_BENEATH) != 0 ?
+ O_RESOLVE_BENEATH : 0), &fcaps);
+ }
if (error != 0) {
fdrop(fp, td);
filecaps_free(&fcaps);

File Metadata

Mime Type
text/plain
Expires
Mon, Sep 14, 5:29 AM (16 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38851620
Default Alt Text
D58403.diff (1 KB)

Event Timeline