sewardj | 4eee476 | 2006-10-14 15:51:32 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
njn | f11335a | 2009-05-20 04:09:38 +0000 | [diff] [blame] | 3 | /*--- Syscall numbers and related operations. pub_tool_vkiscnums.h ---*/ |
sewardj | 4eee476 | 2006-10-14 15:51:32 +0000 | [diff] [blame] | 4 | /*--------------------------------------------------------------------*/ |
| 5 | |
| 6 | /* |
| 7 | This file is part of Valgrind, a dynamic binary instrumentation |
| 8 | framework. |
| 9 | |
sewardj | 9eecbbb | 2010-05-03 21:37:12 +0000 | [diff] [blame] | 10 | Copyright (C) 2005-2010 Nicholas Nethercote |
sewardj | 4eee476 | 2006-10-14 15:51:32 +0000 | [diff] [blame] | 11 | njn@valgrind.org |
sewardj | 9eecbbb | 2010-05-03 21:37:12 +0000 | [diff] [blame] | 12 | Copyright (C) 2006-2010 OpenWorks LLP |
sewardj | 4eee476 | 2006-10-14 15:51:32 +0000 | [diff] [blame] | 13 | info@open-works.co.uk |
| 14 | |
| 15 | This program is free software; you can redistribute it and/or |
| 16 | modify it under the terms of the GNU General Public License as |
| 17 | published by the Free Software Foundation; either version 2 of the |
| 18 | License, or (at your option) any later version. |
| 19 | |
| 20 | This program is distributed in the hope that it will be useful, but |
| 21 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 23 | General Public License for more details. |
| 24 | |
| 25 | You should have received a copy of the GNU General Public License |
| 26 | along with this program; if not, write to the Free Software |
| 27 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 28 | 02111-1307, USA. |
| 29 | |
| 30 | The GNU General Public License is contained in the file COPYING. |
| 31 | */ |
| 32 | |
sewardj | 4eee476 | 2006-10-14 15:51:32 +0000 | [diff] [blame] | 33 | #ifndef __PUB_TOOL_VKISCNUMS_H |
| 34 | #define __PUB_TOOL_VKISCNUMS_H |
| 35 | |
njn | 1a1e95c | 2009-06-03 06:50:06 +0000 | [diff] [blame] | 36 | #include "pub_tool_vkiscnums_asm.h" |
sewardj | 9c606bd | 2008-09-18 18:12:50 +0000 | [diff] [blame] | 37 | |
sewardj | 9c606bd | 2008-09-18 18:12:50 +0000 | [diff] [blame] | 38 | |
njn | 1a1e95c | 2009-06-03 06:50:06 +0000 | [diff] [blame] | 39 | // This converts a syscall number into a string, suitable for printing. It is |
| 40 | // needed because some platforms (AIX, Darwin) munge sysnums in various ways. |
| 41 | // It is used in places where the sycall name will be printed alongside. |
| 42 | extern Char* VG_(sysnum_string) (Word sysnum, SizeT n_buf, Char* buf); |
sewardj | 9c606bd | 2008-09-18 18:12:50 +0000 | [diff] [blame] | 43 | |
njn | 1a1e95c | 2009-06-03 06:50:06 +0000 | [diff] [blame] | 44 | // This is like VG_(sysnum_string), but prints extra info if needed. It is |
| 45 | // called in places where the syscall name will *not* be printed alongside. |
| 46 | extern Char* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, Char* buf); |
sewardj | 9c606bd | 2008-09-18 18:12:50 +0000 | [diff] [blame] | 47 | |
njn | 1a1e95c | 2009-06-03 06:50:06 +0000 | [diff] [blame] | 48 | // Macros that make the above functions easier to use by declaring a local |
| 49 | // buffer. |
| 50 | #define VG_SYSNUM_STRING(sysnum) \ |
| 51 | ({ Char qq_zz_buf[32]; VG_(sysnum_string)(sysnum, 32, qq_zz_buf); }) |
| 52 | #define VG_SYSNUM_STRING_EXTRA(sysnum) \ |
| 53 | ({ Char qq_zz_buf[64]; VG_(sysnum_string_extra)(sysnum, 64, qq_zz_buf); }) |
| 54 | |
| 55 | |
| 56 | #if defined(VGO_linux) |
| 57 | // Nothing. |
| 58 | |
| 59 | #elif defined(VGO_aix5) |
| 60 | // See the AIX5-specific case in pub_tool_vkiscnums_asm.h for an |
| 61 | // explanation of why we include this here rather than there. |
sewardj | 4eee476 | 2006-10-14 15:51:32 +0000 | [diff] [blame] | 62 | # include "vki/vki-scnums-aix5.h" |
sewardj | 9c606bd | 2008-09-18 18:12:50 +0000 | [diff] [blame] | 63 | |
njn | 1a1e95c | 2009-06-03 06:50:06 +0000 | [diff] [blame] | 64 | #elif defined(VGO_darwin) |
| 65 | // Nothing. |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 66 | |
sewardj | 4eee476 | 2006-10-14 15:51:32 +0000 | [diff] [blame] | 67 | #else |
njn | 1a1e95c | 2009-06-03 06:50:06 +0000 | [diff] [blame] | 68 | # error Unknown OS |
sewardj | 4eee476 | 2006-10-14 15:51:32 +0000 | [diff] [blame] | 69 | #endif |
| 70 | |
| 71 | #endif // __PUB_TOOL_VKISCNUMS_H |
| 72 | |
| 73 | /*--------------------------------------------------------------------*/ |
| 74 | /*--- end ---*/ |
| 75 | /*--------------------------------------------------------------------*/ |