syscall_emul.hh (2707:ee2a3f82ac56) | syscall_emul.hh (2764:e6fea7527b3c) |
---|---|
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; --- 19 unchanged lines hidden (view full) --- 28 * Authors: Steve Reinhardt 29 * Kevin Lim 30 * Korey Sewell 31 */ 32 33#ifndef __SIM_SYSCALL_EMUL_HH__ 34#define __SIM_SYSCALL_EMUL_HH__ 35 | 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; --- 19 unchanged lines hidden (view full) --- 28 * Authors: Steve Reinhardt 29 * Kevin Lim 30 * Korey Sewell 31 */ 32 33#ifndef __SIM_SYSCALL_EMUL_HH__ 34#define __SIM_SYSCALL_EMUL_HH__ 35 |
36#define BSD_HOST (defined(__APPLE__) || defined(__OpenBSD__) || \ 37 defined(__FreeBSD__)) | 36#define NO_STAT64 (defined(__APPLE__) || defined(__OpenBSD__) || \ 37 defined(__FreeBSD__) || defined(__CYGWIN__)) |
38 39/// 40/// @file syscall_emul.hh 41/// 42/// This file defines objects used to emulate syscalls from the target 43/// application on the host machine. 44 45#include <errno.h> --- 456 unchanged lines hidden (view full) --- 502 ThreadContext *tc) 503{ 504 int fd = tc->getSyscallArg(0); 505 if (fd < 0 || process->sim_fd(fd) < 0) { 506 // doesn't map to any simulator fd: not a valid target fd 507 return -EBADF; 508 } 509 | 38 39/// 40/// @file syscall_emul.hh 41/// 42/// This file defines objects used to emulate syscalls from the target 43/// application on the host machine. 44 45#include <errno.h> --- 456 unchanged lines hidden (view full) --- 502 ThreadContext *tc) 503{ 504 int fd = tc->getSyscallArg(0); 505 if (fd < 0 || process->sim_fd(fd) < 0) { 506 // doesn't map to any simulator fd: not a valid target fd 507 return -EBADF; 508 } 509 |
510#if BSD_HOST | 510#if NO_STAT64 |
511 struct stat hostBuf; 512 int result = fstat(process->sim_fd(fd), &hostBuf); 513#else 514 struct stat64 hostBuf; 515 int result = fstat64(process->sim_fd(fd), &hostBuf); 516#endif 517 518 if (result < 0) --- 33 unchanged lines hidden (view full) --- 552lstat64Func(SyscallDesc *desc, int callnum, Process *process, 553 ThreadContext *tc) 554{ 555 std::string path; 556 557 if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0))) 558 return -EFAULT; 559 | 511 struct stat hostBuf; 512 int result = fstat(process->sim_fd(fd), &hostBuf); 513#else 514 struct stat64 hostBuf; 515 int result = fstat64(process->sim_fd(fd), &hostBuf); 516#endif 517 518 if (result < 0) --- 33 unchanged lines hidden (view full) --- 552lstat64Func(SyscallDesc *desc, int callnum, Process *process, 553 ThreadContext *tc) 554{ 555 std::string path; 556 557 if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0))) 558 return -EFAULT; 559 |
560#if BSD_HOST | 560#if NO_STAT64 |
561 struct stat hostBuf; 562 int result = lstat(path.c_str(), &hostBuf); 563#else 564 struct stat64 hostBuf; 565 int result = lstat64(path.c_str(), &hostBuf); 566#endif 567 568 if (result < 0) --- 289 unchanged lines hidden --- | 561 struct stat hostBuf; 562 int result = lstat(path.c_str(), &hostBuf); 563#else 564 struct stat64 hostBuf; 565 int result = lstat64(path.c_str(), &hostBuf); 566#endif 567 568 if (result < 0) --- 289 unchanged lines hidden --- |