mirror of
https://github.com/AuxXxilium/eudev.git
synced 2025-03-05 19:58:30 +07:00
[PATCH] udevd - allow to bypass sequence number
This patch allows udevsend to be called by the user and not only by the kernel with its SEQNUM. If no SEQNUM is given, we move the event straight to the exec queue and don't look if something is missing. I don't know if this is really needed, but some people seem trying to send events trough udevd instead of calling udev directly with their scripts and confuse the reorder logic with that. So at least, we may remove this source of confusion and udevsend is much much faster back than udev itself and it will also block concurrent events for the same devpath.
This commit is contained in:
parent
16be132889
commit
86590cd590
26
udevd.c
26
udevd.c
@ -205,14 +205,18 @@ static void *exec_queue_manager(void * parm)
|
||||
}
|
||||
}
|
||||
|
||||
static void exec_queue_activate(void)
|
||||
{
|
||||
pthread_mutex_lock(&exec_active_lock);
|
||||
pthread_cond_signal(&exec_active);
|
||||
pthread_mutex_unlock(&exec_active_lock);
|
||||
}
|
||||
|
||||
/* move message from incoming to exec queue */
|
||||
static void msg_move_exec(struct list_head *head)
|
||||
{
|
||||
list_move_tail(head, &exec_list);
|
||||
/* signal queue activity to manager */
|
||||
pthread_mutex_lock(&exec_active_lock);
|
||||
pthread_cond_signal(&exec_active);
|
||||
pthread_mutex_unlock(&exec_active_lock);
|
||||
exec_queue_activate();
|
||||
}
|
||||
|
||||
/* queue management thread handles the timeouts and dispatches the events */
|
||||
@ -298,9 +302,17 @@ static void *client_threads(void * parm)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&msg_lock);
|
||||
msg_queue_insert(msg);
|
||||
pthread_mutex_unlock(&msg_lock);
|
||||
/* if no seqnum is given, we move straight to exec queue */
|
||||
if (msg->seqnum == 0) {
|
||||
pthread_mutex_lock(&exec_lock);
|
||||
list_add(&msg->list, &exec_list);
|
||||
exec_queue_activate();
|
||||
pthread_mutex_unlock(&exec_lock);
|
||||
} else {
|
||||
pthread_mutex_lock(&msg_lock);
|
||||
msg_queue_insert(msg);
|
||||
pthread_mutex_unlock(&msg_lock);
|
||||
}
|
||||
|
||||
exit:
|
||||
close(sock);
|
||||
|
@ -148,11 +148,10 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
seqnum = get_seqnum();
|
||||
if (seqnum == NULL) {
|
||||
dbg("no seqnum");
|
||||
goto exit;
|
||||
}
|
||||
seq = atoi(seqnum);
|
||||
if (seqnum == NULL)
|
||||
seq = 0;
|
||||
else
|
||||
seq = atoi(seqnum);
|
||||
|
||||
sock = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
if (sock == -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user