linux.cc revision 8229
16691Stjones1@inf.ed.ac.uk/*
26691Stjones1@inf.ed.ac.uk * Copyright (c) 2003-2005 The Regents of The University of Michigan
36691Stjones1@inf.ed.ac.uk * Copyright (c) 2009 The University of Edinburgh
46691Stjones1@inf.ed.ac.uk * All rights reserved.
56691Stjones1@inf.ed.ac.uk *
66691Stjones1@inf.ed.ac.uk * Redistribution and use in source and binary forms, with or without
76691Stjones1@inf.ed.ac.uk * modification, are permitted provided that the following conditions are
86691Stjones1@inf.ed.ac.uk * met: redistributions of source code must retain the above copyright
96691Stjones1@inf.ed.ac.uk * notice, this list of conditions and the following disclaimer;
106691Stjones1@inf.ed.ac.uk * redistributions in binary form must reproduce the above copyright
116691Stjones1@inf.ed.ac.uk * notice, this list of conditions and the following disclaimer in the
126691Stjones1@inf.ed.ac.uk * documentation and/or other materials provided with the distribution;
136691Stjones1@inf.ed.ac.uk * neither the name of the copyright holders nor the names of its
146691Stjones1@inf.ed.ac.uk * contributors may be used to endorse or promote products derived from
156691Stjones1@inf.ed.ac.uk * this software without specific prior written permission.
166691Stjones1@inf.ed.ac.uk *
176691Stjones1@inf.ed.ac.uk * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
186691Stjones1@inf.ed.ac.uk * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
196691Stjones1@inf.ed.ac.uk * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
206691Stjones1@inf.ed.ac.uk * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
216691Stjones1@inf.ed.ac.uk * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
226691Stjones1@inf.ed.ac.uk * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
236691Stjones1@inf.ed.ac.uk * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
246691Stjones1@inf.ed.ac.uk * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
256691Stjones1@inf.ed.ac.uk * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
266691Stjones1@inf.ed.ac.uk * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
276691Stjones1@inf.ed.ac.uk * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
286691Stjones1@inf.ed.ac.uk *
296691Stjones1@inf.ed.ac.uk * Authors: Timothy M. Jones
306691Stjones1@inf.ed.ac.uk */
316691Stjones1@inf.ed.ac.uk
328229Snate@binkert.org#include <fcntl.h>
338229Snate@binkert.org
346691Stjones1@inf.ed.ac.uk#include "arch/power/linux/linux.hh"
356691Stjones1@inf.ed.ac.uk
366691Stjones1@inf.ed.ac.uk// open(2) flags translation table
376691Stjones1@inf.ed.ac.ukOpenFlagTransTable PowerLinux::openFlagTable[] = {
386691Stjones1@inf.ed.ac.uk#ifdef _MSC_VER
396691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_RDONLY,    _O_RDONLY },
406691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_WRONLY,    _O_WRONLY },
416691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_RDWR,      _O_RDWR },
426691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_APPEND,    _O_APPEND },
436691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_CREAT,     _O_CREAT },
446691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_TRUNC,     _O_TRUNC },
456691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_EXCL,      _O_EXCL },
466691Stjones1@inf.ed.ac.uk#ifdef _O_NONBLOCK
476691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_NONBLOCK,  _O_NONBLOCK },
486691Stjones1@inf.ed.ac.uk#endif
496691Stjones1@inf.ed.ac.uk#ifdef _O_NOCTTY
506691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_NOCTTY,    _O_NOCTTY },
516691Stjones1@inf.ed.ac.uk#endif
526691Stjones1@inf.ed.ac.uk#ifdef _O_SYNC
536691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_SYNC,      _O_SYNC },
546691Stjones1@inf.ed.ac.uk#endif
556691Stjones1@inf.ed.ac.uk#ifdef _O_LARGEFILE
566691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_LARGEFILE, _O_LARGEFILE },
576691Stjones1@inf.ed.ac.uk#endif
586691Stjones1@inf.ed.ac.uk#else /* !_MSC_VER */
596691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_RDONLY,    O_RDONLY },
606691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_WRONLY,    O_WRONLY },
616691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_RDWR,      O_RDWR },
626691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_APPEND,    O_APPEND },
636691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_CREAT,     O_CREAT },
646691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_TRUNC,     O_TRUNC },
656691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_EXCL,      O_EXCL },
666691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_NONBLOCK,  O_NONBLOCK },
676691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_NOCTTY,    O_NOCTTY },
686691Stjones1@inf.ed.ac.uk#ifdef O_SYNC
696691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_SYNC,      O_SYNC },
706691Stjones1@inf.ed.ac.uk#endif
716691Stjones1@inf.ed.ac.uk#ifdef O_LARGEFILE
726691Stjones1@inf.ed.ac.uk  { PowerLinux::TGT_O_LARGEFILE, O_LARGEFILE },
736691Stjones1@inf.ed.ac.uk#endif
746691Stjones1@inf.ed.ac.uk#endif /* _MSC_VER */
756691Stjones1@inf.ed.ac.uk};
766691Stjones1@inf.ed.ac.uk
776691Stjones1@inf.ed.ac.ukconst int PowerLinux::NUM_OPEN_FLAGS =
786691Stjones1@inf.ed.ac.uk        (sizeof(PowerLinux::openFlagTable)/sizeof(PowerLinux::openFlagTable[0]));
796691Stjones1@inf.ed.ac.uk
80