fifo_vnops.c (cd72f2180bfff020d03180e6eba1c3a0e0125468) fifo_vnops.c (48e3128b34dad9618402f1f4095f7655e779843c)
1/*
2 * Copyright (c) 1990, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 338 unchanged lines hidden (view full) ---

347 } */ *ap;
348{
349 struct file filetmp; /* Local, so need not be locked. */
350 int error;
351
352 if (ap->a_command == FIONBIO)
353 return (0);
354 if (ap->a_fflag & FREAD) {
1/*
2 * Copyright (c) 1990, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 338 unchanged lines hidden (view full) ---

347 } */ *ap;
348{
349 struct file filetmp; /* Local, so need not be locked. */
350 int error;
351
352 if (ap->a_command == FIONBIO)
353 return (0);
354 if (ap->a_fflag & FREAD) {
355 filetmp.un_data.socket = ap->a_vp->v_fifoinfo->fi_readsock;
355 filetmp.f_data = ap->a_vp->v_fifoinfo->fi_readsock;
356 filetmp.f_cred = ap->a_cred;
357 error = soo_ioctl(&filetmp, ap->a_command, ap->a_data,
358 ap->a_td->td_ucred, ap->a_td);
359 if (error)
360 return (error);
361 }
362 if (ap->a_fflag & FWRITE) {
356 filetmp.f_cred = ap->a_cred;
357 error = soo_ioctl(&filetmp, ap->a_command, ap->a_data,
358 ap->a_td->td_ucred, ap->a_td);
359 if (error)
360 return (error);
361 }
362 if (ap->a_fflag & FWRITE) {
363 filetmp.un_data.socket = ap->a_vp->v_fifoinfo->fi_writesock;
363 filetmp.f_data = ap->a_vp->v_fifoinfo->fi_writesock;
364 filetmp.f_cred = ap->a_cred;
365 error = soo_ioctl(&filetmp, ap->a_command, ap->a_data,
366 ap->a_td->td_ucred, ap->a_td);
367 if (error)
368 return (error);
369 }
370 return (0);
371}

--- 105 unchanged lines hidden (view full) ---

477 * set POLLINIGNEOF to get non-blocking behavior.
478 */
479 if (events & (POLLIN | POLLRDNORM) &&
480 !(events & POLLINIGNEOF)) {
481 events &= ~(POLLIN | POLLRDNORM);
482 events |= POLLINIGNEOF;
483 }
484
364 filetmp.f_cred = ap->a_cred;
365 error = soo_ioctl(&filetmp, ap->a_command, ap->a_data,
366 ap->a_td->td_ucred, ap->a_td);
367 if (error)
368 return (error);
369 }
370 return (0);
371}

--- 105 unchanged lines hidden (view full) ---

477 * set POLLINIGNEOF to get non-blocking behavior.
478 */
479 if (events & (POLLIN | POLLRDNORM) &&
480 !(events & POLLINIGNEOF)) {
481 events &= ~(POLLIN | POLLRDNORM);
482 events |= POLLINIGNEOF;
483 }
484
485 filetmp.un_data.socket = ap->a_vp->v_fifoinfo->fi_readsock;
485 filetmp.f_data = ap->a_vp->v_fifoinfo->fi_readsock;
486 filetmp.f_cred = ap->a_cred;
486 filetmp.f_cred = ap->a_cred;
487 if (filetmp.un_data.socket)
487 if (filetmp.f_data)
488 revents |= soo_poll(&filetmp, events,
489 ap->a_td->td_ucred, ap->a_td);
490
491 /* Reverse the above conversion. */
492 if ((revents & POLLINIGNEOF) &&
493 !(ap->a_events & POLLINIGNEOF)) {
494 revents |= (ap->a_events & (POLLIN | POLLRDNORM));
495 revents &= ~POLLINIGNEOF;
496 }
497 }
498 events = ap->a_events & (POLLOUT | POLLWRNORM | POLLWRBAND);
499 if (events) {
488 revents |= soo_poll(&filetmp, events,
489 ap->a_td->td_ucred, ap->a_td);
490
491 /* Reverse the above conversion. */
492 if ((revents & POLLINIGNEOF) &&
493 !(ap->a_events & POLLINIGNEOF)) {
494 revents |= (ap->a_events & (POLLIN | POLLRDNORM));
495 revents &= ~POLLINIGNEOF;
496 }
497 }
498 events = ap->a_events & (POLLOUT | POLLWRNORM | POLLWRBAND);
499 if (events) {
500 filetmp.un_data.socket = ap->a_vp->v_fifoinfo->fi_writesock;
500 filetmp.f_data = ap->a_vp->v_fifoinfo->fi_writesock;
501 filetmp.f_cred = ap->a_cred;
501 filetmp.f_cred = ap->a_cred;
502 if (filetmp.un_data.socket)
502 if (filetmp.f_data) {
503 revents |= soo_poll(&filetmp, events,
504 ap->a_td->td_ucred, ap->a_td);
503 revents |= soo_poll(&filetmp, events,
504 ap->a_td->td_ucred, ap->a_td);
505 }
505 }
506 return (revents);
507}
508
509/*
510 * Device close routine
511 */
512/* ARGSUSED */

--- 108 unchanged lines hidden ---
506 }
507 return (revents);
508}
509
510/*
511 * Device close routine
512 */
513/* ARGSUSED */

--- 108 unchanged lines hidden ---