syscall_emul.cc (9375:ecfd5607d5e9) syscall_emul.cc (9455:31afddc29cd4)
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;

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

846 // but for our pthread library any non-zero value will work
847 return 1;
848 } else {
849 fatal("Called sys_clone, but no unallocated thread contexts found!\n");
850 return 0;
851 }
852}
853
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;

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

846 // but for our pthread library any non-zero value will work
847 return 1;
848 } else {
849 fatal("Called sys_clone, but no unallocated thread contexts found!\n");
850 return 0;
851 }
852}
853
854SyscallReturn
855accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc)
856{
857 int index = 0;
858
859 string path;
860 if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
861 return (TheISA::IntReg)-EFAULT;
862
863 // Adjust path for current working directory
864 path = p->fullPath(path);
865
866 mode_t mode = p->getSyscallArg(tc, index);
867
868 int result = access(path.c_str(), mode);
869 return (result == -1) ? -errno : result;
870}