Print this page
6474 event ports are broken with FIFOs

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/fifofs/fifovnops.c
          +++ new/usr/src/uts/common/fs/fifofs/fifovnops.c
↓ open down ↓ 1118 lines elided ↑ open up ↑
1119 1119           * Just a quick check
1120 1120           * Once we go to streams mode we don't ever revert back
1121 1121           * So we do this quick check so as not to incur the overhead
1122 1122           * associated with acquiring the lock
1123 1123           */
1124 1124          return ((VTOF(vp)->fn_flag & FIFOFAST) ?
1125 1125              fifo_fastioctl(vp, cmd, arg, mode, cr, rvalp) :
1126 1126              fifo_strioctl(vp, cmd, arg, mode, cr, rvalp));
1127 1127  }
1128 1128  
     1129 +static inline int
     1130 +fifo_ioctl_getpeercred(fifonode_t *fnp, intptr_t arg, int mode)
     1131 +{
     1132 +        k_peercred_t *kp = (k_peercred_t *)arg;
     1133 +
     1134 +        if (mode == FKIOCTL && fnp->fn_pcredp != NULL) {
     1135 +                crhold(fnp->fn_pcredp);
     1136 +                kp->pc_cr = fnp->fn_pcredp;
     1137 +                kp->pc_cpid = fnp->fn_cpid;
     1138 +                return (0);
     1139 +        } else {
     1140 +                return (ENOTSUP);
     1141 +        }
     1142 +}
     1143 +
1129 1144  static int
1130 1145  fifo_fastioctl(vnode_t *vp, int cmd, intptr_t arg, int mode,
1131 1146          cred_t *cr, int *rvalp)
1132 1147  {
1133 1148          fifonode_t      *fnp            = VTOF(vp);
1134 1149          fifonode_t      *fn_dest;
1135 1150          int             error           = 0;
1136 1151          fifolock_t      *fn_lock        = fnp->fn_lock;
1137 1152          int             cnt;
1138 1153  
↓ open down ↓ 199 lines elided ↑ open up ↑
1338 1353  
1339 1354          /*
1340 1355           * Since no band data can ever get on a fifo in fast mode
1341 1356           * just return 0.
1342 1357           */
1343 1358          case I_FLUSHBAND:
1344 1359                  error = 0;
1345 1360                  *rvalp = 0;
1346 1361                  break;
1347 1362  
     1363 +        case _I_GETPEERCRED:
     1364 +                error = fifo_ioctl_getpeercred(fnp, arg, mode);
     1365 +                break;
     1366 +
1348 1367          /*
1349 1368           * invalid calls for stream head or fifos
1350 1369           */
1351 1370  
1352 1371          case I_POP:             /* shouldn't happen */
1353 1372          case I_LOOK:
1354 1373          case I_LINK:
1355 1374          case I_PLINK:
1356 1375          case I_UNLINK:
1357 1376          case I_PUNLINK:
↓ open down ↓ 27 lines elided ↑ open up ↑
1385 1404   * FIFO is in STREAMS mode; STREAMS framework does most of the work.
1386 1405   */
1387 1406  static int
1388 1407  fifo_strioctl(vnode_t *vp, int cmd, intptr_t arg, int mode,
1389 1408          cred_t *cr, int *rvalp)
1390 1409  {
1391 1410          fifonode_t      *fnp = VTOF(vp);
1392 1411          int             error;
1393 1412          fifolock_t      *fn_lock;
1394 1413  
1395      -        if (cmd == _I_GETPEERCRED) {
1396      -                if (mode == FKIOCTL && fnp->fn_pcredp != NULL) {
1397      -                        k_peercred_t *kp = (k_peercred_t *)arg;
1398      -                        crhold(fnp->fn_pcredp);
1399      -                        kp->pc_cr = fnp->fn_pcredp;
1400      -                        kp->pc_cpid = fnp->fn_cpid;
1401      -                        return (0);
1402      -                } else {
1403      -                        return (ENOTSUP);
1404      -                }
1405      -        }
     1414 +        if (cmd == _I_GETPEERCRED)
     1415 +                return (fifo_ioctl_getpeercred(fnp, arg, mode));
1406 1416  
1407 1417          error = strioctl(vp, cmd, arg, mode, U_TO_K, cr, rvalp);
1408 1418  
1409 1419          switch (cmd) {
1410 1420          /*
1411 1421           * The FIFOSEND flag is set to inform other processes that a file
1412 1422           * descriptor is pending at the stream head of this pipe.
1413 1423           * The flag is cleared and the sending process is awoken when
1414 1424           * this process has completed receiving the file descriptor.
1415 1425           * XXX This could become out of sync if the process does I_SENDFDs
↓ open down ↓ 612 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX