diff options
author | jhb <jhb@FreeBSD.org> | 2006-07-08 20:03:39 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-07-08 20:03:39 +0000 |
commit | e09e5b52dbb8914136f6708a8042007a16277dde (patch) | |
tree | 2f42b6b122203b412debeb7c4d7a7de8a551de99 | |
parent | df27227bab23aaf42551e2e2ea6f0955e253f135 (diff) | |
download | FreeBSD-src-e09e5b52dbb8914136f6708a8042007a16277dde.zip FreeBSD-src-e09e5b52dbb8914136f6708a8042007a16277dde.tar.gz |
Add a kern_close() so that the ABIs can close a file descriptor w/o having
to populate a close_args struct and change some of the places that do.
-rw-r--r-- | sys/compat/linux/linux_socket.c | 6 | ||||
-rw-r--r-- | sys/fs/portalfs/portal_vnops.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_descrip.c | 12 | ||||
-rw-r--r-- | sys/sys/syscallsubr.h | 1 |
4 files changed, 14 insertions, 11 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index dfe2e50..8b164fa 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -705,9 +705,6 @@ linux_accept(struct thread *td, struct linux_accept_args *args) struct sockaddr * __restrict name; socklen_t * __restrict anamelen; } */ bsd_args; - struct close_args /* { - int fd; - } */ c_args; int error, fd; if ((error = copyin(args, &linux_args, sizeof(linux_args)))) @@ -724,8 +721,7 @@ linux_accept(struct thread *td, struct linux_accept_args *args) if (linux_args.addr) { error = linux_sa_put(PTRIN(linux_args.addr)); if (error) { - c_args.fd = td->td_retval[0]; - (void)close(td, &c_args); + (void)kern_close(td, td->td_retval[0]); return (error); } } diff --git a/sys/fs/portalfs/portal_vnops.c b/sys/fs/portalfs/portal_vnops.c index 680d1fb..efed4c2 100644 --- a/sys/fs/portalfs/portal_vnops.c +++ b/sys/fs/portalfs/portal_vnops.c @@ -52,7 +52,7 @@ #include <sys/socket.h> #include <sys/socketvar.h> #include <sys/stat.h> -#include <sys/sysproto.h> +#include <sys/syscallsubr.h> #include <sys/systm.h> #include <sys/un.h> #include <sys/unpcb.h> @@ -77,10 +77,8 @@ portal_closefd(td, fd) int fd; { int error; - struct close_args ua; - ua.fd = fd; - error = close(td, &ua); + error = kern_close(td, fd); /* * We should never get an error, and there isn't anything * we could do if we got one, so just print a message. diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index d4ff7b1..599e917 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -973,12 +973,20 @@ close(td, uap) struct thread *td; struct close_args *uap; { + + return (kern_close(td, uap->fd)); +} + +int +kern_close(td, fd) + struct thread *td; + int fd; +{ struct filedesc *fdp; struct file *fp; - int fd, error; + int error; int holdleaders; - fd = uap->fd; error = 0; holdleaders = 0; fdp = td->td_proc->p_fd; diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index faf6f93..c98b0cf 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -68,6 +68,7 @@ int kern_clock_gettime(struct thread *td, clockid_t clock_id, struct timespec *ats); int kern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats); +int kern_close(struct thread *td, int fd); int kern_connect(struct thread *td, int fd, struct sockaddr *sa); int kern_eaccess(struct thread *td, char *path, enum uio_seg pathseg, int flags); |