X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/21362eb3e66fd2c787aee132bce100a44d71a99c..36401178fd6817c043cc00b0c00c7f723e58efae:/bsd/netat/sys_dep.c diff --git a/bsd/netat/sys_dep.c b/bsd/netat/sys_dep.c index 4f63e7351..47a18d89c 100644 --- a/bsd/netat/sys_dep.c +++ b/bsd/netat/sys_dep.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 1995-2007 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -26,8 +26,6 @@ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* - * Copyright (c) 1995-1998 Apple Computer, Inc. - * * Change Log: * Created February 20, 1995 by Tuyen Nguyen * Modified for MP, 1996 by Tuyen Nguyen @@ -53,19 +51,12 @@ #include #include -#include #include +#include #include -int (*sys_ATsocket)() = 0; -int (*sys_ATgetmsg)() = 0; -int (*sys_ATputmsg)() = 0; -int (*sys_ATPsndreq)() = 0; -int (*sys_ATPsndrsp)() = 0; -int (*sys_ATPgetreq)() = 0; -int (*sys_ATPgetrsp)() = 0; +int falloc_locked(proc_t, struct fileproc **, int *, vfs_context_t, int); -extern at_state_t at_state; /* global state of AT network */ extern at_ifaddr_t *ifID_home; /* default interface */ extern lck_mtx_t * atalk_mutex; @@ -77,6 +68,14 @@ extern lck_mtx_t * atalk_mutex; #define f_offset f_fglob->fg_offset #define f_data f_fglob->fg_data + +int _ATkqfilter(struct fileproc *, struct knote *, vfs_context_t); +int _ATselect(struct fileproc *, int, void *, vfs_context_t); +int _ATioctl(struct fileproc *, u_long, caddr_t, vfs_context_t); +int _ATwrite(struct fileproc *, struct uio *, int, vfs_context_t); +int _ATread(struct fileproc *, struct uio *, int, vfs_context_t); +int _ATclose(struct fileglob *, vfs_context_t); + int ATsocket(proc, uap, retval) struct proc *proc; struct ATsocket_args *uap; @@ -84,13 +83,13 @@ int ATsocket(proc, uap, retval) { int err; atalk_lock(); - if (sys_ATsocket) { + if (1 /* _ATsocket*/) { /* required check for all AppleTalk system calls */ if (!(at_state.flags & AT_ST_STARTED) || !ifID_home) { *retval = -1; err = ENOTREADY; } else { - *retval = (*sys_ATsocket)(uap->proto, &err, proc); + *retval = _ATsocket((int)uap->proto, (int *)&err, (void *)proc); } } else { *retval = -1; @@ -108,14 +107,14 @@ int ATgetmsg(proc, uap, retval) int err; atalk_lock(); - if (sys_ATgetmsg) { + if (1 /* _ATgetmsg */) { /* required check for all AppleTalk system calls */ if (!(at_state.flags & AT_ST_STARTED) || !ifID_home) { *retval = -1; err = ENOTREADY; } else { *retval = - (*sys_ATgetmsg)(uap->fd, uap->ctlptr, uap->datptr, + (*_ATgetmsg)(uap->fd, uap->ctlptr, uap->datptr, uap->flags, &err, proc); } } else { @@ -134,14 +133,14 @@ int ATputmsg(proc, uap, retval) int err; atalk_lock(); - if (sys_ATputmsg) { + if (1 /* _ATputmsg */) { /* required check for all AppleTalk system calls */ if (!(at_state.flags & AT_ST_STARTED) || !ifID_home) { *retval = -1; err = ENOTREADY; } else { *retval = - (*sys_ATputmsg)(uap->fd, uap->ctlptr, uap->datptr, + _ATputmsg(uap->fd, uap->ctlptr, uap->datptr, uap->flags, &err, proc); } } else { @@ -160,14 +159,14 @@ int ATPsndreq(proc, uap, retval) int err; atalk_lock(); - if (sys_ATPsndreq) { + if (1 /* _ATPsndreq */) { /* required check for all AppleTalk system calls */ if (!(at_state.flags & AT_ST_STARTED) || !ifID_home) { *retval = -1; err = ENOTREADY; } else { *retval = - (*sys_ATPsndreq)(uap->fd, uap->buf, uap->len, + _ATPsndreq(uap->fd, uap->buf, uap->len, uap->nowait, &err, proc); } } else { @@ -186,14 +185,14 @@ int ATPsndrsp(proc, uap, retval) int err; atalk_lock(); - if (sys_ATPsndrsp) { + if (1 /*_ATPsndrsp*/) { /* required check for all AppleTalk system calls */ if (!(at_state.flags & AT_ST_STARTED) || !ifID_home) { *retval = -1; err = ENOTREADY; } else { *retval = - (*sys_ATPsndrsp)(uap->fd, uap->respbuff, + _ATPsndrsp(uap->fd, uap->respbuff, uap->resplen, uap->datalen, &err, proc); } } else { @@ -212,14 +211,14 @@ int ATPgetreq(proc, uap, retval) int err; atalk_lock(); - if (sys_ATPgetreq) { + if (1 /* _ATPgetreq */) { /* required check for all AppleTalk system calls */ if (!(at_state.flags & AT_ST_STARTED) || !ifID_home) { *retval = -1; err = ENOTREADY; } else { *retval = - (*sys_ATPgetreq)(uap->fd, uap->buf, uap->buflen, + _ATPgetreq(uap->fd, uap->buf, uap->buflen, &err, proc); } } else { @@ -238,14 +237,14 @@ int ATPgetrsp(proc, uap, retval) int err = 0; atalk_lock(); - if (sys_ATPgetrsp) { + if (1 /*_ATPgetrsp*/) { /* required check for all AppleTalk system calls */ if (!(at_state.flags & AT_ST_STARTED) || !ifID_home) { *retval = -1; err = ENOTREADY; } else { *retval = - (*sys_ATPgetrsp)(uap->fd, uap->bdsp, &err, proc); + _ATPgetrsp(uap->fd, (struct atpBDS *)uap->bdsp, &err, proc); } } else { *retval = -1; @@ -271,7 +270,6 @@ int atalk_openref(gref, retfd, proc) int *retfd; struct proc *proc; { - extern int _ATread(), _ATwrite(),_ATioctl(), _ATselect(), _ATclose(), _ATkqfilter(); static struct fileops fileops = {_ATread, _ATwrite, _ATioctl, _ATselect, _ATclose, _ATkqfilter, 0}; int err, fd; @@ -280,7 +278,7 @@ int atalk_openref(gref, retfd, proc) lck_mtx_assert(atalk_mutex, LCK_MTX_ASSERT_OWNED); proc_fdlock(proc); - if ((err = falloc_locked(proc, &fp, &fd, 1)) != 0) { + if ((err = falloc_locked(proc, &fp, &fd, vfs_context_current(), 1)) != 0) { proc_fdunlock(proc); return err; } @@ -293,7 +291,7 @@ int atalk_openref(gref, retfd, proc) fp->f_ops = &fileops; fp->f_data = (void *)gref; - *fdflags(proc, fd) &= ~UF_RESERVED; + procfdtbl_releasefd(proc, fd, NULL); *retfd = fd; fp_drop(proc, fd, fp, 1); proc_fdunlock(proc); @@ -346,7 +344,7 @@ int droponerr; if (fp->f_type != (DTYPE_ATALK+1) || *grefp == 0 || *grefp == (gref_t *)(-1)) { if (droponerr) fp_drop(proc, fd, fp, 1); - printf("atalk_getref_locked EBADF f_data: %x\n", fp->f_data); + printf("atalk_getref_locked EBADF f_data: %p\n", fp->f_data); return EBADF; }