syscall_emul.hh (4189:8e5222bea9ba) syscall_emul.hh (5074:14404677893a)
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;

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

599 return -errno;
600
601 copyOutStatBuf<OS>(tc->getMemPort(), tc->getSyscallArg(1), &hostBuf);
602
603 return 0;
604}
605
606
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;

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

599 return -errno;
600
601 copyOutStatBuf<OS>(tc->getMemPort(), tc->getSyscallArg(1), &hostBuf);
602
603 return 0;
604}
605
606
607/// Target stat64() handler.
608template <class OS>
609SyscallReturn
610stat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
611 ThreadContext *tc)
612{
613 std::string path;
614
615 if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0)))
616 return -EFAULT;
617
618 // Adjust path for current working directory
619 path = process->fullPath(path);
620
621 struct stat64 hostBuf;
622 int result = stat64(path.c_str(), &hostBuf);
623
624 if (result < 0)
625 return -errno;
626
627 copyOutStat64Buf<OS>(tc->getMemPort(), tc->getSyscallArg(1), &hostBuf);
628
629 return 0;
630}
631
632
607/// Target fstat64() handler.
608template <class OS>
609SyscallReturn
610fstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
611 ThreadContext *tc)
612{
613 int fd = tc->getSyscallArg(0);
614 if (fd < 0 || process->sim_fd(fd) < 0) {

--- 378 unchanged lines hidden ---
633/// Target fstat64() handler.
634template <class OS>
635SyscallReturn
636fstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
637 ThreadContext *tc)
638{
639 int fd = tc->getSyscallArg(0);
640 if (fd < 0 || process->sim_fd(fd) < 0) {

--- 378 unchanged lines hidden ---