1 /* File-I/O functions for GDB, the GNU debugger.
3 Copyright (C) 2003-2015 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #include "gdb/fileio.h"
26 /* Convert a host-format errno value to a File-I/O error number. */
28 extern int host_to_fileio_error (int error
);
30 /* Pack a host-format integer into a byte buffer in big-endian
31 format. BYTES specifies the size of the integer to pack in
35 host_to_bigendian (LONGEST num
, char *buf
, int bytes
)
39 for (i
= 0; i
< bytes
; ++i
)
40 buf
[i
] = (num
>> (8 * (bytes
- i
- 1))) & 0xff;
43 /* Pack a host-format integer into an fio_uint_t. */
46 host_to_fileio_uint (long num
, fio_uint_t fnum
)
48 host_to_bigendian ((LONGEST
) num
, (char *) fnum
, 4);
51 /* Pack a host-format time_t into an fio_time_t. */
54 host_to_fileio_time (time_t num
, fio_time_t fnum
)
56 host_to_bigendian ((LONGEST
) num
, (char *) fnum
, 4);
59 /* Pack a host-format struct stat into a struct fio_stat. */
61 extern void host_to_fileio_stat (struct stat
*st
, struct fio_stat
*fst
);
This page took 0.033229 seconds and 5 git commands to generate.