Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177796723
D58666.1795308687.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D58666.1795308687.diff
View Options
diff --git a/lib/libsys/pdfork.2 b/lib/libsys/pdfork.2
--- a/lib/libsys/pdfork.2
+++ b/lib/libsys/pdfork.2
@@ -391,16 +391,16 @@
The
.Fa flags
argument is not zero.
+.It Bq Er EINVAL
+The file descriptor
+.Fa fd
+is not a process file descriptor.
.It Bq Er ESRCH
The process specified by the file descriptor
.Fa fd
exited.
.It Bq Er EBADF
The file descriptor
-.Fa fd
-is not a process file descriptor.
-.It Bq Er EBADF
-The file descriptor
.Fa remotefd
is not a valid file descriptor in the specified process.
.It Bq Er ENOENT
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1563,7 +1563,8 @@
if (error != 0)
return (error);
- error = fget_procdesc(td, fd, &cap_pdwait_rights, &fp, &pd, NULL);
+ error = fget_procdesc(td, fd, &cap_pdwait_rights, EINVAL, &fp,
+ &pd, NULL);
if (error != 0)
goto exit_unlocked;
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1965,7 +1965,8 @@
return (EINVAL);
sx_slock(&proctree_lock);
- error = fget_procdesc(td, uap->fd, &cap_pdkill_rights, &fp, NULL, &p);
+ error = fget_procdesc(td, uap->fd, &cap_pdkill_rights, EBADF, &fp,
+ NULL, &p);
sx_sunlock(&proctree_lock);
if (error != 0)
goto out;
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
@@ -142,7 +142,7 @@
struct file *fp;
int error;
- error = fget_procdesc(td, fd, rightsp, &fp, NULL, NULL);
+ error = fget_procdesc(td, fd, rightsp, EBADF, &fp, NULL, NULL);
if (error == 0)
*pidp = procdesc_pid(fp);
if (fp != NULL)
@@ -753,7 +753,8 @@
*/
int
fget_procdesc(struct thread *td, int pdfd, const cap_rights_t *cap_rights,
- struct file **pfp, struct procdesc **pdp, struct proc **pp)
+ int wrong_type_error, struct file **pfp, struct procdesc **pdp,
+ struct proc **pp)
{
struct file *fp;
struct procdesc *pd;
@@ -769,7 +770,7 @@
return (error);
*pfp = fp;
if (fp->f_type != DTYPE_PROCDESC)
- return (EINVAL);
+ return (wrong_type_error);
pd = fp->f_data;
if (pp != NULL) {
p = pd->pd_proc;
@@ -795,7 +796,8 @@
int error, fdr;
sx_slock(&proctree_lock);
- error = fget_procdesc(td, pdfd, &cap_pddupfd_rights, &pfp, NULL, &p);
+ error = fget_procdesc(td, pdfd, &cap_pddupfd_rights, EINVAL, &pfp,
+ NULL, &p);
if (error == 0) {
if ((p->p_flag & P_WEXIT) != 0) {
error = ESRCH;
diff --git a/sys/sys/procdesc.h b/sys/sys/procdesc.h
--- a/sys/sys/procdesc.h
+++ b/sys/sys/procdesc.h
@@ -122,8 +122,8 @@
int procdesc_falloc(struct thread *, struct file **, int *, int,
struct filecaps *);
int fget_procdesc(struct thread *td, int pfd,
- const cap_rights_t *cap_rights, struct file **pfp,
- struct procdesc **pdp, struct proc **pp);
+ const cap_rights_t *cap_rights, int wrong_type_error,
+ struct file **pfp, struct procdesc **pdp, struct proc **pp);
#else /* !_KERNEL */
#include <sys/cdefs.h>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 22, 12:51 AM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41898323
Default Alt Text
D58666.1795308687.diff (2 KB)
Attached To
Mode
D58666: pdkill(2), pdgetpid(2): return EBADF if the file type is not procdesc
Attached
Detach File
Event Timeline