[PATCH]: possible fix for the fifoor problem

Jung-uk Kim jkim at FreeBSD.org
Tue Nov 7 17:37:50 UTC 2006


On Tuesday 07 November 2006 12:19 pm, Divacky Roman wrote:
> the patch is wrong.... this forces NONBLOCKing on all opened files
> which is wrong.

Nope.  It does not force anything.

static void
translate_path_major_minor(struct thread *td, char *path, struct stat *buf)
{
	struct proc *p = td->td_proc;   
	struct filedesc *fdp = p->p_fd;
	struct file *fp;
	int fd;
	int temp;

	temp = td->td_retval[0];
	if (kern_open(td, path, UIO_SYSSPACE, O_RDONLY, 0) != 0)
		return;
	fd = td->td_retval[0];
	td->td_retval[0] = temp;
	translate_fd_major_minor(td, fd, buf);
	FILEDESC_LOCK(fdp);
	fp = fdp->fd_ofiles[fd];
	FILEDESC_UNLOCK(fdp);
	fdclose(fdp, fdp->fd_ofiles[fd], fd, td);
}

As you can see the function is only used internally to convert
major/minor and fd is closed at the end of the function.

> according to a comment in linux source code linux never blocks for
> O_RDWR which is what I tried to implement with my patch

We don't advertise it but we do the same, AFAIK. ;-)

Jung-uk Kim


More information about the freebsd-emulation mailing list