fd_array.cc (13029:75abda747dc3) fd_array.cc (13897:0388bc4e1c61)
1/*
2 * Copyright (c) 2016 Advanced Micro Devices, Inc.
3 * All rights reserved.
4 *
5 * For use for simulation and test purposes only
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:

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

38#include <fcntl.h>
39#include <unistd.h>
40
41#include <array>
42#include <memory>
43#include <string>
44
45#include "base/logging.hh"
1/*
2 * Copyright (c) 2016 Advanced Micro Devices, Inc.
3 * All rights reserved.
4 *
5 * For use for simulation and test purposes only
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:

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

38#include <fcntl.h>
39#include <unistd.h>
40
41#include <array>
42#include <memory>
43#include <string>
44
45#include "base/logging.hh"
46#include "base/output.hh"
46#include "params/Process.hh"
47#include "sim/fd_entry.hh"
48
49FDArray::FDArray(std::string const& input, std::string const& output,
50 std::string const& errout)
51 : _fdArray(), _input(input), _output(output), _errout(errout),
52 _imap {{"", -1},
53 {"cin", STDIN_FILENO},

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

306FDArray::openInputFile(std::string const& filename) const
307{
308 return openFile(filename, O_RDONLY, 00);
309}
310
311int
312FDArray::openOutputFile(std::string const& filename) const
313{
47#include "params/Process.hh"
48#include "sim/fd_entry.hh"
49
50FDArray::FDArray(std::string const& input, std::string const& output,
51 std::string const& errout)
52 : _fdArray(), _input(input), _output(output), _errout(errout),
53 _imap {{"", -1},
54 {"cin", STDIN_FILENO},

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

307FDArray::openInputFile(std::string const& filename) const
308{
309 return openFile(filename, O_RDONLY, 00);
310}
311
312int
313FDArray::openOutputFile(std::string const& filename) const
314{
314 return openFile(filename, O_WRONLY | O_CREAT | O_TRUNC, 0664);
315 return openFile(simout.resolve(filename),
316 O_WRONLY | O_CREAT | O_TRUNC, 0664);
315}
316
317std::shared_ptr<FDEntry>
318FDArray::getFDEntry(int tgt_fd)
319{
320 assert(0 <= tgt_fd && tgt_fd < _fdArray.size());
321 return _fdArray[tgt_fd];
322}

--- 28 unchanged lines hidden ---
317}
318
319std::shared_ptr<FDEntry>
320FDArray::getFDEntry(int tgt_fd)
321{
322 assert(0 <= tgt_fd && tgt_fd < _fdArray.size());
323 return _fdArray[tgt_fd];
324}

--- 28 unchanged lines hidden ---