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; --- 43 unchanged lines hidden (view full) --- 52#include "sim/sim_exit.hh" 53#include "sim/syscall_debug_macros.hh" 54#include "sim/syscall_desc.hh" 55#include "sim/system.hh" 56 57using namespace std; 58using namespace TheISA; 59 |
60void 61warnUnsupportedOS(std::string syscall_name) 62{ 63 warn("Cannot invoke %s on host operating system.", syscall_name); 64} 65 |
66SyscallReturn 67unimplementedFunc(SyscallDesc *desc, int callnum, Process *process, 68 ThreadContext *tc) 69{ 70 fatal("syscall %s (#%d) unimplemented.", desc->name(), callnum); 71 72 return 1; 73} --- 963 unchanged lines hidden (view full) --- 1037 ThreadContext *tc) 1038{ 1039 return process->egid(); 1040} 1041 1042SyscallReturn 1043fallocateFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc) 1044{ |
1045#if __linux__ |
1046 int index = 0; 1047 int tgt_fd = p->getSyscallArg(tc, index); 1048 int mode = p->getSyscallArg(tc, index); 1049 off_t offset = p->getSyscallArg(tc, index); 1050 off_t len = p->getSyscallArg(tc, index); 1051 1052 auto ffdp = std::dynamic_pointer_cast<FileFDEntry>((*p->fds)[tgt_fd]); 1053 if (!ffdp) 1054 return -EBADF; 1055 int sim_fd = ffdp->getSimFD(); 1056 1057 int result = fallocate(sim_fd, mode, offset, len); 1058 if (result < 0) 1059 return -errno; |
1060 return 0; |
1061#else 1062 warnUnsupportedOS("fallocate"); 1063 return -1; 1064#endif |
1065} 1066 1067SyscallReturn 1068accessFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc, 1069 int index) 1070{ 1071 string path; 1072 if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index))) --- 671 unchanged lines hidden --- |