1 // hostops.h - Wrapper class around host OS calls. -*- C++ -*-
3 // Copyright (C) 1999, 2000 Red Hat.
4 // This file is part of SID and is licensed under the GPL.
5 // See the file COPYING.SID for conditions for redistribution.
11 typedef sid::host_int_4 uint32;
12 typedef sid::signed_host_int_4 int32;
13 typedef sid::host_int_8 uint64;
14 typedef sid::signed_host_int_8 int64;
16 typedef uint32 address32;
17 typedef uint32 size32;
18 typedef int32 offset32;
20 typedef uint64 address64;
21 typedef uint64 size64;
22 typedef int64 offset64;
30 // `flags' argument to open.
36 // mask of previous 3 values
45 // `how' argument to lseek.
46 enum seek_type { seek_set = 0, seek_cur = 1, seek_end = 2 };
48 // Separate 32 bit and 64 bit support.
49 // We want correct semantics for 32/64 target on 32/64 host.
50 // ??? May also be useful for large file support on 32 bit hosts.
51 int open_flags_to_host (int flags);
52 bool open (const char* filename, int flags,
53 int& result_fd, int& errcode);
54 bool open (const char* filename, int flags, int mode,
55 int& result_fd, int& errcode);
56 bool close (int fd, int& errcode);
57 bool read32 (int fd, char* buf, size32 len,
58 size32& len_read, int& errcode);
59 bool write32 (int fd, const char* buf, size32 len,
60 size32& len_written, int& errcode);
61 bool remove (const char* filename, int& errcode);
62 bool rename (const char* oldname, const char* newname, int& errcode);
63 bool lseek32 (int fd, offset32 offset, seek_type how,
64 size32& result, int& errcode);
65 bool getsize32 (int fd, size32& size, int& errcode);
66 bool tmpnam (char* filename, int& errcode);