syscall_emul.cc (3112:76b70de314b6) syscall_emul.cc (3114:7a4771b9b720)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 35 unchanged lines hidden (view full) ---

44#include "sim/process.hh"
45
46#include "sim/sim_exit.hh"
47
48using namespace std;
49using namespace TheISA;
50
51void
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 35 unchanged lines hidden (view full) ---

44#include "sim/process.hh"
45
46#include "sim/sim_exit.hh"
47
48using namespace std;
49using namespace TheISA;
50
51void
52SyscallDesc::doSyscall(int callnum, Process *process, ThreadContext *tc)
52SyscallDesc::doSyscall(int callnum, LiveProcess *process, ThreadContext *tc)
53{
54 DPRINTFR(SyscallVerbose, "%d: %s: syscall %s called w/arguments %d,%d,%d,%d\n",
55 curTick,tc->getCpuPtr()->name(), name,
56 tc->getSyscallArg(0),tc->getSyscallArg(1),
57 tc->getSyscallArg(2),tc->getSyscallArg(3));
58
59 SyscallReturn retval = (*funcPtr)(this, callnum, process, tc);
60
61 DPRINTFR(SyscallVerbose, "%d: %s: syscall %s returns %d\n",
62 curTick,tc->getCpuPtr()->name(), name, retval.value());
63
64 if (!(flags & SyscallDesc::SuppressReturnValue))
65 tc->setSyscallReturn(retval);
66}
67
68
69SyscallReturn
53{
54 DPRINTFR(SyscallVerbose, "%d: %s: syscall %s called w/arguments %d,%d,%d,%d\n",
55 curTick,tc->getCpuPtr()->name(), name,
56 tc->getSyscallArg(0),tc->getSyscallArg(1),
57 tc->getSyscallArg(2),tc->getSyscallArg(3));
58
59 SyscallReturn retval = (*funcPtr)(this, callnum, process, tc);
60
61 DPRINTFR(SyscallVerbose, "%d: %s: syscall %s returns %d\n",
62 curTick,tc->getCpuPtr()->name(), name, retval.value());
63
64 if (!(flags & SyscallDesc::SuppressReturnValue))
65 tc->setSyscallReturn(retval);
66}
67
68
69SyscallReturn
70unimplementedFunc(SyscallDesc *desc, int callnum, Process *process,
70unimplementedFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
71 ThreadContext *tc)
72{
73 fatal("syscall %s (#%d) unimplemented.", desc->name, callnum);
74
75 return 1;
76}
77
78
79SyscallReturn
71 ThreadContext *tc)
72{
73 fatal("syscall %s (#%d) unimplemented.", desc->name, callnum);
74
75 return 1;
76}
77
78
79SyscallReturn
80ignoreFunc(SyscallDesc *desc, int callnum, Process *process,
80ignoreFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
81 ThreadContext *tc)
82{
83 warn("ignoring syscall %s(%d, %d, ...)", desc->name,
84 tc->getSyscallArg(0), tc->getSyscallArg(1));
85
86 return 0;
87}
88
89
90SyscallReturn
81 ThreadContext *tc)
82{
83 warn("ignoring syscall %s(%d, %d, ...)", desc->name,
84 tc->getSyscallArg(0), tc->getSyscallArg(1));
85
86 return 0;
87}
88
89
90SyscallReturn
91exitFunc(SyscallDesc *desc, int callnum, Process *process,
91exitFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
92 ThreadContext *tc)
93{
94 if (tc->exit()) {
95 exitSimLoop("target called exit()", tc->getSyscallArg(0) & 0xff);
96 }
97
98 return 1;
99}
100
101
102SyscallReturn
92 ThreadContext *tc)
93{
94 if (tc->exit()) {
95 exitSimLoop("target called exit()", tc->getSyscallArg(0) & 0xff);
96 }
97
98 return 1;
99}
100
101
102SyscallReturn
103getpagesizeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
103getpagesizeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
104{
105 return (int)VMPageSize;
106}
107
108
109SyscallReturn
104{
105 return (int)VMPageSize;
106}
107
108
109SyscallReturn
110obreakFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
110obreakFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
111{
112 Addr junk;
113
114 // change brk addr to first arg
115 Addr new_brk = tc->getSyscallArg(0);
116 if (new_brk != 0) {
117 for (ChunkGenerator gen(p->brk_point, new_brk - p->brk_point,
118 VMPageSize); !gen.done(); gen.next()) {

--- 4 unchanged lines hidden (view full) ---

123 p->brk_point = new_brk;
124 }
125 DPRINTF(SyscallVerbose, "Break Point changed to: %#X\n", p->brk_point);
126 return p->brk_point;
127}
128
129
130SyscallReturn
111{
112 Addr junk;
113
114 // change brk addr to first arg
115 Addr new_brk = tc->getSyscallArg(0);
116 if (new_brk != 0) {
117 for (ChunkGenerator gen(p->brk_point, new_brk - p->brk_point,
118 VMPageSize); !gen.done(); gen.next()) {

--- 4 unchanged lines hidden (view full) ---

123 p->brk_point = new_brk;
124 }
125 DPRINTF(SyscallVerbose, "Break Point changed to: %#X\n", p->brk_point);
126 return p->brk_point;
127}
128
129
130SyscallReturn
131closeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
131closeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
132{
133 int target_fd = tc->getSyscallArg(0);
134 int status = close(p->sim_fd(target_fd));
135 if (status >= 0)
136 p->free_fd(target_fd);
137 return status;
138}
139
140
141SyscallReturn
132{
133 int target_fd = tc->getSyscallArg(0);
134 int status = close(p->sim_fd(target_fd));
135 if (status >= 0)
136 p->free_fd(target_fd);
137 return status;
138}
139
140
141SyscallReturn
142readFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
142readFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
143{
144 int fd = p->sim_fd(tc->getSyscallArg(0));
145 int nbytes = tc->getSyscallArg(2);
146 BufferArg bufArg(tc->getSyscallArg(1), nbytes);
147
148 int bytes_read = read(fd, bufArg.bufferPtr(), nbytes);
149
150 if (bytes_read != -1)
151 bufArg.copyOut(tc->getMemPort());
152
153 return bytes_read;
154}
155
156SyscallReturn
143{
144 int fd = p->sim_fd(tc->getSyscallArg(0));
145 int nbytes = tc->getSyscallArg(2);
146 BufferArg bufArg(tc->getSyscallArg(1), nbytes);
147
148 int bytes_read = read(fd, bufArg.bufferPtr(), nbytes);
149
150 if (bytes_read != -1)
151 bufArg.copyOut(tc->getMemPort());
152
153 return bytes_read;
154}
155
156SyscallReturn
157writeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
157writeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
158{
159 int fd = p->sim_fd(tc->getSyscallArg(0));
160 int nbytes = tc->getSyscallArg(2);
161 BufferArg bufArg(tc->getSyscallArg(1), nbytes);
162
163 bufArg.copyIn(tc->getMemPort());
164
165 int bytes_written = write(fd, bufArg.bufferPtr(), nbytes);
166
167 fsync(fd);
168
169 return bytes_written;
170}
171
172
173SyscallReturn
158{
159 int fd = p->sim_fd(tc->getSyscallArg(0));
160 int nbytes = tc->getSyscallArg(2);
161 BufferArg bufArg(tc->getSyscallArg(1), nbytes);
162
163 bufArg.copyIn(tc->getMemPort());
164
165 int bytes_written = write(fd, bufArg.bufferPtr(), nbytes);
166
167 fsync(fd);
168
169 return bytes_written;
170}
171
172
173SyscallReturn
174lseekFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
174lseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
175{
176 int fd = p->sim_fd(tc->getSyscallArg(0));
177 uint64_t offs = tc->getSyscallArg(1);
178 int whence = tc->getSyscallArg(2);
179
180 off_t result = lseek(fd, offs, whence);
181
182 return (result == (off_t)-1) ? -errno : result;
183}
184
185
186SyscallReturn
175{
176 int fd = p->sim_fd(tc->getSyscallArg(0));
177 uint64_t offs = tc->getSyscallArg(1);
178 int whence = tc->getSyscallArg(2);
179
180 off_t result = lseek(fd, offs, whence);
181
182 return (result == (off_t)-1) ? -errno : result;
183}
184
185
186SyscallReturn
187munmapFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
187munmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
188{
189 // given that we don't really implement mmap, munmap is really easy
190 return 0;
191}
192
193
194const char *hostname = "m5.eecs.umich.edu";
195
196SyscallReturn
188{
189 // given that we don't really implement mmap, munmap is really easy
190 return 0;
191}
192
193
194const char *hostname = "m5.eecs.umich.edu";
195
196SyscallReturn
197gethostnameFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
197gethostnameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
198{
199 int name_len = tc->getSyscallArg(1);
200 BufferArg name(tc->getSyscallArg(0), name_len);
201
202 strncpy((char *)name.bufferPtr(), hostname, name_len);
203
204 name.copyOut(tc->getMemPort());
205
206 return 0;
207}
208
209SyscallReturn
198{
199 int name_len = tc->getSyscallArg(1);
200 BufferArg name(tc->getSyscallArg(0), name_len);
201
202 strncpy((char *)name.bufferPtr(), hostname, name_len);
203
204 name.copyOut(tc->getMemPort());
205
206 return 0;
207}
208
209SyscallReturn
210unlinkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
210unlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
211{
212 string path;
213
214 if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0)))
215 return (TheISA::IntReg)-EFAULT;
216
217 int result = unlink(path.c_str());
218 return (result == -1) ? -errno : result;
219}
220
221SyscallReturn
211{
212 string path;
213
214 if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0)))
215 return (TheISA::IntReg)-EFAULT;
216
217 int result = unlink(path.c_str());
218 return (result == -1) ? -errno : result;
219}
220
221SyscallReturn
222renameFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
222renameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
223{
224 string old_name;
225
226 if (!tc->getMemPort()->tryReadString(old_name, tc->getSyscallArg(0)))
227 return -EFAULT;
228
229 string new_name;
230
231 if (!tc->getMemPort()->tryReadString(new_name, tc->getSyscallArg(1)))
232 return -EFAULT;
233
234 int64_t result = rename(old_name.c_str(), new_name.c_str());
235 return (result == -1) ? -errno : result;
236}
237
238SyscallReturn
223{
224 string old_name;
225
226 if (!tc->getMemPort()->tryReadString(old_name, tc->getSyscallArg(0)))
227 return -EFAULT;
228
229 string new_name;
230
231 if (!tc->getMemPort()->tryReadString(new_name, tc->getSyscallArg(1)))
232 return -EFAULT;
233
234 int64_t result = rename(old_name.c_str(), new_name.c_str());
235 return (result == -1) ? -errno : result;
236}
237
238SyscallReturn
239truncateFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
239truncateFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
240{
241 string path;
242
243 if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0)))
244 return -EFAULT;
245
246 off_t length = tc->getSyscallArg(1);
247
248 int result = truncate(path.c_str(), length);
249 return (result == -1) ? -errno : result;
250}
251
252SyscallReturn
240{
241 string path;
242
243 if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0)))
244 return -EFAULT;
245
246 off_t length = tc->getSyscallArg(1);
247
248 int result = truncate(path.c_str(), length);
249 return (result == -1) ? -errno : result;
250}
251
252SyscallReturn
253ftruncateFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc)
253ftruncateFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
254{
255 int fd = process->sim_fd(tc->getSyscallArg(0));
256
257 if (fd < 0)
258 return -EBADF;
259
260 off_t length = tc->getSyscallArg(1);
261
262 int result = ftruncate(fd, length);
263 return (result == -1) ? -errno : result;
264}
265
266SyscallReturn
254{
255 int fd = process->sim_fd(tc->getSyscallArg(0));
256
257 if (fd < 0)
258 return -EBADF;
259
260 off_t length = tc->getSyscallArg(1);
261
262 int result = ftruncate(fd, length);
263 return (result == -1) ? -errno : result;
264}
265
266SyscallReturn
267chownFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
267chownFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
268{
269 string path;
270
271 if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0)))
272 return -EFAULT;
273
274 /* XXX endianess */
275 uint32_t owner = tc->getSyscallArg(1);
276 uid_t hostOwner = owner;
277 uint32_t group = tc->getSyscallArg(2);
278 gid_t hostGroup = group;
279
280 int result = chown(path.c_str(), hostOwner, hostGroup);
281 return (result == -1) ? -errno : result;
282}
283
284SyscallReturn
268{
269 string path;
270
271 if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0)))
272 return -EFAULT;
273
274 /* XXX endianess */
275 uint32_t owner = tc->getSyscallArg(1);
276 uid_t hostOwner = owner;
277 uint32_t group = tc->getSyscallArg(2);
278 gid_t hostGroup = group;
279
280 int result = chown(path.c_str(), hostOwner, hostGroup);
281 return (result == -1) ? -errno : result;
282}
283
284SyscallReturn
285fchownFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc)
285fchownFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
286{
287 int fd = process->sim_fd(tc->getSyscallArg(0));
288
289 if (fd < 0)
290 return -EBADF;
291
292 /* XXX endianess */
293 uint32_t owner = tc->getSyscallArg(1);
294 uid_t hostOwner = owner;
295 uint32_t group = tc->getSyscallArg(2);
296 gid_t hostGroup = group;
297
298 int result = fchown(fd, hostOwner, hostGroup);
299 return (result == -1) ? -errno : result;
300}
301
302
303SyscallReturn
286{
287 int fd = process->sim_fd(tc->getSyscallArg(0));
288
289 if (fd < 0)
290 return -EBADF;
291
292 /* XXX endianess */
293 uint32_t owner = tc->getSyscallArg(1);
294 uid_t hostOwner = owner;
295 uint32_t group = tc->getSyscallArg(2);
296 gid_t hostGroup = group;
297
298 int result = fchown(fd, hostOwner, hostGroup);
299 return (result == -1) ? -errno : result;
300}
301
302
303SyscallReturn
304dupFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc)
304dupFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
305{
306 int fd = process->sim_fd(tc->getSyscallArg(0));
307
308 if (fd < 0)
309 return -EBADF;
310
311 int result = dup(fd);
312 return (result == -1) ? -errno : process->alloc_fd(result);
313}
314
315
316SyscallReturn
305{
306 int fd = process->sim_fd(tc->getSyscallArg(0));
307
308 if (fd < 0)
309 return -EBADF;
310
311 int result = dup(fd);
312 return (result == -1) ? -errno : process->alloc_fd(result);
313}
314
315
316SyscallReturn
317fcntlFunc(SyscallDesc *desc, int num, Process *process,
317fcntlFunc(SyscallDesc *desc, int num, LiveProcess *process,
318 ThreadContext *tc)
319{
320 int fd = tc->getSyscallArg(0);
321
322 if (fd < 0 || process->sim_fd(fd) < 0)
323 return -EBADF;
324
325 int cmd = tc->getSyscallArg(1);

--- 25 unchanged lines hidden (view full) ---

351
352 default:
353 warn("Unknown fcntl command %d\n", cmd);
354 return 0;
355 }
356}
357
358SyscallReturn
318 ThreadContext *tc)
319{
320 int fd = tc->getSyscallArg(0);
321
322 if (fd < 0 || process->sim_fd(fd) < 0)
323 return -EBADF;
324
325 int cmd = tc->getSyscallArg(1);

--- 25 unchanged lines hidden (view full) ---

351
352 default:
353 warn("Unknown fcntl command %d\n", cmd);
354 return 0;
355 }
356}
357
358SyscallReturn
359fcntl64Func(SyscallDesc *desc, int num, Process *process,
359fcntl64Func(SyscallDesc *desc, int num, LiveProcess *process,
360 ThreadContext *tc)
361{
362 int fd = tc->getSyscallArg(0);
363
364 if (fd < 0 || process->sim_fd(fd) < 0)
365 return -EBADF;
366
367 int cmd = tc->getSyscallArg(1);

--- 12 unchanged lines hidden (view full) ---

380 // to the underlying OS
381 warn("fcntl64(%d, %d) passed through to host\n", fd, cmd);
382 return fcntl(process->sim_fd(fd), cmd);
383 // return 0;
384 }
385}
386
387SyscallReturn
360 ThreadContext *tc)
361{
362 int fd = tc->getSyscallArg(0);
363
364 if (fd < 0 || process->sim_fd(fd) < 0)
365 return -EBADF;
366
367 int cmd = tc->getSyscallArg(1);

--- 12 unchanged lines hidden (view full) ---

380 // to the underlying OS
381 warn("fcntl64(%d, %d) passed through to host\n", fd, cmd);
382 return fcntl(process->sim_fd(fd), cmd);
383 // return 0;
384 }
385}
386
387SyscallReturn
388pipePseudoFunc(SyscallDesc *desc, int callnum, Process *process,
388pipePseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
389 ThreadContext *tc)
390{
391 int fds[2], sim_fds[2];
392 int pipe_retval = pipe(fds);
393
394 if (pipe_retval < 0) {
395 // error
396 return pipe_retval;

--- 5 unchanged lines hidden (view full) ---

402 // Alpha Linux convention for pipe() is that fd[0] is returned as
403 // the return value of the function, and fd[1] is returned in r20.
404 tc->setIntReg(SyscallPseudoReturnReg, sim_fds[1]);
405 return sim_fds[0];
406}
407
408
409SyscallReturn
389 ThreadContext *tc)
390{
391 int fds[2], sim_fds[2];
392 int pipe_retval = pipe(fds);
393
394 if (pipe_retval < 0) {
395 // error
396 return pipe_retval;

--- 5 unchanged lines hidden (view full) ---

402 // Alpha Linux convention for pipe() is that fd[0] is returned as
403 // the return value of the function, and fd[1] is returned in r20.
404 tc->setIntReg(SyscallPseudoReturnReg, sim_fds[1]);
405 return sim_fds[0];
406}
407
408
409SyscallReturn
410getpidPseudoFunc(SyscallDesc *desc, int callnum, Process *process,
410getpidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
411 ThreadContext *tc)
412{
413 // Make up a PID. There's no interprocess communication in
414 // fake_syscall mode, so there's no way for a process to know it's
415 // not getting a unique value.
416
411 ThreadContext *tc)
412{
413 // Make up a PID. There's no interprocess communication in
414 // fake_syscall mode, so there's no way for a process to know it's
415 // not getting a unique value.
416
417 tc->setIntReg(SyscallPseudoReturnReg, process->ppid);
418 return process->pid;
417 tc->setIntReg(SyscallPseudoReturnReg, process->ppid());
418 return process->pid();
419}
420
421
422SyscallReturn
419}
420
421
422SyscallReturn
423getuidPseudoFunc(SyscallDesc *desc, int callnum, Process *process,
423getuidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
424 ThreadContext *tc)
425{
426 // Make up a UID and EUID... it shouldn't matter, and we want the
427 // simulation to be deterministic.
428
429 // EUID goes in r20.
424 ThreadContext *tc)
425{
426 // Make up a UID and EUID... it shouldn't matter, and we want the
427 // simulation to be deterministic.
428
429 // EUID goes in r20.
430 tc->setIntReg(SyscallPseudoReturnReg, process->euid); //EUID
431 return process->uid; // UID
430 tc->setIntReg(SyscallPseudoReturnReg, process->euid()); //EUID
431 return process->uid(); // UID
432}
433
434
435SyscallReturn
432}
433
434
435SyscallReturn
436getgidPseudoFunc(SyscallDesc *desc, int callnum, Process *process,
436getgidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
437 ThreadContext *tc)
438{
439 // Get current group ID. EGID goes in r20.
437 ThreadContext *tc)
438{
439 // Get current group ID. EGID goes in r20.
440 tc->setIntReg(SyscallPseudoReturnReg, process->egid); //EGID
441 return process->gid;
440 tc->setIntReg(SyscallPseudoReturnReg, process->egid()); //EGID
441 return process->gid();
442}
443
444
445SyscallReturn
442}
443
444
445SyscallReturn
446setuidFunc(SyscallDesc *desc, int callnum, Process *process,
446setuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
447 ThreadContext *tc)
448{
449 // can't fathom why a benchmark would call this.
450 warn("Ignoring call to setuid(%d)\n", tc->getSyscallArg(0));
451 return 0;
452}
453
454SyscallReturn
447 ThreadContext *tc)
448{
449 // can't fathom why a benchmark would call this.
450 warn("Ignoring call to setuid(%d)\n", tc->getSyscallArg(0));
451 return 0;
452}
453
454SyscallReturn
455getpidFunc(SyscallDesc *desc, int callnum, Process *process,
455getpidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
456 ThreadContext *tc)
457{
458 // Make up a PID. There's no interprocess communication in
459 // fake_syscall mode, so there's no way for a process to know it's
460 // not getting a unique value.
461
456 ThreadContext *tc)
457{
458 // Make up a PID. There's no interprocess communication in
459 // fake_syscall mode, so there's no way for a process to know it's
460 // not getting a unique value.
461
462 tc->setIntReg(SyscallPseudoReturnReg, process->ppid); //PID
463 return process->pid;
462 tc->setIntReg(SyscallPseudoReturnReg, process->ppid()); //PID
463 return process->pid();
464}
465
466SyscallReturn
464}
465
466SyscallReturn
467getppidFunc(SyscallDesc *desc, int callnum, Process *process,
467getppidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
468 ThreadContext *tc)
469{
468 ThreadContext *tc)
469{
470 return process->ppid;
470 return process->ppid();
471}
472
473SyscallReturn
471}
472
473SyscallReturn
474getuidFunc(SyscallDesc *desc, int callnum, Process *process,
474getuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
475 ThreadContext *tc)
476{
475 ThreadContext *tc)
476{
477 return process->uid; // UID
477 return process->uid(); // UID
478}
479
480SyscallReturn
478}
479
480SyscallReturn
481geteuidFunc(SyscallDesc *desc, int callnum, Process *process,
481geteuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
482 ThreadContext *tc)
483{
482 ThreadContext *tc)
483{
484 return process->euid; // UID
484 return process->euid(); // UID
485}
486
487SyscallReturn
485}
486
487SyscallReturn
488getgidFunc(SyscallDesc *desc, int callnum, Process *process,
488getgidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
489 ThreadContext *tc)
490{
489 ThreadContext *tc)
490{
491 return process->gid;
491 return process->gid();
492}
493
494SyscallReturn
492}
493
494SyscallReturn
495getegidFunc(SyscallDesc *desc, int callnum, Process *process,
495getegidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
496 ThreadContext *tc)
497{
496 ThreadContext *tc)
497{
498 return process->egid;
498 return process->egid();
499}
500
501
499}
500
501