Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 May 1995 07:21:15 +0200 (MET DST)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        dufault@hda.com (Peter Dufault)
Cc:        hackers@FreeBSD.org
Subject:   Re: what's in ioctl flag arg?
Message-ID:  <199505030521.HAA18020@uriah.heep.sax.de>
In-Reply-To: <199505022207.SAA00880@hda.com> from "Peter Dufault" at May 2, 95 06:07:12 pm

next in thread | previous in thread | raw e-mail | index | archive | help
As Peter Dufault wrote:
> 
> What's in the ioctl flag arg?  I hope it is a copy of the
> flag passed in to the open(), but I can't find where it gets
> set up and I'm not sure if it gets translated into an "F_"
> thing instead.

Somewhere in the generic ioctl code.

> Is this how I verify that you can't write to a file in the ioctl call:


        case FD_FORM:
                if((flag & FWRITE) == 0)
                        error = EBADF;  /* must be opened for writing */
                ...


Perhaps you'd need this, too:

        case FD_STYPE:                  /* set drive type */
                /* this is considered harmful; only allow for superuser */
                if(suser(p->p_ucred, &p->p_acflag) != 0)
                        return EPERM;

                ...

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199505030521.HAA18020>