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; --- 715 unchanged lines hidden (view full) --- 724 /** 725 * Alpha Linux convention for pipe() is that fd[0] is returned as 726 * the return value of the function, and fd[1] is returned in r20. 727 */ 728 tc->setIntReg(SyscallPseudoReturnReg, tgt_fds[1]); 729 return sim_fds[0]; 730} 731 |
732SyscallReturn 733setpgidFunc(SyscallDesc *desc, int callnum, Process *process, 734 ThreadContext *tc) 735{ 736 int index = 0; 737 int pid = process->getSyscallArg(tc, index); 738 int pgid = process->getSyscallArg(tc, index); |
739 |
740 if (pgid < 0) 741 return -EINVAL; 742 743 if (pid == 0) { 744 process->setpgid(process->pid()); 745 return 0; 746 } 747 748 Process *matched_ph = NULL; 749 System *sysh = tc->getSystemPtr(); 750 751 // Retrieves process pointer from active/suspended thread contexts. 752 for (int i = 0; i < sysh->numContexts(); i++) { 753 if (sysh->threadContexts[i]->status() != ThreadContext::Halted) { 754 Process *temp_h = sysh->threadContexts[i]->getProcessPtr(); 755 Process *walk_ph = (Process*)temp_h; 756 757 if (walk_ph && walk_ph->pid() == process->pid()) 758 matched_ph = walk_ph; 759 } 760 } 761 762 assert(matched_ph != NULL); 763 matched_ph->setpgid((pgid == 0) ? matched_ph->pid() : pgid); 764 765 return 0; 766} 767 |
768SyscallReturn 769getpidPseudoFunc(SyscallDesc *desc, int callnum, Process *process, 770 ThreadContext *tc) 771{ 772 // Make up a PID. There's no interprocess communication in 773 // fake_syscall mode, so there's no way for a process to know it's 774 // not getting a unique value. 775 --- 34 unchanged lines hidden (view full) --- 810 warn("Ignoring call to setuid(%d)\n", process->getSyscallArg(tc, index)); 811 return 0; 812} 813 814SyscallReturn 815getpidFunc(SyscallDesc *desc, int callnum, Process *process, 816 ThreadContext *tc) 817{ |
818 return process->tgid(); 819} |
820 |
821SyscallReturn 822gettidFunc(SyscallDesc *desc, int callnum, Process *process, 823 ThreadContext *tc) 824{ |
825 return process->pid(); 826} 827 828SyscallReturn 829getppidFunc(SyscallDesc *desc, int callnum, Process *process, 830 ThreadContext *tc) 831{ 832 return process->ppid(); --- 160 unchanged lines hidden --- |