]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
It seems that the perf_counter_open system call was renamed to
authorTom Hughes <tom@compton.nu>
Wed, 8 Jun 2011 09:10:40 +0000 (09:10 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 8 Jun 2011 09:10:40 +0000 (09:10 +0000)
perf_event_open some time after we added it, so correct the name
wherever it appears to match the current kernel source.

Also fixup the PRE handler to do the check correctly, using the
size field of the structure to work out how much data there is.

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

coregrind/m_syswrap/priv_syswrap-linux.h
coregrind/m_syswrap/syswrap-amd64-linux.c
coregrind/m_syswrap/syswrap-linux.c
coregrind/m_syswrap/syswrap-ppc32-linux.c
coregrind/m_syswrap/syswrap-ppc64-linux.c
coregrind/m_syswrap/syswrap-x86-linux.c
include/vki/vki-linux.h
include/vki/vki-scnums-amd64-linux.h
include/vki/vki-scnums-ppc32-linux.h
include/vki/vki-scnums-ppc64-linux.h
include/vki/vki-scnums-x86-linux.h

index e2a21d6ba2e1af5df782e6378a1d84d126bcfd69..28b6911e5827be2c1807a471f98e586cb1480787 100644 (file)
@@ -47,7 +47,7 @@ extern SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags,
 DECL_TEMPLATE(linux, sys_mount);
 DECL_TEMPLATE(linux, sys_oldumount);
 DECL_TEMPLATE(linux, sys_umount);
-DECL_TEMPLATE(linux, sys_perf_counter_open);
+DECL_TEMPLATE(linux, sys_perf_event_open);
 DECL_TEMPLATE(linux, sys_preadv);
 DECL_TEMPLATE(linux, sys_pwritev);
 DECL_TEMPLATE(linux, sys_dup3);
index ece1a73b4448f10be8db15faa01c7e252ef33fa9..b58c17189f3efc1d4fc2c0a95e06a0a682636e17 100644 (file)
@@ -1410,7 +1410,7 @@ static SyscallTableEntry syscall_table[] = {
    LINXY(__NR_preadv,            sys_preadv),           // 295
    LINX_(__NR_pwritev,           sys_pwritev),          // 296
    LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 297
-   LINXY(__NR_perf_counter_open, sys_perf_counter_open) // 298
+   LINXY(__NR_perf_event_open,   sys_perf_event_open)   // 298
 };
 
 SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
index e3c57d69b08647e2f9f07c937113b77abe444ac0..f4f75532efe0c9baf385229664ca678e414676f2 100644 (file)
@@ -2583,22 +2583,26 @@ PRE(sys_stime)
    PRE_MEM_READ( "stime(t)", ARG1, sizeof(vki_time_t) );
 }
 
-PRE(sys_perf_counter_open)
+PRE(sys_perf_event_open)
 {
-   PRINT("sys_perf_counter_open ( %#lx, %ld, %ld, %ld, %ld )",
+   struct vki_perf_event_attr *attr;
+   PRINT("sys_perf_event_open ( %#lx, %ld, %ld, %ld, %ld )",
          ARG1,ARG2,ARG3,ARG4,ARG5);
-   PRE_REG_READ5(long, "perf_counter_open",
-                 struct vki_perf_counter_attr *, attr,
+   PRE_REG_READ5(long, "perf_event_open",
+                 struct vki_perf_event_attr *, attr,
                  vki_pid_t, pid, int, cpu, int, group_fd,
                  unsigned long, flags);
-   PRE_MEM_READ( "perf_counter_open(attr)",
-                 ARG1, sizeof(struct vki_perf_counter_attr) );
+   attr = (struct vki_perf_event_attr *)ARG1;
+   PRE_MEM_READ( "perf_event_open(attr->size)",
+                 &attr->size, sizeof(attr->size) );
+   PRE_MEM_READ( "perf_event_open(attr)",
+                 attr, attr->size );
 }
 
-POST(sys_perf_counter_open)
+POST(sys_perf_event_open)
 {
    vg_assert(SUCCESS);
-   if (!ML_(fd_allowed)(RES, "perf_counter_open", tid, True)) {
+   if (!ML_(fd_allowed)(RES, "perf_event_open", tid, True)) {
       VG_(close)(RES);
       SET_STATUS_Failure( VKI_EMFILE );
    } else {
index 9baf8d8e06740bdaeb1fd9cb93e6a4840d9a6c76..997acf3a3db784c562961a0b6d821754fb480659 100644 (file)
@@ -1890,7 +1890,7 @@ static SyscallTableEntry syscall_table[] = {
    LINXY(__NR_dup3,              sys_dup3),             // 316
    LINXY(__NR_pipe2,             sys_pipe2),            // 317
    LINXY(__NR_inotify_init1,     sys_inotify_init1),    // 318
-   LINXY(__NR_perf_counter_open, sys_perf_counter_open),// 319
+   LINXY(__NR_perf_event_open,   sys_perf_event_open),  // 319
    LINXY(__NR_preadv,            sys_preadv),           // 320
    LINX_(__NR_pwritev,           sys_pwritev),          // 321
    LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) // 322
index 6e91052d7885f6980816535c54013351a7ed74b4..54e866d014190f3e1e54fed6ab880a73ef05596a 100644 (file)
@@ -1531,7 +1531,7 @@ static SyscallTableEntry syscall_table[] = {
    LINXY(__NR_dup3,              sys_dup3),             // 316
    LINXY(__NR_pipe2,             sys_pipe2),            // 317
    LINXY(__NR_inotify_init1,     sys_inotify_init1),    // 318
-   LINXY(__NR_perf_counter_open, sys_perf_counter_open),// 319
+   LINXY(__NR_perf_event_open,   sys_perf_event_open),  // 319
    LINXY(__NR_preadv,            sys_preadv),           // 320
    LINX_(__NR_pwritev,           sys_pwritev),          // 321
    LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) // 322
index 4b526563bcf986ba31f3d2603b386193d850f385..ecd2e13393dc321c0fa2d9df921202b5b9ab1580 100644 (file)
@@ -2280,7 +2280,7 @@ static SyscallTableEntry syscall_table[] = {
    LINX_(__NR_pwritev,           sys_pwritev),          // 334
 
    LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 335
-   LINXY(__NR_perf_counter_open, sys_perf_counter_open) // 336
+   LINXY(__NR_perf_event_open,   sys_perf_event_open)   // 336
 };
 
 SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
index eee044d5649a2661a6e72e369be6a5f0338132b7..e3e1d939569fc380d79b1cd9c0c365c6a6ffbab9 100644 (file)
@@ -2625,10 +2625,10 @@ struct  vki_iwreq
 };
 
 /*--------------------------------------------------------------------*/
-// From linux-2.6.31.5/include/linux/perf_counter.h
+// From linux-2.6.31.5/include/linux/perf_event.h
 /*--------------------------------------------------------------------*/
 
-struct vki_perf_counter_attr {
+struct vki_perf_event_attr {
 
        /*
         * Major type: hardware/software/tracepoint/etc.
@@ -2667,13 +2667,37 @@ struct vki_perf_counter_attr {
                                        inherit_stat   :  1, /* per task counts       */
                                        enable_on_exec :  1, /* next exec enables     */
                                        task           :  1, /* trace fork/exit       */
+                                       watermark      :  1, /* wakeup_watermark      */
+                                       /*
+                                        * precise_ip:
+                                        *
+                                        *  0 - SAMPLE_IP can have arbitrary skid
+                                        *  1 - SAMPLE_IP must have constant skid
+                                        *  2 - SAMPLE_IP requested to have 0 skid
+                                        *  3 - SAMPLE_IP must have 0 skid
+                                        *
+                                        *  See also PERF_RECORD_MISC_EXACT_IP
+                                        */
+                                       precise_ip     :  2, /* skid constraint       */
+                                       mmap_data      :  1, /* non-exec mmap data    */
+                                       sample_id_all  :  1, /* sample_type all events */
+
+                                       __reserved_1   : 45;
 
-                                       __reserved_1   : 50;
-
-       __vki_u32                       wakeup_events;  /* wakeup every n events */
-       __vki_u32                       __reserved_2;
+       union {
+               __vki_u32               wakeup_events;    /* wakeup every n events */
+               __vki_u32               wakeup_watermark; /* bytes before wakeup   */
+       };
 
-       __vki_u64                       __reserved_3;
+       __vki_u32                       bp_type;
+       union {
+               __vki_u64               bp_addr;
+               __vki_u64               config1; /* extension of config */
+       };
+       union {
+               __vki_u64               bp_len;
+               __vki_u64               config2; /* extension of config1 */
+       };
 };
 
 /*--------------------------------------------------------------------*/
index f891f9472bcd01d8b43c3d038c8d65d2f42d3a78..d5b2bf8affc11516e2381bc1e724148c1c7202b7 100644 (file)
 #define __NR_preadv             295
 #define __NR_pwritev            296
 #define __NR_rt_tgsigqueueinfo  297
-#define __NR_perf_counter_open  298
+#define __NR_perf_event_open    298
 
 #endif /* __VKI_SCNUMS_AMD64_LINUX_H */
 
index 223565321c898b6ee4d5ed07bf88fa6a4896e81d..b98cfbb9b984c34eb8e3ee8c93a0038531a6ff0a 100644 (file)
 #define __NR_dup3               316
 #define __NR_pipe2              317
 #define __NR_inotify_init1      318
-#define __NR_perf_counter_open  319
+#define __NR_perf_event_open    319
 #define __NR_preadv             320
 #define __NR_pwritev            321
 #define __NR_rt_tgsigqueueinfo  322
index e019e6f54d1f4e9ff44b315c77ed408d669e276d..83dcbb3231995c6c387107c20d37e1e9baccb708 100644 (file)
 #define __NR_dup3               316
 #define __NR_pipe2              317
 #define __NR_inotify_init1      318
-#define __NR_perf_counter_open  319
+#define __NR_perf_event_open    319
 #define __NR_preadv             320
 #define __NR_pwritev            321
 #define __NR_rt_tgsigqueueinfo  322
index f1942775af3ba8eec43e29bf75bfcd291a5f884d..e53ca257c4f1ae97d9c416047da7ce3bd0aaf17b 100644 (file)
 #define __NR_preadv             333
 #define __NR_pwritev            334
 #define __NR_rt_tgsigqueueinfo  335
-#define __NR_perf_counter_open  336
+#define __NR_perf_event_open   336
 
 #endif /* __VKI_SCNUMS_X86_LINUX_H */