1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-30 08:19:09 +00:00

MFP4: Turn emul_lock into a mutex.

Submitted by:	rdivacky
This commit is contained in:
Jung-uk Kim 2007-04-02 18:38:13 +00:00
parent 19c90c637c
commit 357afa7113
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168275
4 changed files with 18 additions and 18 deletions

View File

@ -1081,7 +1081,7 @@ linux_elf_modevent(module_t mod, int type, void *data)
linux_ioctl_register_handler(*lihp);
SET_FOREACH(ldhp, linux_device_handler_set)
linux_device_register_handler(*ldhp);
sx_init(&emul_lock, "emuldata lock");
mtx_init(&emul_lock, "emuldata lock", NULL, MTX_DEF);
sx_init(&emul_shared_lock, "emuldata->shared lock");
LIST_INIT(&futex_list);
sx_init(&futex_sx, "futex protection lock");
@ -1112,7 +1112,7 @@ linux_elf_modevent(module_t mod, int type, void *data)
linux_ioctl_unregister_handler(*lihp);
SET_FOREACH(ldhp, linux_device_handler_set)
linux_device_unregister_handler(*ldhp);
sx_destroy(&emul_lock);
mtx_destroy(&emul_lock);
sx_destroy(&emul_shared_lock);
sx_destroy(&futex_sx);
EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);

View File

@ -55,8 +55,8 @@ __FBSDID("$FreeBSD$");
#include <machine/../linux/linux_proto.h>
#endif
struct sx emul_shared_lock;
struct sx emul_lock;
struct sx emul_shared_lock;
struct mtx emul_lock;
/* this returns locked reference to the emuldata entry (if found) */
struct linux_emuldata *

View File

@ -29,7 +29,7 @@
*/
#ifndef _LINUX_EMUL_H_
#define _LINUX_EMUL_H_
#define _LINUX_EMUL_H_
struct linux_emuldata_shared {
int refs;
@ -55,26 +55,26 @@ struct linux_emuldata {
LIST_ENTRY(linux_emuldata) threads; /* list of linux threads */
};
struct linux_emuldata *em_find(struct proc *, int locked);
struct linux_emuldata *em_find(struct proc *, int locked);
#define EMUL_LOCK(l) sx_xlock(l)
#define EMUL_UNLOCK(l) sx_xunlock(l)
#define EMUL_LOCK(l) mtx_lock(l)
#define EMUL_UNLOCK(l) mtx_unlock(l)
#define EMUL_SHARED_RLOCK(l) sx_slock(l)
#define EMUL_SHARED_RUNLOCK(l) sx_sunlock(l)
#define EMUL_SHARED_WLOCK(l) sx_xlock(l)
#define EMUL_SHARED_WUNLOCK(l) sx_xunlock(l)
#define EMUL_SHARED_RLOCK(l) sx_slock(l)
#define EMUL_SHARED_RUNLOCK(l) sx_sunlock(l)
#define EMUL_SHARED_WLOCK(l) sx_xlock(l)
#define EMUL_SHARED_WUNLOCK(l) sx_xunlock(l)
/* for em_find use */
#define EMUL_DOLOCK 1
#define EMUL_DONTLOCK 0
#define EMUL_DOLOCK 1
#define EMUL_DONTLOCK 0
int linux_proc_init(struct thread *, pid_t, int);
void linux_proc_exit(void *, struct proc *);
void linux_schedtail(void *, struct proc *);
void linux_proc_exec(void *, struct proc *, struct image_params *);
extern struct sx emul_shared_lock;
extern struct sx emul_lock;
extern struct sx emul_shared_lock;
extern struct mtx emul_lock;
#endif /* !_LINUX_EMUL_H_ */

View File

@ -917,7 +917,7 @@ linux_elf_modevent(module_t mod, int type, void *data)
linux_ioctl_register_handler(*lihp);
SET_FOREACH(ldhp, linux_device_handler_set)
linux_device_register_handler(*ldhp);
sx_init(&emul_lock, "emuldata lock");
mtx_init(&emul_lock, "emuldata lock", NULL, MTX_DEF);
sx_init(&emul_shared_lock, "emuldata->shared lock");
LIST_INIT(&futex_list);
sx_init(&futex_sx, "futex protection lock");
@ -948,7 +948,7 @@ linux_elf_modevent(module_t mod, int type, void *data)
linux_ioctl_unregister_handler(*lihp);
SET_FOREACH(ldhp, linux_device_handler_set)
linux_device_unregister_handler(*ldhp);
sx_destroy(&emul_lock);
mtx_destroy(&emul_lock);
sx_destroy(&emul_shared_lock);
sx_destroy(&futex_sx);
EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);