this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

LKM: Initial code for psynch_mutexdrop

+28 -2
+28 -2
src/lkm/psynch/psynch_mutex.c
··· 69 69 } 70 70 71 71 waiter.wakeup = 0; 72 - list_add(&waiter.entry, &mutex->waiting); 72 + list_add_tail(&waiter.entry, &mutex->waiting); 73 73 74 74 spin_unlock(&task->mutex_wq_lock); 75 75 ··· 89 89 } 90 90 91 91 int psynch_mutexdrop_trap(mach_task_t* task, 92 - struct psynch_mutexdrop_args* args) 92 + struct psynch_mutexdrop_args* in_args) 93 93 { 94 + pthread_mutex_t* mutex; 95 + struct psynch_mutexdrop_args args; 96 + 97 + if (copy_from_user(&args, in_args, sizeof(args))) 98 + return -EFAULT; 99 + 100 + spin_lock(&task->mutex_wq_lock); 101 + 102 + mutex = mutex_get(task, args.mutex); 103 + mutex->mgen = args.mgen; 104 + 105 + if (!list_empty(&mutex->waiting)) 106 + { 107 + struct pthread_waiter* waiter; 108 + 109 + waiter = list_first_entry(&mutex->waiting, struct pthread_waiter, 110 + entry); 111 + 112 + waiter->wakeup = 1; 113 + 114 + wake_up_interruptible(&mutex->wq); 115 + } 116 + 117 + mutex_put(task, mutex); 118 + spin_unlock(&task->mutex_wq_lock); 119 + 94 120 return 0; 95 121 } 96 122