syscall_emul.hh (10831:fbdaa08aaa42) syscall_emul.hh (10850:e4328e028961)
1/*
1/*
2 * Copyright (c) 2012-2013 ARM Limited
2 * Copyright (c) 2012-2013, 2015 ARM Limited
3 * Copyright (c) 2015 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating
9 * to a hardware implementation of the functionality of the software
10 * licensed hereunder. You may use the software subject to the license

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

710{
711 int index = 0;
712 int dirfd = process->getSyscallArg(tc, index);
713 if (dirfd != OS::TGT_AT_FDCWD)
714 warn("openat: first argument not AT_FDCWD; unlikely to work");
715 return readlinkFunc(desc, callnum, process, tc, 1);
716}
717
3 * Copyright (c) 2015 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating
9 * to a hardware implementation of the functionality of the software
10 * licensed hereunder. You may use the software subject to the license

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

710{
711 int index = 0;
712 int dirfd = process->getSyscallArg(tc, index);
713 if (dirfd != OS::TGT_AT_FDCWD)
714 warn("openat: first argument not AT_FDCWD; unlikely to work");
715 return readlinkFunc(desc, callnum, process, tc, 1);
716}
717
718/// Target renameat() handler.
719template <class OS>
720SyscallReturn
721renameatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
722 ThreadContext *tc)
723{
724 int index = 0;
725
726 int olddirfd = process->getSyscallArg(tc, index);
727 if (olddirfd != OS::TGT_AT_FDCWD)
728 warn("renameat: first argument not AT_FDCWD; unlikely to work");
729
730 std::string old_name;
731
732 if (!tc->getMemProxy().tryReadString(old_name,
733 process->getSyscallArg(tc, index)))
734 return -EFAULT;
735
736 int newdirfd = process->getSyscallArg(tc, index);
737 if (newdirfd != OS::TGT_AT_FDCWD)
738 warn("renameat: third argument not AT_FDCWD; unlikely to work");
739
740 std::string new_name;
741
742 if (!tc->getMemProxy().tryReadString(new_name,
743 process->getSyscallArg(tc, index)))
744 return -EFAULT;
745
746 // Adjust path for current working directory
747 old_name = process->fullPath(old_name);
748 new_name = process->fullPath(new_name);
749
750 int result = rename(old_name.c_str(), new_name.c_str());
751 return (result == -1) ? -errno : result;
752}
753
718/// Target sysinfo() handler.
719template <class OS>
720SyscallReturn
721sysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
722 ThreadContext *tc)
723{
724
725 int index = 0;

--- 752 unchanged lines hidden ---
754/// Target sysinfo() handler.
755template <class OS>
756SyscallReturn
757sysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
758 ThreadContext *tc)
759{
760
761 int index = 0;

--- 752 unchanged lines hidden ---