DragonFly BSD
DragonFly kernel List (threaded) for 2003-10
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: splitting fnctl(), ioctl()


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 10 Oct 2003 14:10:18 -0700 (PDT)

:Not yet.  However, I expect them to look like:
:
:int
:fcntl_copyin(int cmd, caddr_t arg, caddr_t buf)
:{
:	switch (cmd) {
:	case F_GETFD:
:		break;
:[snip]
:	case F_SETLK:
:		copyin(uap->arg, buf, sizeof(struct flock);
:		break;
:	case F_GETLK:
:		copyin(uap->arg, buf, sizeof(struct flock);
:		break;
:	}
:}
:
:int
:fcntl_copyout(int cmd, caddr_t arg, caddr_t buf)
:{
:	switch (cmd) {
:	case F_GETFD:
:		break;
:[snip]
:	case F_SETLK:
:		break;
:	case F_GETLK:
:		copyout(buf, uap->arg, sizeof(struct flock);
:	}
:}
:
:While they get most of the job done, I don't like the fact that this
:method separates the code.
:
:-- 
:   David P. Reese, Jr.                                     daver@xxxxxxxxxxxx

    Hmm.  Since the copyin and copyout are going to be overriden by 
    emulation code, isn't there only going to be (approximately) one
    call to fcntl_copyin() and fcntl_copyout() over the whole source
    base?  In that case you might as well do away with fcntl_copyin()
    and fcntl_copyout() and just embed the work in the fcntl() syscall,
    with the kern_fcntl() call nestled in between.

    Then instead of having a 'buf' you could have a union which contains
    all the structs that might be needed to be copied in and out, which is
    then passed to kern_fcntl().

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]