syscall_emul.hh (4131:660ebc4994a9) syscall_emul.hh (4189:8e5222bea9ba)
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;

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

348//// Helper function to convert a host stat buffer to a target stat
349//// buffer. Also copies the target buffer out to the simulated
350//// memory space. Used by stat(), fstat(), and lstat().
351
352template <typename target_stat, typename host_stat>
353static void
354convertStatBuf(target_stat &tgt, host_stat *host, bool fakeTTY = false)
355{
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;

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

348//// Helper function to convert a host stat buffer to a target stat
349//// buffer. Also copies the target buffer out to the simulated
350//// memory space. Used by stat(), fstat(), and lstat().
351
352template <typename target_stat, typename host_stat>
353static void
354convertStatBuf(target_stat &tgt, host_stat *host, bool fakeTTY = false)
355{
356 using namespace TheISA;
357
356 if (fakeTTY)
357 tgt->st_dev = 0xA;
358 else
359 tgt->st_dev = host->st_dev;
360 tgt->st_dev = htog(tgt->st_dev);
361 tgt->st_ino = host->st_ino;
362 tgt->st_ino = htog(tgt->st_ino);
363 tgt->st_mode = host->st_mode;

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

390}
391
392// Same for stat64
393
394template <typename target_stat, typename host_stat64>
395static void
396convertStat64Buf(target_stat &tgt, host_stat64 *host, bool fakeTTY = false)
397{
358 if (fakeTTY)
359 tgt->st_dev = 0xA;
360 else
361 tgt->st_dev = host->st_dev;
362 tgt->st_dev = htog(tgt->st_dev);
363 tgt->st_ino = host->st_ino;
364 tgt->st_ino = htog(tgt->st_ino);
365 tgt->st_mode = host->st_mode;

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

392}
393
394// Same for stat64
395
396template <typename target_stat, typename host_stat64>
397static void
398convertStat64Buf(target_stat &tgt, host_stat64 *host, bool fakeTTY = false)
399{
400 using namespace TheISA;
401
398 convertStatBuf<target_stat, host_stat64>(tgt, host, fakeTTY);
399#if defined(STAT_HAVE_NSEC)
400 tgt->st_atime_nsec = host->st_atime_nsec;
401 tgt->st_atime_nsec = htog(tgt->st_atime_nsec);
402 tgt->st_mtime_nsec = host->st_mtime_nsec;
403 tgt->st_mtime_nsec = htog(tgt->st_mtime_nsec);
404 tgt->st_ctime_nsec = host->st_ctime_nsec;
405 tgt->st_ctime_nsec = htog(tgt->st_ctime_nsec);

--- 583 unchanged lines hidden ---
402 convertStatBuf<target_stat, host_stat64>(tgt, host, fakeTTY);
403#if defined(STAT_HAVE_NSEC)
404 tgt->st_atime_nsec = host->st_atime_nsec;
405 tgt->st_atime_nsec = htog(tgt->st_atime_nsec);
406 tgt->st_mtime_nsec = host->st_mtime_nsec;
407 tgt->st_mtime_nsec = htog(tgt->st_mtime_nsec);
408 tgt->st_ctime_nsec = host->st_ctime_nsec;
409 tgt->st_ctime_nsec = htog(tgt->st_ctime_nsec);

--- 583 unchanged lines hidden ---