syscall_emul.hh (11800:54436a1784dc) syscall_emul.hh (11812:30aada507f03)
1/*
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

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

65#include <sys/fcntl.h>
66
67#endif
68#include <fcntl.h>
69#include <sys/mman.h>
70#include <sys/stat.h>
71#if (NO_STATFS == 0)
72#include <sys/statfs.h>
1/*
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

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

65#include <sys/fcntl.h>
66
67#endif
68#include <fcntl.h>
69#include <sys/mman.h>
70#include <sys/stat.h>
71#if (NO_STATFS == 0)
72#include <sys/statfs.h>
73#else
74#include <sys/mount.h>
73#endif
74#include <sys/time.h>
75#include <sys/uio.h>
76#include <unistd.h>
77
78#include <cerrno>
79#include <string>
80

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

522
523template <class OS>
524static void
525copyOutStatfsBuf(SETranslatingPortProxy &mem, Addr addr,
526 hst_statfs *host)
527{
528 TypedBufferArg<typename OS::tgt_statfs> tgt(addr);
529
75#endif
76#include <sys/time.h>
77#include <sys/uio.h>
78#include <unistd.h>
79
80#include <cerrno>
81#include <string>
82

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

524
525template <class OS>
526static void
527copyOutStatfsBuf(SETranslatingPortProxy &mem, Addr addr,
528 hst_statfs *host)
529{
530 TypedBufferArg<typename OS::tgt_statfs> tgt(addr);
531
530#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__FreeBSD__)
531 tgt->f_type = 0;
532#else
533 tgt->f_type = TheISA::htog(host->f_type);
532 tgt->f_type = TheISA::htog(host->f_type);
534#endif
533#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
534 tgt->f_bsize = TheISA::htog(host->f_iosize);
535#else
535 tgt->f_bsize = TheISA::htog(host->f_bsize);
536 tgt->f_bsize = TheISA::htog(host->f_bsize);
537#endif
536 tgt->f_blocks = TheISA::htog(host->f_blocks);
537 tgt->f_bfree = TheISA::htog(host->f_bfree);
538 tgt->f_bavail = TheISA::htog(host->f_bavail);
539 tgt->f_files = TheISA::htog(host->f_files);
540 tgt->f_ffree = TheISA::htog(host->f_ffree);
541 memcpy(&tgt->f_fsid, &host->f_fsid, sizeof(host->f_fsid));
538 tgt->f_blocks = TheISA::htog(host->f_blocks);
539 tgt->f_bfree = TheISA::htog(host->f_bfree);
540 tgt->f_bavail = TheISA::htog(host->f_bavail);
541 tgt->f_files = TheISA::htog(host->f_files);
542 tgt->f_ffree = TheISA::htog(host->f_ffree);
543 memcpy(&tgt->f_fsid, &host->f_fsid, sizeof(host->f_fsid));
544#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
545 tgt->f_namelen = TheISA::htog(host->f_namemax);
546 tgt->f_frsize = TheISA::htog(host->f_bsize);
547#elif defined(__APPLE__)
548 tgt->f_namelen = 0;
549 tgt->f_frsize = 0;
550#else
542 tgt->f_namelen = TheISA::htog(host->f_namelen);
543 tgt->f_frsize = TheISA::htog(host->f_frsize);
551 tgt->f_namelen = TheISA::htog(host->f_namelen);
552 tgt->f_frsize = TheISA::htog(host->f_frsize);
553#endif
554#if defined(__linux__)
544 memcpy(&tgt->f_spare, &host->f_spare, sizeof(host->f_spare));
555 memcpy(&tgt->f_spare, &host->f_spare, sizeof(host->f_spare));
556#else
557 /*
558 * The fields are different sizes per OS. Don't bother with
559 * f_spare or f_reserved on non-Linux for now.
560 */
561 memset(&tgt->f_spare, 0, sizeof(tgt->f_spare));
562#endif
545
546 tgt.copyOut(mem);
547}
548
549/// Target ioctl() handler. For the most part, programs call ioctl()
550/// only to find out if their stdout is a tty, to determine whether to
551/// do line or block buffering. We always claim that output fds are
552/// not TTYs to provide repeatable results.

--- 1109 unchanged lines hidden ---
563
564 tgt.copyOut(mem);
565}
566
567/// Target ioctl() handler. For the most part, programs call ioctl()
568/// only to find out if their stdout is a tty, to determine whether to
569/// do line or block buffering. We always claim that output fds are
570/// not TTYs to provide repeatable results.

--- 1109 unchanged lines hidden ---