xref: /netbsd-src/external/gpl3/gdb/dist/sim/common/sim-io.h (revision 88241920d21b339bf319c0e979ffda80c49a2936)
1 /* The common simulator framework for GDB, the GNU Debugger.
2 
3    Copyright 2002-2024 Free Software Foundation, Inc.
4 
5    Contributed by Andrew Cagney and Red Hat.
6 
7    This file is part of GDB.
8 
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21 
22 
23 #ifndef SIM_IO_H
24 #define SIM_IO_H
25 
26 #include <stdarg.h>
27 #include <stdint.h>
28 #include <sys/stat.h>
29 #include <sys/types.h>
30 
31 #include "ansidecl.h"
32 
33 /* See the file include/callbacks.h for a description */
34 
35 int sim_io_init (SIM_DESC sd);
36 
37 int sim_io_shutdown (SIM_DESC sd);
38 
39 int sim_io_unlink (SIM_DESC sd, const char *);
40 
41 int64_t sim_io_time (SIM_DESC sd);
42 
43 int sim_io_system (SIM_DESC sd, const char *);
44 
45 int sim_io_rename (SIM_DESC sd, const char *, const char *);
46 
47 int sim_io_write_stdout (SIM_DESC sd, const char *, int);
48 
49 void sim_io_flush_stdout (SIM_DESC sd);
50 
51 int sim_io_write_stderr (SIM_DESC sd, const char *, int);
52 
53 void sim_io_flush_stderr (SIM_DESC sd);
54 
55 int sim_io_write (SIM_DESC sd, int, const char *, int);
56 
57 int sim_io_read_stdin (SIM_DESC sd, char *, int);
58 
59 int sim_io_read (SIM_DESC sd, int, char *, int);
60 
61 int sim_io_open (SIM_DESC sd, const char *, int);
62 
63 int64_t sim_io_lseek (SIM_DESC sd, int, int64_t, int);
64 
65 int sim_io_isatty (SIM_DESC sd, int);
66 
67 int sim_io_get_errno (SIM_DESC sd);
68 
69 int sim_io_close (SIM_DESC sd, int);
70 
71 void sim_io_printf (SIM_DESC sd,
72 		    const char *fmt,
73 		    ...) ATTRIBUTE_PRINTF (2, 3);
74 
75 void sim_io_vprintf (SIM_DESC sd, const char *fmt, va_list ap)
76   ATTRIBUTE_PRINTF (2, 0);
77 
78 void sim_io_eprintf (SIM_DESC sd,
79 		     const char *fmt,
80 		     ...) ATTRIBUTE_PRINTF (2, 3);
81 
82 void sim_io_evprintf (SIM_DESC sd, const char *fmt, va_list ap)
83   ATTRIBUTE_PRINTF (2, 0);
84 
85 void sim_io_error (SIM_DESC sd,
86 		   const char *fmt,
87 		   ...)
88   ATTRIBUTE_PRINTF (2, 3)
89   ATTRIBUTE_NORETURN;
90 
91 void sim_io_poll_quit (SIM_DESC sd);
92 
93 /* Returns -1 and sets (host) EAGAIN if not ready. */
94 int sim_io_poll_read (SIM_DESC sd, int, char *, int);
95 
96 int sim_io_stat (SIM_DESC sd, const char *path, struct stat *buf);
97 
98 int sim_io_fstat (SIM_DESC sd, int fd, struct stat *buf);
99 #endif
100