Create a new module, m_vkiscnums, and move all the system call numbers
into that. Mostly this means moving vki_unistd-<plat>.h to
include/vki/vki-scnums-<plat>.h.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6224 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am
index 4727318..8d216b3 100644
--- a/coregrind/Makefile.am
+++ b/coregrind/Makefile.am
@@ -108,11 +108,7 @@
pub_core_transtab.h \
pub_core_transtab_asm.h \
pub_core_ume.h \
- vki_unistd.h \
- vki_unistd-amd64-linux.h\
- vki_unistd-ppc32-linux.h\
- vki_unistd-ppc64-linux.h\
- vki_unistd-x86-linux.h \
+ pub_core_vkiscnums.h \
m_coredump/priv_elf.h \
m_debuginfo/priv_storage.h \
m_debuginfo/priv_readstabs.h \
@@ -166,6 +162,7 @@
m_translate.c \
m_transtab.c \
m_ume.c \
+ m_vkiscnums.c \
m_aspacemgr/aspacemgr.c \
m_debuginfo/storage.c \
m_debuginfo/readdwarf.c \
diff --git a/coregrind/m_aspacemgr/aspacemgr.c b/coregrind/m_aspacemgr/aspacemgr.c
index c410dec..0e857cd 100644
--- a/coregrind/m_aspacemgr/aspacemgr.c
+++ b/coregrind/m_aspacemgr/aspacemgr.c
@@ -48,7 +48,7 @@
#include "pub_core_options.h" // VG_(clo_sanity_level)
-#include "vki_unistd.h" // __NR_* constants
+#include "pub_core_vkiscnums.h" // __NR_* constants
#include "pub_core_aspacemgr.h" // self
diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c
index eb39e5d..5e4c5ed 100644
--- a/coregrind/m_libcassert.c
+++ b/coregrind/m_libcassert.c
@@ -38,7 +38,7 @@
#include "pub_core_syscall.h"
#include "pub_core_tooliface.h" // For VG_(details).{name,bug_reports_to}
#include "pub_core_options.h" // For VG_(clo_xml)
-#include "vki_unistd.h"
+#include "pub_core_vkiscnums.h"
/* ---------------------------------------------------------------------
Assertery.
diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c
index 4afe9cf..ec455841 100644
--- a/coregrind/m_libcfile.c
+++ b/coregrind/m_libcfile.c
@@ -36,7 +36,7 @@
#include "pub_core_libcproc.h" // VG_(getpid), VG_(getppid)
#include "pub_core_clientstate.h" // VG_(fd_hard_limit)
#include "pub_core_syscall.h"
-#include "vki_unistd.h"
+#include "pub_core_vkiscnums.h"
/* ---------------------------------------------------------------------
File stuff
diff --git a/coregrind/m_libcproc.c b/coregrind/m_libcproc.c
index d6fe29f..16efd4d 100644
--- a/coregrind/m_libcproc.c
+++ b/coregrind/m_libcproc.c
@@ -36,7 +36,7 @@
#include "pub_core_mallocfree.h"
#include "pub_core_syscall.h"
#include "pub_core_clientstate.h"
-#include "vki_unistd.h"
+#include "pub_core_vkiscnums.h"
/* ---------------------------------------------------------------------
Command line and environment stuff
diff --git a/coregrind/m_libcsignal.c b/coregrind/m_libcsignal.c
index c62220b..39c81cd 100644
--- a/coregrind/m_libcsignal.c
+++ b/coregrind/m_libcsignal.c
@@ -33,7 +33,7 @@
#include "pub_core_libcassert.h"
#include "pub_core_libcsignal.h"
#include "pub_core_syscall.h"
-#include "vki_unistd.h"
+#include "pub_core_vkiscnums.h"
/* sigemptyset, sigfullset, sigaddset and sigdelset return 0 on
success and -1 on error. */
diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c
index d50e9e2..c2f4333 100644
--- a/coregrind/m_scheduler/scheduler.c
+++ b/coregrind/m_scheduler/scheduler.c
@@ -81,7 +81,7 @@
#include "pub_core_tooliface.h"
#include "pub_core_translate.h" // For VG_(translate)()
#include "pub_core_transtab.h"
-#include "vki_unistd.h"
+#include "pub_core_vkiscnums.h"
#include "priv_sema.h"
/* #include "pub_core_debuginfo.h" */ // DEBUGGING HACK ONLY
diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c
index cb4153e..3ca1398 100644
--- a/coregrind/m_signals.c
+++ b/coregrind/m_signals.c
@@ -103,7 +103,7 @@
#include "pub_core_syswrap.h"
#include "pub_core_tooliface.h"
#include "pub_core_coredump.h"
-#include "vki_unistd.h"
+#include "pub_core_vkiscnums.h"
/* ---------------------------------------------------------------------
diff --git a/coregrind/m_syswrap/syscall-x86-linux.S b/coregrind/m_syswrap/syscall-x86-linux.S
index 117fa1f..7432edb 100644
--- a/coregrind/m_syswrap/syscall-x86-linux.S
+++ b/coregrind/m_syswrap/syscall-x86-linux.S
@@ -29,7 +29,7 @@
*/
#include "pub_core_basics_asm.h"
-#include "vki_unistd.h"
+#include "pub_core_vkiscnums.h"
#include "libvex_guest_offsets.h"
diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c
index 5801afc..3812e19 100644
--- a/coregrind/m_syswrap/syswrap-generic.c
+++ b/coregrind/m_syswrap/syswrap-generic.c
@@ -55,7 +55,7 @@
#include "priv_types_n_macros.h"
#include "priv_syswrap-generic.h"
-#include "vki_unistd.h" /* for the __NR_* constants */
+#include "pub_core_vkiscnums.h" /* for the __NR_* constants */
/* Returns True iff address range is something the client can
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 7a77445..de5e737 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -53,7 +53,7 @@
#include "priv_syswrap-generic.h"
#include "priv_syswrap-linux.h"
-#include "vki_unistd.h" /* for the __NR_* constants */
+#include "pub_core_vkiscnums.h" /* for the __NR_* constants */
// Run a thread from beginning to end and return the thread's
// scheduler-return-code.
diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
index 228fb47..a782af1 100644
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
@@ -58,7 +58,7 @@
#include "priv_syswrap-linux-variants.h" /* decls of linux variant wrappers */
#include "priv_syswrap-main.h"
-#include "vki_unistd.h" /* for the __NR_* constants */
+#include "pub_core_vkiscnums.h" /* for the __NR_* constants */
/* ---------------------------------------------------------------------
diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S
index a795a59..59f8588 100644
--- a/coregrind/m_trampoline.S
+++ b/coregrind/m_trampoline.S
@@ -29,7 +29,7 @@
*/
#include "pub_core_basics_asm.h"
-#include "vki_unistd.h"
+#include "pub_core_vkiscnums.h"
/* ------------------ SIMULATED CPU HELPERS ------------------ */
/*
diff --git a/coregrind/m_ume.c b/coregrind/m_ume.c
index e46a354..4ff5953 100644
--- a/coregrind/m_ume.c
+++ b/coregrind/m_ume.c
@@ -48,7 +48,7 @@
#include "pub_core_libcassert.h" // VG_(exit), vg_assert
#include "pub_core_mallocfree.h" // VG_(malloc), VG_(free)
#include "pub_core_syscall.h" // VG_(strerror)
-#include "vki_unistd.h" // mmap-related constants
+#include "pub_core_vkiscnums.h" // mmap-related constants
#include "pub_core_ume.h"
diff --git a/coregrind/vki_unistd.h b/coregrind/vki_unistd.h
deleted file mode 100644
index 934442d..0000000
--- a/coregrind/vki_unistd.h
+++ /dev/null
@@ -1,51 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Generic header for Valgrind's kernel interface. ---*/
-/*--- vki_unistd.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2005 Nicholas Nethercote
- njn@valgrind.org
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#ifndef __VKI_UNISTD_H
-#define __VKI_UNISTD_H
-
-#if defined(VGP_x86_linux)
-# include "vki_unistd-x86-linux.h"
-#elif defined(VGP_amd64_linux)
-# include "vki_unistd-amd64-linux.h"
-#elif defined(VGP_ppc32_linux)
-# include "vki_unistd-ppc32-linux.h"
-#elif defined(VGP_ppc64_linux)
-# include "vki_unistd-ppc64-linux.h"
-#else
-# error Unknown platform
-#endif
-
-#endif // __VKI_UNISTD_H
-
-/*--------------------------------------------------------------------*/
-/*--- end ---*/
-/*--------------------------------------------------------------------*/
diff --git a/include/Makefile.am b/include/Makefile.am
index 4fb93cb..0331635 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -28,13 +28,14 @@
pub_tool_stacktrace.h \
pub_tool_threadstate.h \
pub_tool_tooliface.h \
+ pub_tool_vkiscnums.h \
valgrind.h \
vki-linux.h \
vki-amd64-linux.h \
vki-ppc32-linux.h \
vki-ppc64-linux.h \
vki-x86-linux.h \
- vki_posixtypes-amd64-linux.h \
- vki_posixtypes-ppc32-linux.h \
- vki_posixtypes-ppc64-linux.h \
- vki_posixtypes-x86-linux.h
+ vki/vki-scnums-amd64-linux.h \
+ vki/vki-scnums-ppc32-linux.h \
+ vki/vki-scnums-ppc64-linux.h \
+ vki/vki-scnums-x86-linux.h
diff --git a/include/pub_tool_vkiscnums.h b/include/pub_tool_vkiscnums.h
new file mode 100644
index 0000000..f33c6b4
--- /dev/null
+++ b/include/pub_tool_vkiscnums.h
@@ -0,0 +1,73 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Top level for kernel interface system call numbers. ---*/
+/*--- pub_tool_vkiscnums.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2005-2006 Nicholas Nethercote
+ njn@valgrind.org
+ Copyright (C) 2006-2006 OpenWorks LLP
+ info@open-works.co.uk
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+/* This file defines the system call numbers.
+
+ On Linux they are a bunch of #define'd constants of the form
+ __NR_name, and this file must contain nothing else, since it will
+ be included in assembly code (m_trampoline.S).
+
+ On AIX the __NR_name consts are renamings of global variables which
+ tell us the number for each syscall. This elaboration is necessary
+ because on AIX the syscall numbers are not constant; they can be
+ different for each process (in principle; in practice they rarely
+ change). 32- and 64-bit AIX5 share a common "implementation".
+
+ This file is merely a top-level "steering" file, which pulls in the
+ correct bits for the relevant platform. You should not directly
+ #include any file in include/vki; instead #include only this one or
+ pub_core_vkiscnums.h.
+*/
+
+#ifndef __PUB_TOOL_VKISCNUMS_H
+#define __PUB_TOOL_VKISCNUMS_H
+
+#if defined(VGP_x86_linux)
+# include "vki/vki-scnums-x86-linux.h"
+#elif defined(VGP_amd64_linux)
+# include "vki/vki-scnums-amd64-linux.h"
+#elif defined(VGP_ppc32_linux)
+# include "vki/vki-scnums-ppc32-linux.h"
+#elif defined(VGP_ppc64_linux)
+# include "vki/vki-scnums-ppc64-linux.h"
+#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+# include "vki/vki-scnums-aix5.h"
+#else
+# error Unknown platform
+#endif
+
+#endif // __PUB_TOOL_VKISCNUMS_H
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
diff --git a/coregrind/vki_unistd-amd64-linux.h b/include/vki/vki-scnums-amd64-linux.h
similarity index 94%
rename from coregrind/vki_unistd-amd64-linux.h
rename to include/vki/vki-scnums-amd64-linux.h
index 617f6a3..c2d94de 100644
--- a/coregrind/vki_unistd-amd64-linux.h
+++ b/include/vki/vki-scnums-amd64-linux.h
@@ -1,4 +1,9 @@
+/*--------------------------------------------------------------------*/
+/*--- System call numbers for amd64-linux. ---*/
+/*--- vki-scnums-amd64-linux.h ---*/
+/*--------------------------------------------------------------------*/
+
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
@@ -24,8 +29,8 @@
The GNU General Public License is contained in the file COPYING.
*/
-#ifndef __VKI_UNISTD_AMD64_LINUX_H
-#define __VKI_UNISTD_AMD64_LINUX_H
+#ifndef __VKI_SCNUMS_AMD64_LINUX_H
+#define __VKI_SCNUMS_AMD64_LINUX_H
// From linux-2.6.9/include/asm-x86_64/unistd.h
@@ -356,4 +361,8 @@
#define __NR_sync_file_range 277
#define __NR_vmsplice 278
-#endif /* __VKI_UNISTD_AMD64_LINUX_H */
+#endif /* __VKI_SCNUMS_AMD64_LINUX_H */
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
diff --git a/coregrind/vki_unistd-ppc32-linux.h b/include/vki/vki-scnums-ppc32-linux.h
similarity index 92%
rename from coregrind/vki_unistd-ppc32-linux.h
rename to include/vki/vki-scnums-ppc32-linux.h
index b5c7e68..9ea8199 100644
--- a/coregrind/vki_unistd-ppc32-linux.h
+++ b/include/vki/vki-scnums-ppc32-linux.h
@@ -1,8 +1,14 @@
+
+/*--------------------------------------------------------------------*/
+/*--- System call numbers for ppc32-linux. ---*/
+/*--- vki-scnums-ppc32-linux.h ---*/
+/*--------------------------------------------------------------------*/
+
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
- Copyright (C) 2005 Julian Seward
+ Copyright (C) 2005-2006 Julian Seward
jseward@acm.org
This program is free software; you can redistribute it and/or
@@ -23,8 +29,8 @@
The GNU General Public License is contained in the file COPYING.
*/
-#ifndef __VKI_UNISTD_PPC32_LINUX_H
-#define __VKI_UNISTD_PPC32_LINUX_H
+#ifndef __VKI_SCNUMS_PPC32_LINUX_H
+#define __VKI_SCNUMS_PPC32_LINUX_H
// From linux-2.6.9/include/asm-ppc/unistd.h
@@ -340,4 +346,8 @@
#define __NR_syscalls 301
-#endif /* __VKI_UNISTD_PPC32_LINUX_H */
+#endif /* __VKI_SCNUMS_PPC32_LINUX_H */
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
diff --git a/coregrind/vki_unistd-ppc64-linux.h b/include/vki/vki-scnums-ppc64-linux.h
similarity index 94%
rename from coregrind/vki_unistd-ppc64-linux.h
rename to include/vki/vki-scnums-ppc64-linux.h
index 3748a6c..79f4481 100644
--- a/coregrind/vki_unistd-ppc64-linux.h
+++ b/include/vki/vki-scnums-ppc64-linux.h
@@ -1,9 +1,14 @@
+/*--------------------------------------------------------------------*/
+/*--- System call numbers for ppc64-linux. ---*/
+/*--- vki-scnums-ppc64-linux.h ---*/
+/*--------------------------------------------------------------------*/
+
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
- Copyright (C) 2005 Julian Seward
+ Copyright (C) 2005-2006 Julian Seward
jseward@acm.org
This program is free software; you can redistribute it and/or
@@ -24,8 +29,8 @@
The GNU General Public License is contained in the file COPYING.
*/
-#ifndef __VKI_UNISTD_PPC64_LINUX_H
-#define __VKI_UNISTD_PPC64_LINUX_H
+#ifndef __VKI_SCNUMS_PPC64_LINUX_H
+#define __VKI_SCNUMS_PPC64_LINUX_H
// From linux-2.6.16-rc4/include/asm-powerpc/unistd.h
@@ -331,4 +336,8 @@
#define __NR_get_robust_list 299
#define __NR_set_robust_list 300
-#endif /* __VKI_UNISTD_PPC64_LINUX_H */
+#endif /* __VKI_SCNUMS_PPC64_LINUX_H */
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
diff --git a/coregrind/vki_unistd-x86-linux.h b/include/vki/vki-scnums-x86-linux.h
similarity index 93%
rename from coregrind/vki_unistd-x86-linux.h
rename to include/vki/vki-scnums-x86-linux.h
index 60f2f2f..92473ec 100644
--- a/coregrind/vki_unistd-x86-linux.h
+++ b/include/vki/vki-scnums-x86-linux.h
@@ -1,4 +1,9 @@
+/*--------------------------------------------------------------------*/
+/*--- System call numbers for x86-linux. ---*/
+/*--- vki-scnums-x86-linux.h ---*/
+/*--------------------------------------------------------------------*/
+
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
@@ -24,8 +29,8 @@
The GNU General Public License is contained in the file COPYING.
*/
-#ifndef __VKI_UNISTD_X86_LINUX_H
-#define __VKI_UNISTD_X86_LINUX_H
+#ifndef __VKI_SCNUMS_X86_LINUX_H
+#define __VKI_SCNUMS_X86_LINUX_H
// From linux-2.6.9/include/asm-i386/unistd.h
@@ -347,4 +352,8 @@
#define __NR_tee 315
#define __NR_vmsplice 316
-#endif /* __VKI_UNISTD_X86_LINUX_H */
+#endif /* __VKI_SCNUMS_X86_LINUX_H */
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
diff --git a/memcheck/tests/x86/scalar.h b/memcheck/tests/x86/scalar.h
index 3fa86c9..072b9c6 100644
--- a/memcheck/tests/x86/scalar.h
+++ b/memcheck/tests/x86/scalar.h
@@ -1,4 +1,4 @@
-#include "../../../coregrind/vki_unistd-x86-linux.h"
+#include "../../../include/vki/vki-scnums-x86-linux.h"
#include <assert.h>
#include <errno.h>