blob: f7fddcbb4d55c847e2d7eecbf89e1f72702da78a [file] [log] [blame]
sewardjad833942006-10-14 19:34:11 +00001
2/*--------------------------------------------------------------------*/
3/*--- Notional "implementation" for m_vkiscnums. ---*/
4/*--- m_vkiscnums.c ---*/
5/*--------------------------------------------------------------------*/
6
7/*
8 This file is part of Valgrind, a dynamic binary instrumentation
9 framework.
10
sewardj03f8d3f2012-08-05 15:46:46 +000011 Copyright (C) 2006-2012 OpenWorks LLP
sewardjad833942006-10-14 19:34:11 +000012 info@open-works.co.uk
13
14 This program is free software; you can redistribute it and/or
15 modify it under the terms of the GNU General Public License as
16 published by the Free Software Foundation; either version 2 of the
17 License, or (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
27 02111-1307, USA.
28
29 The GNU General Public License is contained in the file COPYING.
30*/
31
32#include "pub_core_basics.h"
njn1a1e95c2009-06-03 06:50:06 +000033#include "pub_core_libcassert.h"
34#include "pub_core_libcprint.h"
35
sewardjad833942006-10-14 19:34:11 +000036#include "pub_core_vkiscnums.h" /* self */
37
38/* We have pub_{core,tool}_vkiscnums.h. This is the matching implementation
39 for that interface.
40
41 On Linux, the interface exports a bunch of "#define __NR_foo 42" style
42 definitions, so there is no implementation.
sewardjad833942006-10-14 19:34:11 +000043*/
44
njn1a1e95c2009-06-03 06:50:06 +000045//---------------------------------------------------------------------------
46#if defined(VGO_linux)
47//---------------------------------------------------------------------------
48
floriandbb35842012-10-27 18:39:11 +000049HChar* VG_(sysnum_string)(Word sysnum, SizeT n_buf, HChar* buf)
njn1a1e95c2009-06-03 06:50:06 +000050{
51 VG_(snprintf)(buf, n_buf, "%3ld", sysnum);
52 return buf;
53}
54
floriandbb35842012-10-27 18:39:11 +000055HChar* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, HChar* buf)
njn1a1e95c2009-06-03 06:50:06 +000056{
57 return VG_(sysnum_string)(sysnum, n_buf, buf);
58}
59
60//---------------------------------------------------------------------------
njn1a1e95c2009-06-03 06:50:06 +000061#elif defined(VGO_darwin)
62//---------------------------------------------------------------------------
63
floriandbb35842012-10-27 18:39:11 +000064HChar* VG_(sysnum_string)(Word sysnum, SizeT n_buf, HChar* buf)
njn1a1e95c2009-06-03 06:50:06 +000065{
floriandbb35842012-10-27 18:39:11 +000066 const HChar* classname = NULL;
njn1a1e95c2009-06-03 06:50:06 +000067 switch (VG_DARWIN_SYSNO_CLASS(sysnum)) {
sewardj12445b82010-07-01 11:15:32 +000068 case VG_DARWIN_SYSCALL_CLASS_MACH: classname = "mach"; break;
69 case VG_DARWIN_SYSCALL_CLASS_UNIX: classname = "unix"; break;
70 case VG_DARWIN_SYSCALL_CLASS_MDEP: classname = "mdep"; break;
71 case VG_DARWIN_SYSCALL_CLASS_DIAG: classname = "diag"; break;
72 default: classname = "UNKNOWN"; break;
njn1a1e95c2009-06-03 06:50:06 +000073 }
74 VG_(snprintf)(buf, n_buf, "%s:%3ld",
75 classname, VG_DARWIN_SYSNO_INDEX(sysnum));
76 return buf;
77}
78
floriandbb35842012-10-27 18:39:11 +000079HChar* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, HChar* buf)
njn1a1e95c2009-06-03 06:50:06 +000080{
81 return VG_(sysnum_string)(sysnum, n_buf, buf);
82}
83
84//---------------------------------------------------------------------------
85#else
86//---------------------------------------------------------------------------
87# error Unknown OS
88#endif
sewardjad833942006-10-14 19:34:11 +000089
90/*--------------------------------------------------------------------*/
91/*--- end ---*/
92/*--------------------------------------------------------------------*/