Deleted Added
sdiff udiff text old ( 4118:ddd23e5282d7 ) new ( 5282:2dba627b6646 )
full compact
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;

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

345 return (result == -1) ? -errno : result;
346}
347
348
349SyscallReturn
350dupFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
351{
352 int fd = process->sim_fd(tc->getSyscallArg(0));
353
354 if (fd < 0)
355 return -EBADF;
356
357 int result = dup(fd);
358 return (result == -1) ? -errno : process->alloc_fd(result);
359}
360
361
362SyscallReturn
363fcntlFunc(SyscallDesc *desc, int num, LiveProcess *process,
364 ThreadContext *tc)
365{
366 int fd = tc->getSyscallArg(0);

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

437 int fds[2], sim_fds[2];
438 int pipe_retval = pipe(fds);
439
440 if (pipe_retval < 0) {
441 // error
442 return pipe_retval;
443 }
444
445 sim_fds[0] = process->alloc_fd(fds[0]);
446 sim_fds[1] = process->alloc_fd(fds[1]);
447
448 // Alpha Linux convention for pipe() is that fd[0] is returned as
449 // the return value of the function, and fd[1] is returned in r20.
450 tc->setIntReg(SyscallPseudoReturnReg, sim_fds[1]);
451 return sim_fds[0];
452}
453
454
455SyscallReturn

--- 92 unchanged lines hidden ---