syscall_emul.cc (3114:7a4771b9b720) | syscall_emul.cc (3669:3607aaed36b6) |
---|---|
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; --- 200 unchanged lines hidden (view full) --- 209SyscallReturn 210unlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) 211{ 212 string path; 213 214 if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0))) 215 return (TheISA::IntReg)-EFAULT; 216 | 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; --- 200 unchanged lines hidden (view full) --- 209SyscallReturn 210unlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) 211{ 212 string path; 213 214 if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0))) 215 return (TheISA::IntReg)-EFAULT; 216 |
217 // Adjust path for current working directory 218 path = p->fullPath(path); 219 |
|
217 int result = unlink(path.c_str()); 218 return (result == -1) ? -errno : result; 219} 220 221SyscallReturn 222renameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) 223{ 224 string old_name; 225 226 if (!tc->getMemPort()->tryReadString(old_name, tc->getSyscallArg(0))) 227 return -EFAULT; 228 229 string new_name; 230 231 if (!tc->getMemPort()->tryReadString(new_name, tc->getSyscallArg(1))) 232 return -EFAULT; 233 | 220 int result = unlink(path.c_str()); 221 return (result == -1) ? -errno : result; 222} 223 224SyscallReturn 225renameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) 226{ 227 string old_name; 228 229 if (!tc->getMemPort()->tryReadString(old_name, tc->getSyscallArg(0))) 230 return -EFAULT; 231 232 string new_name; 233 234 if (!tc->getMemPort()->tryReadString(new_name, tc->getSyscallArg(1))) 235 return -EFAULT; 236 |
237 // Adjust path for current working directory 238 old_name = p->fullPath(old_name); 239 new_name = p->fullPath(new_name); 240 |
|
234 int64_t result = rename(old_name.c_str(), new_name.c_str()); 235 return (result == -1) ? -errno : result; 236} 237 238SyscallReturn 239truncateFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) 240{ 241 string path; 242 243 if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0))) 244 return -EFAULT; 245 246 off_t length = tc->getSyscallArg(1); 247 | 241 int64_t result = rename(old_name.c_str(), new_name.c_str()); 242 return (result == -1) ? -errno : result; 243} 244 245SyscallReturn 246truncateFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) 247{ 248 string path; 249 250 if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0))) 251 return -EFAULT; 252 253 off_t length = tc->getSyscallArg(1); 254 |
255 // Adjust path for current working directory 256 path = p->fullPath(path); 257 |
|
248 int result = truncate(path.c_str(), length); 249 return (result == -1) ? -errno : result; 250} 251 252SyscallReturn 253ftruncateFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc) 254{ 255 int fd = process->sim_fd(tc->getSyscallArg(0)); --- 16 unchanged lines hidden (view full) --- 272 return -EFAULT; 273 274 /* XXX endianess */ 275 uint32_t owner = tc->getSyscallArg(1); 276 uid_t hostOwner = owner; 277 uint32_t group = tc->getSyscallArg(2); 278 gid_t hostGroup = group; 279 | 258 int result = truncate(path.c_str(), length); 259 return (result == -1) ? -errno : result; 260} 261 262SyscallReturn 263ftruncateFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc) 264{ 265 int fd = process->sim_fd(tc->getSyscallArg(0)); --- 16 unchanged lines hidden (view full) --- 282 return -EFAULT; 283 284 /* XXX endianess */ 285 uint32_t owner = tc->getSyscallArg(1); 286 uid_t hostOwner = owner; 287 uint32_t group = tc->getSyscallArg(2); 288 gid_t hostGroup = group; 289 |
290 // Adjust path for current working directory 291 path = p->fullPath(path); 292 |
|
280 int result = chown(path.c_str(), hostOwner, hostGroup); 281 return (result == -1) ? -errno : result; 282} 283 284SyscallReturn 285fchownFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc) 286{ 287 int fd = process->sim_fd(tc->getSyscallArg(0)); --- 214 unchanged lines hidden --- | 293 int result = chown(path.c_str(), hostOwner, hostGroup); 294 return (result == -1) ? -errno : result; 295} 296 297SyscallReturn 298fchownFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc) 299{ 300 int fd = process->sim_fd(tc->getSyscallArg(0)); --- 214 unchanged lines hidden --- |