* [patch] udevd - allow to bypass sequence number
@ 2004-02-05 0:27 Kay Sievers
2004-02-05 1:37 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Kay Sievers @ 2004-02-05 0:27 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 577 bytes --]
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.
thanks,
Kay
[-- Attachment #2: 01-bypass-seqnum.patch --]
[-- Type: text/plain, Size: 1679 bytes --]
===== udevd.c 1.10 vs edited =====
--- 1.10/udevd.c Mon Feb 2 09:19:41 2004
+++ edited/udevd.c Thu Feb 5 00:51:39 2004
@@ -205,16 +205,20 @@
}
}
-/* move message from incoming to exec queue */
-static void msg_move_exec(struct list_head *head)
+static void exec_queue_activate(void)
{
- 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);
}
+/* move message from incoming to exec queue */
+static void msg_move_exec(struct list_head *head)
+{
+ list_move_tail(head, &exec_list);
+ exec_queue_activate();
+}
+
/* queue management thread handles the timeouts and dispatches the events */
static void *msg_queue_manager(void * parm)
{
@@ -298,9 +302,17 @@
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);
===== udevsend.c 1.14 vs edited =====
--- 1.14/udevsend.c Mon Feb 2 19:42:41 2004
+++ edited/udevsend.c Thu Feb 5 01:18:52 2004
@@ -148,11 +148,10 @@
}
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) {
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] udevd - allow to bypass sequence number
2004-02-05 0:27 [patch] udevd - allow to bypass sequence number Kay Sievers
@ 2004-02-05 1:37 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2004-02-05 1:37 UTC (permalink / raw)
To: linux-hotplug
On Thu, Feb 05, 2004 at 01:27:09AM +0100, Kay Sievers wrote:
> 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.
Applied, thanks.
greg k-h
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-05 1:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-05 0:27 [patch] udevd - allow to bypass sequence number Kay Sievers
2004-02-05 1:37 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).