Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl> |
| 3 | * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> |
| 4 | * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com> |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 5 | * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl> |
Roland McGrath | e1e584b | 2003-06-02 19:18:58 +0000 | [diff] [blame] | 6 | * Copyright (c) 2000 PocketPenguins Inc. Linux for Hitachi SuperH |
| 7 | * port by Greg Banks <gbanks@pocketpenguins.com> |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 8 | * All rights reserved. |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or without |
| 11 | * modification, are permitted provided that the following conditions |
| 12 | * are met: |
| 13 | * 1. Redistributions of source code must retain the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer. |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in the |
| 17 | * documentation and/or other materials provided with the distribution. |
| 18 | * 3. The name of the author may not be used to endorse or promote products |
| 19 | * derived from this software without specific prior written permission. |
| 20 | * |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | * |
| 32 | * $Id$ |
| 33 | */ |
| 34 | |
| 35 | #include "defs.h" |
| 36 | |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 37 | #ifdef LINUX |
Roland McGrath | 05cdd3c | 2004-03-02 06:16:59 +0000 | [diff] [blame] | 38 | #include <asm/mman.h> |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 39 | #endif |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 40 | #include <sys/mman.h> |
Wichert Akkerman | 5daa028 | 1999-03-15 19:49:42 +0000 | [diff] [blame] | 41 | |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 42 | #if defined(LINUX) && defined(I386) |
Wichert Akkerman | 8bc6cfd | 1999-04-21 15:57:38 +0000 | [diff] [blame] | 43 | #include <asm/ldt.h> |
Roland McGrath | 7decfb2 | 2004-03-01 22:10:52 +0000 | [diff] [blame] | 44 | # ifdef HAVE_STRUCT_USER_DESC |
| 45 | # define modify_ldt_ldt_s user_desc |
| 46 | # endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 47 | #endif |
Roland McGrath | f5a4777 | 2003-06-26 22:40:42 +0000 | [diff] [blame] | 48 | #if defined(LINUX) && defined(SH64) |
Roland McGrath | e1e584b | 2003-06-02 19:18:58 +0000 | [diff] [blame] | 49 | #include <asm/page.h> /* for PAGE_SHIFT */ |
| 50 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 51 | |
John Hughes | 70623be | 2001-03-08 13:59:00 +0000 | [diff] [blame] | 52 | #ifdef HAVE_LONG_LONG_OFF_T |
| 53 | /* |
| 54 | * Ugly hacks for systems that have a long long off_t |
| 55 | */ |
| 56 | #define sys_mmap64 sys_mmap |
| 57 | #endif |
| 58 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 59 | int |
| 60 | sys_brk(tcp) |
| 61 | struct tcb *tcp; |
| 62 | { |
| 63 | if (entering(tcp)) { |
| 64 | tprintf("%#lx", tcp->u_arg[0]); |
| 65 | } |
Wichert Akkerman | 5daa028 | 1999-03-15 19:49:42 +0000 | [diff] [blame] | 66 | #ifdef LINUX |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 67 | return RVAL_HEX; |
| 68 | #else |
| 69 | return 0; |
| 70 | #endif |
| 71 | } |
| 72 | |
| 73 | int |
| 74 | sys_sbrk(tcp) |
| 75 | struct tcb *tcp; |
| 76 | { |
| 77 | if (entering(tcp)) { |
| 78 | tprintf("%lu", tcp->u_arg[0]); |
| 79 | } |
| 80 | return RVAL_HEX; |
| 81 | } |
| 82 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 83 | static const struct xlat mmap_prot[] = { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 84 | { PROT_NONE, "PROT_NONE", }, |
| 85 | { PROT_READ, "PROT_READ" }, |
| 86 | { PROT_WRITE, "PROT_WRITE" }, |
| 87 | { PROT_EXEC, "PROT_EXEC" }, |
Roland McGrath | 47eb0e2 | 2003-09-25 23:06:04 +0000 | [diff] [blame] | 88 | #ifdef PROT_SEM |
| 89 | { PROT_SEM, "PROT_SEM" }, |
| 90 | #endif |
| 91 | #ifdef PROT_GROWSDOWN |
| 92 | { PROT_GROWSDOWN,"PROT_GROWSDOWN"}, |
| 93 | #endif |
| 94 | #ifdef PROT_GROWSUP |
| 95 | { PROT_GROWSUP, "PROT_GROWSUP" }, |
| 96 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 97 | { 0, NULL }, |
| 98 | }; |
| 99 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 100 | static const struct xlat mmap_flags[] = { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 101 | { MAP_SHARED, "MAP_SHARED" }, |
| 102 | { MAP_PRIVATE, "MAP_PRIVATE" }, |
| 103 | { MAP_FIXED, "MAP_FIXED" }, |
| 104 | #ifdef MAP_ANONYMOUS |
| 105 | { MAP_ANONYMOUS,"MAP_ANONYMOUS" }, |
| 106 | #endif |
| 107 | #ifdef MAP_RENAME |
| 108 | { MAP_RENAME, "MAP_RENAME" }, |
| 109 | #endif |
| 110 | #ifdef MAP_NORESERVE |
| 111 | { MAP_NORESERVE,"MAP_NORESERVE" }, |
| 112 | #endif |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 113 | #ifdef MAP_POPULATE |
| 114 | { MAP_POPULATE, "MAP_POPULATE" }, |
| 115 | #endif |
| 116 | #ifdef MAP_NONBLOCK |
| 117 | { MAP_NONBLOCK, "MAP_NONBLOCK" }, |
| 118 | #endif |
Wichert Akkerman | 8829a55 | 1999-06-11 13:18:40 +0000 | [diff] [blame] | 119 | /* |
| 120 | * XXX - this was introduced in SunOS 4.x to distinguish between |
| 121 | * the old pre-4.x "mmap()", which: |
| 122 | * |
| 123 | * only let you map devices with an "mmap" routine (e.g., |
| 124 | * frame buffers) in; |
| 125 | * |
| 126 | * required you to specify the mapping address; |
| 127 | * |
| 128 | * returned 0 on success and -1 on failure; |
| 129 | * |
| 130 | * memory and which, and the 4.x "mmap()" which: |
| 131 | * |
| 132 | * can map plain files; |
| 133 | * |
| 134 | * can be asked to pick where to map the file; |
| 135 | * |
| 136 | * returns the address where it mapped the file on success |
| 137 | * and -1 on failure. |
| 138 | * |
| 139 | * It's not actually used in source code that calls "mmap()"; the |
| 140 | * "mmap()" routine adds it for you. |
| 141 | * |
| 142 | * It'd be nice to come up with some way of eliminating it from |
| 143 | * the flags, e.g. reporting calls *without* it as "old_mmap()" |
| 144 | * and calls with it as "mmap()". |
| 145 | */ |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 146 | #ifdef _MAP_NEW |
| 147 | { _MAP_NEW, "_MAP_NEW" }, |
| 148 | #endif |
| 149 | #ifdef MAP_GROWSDOWN |
| 150 | { MAP_GROWSDOWN,"MAP_GROWSDOWN" }, |
| 151 | #endif |
| 152 | #ifdef MAP_DENYWRITE |
| 153 | { MAP_DENYWRITE,"MAP_DENYWRITE" }, |
| 154 | #endif |
| 155 | #ifdef MAP_EXECUTABLE |
| 156 | { MAP_EXECUTABLE,"MAP_EXECUTABLE"}, |
| 157 | #endif |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 158 | #ifdef MAP_INHERIT |
| 159 | { MAP_INHERIT,"MAP_INHERIT" }, |
| 160 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 161 | #ifdef MAP_FILE |
| 162 | { MAP_FILE,"MAP_FILE"}, |
| 163 | #endif |
| 164 | #ifdef MAP_LOCKED |
| 165 | { MAP_LOCKED,"MAP_LOCKED"}, |
| 166 | #endif |
Wichert Akkerman | bf79f2e | 2000-09-01 21:03:06 +0000 | [diff] [blame] | 167 | /* FreeBSD ones */ |
| 168 | #ifdef MAP_ANON |
| 169 | { MAP_ANON, "MAP_ANON" }, |
| 170 | #endif |
| 171 | #ifdef MAP_HASSEMAPHORE |
| 172 | { MAP_HASSEMAPHORE, "MAP_HASSEMAPHORE" }, |
| 173 | #endif |
| 174 | #ifdef MAP_STACK |
| 175 | { MAP_STACK, "MAP_STACK" }, |
| 176 | #endif |
| 177 | #ifdef MAP_NOSYNC |
| 178 | { MAP_NOSYNC, "MAP_NOSYNC" }, |
| 179 | #endif |
| 180 | #ifdef MAP_NOCORE |
| 181 | { MAP_NOCORE, "MAP_NOCORE" }, |
| 182 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 183 | { 0, NULL }, |
| 184 | }; |
| 185 | |
John Hughes | 70623be | 2001-03-08 13:59:00 +0000 | [diff] [blame] | 186 | #if !HAVE_LONG_LONG_OFF_T |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 187 | static |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 188 | int |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 189 | print_mmap(tcp,u_arg) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 190 | struct tcb *tcp; |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 191 | long *u_arg; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 192 | { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 193 | if (entering(tcp)) { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 194 | /* addr */ |
Wichert Akkerman | 8829a55 | 1999-06-11 13:18:40 +0000 | [diff] [blame] | 195 | if (!u_arg[0]) |
| 196 | tprintf("NULL, "); |
| 197 | else |
| 198 | tprintf("%#lx, ", u_arg[0]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 199 | /* len */ |
| 200 | tprintf("%lu, ", u_arg[1]); |
| 201 | /* prot */ |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 202 | printflags(mmap_prot, u_arg[2], "PROT_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 203 | tprintf(", "); |
| 204 | /* flags */ |
Wichert Akkerman | bf79f2e | 2000-09-01 21:03:06 +0000 | [diff] [blame] | 205 | #ifdef MAP_TYPE |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 206 | printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???"); |
| 207 | addflags(mmap_flags, u_arg[3] & ~MAP_TYPE); |
Wichert Akkerman | bf79f2e | 2000-09-01 21:03:06 +0000 | [diff] [blame] | 208 | #else |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 209 | printflags(mmap_flags, u_arg[3], "MAP_???"); |
Wichert Akkerman | bf79f2e | 2000-09-01 21:03:06 +0000 | [diff] [blame] | 210 | #endif |
Michal Ludvig | 0e03550 | 2002-09-23 15:41:01 +0000 | [diff] [blame] | 211 | /* fd (is always int, not long) */ |
| 212 | tprintf(", %d, ", (int)u_arg[4]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 213 | /* offset */ |
| 214 | tprintf("%#lx", u_arg[5]); |
| 215 | } |
| 216 | return RVAL_HEX; |
| 217 | } |
| 218 | |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 219 | #ifdef LINUX |
| 220 | int sys_old_mmap(tcp) |
| 221 | struct tcb *tcp; |
| 222 | { |
| 223 | long u_arg[6]; |
| 224 | |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 225 | #if defined(IA64) |
Wichert Akkerman | 12f75d1 | 2000-02-14 16:23:40 +0000 | [diff] [blame] | 226 | int i, v; |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 227 | /* |
| 228 | * IA64 processes never call this routine, they only use the |
| 229 | * new `sys_mmap' interface. This code converts the integer |
| 230 | * arguments that the IA32 process pushed onto the stack into |
| 231 | * longs. |
| 232 | * |
| 233 | * Note that addresses with bit 31 set will be sign extended. |
| 234 | * Fortunately, those addresses are not currently being generated |
| 235 | * for IA32 processes so it's not a problem. |
| 236 | */ |
| 237 | for (i = 0; i < 6; i++) |
| 238 | if (umove(tcp, tcp->u_arg[0] + (i * sizeof(int)), &v) == -1) |
| 239 | return 0; |
| 240 | else |
| 241 | u_arg[i] = v; |
Roland McGrath | f5a4777 | 2003-06-26 22:40:42 +0000 | [diff] [blame] | 242 | #elif defined(SH) || defined(SH64) |
Roland McGrath | 6b1d43e | 2003-03-31 01:05:01 +0000 | [diff] [blame] | 243 | /* SH has always passed the args in registers */ |
| 244 | int i; |
| 245 | for (i=0; i<6; i++) |
| 246 | u_arg[i] = tcp->u_arg[i]; |
| 247 | #else |
Roland McGrath | 520e21f | 2005-07-05 09:50:18 +0000 | [diff] [blame^] | 248 | # if defined(X86_64) |
| 249 | if (current_personality == 1) { |
| 250 | int i; |
| 251 | for (i = 0; i < 6; ++i) { |
| 252 | unsigned int val; |
| 253 | if (umove(tcp, tcp->u_arg[0] + i * 4, &val) == -1) |
| 254 | return 0; |
| 255 | u_arg[i] = val; |
| 256 | } |
| 257 | } |
| 258 | else |
| 259 | # endif |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 260 | if (umoven(tcp, tcp->u_arg[0], sizeof u_arg, (char *) u_arg) == -1) |
| 261 | return 0; |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 262 | #endif // defined(IA64) |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 263 | return print_mmap(tcp, u_arg); |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 264 | |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 265 | } |
| 266 | #endif |
| 267 | |
| 268 | int |
| 269 | sys_mmap(tcp) |
| 270 | struct tcb *tcp; |
| 271 | { |
Roland McGrath | f5a4777 | 2003-06-26 22:40:42 +0000 | [diff] [blame] | 272 | #if defined(LINUX) && defined(SH64) |
Roland McGrath | e1e584b | 2003-06-02 19:18:58 +0000 | [diff] [blame] | 273 | /* |
| 274 | * Old mmap differs from new mmap in specifying the |
| 275 | * offset in units of bytes rather than pages. We |
| 276 | * pretend it's in byte units so the user only ever |
| 277 | * sees bytes in the printout. |
| 278 | */ |
| 279 | tcp->u_arg[5] <<= PAGE_SHIFT; |
| 280 | #endif |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 281 | return print_mmap(tcp, tcp->u_arg); |
| 282 | } |
John Hughes | 70623be | 2001-03-08 13:59:00 +0000 | [diff] [blame] | 283 | #endif /* !HAVE_LONG_LONG_OFF_T */ |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 284 | |
John Hughes | 70623be | 2001-03-08 13:59:00 +0000 | [diff] [blame] | 285 | #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T |
John Hughes | bdf48f5 | 2001-03-06 15:08:09 +0000 | [diff] [blame] | 286 | int |
| 287 | sys_mmap64(tcp) |
| 288 | struct tcb *tcp; |
| 289 | { |
| 290 | #ifdef linux |
| 291 | #ifdef ALPHA |
| 292 | long *u_arg = tcp->u_arg; |
| 293 | #else /* !ALPHA */ |
| 294 | long u_arg[7]; |
| 295 | #endif /* !ALPHA */ |
| 296 | #else /* !linux */ |
| 297 | long *u_arg = tcp->u_arg; |
| 298 | #endif /* !linux */ |
| 299 | |
| 300 | if (entering(tcp)) { |
| 301 | #ifdef linux |
| 302 | #ifndef ALPHA |
| 303 | if (umoven(tcp, tcp->u_arg[0], sizeof u_arg, |
| 304 | (char *) u_arg) == -1) |
| 305 | return 0; |
| 306 | #endif /* ALPHA */ |
| 307 | #endif /* linux */ |
John Hughes | 5a826b8 | 2001-03-07 13:21:24 +0000 | [diff] [blame] | 308 | ALIGN64 (tcp, 5); /* FreeBSD wierdies */ |
John Hughes | bdf48f5 | 2001-03-06 15:08:09 +0000 | [diff] [blame] | 309 | |
| 310 | /* addr */ |
| 311 | tprintf("%#lx, ", u_arg[0]); |
| 312 | /* len */ |
| 313 | tprintf("%lu, ", u_arg[1]); |
| 314 | /* prot */ |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 315 | printflags(mmap_prot, u_arg[2], "PROT_???"); |
John Hughes | bdf48f5 | 2001-03-06 15:08:09 +0000 | [diff] [blame] | 316 | tprintf(", "); |
| 317 | /* flags */ |
John Hughes | 5a826b8 | 2001-03-07 13:21:24 +0000 | [diff] [blame] | 318 | #ifdef MAP_TYPE |
John Hughes | bdf48f5 | 2001-03-06 15:08:09 +0000 | [diff] [blame] | 319 | printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???"); |
| 320 | addflags(mmap_flags, u_arg[3] & ~MAP_TYPE); |
John Hughes | 5a826b8 | 2001-03-07 13:21:24 +0000 | [diff] [blame] | 321 | #else |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 322 | printflags(mmap_flags, u_arg[3], "MAP_???"); |
John Hughes | 5a826b8 | 2001-03-07 13:21:24 +0000 | [diff] [blame] | 323 | #endif |
John Hughes | bdf48f5 | 2001-03-06 15:08:09 +0000 | [diff] [blame] | 324 | /* fd */ |
| 325 | tprintf(", %ld, ", u_arg[4]); |
| 326 | /* offset */ |
John Hughes | 0c79e01 | 2001-03-08 14:40:06 +0000 | [diff] [blame] | 327 | tprintf("%#llx", LONG_LONG(u_arg[5], u_arg[6])); |
John Hughes | bdf48f5 | 2001-03-06 15:08:09 +0000 | [diff] [blame] | 328 | } |
| 329 | return RVAL_HEX; |
| 330 | } |
| 331 | #endif |
| 332 | |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 333 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 334 | int |
| 335 | sys_munmap(tcp) |
| 336 | struct tcb *tcp; |
| 337 | { |
| 338 | if (entering(tcp)) { |
| 339 | tprintf("%#lx, %lu", |
| 340 | tcp->u_arg[0], tcp->u_arg[1]); |
| 341 | } |
| 342 | return 0; |
| 343 | } |
| 344 | |
| 345 | int |
| 346 | sys_mprotect(tcp) |
| 347 | struct tcb *tcp; |
| 348 | { |
| 349 | if (entering(tcp)) { |
| 350 | tprintf("%#lx, %lu, ", |
| 351 | tcp->u_arg[0], tcp->u_arg[1]); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 352 | printflags(mmap_prot, tcp->u_arg[2], "PROT_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 353 | } |
| 354 | return 0; |
| 355 | } |
| 356 | |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 357 | #ifdef LINUX |
| 358 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 359 | static const struct xlat mremap_flags[] = { |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 360 | { MREMAP_MAYMOVE, "MREMAP_MAYMOVE" }, |
| 361 | { 0, NULL } |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 362 | }; |
| 363 | |
| 364 | int |
| 365 | sys_mremap(tcp) |
| 366 | struct tcb *tcp; |
| 367 | { |
| 368 | if (entering(tcp)) { |
| 369 | tprintf("%#lx, %lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1], |
| 370 | tcp->u_arg[2]); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 371 | printflags(mremap_flags, tcp->u_arg[3], "MREMAP_???"); |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 372 | } |
| 373 | return RVAL_HEX; |
| 374 | } |
| 375 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 376 | static const struct xlat madvise_flags[] = { |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 377 | #ifdef MADV_NORMAL |
| 378 | { MADV_NORMAL, "MADV_NORMAL" }, |
| 379 | #endif |
| 380 | #ifdef MADZV_RANDOM |
| 381 | { MADV_RANDOM, "MADV_RANDOM" }, |
| 382 | #endif |
| 383 | #ifdef MADV_SEQUENTIAL |
| 384 | { MADV_SEQUENTIAL, "MADV_SEQUENTIAL" }, |
| 385 | #endif |
| 386 | #ifdef MADV_WILLNEED |
| 387 | { MADV_WILLNEED, "MADV_WILLNEED" }, |
| 388 | #endif |
| 389 | #ifdef MADV_DONTNED |
| 390 | { MADV_DONTNEED, "MADV_DONTNEED" }, |
| 391 | #endif |
| 392 | { 0, NULL }, |
| 393 | }; |
| 394 | |
| 395 | |
| 396 | int |
| 397 | sys_madvise(tcp) |
| 398 | struct tcb *tcp; |
| 399 | { |
| 400 | if (entering(tcp)) { |
| 401 | tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 402 | printflags(madvise_flags, tcp->u_arg[2], "MADV_???"); |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 403 | } |
| 404 | return 0; |
| 405 | } |
| 406 | |
| 407 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 408 | static const struct xlat mlockall_flags[] = { |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 409 | #ifdef MCL_CURRENT |
| 410 | { MCL_CURRENT, "MCL_CURRENT" }, |
| 411 | #endif |
| 412 | #ifdef MCL_FUTURE |
| 413 | { MCL_FUTURE, "MCL_FUTURE" }, |
| 414 | #endif |
| 415 | { 0, NULL} |
| 416 | }; |
| 417 | |
| 418 | int |
| 419 | sys_mlockall(tcp) |
| 420 | struct tcb *tcp; |
| 421 | { |
| 422 | if (entering(tcp)) { |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 423 | printflags(mlockall_flags, tcp->u_arg[0], "MCL_???"); |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 424 | } |
| 425 | return 0; |
| 426 | } |
| 427 | |
| 428 | |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 429 | #endif /* LINUX */ |
| 430 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 431 | #ifdef MS_ASYNC |
| 432 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 433 | static const struct xlat mctl_sync[] = { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 434 | #ifdef MS_SYNC |
| 435 | { MS_SYNC, "MS_SYNC" }, |
| 436 | #endif |
John Hughes | aca07f3 | 2001-10-16 18:12:27 +0000 | [diff] [blame] | 437 | { MS_ASYNC, "MS_ASYNC" }, |
| 438 | { MS_INVALIDATE,"MS_INVALIDATE" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 439 | { 0, NULL }, |
| 440 | }; |
| 441 | |
| 442 | int |
| 443 | sys_msync(tcp) |
| 444 | struct tcb *tcp; |
| 445 | { |
| 446 | if (entering(tcp)) { |
| 447 | /* addr */ |
| 448 | tprintf("%#lx", tcp->u_arg[0]); |
| 449 | /* len */ |
| 450 | tprintf(", %lu, ", tcp->u_arg[1]); |
| 451 | /* flags */ |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 452 | printflags(mctl_sync, tcp->u_arg[2], "MS_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 453 | } |
| 454 | return 0; |
| 455 | } |
| 456 | |
| 457 | #endif /* MS_ASYNC */ |
| 458 | |
| 459 | #ifdef MC_SYNC |
| 460 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 461 | static const struct xlat mctl_funcs[] = { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 462 | { MC_LOCK, "MC_LOCK" }, |
| 463 | { MC_LOCKAS, "MC_LOCKAS" }, |
| 464 | { MC_SYNC, "MC_SYNC" }, |
| 465 | { MC_UNLOCK, "MC_UNLOCK" }, |
| 466 | { MC_UNLOCKAS, "MC_UNLOCKAS" }, |
| 467 | { 0, NULL }, |
| 468 | }; |
| 469 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 470 | static const struct xlat mctl_lockas[] = { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 471 | { MCL_CURRENT, "MCL_CURRENT" }, |
| 472 | { MCL_FUTURE, "MCL_FUTURE" }, |
| 473 | { 0, NULL }, |
| 474 | }; |
| 475 | |
| 476 | int |
| 477 | sys_mctl(tcp) |
| 478 | struct tcb *tcp; |
| 479 | { |
| 480 | int arg, function; |
| 481 | |
| 482 | if (entering(tcp)) { |
| 483 | /* addr */ |
| 484 | tprintf("%#lx", tcp->u_arg[0]); |
| 485 | /* len */ |
| 486 | tprintf(", %lu, ", tcp->u_arg[1]); |
| 487 | /* function */ |
| 488 | function = tcp->u_arg[2]; |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 489 | printflags(mctl_funcs, function, "MC_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 490 | /* arg */ |
| 491 | arg = tcp->u_arg[3]; |
| 492 | tprintf(", "); |
| 493 | switch (function) { |
| 494 | case MC_SYNC: |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 495 | printflags(mctl_sync, arg, "MS_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 496 | break; |
| 497 | case MC_LOCKAS: |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 498 | printflags(mctl_lockas, arg, "MCL_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 499 | break; |
| 500 | default: |
| 501 | tprintf("%#x", arg); |
| 502 | break; |
| 503 | } |
| 504 | } |
| 505 | return 0; |
| 506 | } |
| 507 | |
| 508 | #endif /* MC_SYNC */ |
| 509 | |
| 510 | int |
| 511 | sys_mincore(tcp) |
| 512 | struct tcb *tcp; |
| 513 | { |
Roland McGrath | 46100d0 | 2005-06-01 18:55:42 +0000 | [diff] [blame] | 514 | unsigned long i, len; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 515 | char *vec = NULL; |
| 516 | |
| 517 | if (entering(tcp)) { |
| 518 | tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); |
| 519 | } else { |
| 520 | len = tcp->u_arg[1]; |
| 521 | if (syserror(tcp) || tcp->u_arg[2] == 0 || |
Roland McGrath | 46100d0 | 2005-06-01 18:55:42 +0000 | [diff] [blame] | 522 | (vec = malloc(len)) == NULL || |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 523 | umoven(tcp, tcp->u_arg[2], len, vec) < 0) |
| 524 | tprintf("%#lx", tcp->u_arg[2]); |
| 525 | else { |
| 526 | tprintf("["); |
| 527 | for (i = 0; i < len; i++) { |
| 528 | if (abbrev(tcp) && i >= max_strlen) { |
| 529 | tprintf("..."); |
| 530 | break; |
| 531 | } |
| 532 | tprintf((vec[i] & 1) ? "1" : "0"); |
| 533 | } |
| 534 | tprintf("]"); |
| 535 | } |
| 536 | if (vec) |
| 537 | free(vec); |
| 538 | } |
| 539 | return 0; |
| 540 | } |
| 541 | |
| 542 | int |
| 543 | sys_getpagesize(tcp) |
| 544 | struct tcb *tcp; |
| 545 | { |
| 546 | if (exiting(tcp)) |
| 547 | return RVAL_HEX; |
| 548 | return 0; |
| 549 | } |
| 550 | |
| 551 | #if defined(LINUX) && defined(__i386__) |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 552 | void |
Roland McGrath | 34e4a69 | 2002-12-15 23:58:17 +0000 | [diff] [blame] | 553 | print_ldt_entry (ldt_entry) |
| 554 | struct modify_ldt_ldt_s *ldt_entry; |
| 555 | { |
| 556 | tprintf("base_addr:%#08lx, " |
| 557 | "limit:%d, " |
| 558 | "seg_32bit:%d, " |
| 559 | "contents:%d, " |
| 560 | "read_exec_only:%d, " |
| 561 | "limit_in_pages:%d, " |
| 562 | "seg_not_present:%d, " |
| 563 | "useable:%d}", |
| 564 | ldt_entry->base_addr, |
| 565 | ldt_entry->limit, |
| 566 | ldt_entry->seg_32bit, |
| 567 | ldt_entry->contents, |
| 568 | ldt_entry->read_exec_only, |
| 569 | ldt_entry->limit_in_pages, |
| 570 | ldt_entry->seg_not_present, |
| 571 | ldt_entry->useable); |
| 572 | } |
| 573 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 574 | int |
| 575 | sys_modify_ldt(tcp) |
| 576 | struct tcb *tcp; |
| 577 | { |
| 578 | if (entering(tcp)) { |
| 579 | struct modify_ldt_ldt_s copy; |
| 580 | tprintf("%ld", tcp->u_arg[0]); |
| 581 | if (tcp->u_arg[1] == 0 |
| 582 | || tcp->u_arg[2] != sizeof (struct modify_ldt_ldt_s) |
| 583 | || umove(tcp, tcp->u_arg[1], ©) == -1) |
| 584 | tprintf(", %lx", tcp->u_arg[1]); |
| 585 | else { |
| 586 | tprintf(", {entry_number:%d, ", copy.entry_number); |
| 587 | if (!verbose(tcp)) |
| 588 | tprintf("...}"); |
| 589 | else { |
Roland McGrath | 34e4a69 | 2002-12-15 23:58:17 +0000 | [diff] [blame] | 590 | print_ldt_entry(©); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 591 | } |
| 592 | } |
| 593 | tprintf(", %lu", tcp->u_arg[2]); |
| 594 | } |
| 595 | return 0; |
| 596 | } |
Roland McGrath | 34e4a69 | 2002-12-15 23:58:17 +0000 | [diff] [blame] | 597 | |
| 598 | int |
| 599 | sys_set_thread_area(tcp) |
| 600 | struct tcb *tcp; |
| 601 | { |
| 602 | struct modify_ldt_ldt_s copy; |
| 603 | if (entering(tcp)) { |
| 604 | if (umove(tcp, tcp->u_arg[0], ©) != -1) { |
| 605 | if (copy.entry_number == -1) |
| 606 | tprintf("{entry_number:%d -> ", |
| 607 | copy.entry_number); |
| 608 | else |
| 609 | tprintf("{entry_number:"); |
| 610 | } |
| 611 | } else { |
| 612 | if (umove(tcp, tcp->u_arg[0], ©) != -1) { |
| 613 | tprintf("%d, ", copy.entry_number); |
| 614 | if (!verbose(tcp)) |
| 615 | tprintf("...}"); |
| 616 | else { |
| 617 | print_ldt_entry(©); |
| 618 | } |
| 619 | } else { |
| 620 | tprintf("%lx", tcp->u_arg[0]); |
| 621 | } |
| 622 | } |
| 623 | return 0; |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 624 | |
Roland McGrath | 34e4a69 | 2002-12-15 23:58:17 +0000 | [diff] [blame] | 625 | } |
| 626 | |
| 627 | int |
| 628 | sys_get_thread_area(tcp) |
| 629 | struct tcb *tcp; |
| 630 | { |
| 631 | struct modify_ldt_ldt_s copy; |
| 632 | if (exiting(tcp)) { |
| 633 | if (umove(tcp, tcp->u_arg[0], ©) != -1) { |
| 634 | tprintf("{entry_number:%d, ", copy.entry_number); |
| 635 | if (!verbose(tcp)) |
| 636 | tprintf("...}"); |
| 637 | else { |
| 638 | print_ldt_entry(©); |
| 639 | } |
| 640 | } else { |
| 641 | tprintf("%lx", tcp->u_arg[0]); |
| 642 | } |
| 643 | } |
| 644 | return 0; |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 645 | |
Roland McGrath | 34e4a69 | 2002-12-15 23:58:17 +0000 | [diff] [blame] | 646 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 647 | #endif /* LINUX && __i386__ */ |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 648 | |
| 649 | #if defined(LINUX) |
| 650 | int |
| 651 | sys_remap_file_pages(tcp) |
| 652 | struct tcb *tcp; |
| 653 | { |
| 654 | if (entering(tcp)) { |
| 655 | tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 656 | printflags(mmap_prot, tcp->u_arg[2], "PROT_???"); |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 657 | tprintf(", %lu, ", tcp->u_arg[3]); |
| 658 | #ifdef MAP_TYPE |
| 659 | printxval(mmap_flags, tcp->u_arg[4] & MAP_TYPE, "MAP_???"); |
| 660 | addflags(mmap_flags, tcp->u_arg[4] & ~MAP_TYPE); |
| 661 | #else |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 662 | printflags(mmap_flags, tcp->u_arg[4], "MAP_???"); |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 663 | #endif |
| 664 | } |
| 665 | return 0; |
| 666 | } |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 667 | |
| 668 | |
| 669 | #define MPOL_DEFAULT 0 |
| 670 | #define MPOL_PREFERRED 1 |
| 671 | #define MPOL_BIND 2 |
| 672 | #define MPOL_INTERLEAVE 3 |
| 673 | |
| 674 | #define MPOL_F_NODE (1<<0) |
| 675 | #define MPOL_F_ADDR (1<<1) |
| 676 | |
| 677 | #define MPOL_MF_STRICT (1<<0) |
| 678 | |
| 679 | |
| 680 | static const struct xlat policies[] = { |
| 681 | { MPOL_DEFAULT, "MPOL_DEFAULT" }, |
| 682 | { MPOL_PREFERRED, "MPOL_PREFERRED" }, |
| 683 | { MPOL_BIND, "MPOL_BIND" }, |
| 684 | { MPOL_INTERLEAVE, "MPOL_INTERLEAVE" }, |
| 685 | { 0, NULL } |
| 686 | }; |
| 687 | |
| 688 | static const struct xlat mbindflags[] = { |
| 689 | { MPOL_MF_STRICT, "MPOL_MF_STRICT" }, |
| 690 | { 0, NULL } |
| 691 | }; |
| 692 | |
| 693 | static const struct xlat mempolicyflags[] = { |
| 694 | { MPOL_F_NODE, "MPOL_F_NODE" }, |
| 695 | { MPOL_F_ADDR, "MPOL_F_ADDR" }, |
| 696 | { 0, NULL } |
| 697 | }; |
| 698 | |
| 699 | |
| 700 | static void |
| 701 | get_nodes(tcp, ptr, maxnodes, err) |
| 702 | struct tcb *tcp; |
| 703 | unsigned long ptr; |
| 704 | unsigned long maxnodes; |
| 705 | int err; |
| 706 | { |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 707 | unsigned long nlongs, size, end; |
| 708 | |
| 709 | nlongs = (maxnodes + 8 * sizeof(long) - 1) / (8 * sizeof(long)); |
| 710 | size = nlongs * sizeof(long); |
| 711 | end = ptr + size; |
| 712 | if (nlongs == 0 || ((err || verbose(tcp)) && (size * 8 == maxnodes) |
| 713 | && (end > ptr))) { |
| 714 | unsigned long n, cur, abbrev_end; |
| 715 | int failed = 0; |
| 716 | |
| 717 | if (abbrev(tcp)) { |
| 718 | abbrev_end = ptr + max_strlen * sizeof(long); |
| 719 | if (abbrev_end < ptr) |
| 720 | abbrev_end = end; |
| 721 | } else { |
| 722 | abbrev_end = end; |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 723 | } |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 724 | tprintf(", {"); |
| 725 | for (cur = ptr; cur < end; cur += sizeof(long)) { |
| 726 | if (cur > ptr) |
| 727 | tprintf(", "); |
| 728 | if (cur >= abbrev_end) { |
| 729 | tprintf("..."); |
| 730 | break; |
| 731 | } |
| 732 | if (umoven(tcp, cur, sizeof(n), (char *) &n) < 0) { |
| 733 | tprintf("?"); |
| 734 | failed = 1; |
| 735 | break; |
| 736 | } |
| 737 | tprintf("%#0*lx", (int) sizeof(long) * 2 + 2, n); |
| 738 | } |
| 739 | tprintf("}"); |
| 740 | if (failed) |
| 741 | tprintf(" %#lx", ptr); |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 742 | } else |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 743 | tprintf(", %#lx", ptr); |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 744 | tprintf(", %lu", maxnodes); |
| 745 | } |
| 746 | |
| 747 | int |
| 748 | sys_mbind(tcp) |
| 749 | struct tcb *tcp; |
| 750 | { |
| 751 | if (entering(tcp)) { |
| 752 | tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); |
| 753 | printxval(policies, tcp->u_arg[2], "MPOL_???"); |
| 754 | get_nodes(tcp, tcp->u_arg[3], tcp->u_arg[4], 0); |
| 755 | tprintf(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 756 | printflags(mbindflags, tcp->u_arg[5], "MPOL_???"); |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 757 | } |
| 758 | return 0; |
| 759 | } |
| 760 | |
| 761 | int |
| 762 | sys_set_mempolicy(tcp) |
| 763 | struct tcb *tcp; |
| 764 | { |
| 765 | if (entering(tcp)) { |
| 766 | printxval(policies, tcp->u_arg[0], "MPOL_???"); |
| 767 | get_nodes(tcp, tcp->u_arg[1], tcp->u_arg[2], 0); |
| 768 | } |
| 769 | return 0; |
| 770 | } |
| 771 | |
| 772 | int |
| 773 | sys_get_mempolicy(tcp) |
| 774 | struct tcb *tcp; |
| 775 | { |
| 776 | if (exiting(tcp)) { |
| 777 | int pol; |
| 778 | if (tcp->u_arg[0] == 0) |
| 779 | tprintf("NULL"); |
| 780 | else if (syserror(tcp) || umove(tcp, tcp->u_arg[0], &pol) < 0) |
| 781 | tprintf("%#lx", tcp->u_arg[0]); |
| 782 | else |
| 783 | printxval(policies, pol, "MPOL_???"); |
| 784 | get_nodes(tcp, tcp->u_arg[1], tcp->u_arg[2], syserror(tcp)); |
| 785 | tprintf(", %#lx, ", tcp->u_arg[3]); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 786 | printflags(mempolicyflags, tcp->u_arg[4], "MPOL_???"); |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 787 | } |
| 788 | return 0; |
| 789 | } |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 790 | #endif |