version 1.56, 2009/04/11 15:47:33 |
version 1.57, 2009/04/11 23:05:26 |
Line 139 static int tap_dev_read(int, struct uio |
|
Line 139 static int tap_dev_read(int, struct uio |
|
static int tap_dev_write(int, struct uio *, int); |
static int tap_dev_write(int, struct uio *, int); |
static int tap_dev_ioctl(int, u_long, void *, struct lwp *); |
static int tap_dev_ioctl(int, u_long, void *, struct lwp *); |
static int tap_dev_poll(int, int, struct lwp *); |
static int tap_dev_poll(int, int, struct lwp *); |
static int tap_dev_stat(int , struct stat *); |
|
static int tap_dev_kqfilter(int, struct knote *); |
static int tap_dev_kqfilter(int, struct knote *); |
|
|
/* Fileops access routines */ |
/* Fileops access routines */ |
|
|
tap_fops_stat(file_t *fp, struct stat *st) |
tap_fops_stat(file_t *fp, struct stat *st) |
{ |
{ |
int error; |
int error; |
KERNEL_LOCK(1, NULL); |
struct tap_softc *sc; |
error = tap_dev_stat((intptr_t)fp->f_data, st); |
int unit = (uintptr_t)fp->f_data; |
KERNEL_UNLOCK_ONE(NULL); |
|
return error; |
|
} |
|
|
|
static int |
|
tap_dev_stat(int unit, struct stat *st) |
|
{ |
|
struct tap_softc *sc = |
|
device_lookup_private(&tap_cd, unit); |
|
|
|
if (sc == NULL) |
|
return ENXIO; |
|
|
|
(void)memset(st, 0, sizeof(*st)); |
(void)memset(st, 0, sizeof(*st)); |
|
|
|
KERNEL_LOCK(1, NULL); |
|
sc = device_lookup_private(&tap_cd, unit); |
|
if (sc == NULL) { |
|
error = ENXIO; |
|
goto out; |
|
} |
|
|
st->st_dev = makedev(cdevsw_lookup_major(&tap_cdevsw), unit); |
st->st_dev = makedev(cdevsw_lookup_major(&tap_cdevsw), unit); |
st->st_atimespec = sc->sc_atime; |
st->st_atimespec = sc->sc_atime; |
st->st_mtimespec = sc->sc_mtime; |
st->st_mtimespec = sc->sc_mtime; |
st->st_ctimespec = st->st_birthtimespec = sc->sc_btime; |
st->st_ctimespec = st->st_birthtimespec = sc->sc_btime; |
return 0; |
st->st_uid = kauth_cred_geteuid(fp->f_cred); |
|
st->st_gid = kauth_cred_getegid(fp->f_cred); |
|
out: |
|
KERNEL_UNLOCK_ONE(NULL); |
|
return error; |
} |
} |
|
|
static int |
static int |