diff options
author | jhb <jhb@FreeBSD.org> | 2005-07-07 19:27:29 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2005-07-07 19:27:29 +0000 |
commit | 89c65bc296d1121e3f14a3f228aa3d87565a4e5a (patch) | |
tree | 7335c4fd0f960ddc982ad1a8142b290c67e2c71e /sys/compat/svr4 | |
parent | f2ca5e0f592dbaa6c65210447b25de33749f7886 (diff) | |
download | FreeBSD-src-89c65bc296d1121e3f14a3f228aa3d87565a4e5a.zip FreeBSD-src-89c65bc296d1121e3f14a3f228aa3d87565a4e5a.tar.gz |
Lock Giant in svr4_add_socket() so that the various svr4_*stat() calls
can be marked MP safe as this is the only part of them that is not
already MP safe.
Approved by: re (scottl)
Diffstat (limited to 'sys/compat/svr4')
-rw-r--r-- | sys/compat/svr4/svr4_socket.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/compat/svr4/svr4_socket.c b/sys/compat/svr4/svr4_socket.c index ffa014b..bae6e0c 100644 --- a/sys/compat/svr4/svr4_socket.c +++ b/sys/compat/svr4/svr4_socket.c @@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/queue.h> #include <sys/file.h> +#include <sys/lock.h> +#include <sys/mutex.h> #include <sys/socket.h> #include <sys/socketvar.h> #include <sys/sysproto.h> @@ -114,6 +116,8 @@ svr4_add_socket(td, path, st) struct svr4_sockcache_entry *e; int len, error; + mtx_lock(&Giant); + /* * Wait for the TAILQ to be initialized. Only the very first CPU * will succeed on the atomic_cmpset(). The other CPU's will spin @@ -135,6 +139,7 @@ svr4_add_socket(td, path, st) if ((error = copyinstr(path, e->sock.sun_path, sizeof(e->sock.sun_path), &len)) != 0) { + mtx_unlock(&Giant); DPRINTF(("svr4_add_socket: copyinstr failed %d\n", error)); free(e, M_TEMP); return error; @@ -144,6 +149,7 @@ svr4_add_socket(td, path, st) e->sock.sun_len = len; TAILQ_INSERT_HEAD(&svr4_head, e, entries); + mtx_unlock(&Giant); DPRINTF(("svr4_add_socket: %s [%p,%d,%d]\n", e->sock.sun_path, td->td_proc, e->dev, e->ino)); return 0; |