]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix bug #107524 -- epoll_ctl does not access 'events' if it's a
authorNicholas Nethercote <njn@valgrind.org>
Fri, 24 Jun 2005 21:41:28 +0000 (21:41 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Fri, 24 Jun 2005 21:41:28 +0000 (21:41 +0000)
EPOLL_CTL_DEL invocation.

Also renamed our "struct epoll_event" to "struct vki_epoll_event" as it
should be called.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4014

coregrind/m_syswrap/syswrap-linux.c
include/vki-linux.h

index f98156ea9e89748a25293051b9e6468d8939ee95..cec3d9dad10d508313682de9707b0636bdd32574 100644 (file)
@@ -567,8 +567,9 @@ PRE(sys_epoll_ctl)
    PRINT("sys_epoll_ctl ( %d, %s, %d, %p )", 
          ARG1, ( ARG2<3 ? epoll_ctl_s[ARG2] : "?" ), ARG3, ARG4);
    PRE_REG_READ4(long, "epoll_ctl",
-                 int, epfd, int, op, int, fd, struct epoll_event *, event);
-   PRE_MEM_READ( "epoll_ctl(event)", ARG4, sizeof(struct epoll_event) );
+                 int, epfd, int, op, int, fd, struct vki_epoll_event *, event);
+   if (ARG2 != VKI_EPOLL_CTL_DEL)
+      PRE_MEM_READ( "epoll_ctl(event)", ARG4, sizeof(struct vki_epoll_event) );
 }
 
 PRE(sys_epoll_wait)
@@ -576,15 +577,15 @@ PRE(sys_epoll_wait)
    *flags |= SfMayBlock;
    PRINT("sys_epoll_wait ( %d, %p, %d, %d )", ARG1, ARG2, ARG3, ARG4);
    PRE_REG_READ4(long, "epoll_wait",
-                 int, epfd, struct epoll_event *, events,
+                 int, epfd, struct vki_epoll_event *, events,
                  int, maxevents, int, timeout);
-   PRE_MEM_WRITE( "epoll_wait(events)", ARG2, sizeof(struct epoll_event)*ARG3);
+   PRE_MEM_WRITE( "epoll_wait(events)", ARG2, sizeof(struct vki_epoll_event)*ARG3);
 }
 POST(sys_epoll_wait)
 {
    vg_assert(SUCCESS);
    if (RES > 0)
-      POST_MEM_WRITE( ARG2, sizeof(struct epoll_event)*RES ) ;
+      POST_MEM_WRITE( ARG2, sizeof(struct vki_epoll_event)*RES ) ;
 }
 
 PRE(sys_gettid)
index 504570b554d23ff11a8dc333a49546bda44dbf10..951fb24ca37c3c5f9348004c3b2f47f6b9f8a4dc 100644 (file)
@@ -845,16 +845,21 @@ struct vki_elf_prpsinfo
 };
 
 //----------------------------------------------------------------------
-// From linux-2.6.8.1/include/linux/eventpoll.h
+// From linux-2.6.12.1/include/linux/eventpoll.h
 //----------------------------------------------------------------------
 
+/* Valid opcodes to issue to sys_epoll_ctl() */
+#define VKI_EPOLL_CTL_ADD 1
+#define VKI_EPOLL_CTL_DEL 2
+#define VKI_EPOLL_CTL_MOD 3
+
 #ifdef __x86_64__
 #define VKI_EPOLL_PACKED __attribute__((packed))
 #else
 #define VKI_EPOLL_PACKED
 #endif
 
-struct epoll_event {
+struct vki_epoll_event {
        __vki_u32 events;
        __vki_u64 data;
 } VKI_EPOLL_PACKED;