-fset(fp, bit, value)
- struct file *fp;
- int bit, value;
-{
-
- if (value)
- fp->f_flag |= bit;
- else
- fp->f_flag &= ~bit;
- return (fioctl(fp, (int)(bit == FNDELAY ? FIONBIO : FIOASYNC),
- (caddr_t)&value));
-}
-
-fgetown(fp, valuep)
- struct file *fp;
- int *valuep;
-{
- int error;
-
- switch (fp->f_type) {
-
- case DTYPE_SOCKET:
- *valuep = ((struct socket *)fp->f_data)->so_pgid;
- return (0);
-
- default:
- error = fioctl(fp, (int)TIOCGPGRP, (caddr_t)valuep);
- *valuep = -*valuep;
- return (error);
- }
-}
-
-fsetown(fp, value)
- struct file *fp;
- int value;
-{
-
- if (fp->f_type == DTYPE_SOCKET) {
- ((struct socket *)fp->f_data)->so_pgid = value;
- return (0);
- }
- if (value > 0) {
- struct proc *p = pfind(value);
- if (p == 0)
- return (ESRCH);
- value = p->p_pgrp->pg_id;
- } else
- value = -value;
- return (fioctl(fp, (int)TIOCSPGRP, (caddr_t)&value));
-}
-
-fioctl(fp, cmd, value)
- struct file *fp;
- int cmd;
- caddr_t value;
-{
-
- return ((*fp->f_ops->fo_ioctl)(fp, cmd, value));
-}
-