Created
July 28, 2016 18:51
-
-
Save pedroarthur/5e2ad832cbee0c31797a91a9c0cd5a31 to your computer and use it in GitHub Desktop.
DEBUG_LOCKS_WARN_ON(lock->owner != current)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <linux/module.h> | |
#include <linux/init.h> | |
#include <linux/mutex.h> | |
DEFINE_MUTEX (master_mutex); | |
EXPORT_SYMBOL(master_mutex); | |
static int __init mutex_master_init(void) | |
{ | |
pr_info("%s loading at 0x%p\n", KBUILD_MODNAME, mutex_master_init); | |
return 0; | |
} | |
static void __exit mutex_master_exit(void) | |
{ | |
pr_info("%s is been unloaded\n", KBUILD_MODNAME); | |
} | |
module_init(mutex_master_init); | |
module_exit(mutex_master_exit); | |
MODULE_AUTHOR("Pedro Duarte"); | |
MODULE_LICENSE("GPL v2"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <linux/module.h> | |
#include <linux/init.h> | |
#include <linux/mutex.h> | |
extern struct mutex master_mutex; | |
static int __init mutex_slave_one_init(void) | |
{ | |
pr_info("%s loading at 0x%p\n", KBUILD_MODNAME, mutex_slave_one_init); | |
if (mutex_trylock(&master_mutex)) | |
return 0; | |
return -EBUSY; | |
} | |
static void __exit mutex_slave_one_exit(void) | |
{ | |
mutex_unlock(&master_mutex); | |
pr_info("%s is been unloaded\n", KBUILD_MODNAME); | |
} | |
module_init(mutex_slave_one_init); | |
module_exit(mutex_slave_one_exit); | |
MODULE_AUTHOR("Pedro Duarte"); | |
MODULE_LICENSE("GPL v2"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <linux/module.h> | |
#include <linux/init.h> | |
#include <linux/mutex.h> | |
extern struct mutex master_mutex; | |
static int __init mutex_slave_two_init(void) | |
{ | |
pr_info("%s loading at 0x%p\n", KBUILD_MODNAME, mutex_slave_two_init); | |
if (mutex_trylock(&master_mutex)) | |
return 0; | |
return -EBUSY; | |
} | |
static void __exit mutex_slave_two_exit(void) | |
{ | |
mutex_unlock(&master_mutex); | |
pr_info("%s is been unloaded\n", KBUILD_MODNAME); | |
} | |
module_init(mutex_slave_two_init); | |
module_exit(mutex_slave_two_exit); | |
MODULE_AUTHOR("Pedro Duarte"); | |
MODULE_LICENSE("GPL v2"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment