[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lost] [Patch] Caching in Listen aktivieren und LostIO-Fixes



* libc: Caching in den Listen wieder aktivieren
! libc: LostIO Fix für Race-Condition beim Suchen von Filehandles die
        Probleme mit dem Listencaching verursacht.


-- 
Antoine Kaufmann
<toni@xxxxxxxxxxxxxxxx>
Index: src/lib/collections/list.c
===================================================================
--- src/lib/collections/list.c	(Revision 911)
+++ src/lib/collections/list.c	(Arbeitskopie)
@@ -187,8 +187,7 @@ static struct list_node* list_get_node_a
     if (!list || !list->anchor || (index < 0)) {
         return NULL;
     }
-    //Chaching deaktivieren
-    last_list = NULL;
+
     struct list_node* current = list->anchor;
     int n = index;
 
Index: src/modules/lib/lostio/lostio.c
===================================================================
--- src/modules/lib/lostio/lostio.c	(Revision 911)
+++ src/modules/lib/lostio/lostio.c	(Arbeitskopie)
@@ -150,16 +150,11 @@ lostio_filehandle_t* get_filehandle(pid_
     lostio_filehandle_t* filehandle;
     int i = 0;
 
-    while((filehandle = list_get_element_at(filehandles, i++)))
-    {
-        //printf("fh ->id:%d == %d  ->pid:%d == %d\n", id, filehandle->id, pid, filehandle->pid);
-        //FIXME:PID sollte auch geprueft werden. Macht aber im moment Probleme mit pipes
-        if((filehandle->id == id) /*&& (filehandle->pid == pid)*/)
-        {
-            break;
-        }
-    }
-    
+    p();
+    for (i = 0; (filehandle = list_get_element_at(filehandles, i)) &&
+        (filehandle->id != id); i++);
+    v();
+
     return filehandle;
 }
 

Attachment: pgpSiMAJL3v8H.pgp
Description: PGP signature