Print this page
6474 event ports are broken with FIFOs
@@ -1124,10 +1124,25 @@
return ((VTOF(vp)->fn_flag & FIFOFAST) ?
fifo_fastioctl(vp, cmd, arg, mode, cr, rvalp) :
fifo_strioctl(vp, cmd, arg, mode, cr, rvalp));
}
+static inline int
+fifo_ioctl_getpeercred(fifonode_t *fnp, intptr_t arg, int mode)
+{
+ k_peercred_t *kp = (k_peercred_t *)arg;
+
+ if (mode == FKIOCTL && fnp->fn_pcredp != NULL) {
+ crhold(fnp->fn_pcredp);
+ kp->pc_cr = fnp->fn_pcredp;
+ kp->pc_cpid = fnp->fn_cpid;
+ return (0);
+ } else {
+ return (ENOTSUP);
+ }
+}
+
static int
fifo_fastioctl(vnode_t *vp, int cmd, intptr_t arg, int mode,
cred_t *cr, int *rvalp)
{
fifonode_t *fnp = VTOF(vp);
@@ -1343,10 +1358,14 @@
case I_FLUSHBAND:
error = 0;
*rvalp = 0;
break;
+ case _I_GETPEERCRED:
+ error = fifo_ioctl_getpeercred(fnp, arg, mode);
+ break;
+
/*
* invalid calls for stream head or fifos
*/
case I_POP: /* shouldn't happen */
@@ -1390,21 +1409,12 @@
{
fifonode_t *fnp = VTOF(vp);
int error;
fifolock_t *fn_lock;
- if (cmd == _I_GETPEERCRED) {
- if (mode == FKIOCTL && fnp->fn_pcredp != NULL) {
- k_peercred_t *kp = (k_peercred_t *)arg;
- crhold(fnp->fn_pcredp);
- kp->pc_cr = fnp->fn_pcredp;
- kp->pc_cpid = fnp->fn_cpid;
- return (0);
- } else {
- return (ENOTSUP);
- }
- }
+ if (cmd == _I_GETPEERCRED)
+ return (fifo_ioctl_getpeercred(fnp, arg, mode));
error = strioctl(vp, cmd, arg, mode, U_TO_K, cr, rvalp);
switch (cmd) {
/*