Jakub Jelinek 0332e1
--- valgrind/coregrind/m_syswrap/priv_syswrap-linux.h	2009-10-27 21:31:49.852433085 +0100
Jakub Jelinek 0332e1
+++ valgrind/coregrind/m_syswrap/priv_syswrap-linux.h	2009-10-27 21:25:05.000000000 +0100
Jakub Jelinek 0332e1
@@ -47,6 +47,7 @@ extern SysRes ML_(do_fork_clone) ( Threa
Jakub Jelinek 0332e1
 DECL_TEMPLATE(linux, sys_mount);
Jakub Jelinek 0332e1
 DECL_TEMPLATE(linux, sys_oldumount);
Jakub Jelinek 0332e1
 DECL_TEMPLATE(linux, sys_umount);
Jakub Jelinek 0332e1
+DECL_TEMPLATE(linux, sys_perf_counter_open);
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 // POSIX, but various sub-cases differ between Linux and Darwin.
Jakub Jelinek 0332e1
 DECL_TEMPLATE(linux, sys_fcntl);
Jakub Jelinek 0332e1
--- valgrind/coregrind/m_syswrap/syswrap-amd64-linux.c	2009-10-27 21:31:49.852433085 +0100
Jakub Jelinek 0332e1
+++ valgrind/coregrind/m_syswrap/syswrap-amd64-linux.c	2009-10-27 21:25:05.000000000 +0100
Jakub Jelinek 0332e1
@@ -1375,7 +1375,12 @@ const SyscallTableEntry ML_(syscall_tabl
Jakub Jelinek 0332e1
    LINXY(__NR_epoll_create1,     sys_epoll_create1),    // 291
Jakub Jelinek 0332e1
    //   (__NR_dup3,              sys_ni_syscall)        // 292
Jakub Jelinek 0332e1
    LINXY(__NR_pipe2,             sys_pipe2),            // 293
Jakub Jelinek 0332e1
-   LINXY(__NR_inotify_init1,     sys_inotify_init1),     // 294
Jakub Jelinek 0332e1
+   LINXY(__NR_inotify_init1,     sys_inotify_init1),    // 294
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+   //   (__NR_preadv,            sys_ni_syscall)        // 295
Jakub Jelinek 0332e1
+   //   (__NR_pwritev,           sys_ni_syscall)        // 296
Jakub Jelinek 0332e1
+   //   (__NR_rt_tgsigqueueinfo, sys_ni_syscall)        // 297
Jakub Jelinek 0332e1
+   LINXY(__NR_perf_counter_open, sys_perf_counter_open) // 298
Jakub Jelinek 0332e1
 };
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 const UInt ML_(syscall_table_size) = 
Jakub Jelinek 0332e1
--- valgrind/coregrind/m_syswrap/syswrap-linux.c	2009-10-27 21:31:49.853433112 +0100
Jakub Jelinek 0332e1
+++ valgrind/coregrind/m_syswrap/syswrap-linux.c	2009-10-27 21:25:05.000000000 +0100
Jakub Jelinek 0332e1
@@ -2410,6 +2410,30 @@ PRE(sys_stime)
Jakub Jelinek 0332e1
    PRE_MEM_READ( "stime(t)", ARG1, sizeof(vki_time_t) );
Jakub Jelinek 0332e1
 }
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
+PRE(sys_perf_counter_open)
Jakub Jelinek 0332e1
+{
Jakub Jelinek 0332e1
+   PRINT("sys_perf_counter_open ( %#lx, %ld, %ld, %ld, %ld )",
Jakub Jelinek 0332e1
+         ARG1,ARG2,ARG3,ARG4,ARG5);
Jakub Jelinek 0332e1
+   PRE_REG_READ5(long, "perf_counter_open",
Jakub Jelinek 0332e1
+                 struct vki_perf_counter_attr *, attr,
Jakub Jelinek 0332e1
+                 vki_pid_t, pid, int, cpu, int, group_fd,
Jakub Jelinek 0332e1
+                 unsigned long, flags);
Jakub Jelinek 0332e1
+   PRE_MEM_READ( "perf_counter_open(attr)",
Jakub Jelinek 0332e1
+                 ARG1, sizeof(struct vki_perf_counter_attr) );
Jakub Jelinek 0332e1
+}
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+POST(sys_perf_counter_open)
Jakub Jelinek 0332e1
+{
Jakub Jelinek 0332e1
+   vg_assert(SUCCESS);
Jakub Jelinek 0332e1
+   if (!ML_(fd_allowed)(RES, "perf_counter_open", tid, True)) {
Jakub Jelinek 0332e1
+      VG_(close)(RES);
Jakub Jelinek 0332e1
+      SET_STATUS_Failure( VKI_EMFILE );
Jakub Jelinek 0332e1
+   } else {
Jakub Jelinek 0332e1
+      if (VG_(clo_track_fds))
Jakub Jelinek 0332e1
+         ML_(record_fd_open_nameless)(tid, RES);
Jakub Jelinek 0332e1
+   }
Jakub Jelinek 0332e1
+}
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
 /* ---------------------------------------------------------------------
Jakub Jelinek 0332e1
    utime wrapper
Jakub Jelinek 0332e1
    ------------------------------------------------------------------ */
Jakub Jelinek 0332e1
--- valgrind/coregrind/m_syswrap/syswrap-ppc32-linux.c	2009-10-27 21:31:49.855432715 +0100
Jakub Jelinek 0332e1
+++ valgrind/coregrind/m_syswrap/syswrap-ppc32-linux.c	2009-10-27 21:25:05.000000000 +0100
Jakub Jelinek 0332e1
@@ -1867,7 +1867,11 @@ const SyscallTableEntry ML_(syscall_tabl
Jakub Jelinek 0332e1
    LINXY(__NR_epoll_create1,     sys_epoll_create1),    // 315
Jakub Jelinek 0332e1
    //   (__NR_dup3,              sys_ni_syscall)        // 316
Jakub Jelinek 0332e1
    LINXY(__NR_pipe2,             sys_pipe2),            // 317
Jakub Jelinek 0332e1
-   LINX_(__NR_inotify_init1,     sys_inotify_init1)     // 318
Jakub Jelinek 0332e1
+   LINXY(__NR_inotify_init1,     sys_inotify_init1),    // 318
Jakub Jelinek 0332e1
+   LINXY(__NR_perf_counter_open, sys_perf_counter_open) // 319
Jakub Jelinek 0332e1
+   //   (__NR_preadv,            sys_ni_syscall)        // 320
Jakub Jelinek 0332e1
+   //   (__NR_pwritev,           sys_ni_syscall)        // 321
Jakub Jelinek 0332e1
+   //   (__NR_rt_tgsigqueueinfo, sys_ni_syscall)        // 322
Jakub Jelinek 0332e1
 };
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 const UInt ML_(syscall_table_size) = 
Jakub Jelinek 0332e1
--- valgrind/coregrind/m_syswrap/syswrap-ppc64-linux.c	2009-10-27 21:31:49.855432715 +0100
Jakub Jelinek 0332e1
+++ valgrind/coregrind/m_syswrap/syswrap-ppc64-linux.c	2009-10-27 21:25:05.000000000 +0100
Jakub Jelinek 0332e1
@@ -1191,10 +1191,10 @@ const SyscallTableEntry ML_(syscall_tabl
Jakub Jelinek 0332e1
    GENX_(__NR_rename,            sys_rename),             //  38
Jakub Jelinek 0332e1
    GENX_(__NR_mkdir,             sys_mkdir),              //  39
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
-// _____(__NR_rmdir,             sys_rmdir),              //  40
Jakub Jelinek 0332e1
+   GENX_(__NR_rmdir,             sys_rmdir),              //  40
Jakub Jelinek 0332e1
    GENXY(__NR_dup,               sys_dup),                //  41
Jakub Jelinek 0332e1
    LINXY(__NR_pipe,              sys_pipe),               //  42
Jakub Jelinek 0332e1
-   GENXY(__NR_times,             sys_times),              // 43
Jakub Jelinek 0332e1
+   GENXY(__NR_times,             sys_times),              //  43
Jakub Jelinek 0332e1
 // _____(__NR_prof,              sys_prof),               //  44
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
    GENX_(__NR_brk,               sys_brk),                //  45
Jakub Jelinek 0332e1
@@ -1355,7 +1355,7 @@ const SyscallTableEntry ML_(syscall_tabl
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 // _____(__NR_rt_sigpending,     sys_rt_sigpending),      // 175
Jakub Jelinek 0332e1
    LINXY(__NR_rt_sigtimedwait,   sys_rt_sigtimedwait),    // 176
Jakub Jelinek 0332e1
-// _____(__NR_rt_sigqueueinfo,   sys_rt_sigqueueinfo),    // 177
Jakub Jelinek 0332e1
+   LINXY(__NR_rt_sigqueueinfo,   sys_rt_sigqueueinfo),    // 177
Jakub Jelinek 0332e1
 // _____(__NR_rt_sigsuspend,     sys_rt_sigsuspend),      // 178
Jakub Jelinek 0332e1
    GENXY(__NR_pread64,           sys_pread64),            // 179
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
@@ -1507,7 +1507,11 @@ const SyscallTableEntry ML_(syscall_tabl
Jakub Jelinek 0332e1
    LINXY(__NR_epoll_create1,     sys_epoll_create1),    // 315
Jakub Jelinek 0332e1
    //   (__NR_dup3,              sys_ni_syscall)        // 316
Jakub Jelinek 0332e1
    LINXY(__NR_pipe2,             sys_pipe2),            // 317
Jakub Jelinek 0332e1
-   LINX_(__NR_inotify_init1,     sys_inotify_init1)     // 318
Jakub Jelinek 0332e1
+   LINXY(__NR_inotify_init1,     sys_inotify_init1),    // 318
Jakub Jelinek 0332e1
+   LINXY(__NR_perf_counter_open, sys_perf_counter_open) // 319
Jakub Jelinek 0332e1
+   //   (__NR_preadv,            sys_ni_syscall)        // 320
Jakub Jelinek 0332e1
+   //   (__NR_pwritev,           sys_ni_syscall)        // 321
Jakub Jelinek 0332e1
+   //   (__NR_rt_tgsigqueueinfo, sys_ni_syscall)        // 322
Jakub Jelinek 0332e1
 };
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 const UInt ML_(syscall_table_size) = 
Jakub Jelinek 0332e1
--- valgrind/coregrind/m_syswrap/syswrap-x86-linux.c	2009-10-27 21:31:49.854432906 +0100
Jakub Jelinek 0332e1
+++ valgrind/coregrind/m_syswrap/syswrap-x86-linux.c	2009-10-27 21:25:05.000000000 +0100
Jakub Jelinek 0332e1
@@ -2254,7 +2254,12 @@ const SyscallTableEntry ML_(syscall_tabl
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
    //   (__NR_dup3,              sys_ni_syscall)        // 330
Jakub Jelinek 0332e1
    LINXY(__NR_pipe2,             sys_pipe2),            // 331
Jakub Jelinek 0332e1
-   LINX_(__NR_inotify_init1,     sys_inotify_init1)     // 332
Jakub Jelinek 0332e1
+   LINXY(__NR_inotify_init1,     sys_inotify_init1),    // 332
Jakub Jelinek 0332e1
+   //   (__NR_preadv,            sys_ni_syscall)        // 333
Jakub Jelinek 0332e1
+   //   (__NR_pwritev,           sys_ni_syscall)        // 334
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+   //   (__NR_rt_tgsigqueueinfo, sys_ni_syscall)        // 335
Jakub Jelinek 0332e1
+   LINXY(__NR_perf_counter_open, sys_perf_counter_open) // 336
Jakub Jelinek 0332e1
 };
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 const UInt ML_(syscall_table_size) = 
Jakub Jelinek 0332e1
--- valgrind/include/vki/vki-linux.h	2009-08-19 15:37:07.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/include/vki/vki-linux.h	2009-10-27 21:50:13.000000000 +0100
Jakub Jelinek 0332e1
@@ -2570,6 +2570,57 @@ struct	vki_iwreq 
Jakub Jelinek 0332e1
 	union	vki_iwreq_data	u;
Jakub Jelinek 0332e1
 };
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
+/*--------------------------------------------------------------------*/
Jakub Jelinek 0332e1
+// From linux-2.6.31.5/include/linux/perf_counter.h
Jakub Jelinek 0332e1
+/*--------------------------------------------------------------------*/
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+struct vki_perf_counter_attr {
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+	/*
Jakub Jelinek 0332e1
+	 * Major type: hardware/software/tracepoint/etc.
Jakub Jelinek 0332e1
+	 */
Jakub Jelinek 0332e1
+	__vki_u32			type;
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+	/*
Jakub Jelinek 0332e1
+	 * Size of the attr structure, for fwd/bwd compat.
Jakub Jelinek 0332e1
+	 */
Jakub Jelinek 0332e1
+	__vki_u32			size;
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+	/*
Jakub Jelinek 0332e1
+	 * Type specific configuration information.
Jakub Jelinek 0332e1
+	 */
Jakub Jelinek 0332e1
+	__vki_u64			config;
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+	union {
Jakub Jelinek 0332e1
+		__vki_u64		sample_period;
Jakub Jelinek 0332e1
+		__vki_u64		sample_freq;
Jakub Jelinek 0332e1
+	};
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+	__vki_u64			sample_type;
Jakub Jelinek 0332e1
+	__vki_u64			read_format;
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+	__vki_u64			disabled       :  1, /* off by default        */
Jakub Jelinek 0332e1
+					inherit	       :  1, /* children inherit it   */
Jakub Jelinek 0332e1
+					pinned	       :  1, /* must always be on PMU */
Jakub Jelinek 0332e1
+					exclusive      :  1, /* only group on PMU     */
Jakub Jelinek 0332e1
+					exclude_user   :  1, /* don't count user      */
Jakub Jelinek 0332e1
+					exclude_kernel :  1, /* ditto kernel          */
Jakub Jelinek 0332e1
+					exclude_hv     :  1, /* ditto hypervisor      */
Jakub Jelinek 0332e1
+					exclude_idle   :  1, /* don't count when idle */
Jakub Jelinek 0332e1
+					mmap           :  1, /* include mmap data     */
Jakub Jelinek 0332e1
+					comm	       :  1, /* include comm data     */
Jakub Jelinek 0332e1
+					freq           :  1, /* use freq, not period  */
Jakub Jelinek 0332e1
+					inherit_stat   :  1, /* per task counts       */
Jakub Jelinek 0332e1
+					enable_on_exec :  1, /* next exec enables     */
Jakub Jelinek 0332e1
+					task           :  1, /* trace fork/exit       */
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+					__reserved_1   : 50;
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+	__vki_u32			wakeup_events;	/* wakeup every n events */
Jakub Jelinek 0332e1
+	__vki_u32			__reserved_2;
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+	__vki_u64			__reserved_3;
Jakub Jelinek 0332e1
+};
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 #endif // __VKI_LINUX_H
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
--- valgrind/include/vki/vki-scnums-amd64-linux.h	2009-08-19 15:37:07.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/include/vki/vki-scnums-amd64-linux.h	2009-10-27 21:50:13.000000000 +0100
Jakub Jelinek 0332e1
@@ -376,6 +376,10 @@
Jakub Jelinek 0332e1
 #define __NR_dup3               292
Jakub Jelinek 0332e1
 #define __NR_pipe2              293
Jakub Jelinek 0332e1
 #define __NR_inotify_init1      294
Jakub Jelinek 0332e1
+#define __NR_preadv             295
Jakub Jelinek 0332e1
+#define __NR_pwritev            296
Jakub Jelinek 0332e1
+#define __NR_rt_tgsigqueueinfo  297
Jakub Jelinek 0332e1
+#define __NR_perf_counter_open  298
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 #endif /* __VKI_SCNUMS_AMD64_LINUX_H */
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
--- valgrind/include/vki/vki-scnums-ppc32-linux.h	2009-08-19 15:37:07.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/include/vki/vki-scnums-ppc32-linux.h	2009-10-27 21:50:13.000000000 +0100
Jakub Jelinek 0332e1
@@ -361,6 +361,10 @@
Jakub Jelinek 0332e1
 #define __NR_dup3               316
Jakub Jelinek 0332e1
 #define __NR_pipe2              317
Jakub Jelinek 0332e1
 #define __NR_inotify_init1      318
Jakub Jelinek 0332e1
+#define __NR_perf_counter_open  319
Jakub Jelinek 0332e1
+#define __NR_preadv             320
Jakub Jelinek 0332e1
+#define __NR_pwritev            321
Jakub Jelinek 0332e1
+#define __NR_rt_tgsigqueueinfo  322
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 #endif /* __VKI_SCNUMS_PPC32_LINUX_H */
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
--- valgrind/include/vki/vki-scnums-ppc64-linux.h	2009-08-19 15:37:07.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/include/vki/vki-scnums-ppc64-linux.h	2009-10-27 21:50:13.000000000 +0100
Jakub Jelinek 0332e1
@@ -353,6 +353,10 @@
Jakub Jelinek 0332e1
 #define __NR_dup3               316
Jakub Jelinek 0332e1
 #define __NR_pipe2              317
Jakub Jelinek 0332e1
 #define __NR_inotify_init1      318
Jakub Jelinek 0332e1
+#define __NR_perf_counter_open  319
Jakub Jelinek 0332e1
+#define __NR_preadv             320
Jakub Jelinek 0332e1
+#define __NR_pwritev            321
Jakub Jelinek 0332e1
+#define __NR_rt_tgsigqueueinfo  322
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 #endif /* __VKI_SCNUMS_PPC64_LINUX_H */
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
diff -upr valgrind/include/vki/vki-scnums-x86-linux.h valgrind/include/vki/vki-scnums-x86-linux.h
Jakub Jelinek 0332e1
--- valgrind/include/vki/vki-scnums-x86-linux.h	2009-08-19 15:37:07.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/include/vki/vki-scnums-x86-linux.h	2009-10-27 21:50:13.000000000 +0100
Jakub Jelinek 0332e1
@@ -367,6 +367,10 @@
Jakub Jelinek 0332e1
 #define __NR_dup3               330
Jakub Jelinek 0332e1
 #define __NR_pipe2              331
Jakub Jelinek 0332e1
 #define __NR_inotify_init1      332
Jakub Jelinek 0332e1
+#define __NR_preadv             333
Jakub Jelinek 0332e1
+#define __NR_pwritev            334
Jakub Jelinek 0332e1
+#define __NR_rt_tgsigqueueinfo  335
Jakub Jelinek 0332e1
+#define __NR_perf_counter_open  336
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 #endif /* __VKI_SCNUMS_X86_LINUX_H */
Jakub Jelinek 0332e1