xref: /netbsd-src/external/gpl3/gdb/dist/sim/common/sim-io.h (revision 88241920d21b339bf319c0e979ffda80c49a2936)
14e98e3e1Schristos /* The common simulator framework for GDB, the GNU Debugger.
24e98e3e1Schristos 
3*88241920Schristos    Copyright 2002-2024 Free Software Foundation, Inc.
44e98e3e1Schristos 
54e98e3e1Schristos    Contributed by Andrew Cagney and Red Hat.
64e98e3e1Schristos 
74e98e3e1Schristos    This file is part of GDB.
84e98e3e1Schristos 
94e98e3e1Schristos    This program is free software; you can redistribute it and/or modify
104e98e3e1Schristos    it under the terms of the GNU General Public License as published by
114e98e3e1Schristos    the Free Software Foundation; either version 3 of the License, or
124e98e3e1Schristos    (at your option) any later version.
134e98e3e1Schristos 
144e98e3e1Schristos    This program is distributed in the hope that it will be useful,
154e98e3e1Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
164e98e3e1Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
174e98e3e1Schristos    GNU General Public License for more details.
184e98e3e1Schristos 
194e98e3e1Schristos    You should have received a copy of the GNU General Public License
204e98e3e1Schristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
214e98e3e1Schristos 
224e98e3e1Schristos 
234e98e3e1Schristos #ifndef SIM_IO_H
244e98e3e1Schristos #define SIM_IO_H
254e98e3e1Schristos 
264b169a6bSchristos #include <stdarg.h>
274b169a6bSchristos #include <stdint.h>
284b169a6bSchristos #include <sys/stat.h>
294b169a6bSchristos #include <sys/types.h>
304b169a6bSchristos 
314b169a6bSchristos #include "ansidecl.h"
324b169a6bSchristos 
334e98e3e1Schristos /* See the file include/callbacks.h for a description */
344e98e3e1Schristos 
354e98e3e1Schristos int sim_io_init (SIM_DESC sd);
364e98e3e1Schristos 
374e98e3e1Schristos int sim_io_shutdown (SIM_DESC sd);
384e98e3e1Schristos 
394e98e3e1Schristos int sim_io_unlink (SIM_DESC sd, const char *);
404e98e3e1Schristos 
414b169a6bSchristos int64_t sim_io_time (SIM_DESC sd);
424e98e3e1Schristos 
434e98e3e1Schristos int sim_io_system (SIM_DESC sd, const char *);
444e98e3e1Schristos 
454e98e3e1Schristos int sim_io_rename (SIM_DESC sd, const char *, const char *);
464e98e3e1Schristos 
474e98e3e1Schristos int sim_io_write_stdout (SIM_DESC sd, const char *, int);
484e98e3e1Schristos 
494e98e3e1Schristos void sim_io_flush_stdout (SIM_DESC sd);
504e98e3e1Schristos 
514e98e3e1Schristos int sim_io_write_stderr (SIM_DESC sd, const char *, int);
524e98e3e1Schristos 
534e98e3e1Schristos void sim_io_flush_stderr (SIM_DESC sd);
544e98e3e1Schristos 
554e98e3e1Schristos int sim_io_write (SIM_DESC sd, int, const char *, int);
564e98e3e1Schristos 
574e98e3e1Schristos int sim_io_read_stdin (SIM_DESC sd, char *, int);
584e98e3e1Schristos 
594e98e3e1Schristos int sim_io_read (SIM_DESC sd, int, char *, int);
604e98e3e1Schristos 
614e98e3e1Schristos int sim_io_open (SIM_DESC sd, const char *, int);
624e98e3e1Schristos 
634b169a6bSchristos int64_t sim_io_lseek (SIM_DESC sd, int, int64_t, int);
644e98e3e1Schristos 
654e98e3e1Schristos int sim_io_isatty (SIM_DESC sd, int);
664e98e3e1Schristos 
674e98e3e1Schristos int sim_io_get_errno (SIM_DESC sd);
684e98e3e1Schristos 
694e98e3e1Schristos int sim_io_close (SIM_DESC sd, int);
704e98e3e1Schristos 
714e98e3e1Schristos void sim_io_printf (SIM_DESC sd,
724e98e3e1Schristos 		    const char *fmt,
734b169a6bSchristos 		    ...) ATTRIBUTE_PRINTF (2, 3);
744e98e3e1Schristos 
754b169a6bSchristos void sim_io_vprintf (SIM_DESC sd, const char *fmt, va_list ap)
764b169a6bSchristos   ATTRIBUTE_PRINTF (2, 0);
774e98e3e1Schristos 
784e98e3e1Schristos void sim_io_eprintf (SIM_DESC sd,
794e98e3e1Schristos 		     const char *fmt,
804b169a6bSchristos 		     ...) ATTRIBUTE_PRINTF (2, 3);
814e98e3e1Schristos 
824b169a6bSchristos void sim_io_evprintf (SIM_DESC sd, const char *fmt, va_list ap)
834b169a6bSchristos   ATTRIBUTE_PRINTF (2, 0);
844e98e3e1Schristos 
854e98e3e1Schristos void sim_io_error (SIM_DESC sd,
864e98e3e1Schristos 		   const char *fmt,
874e98e3e1Schristos 		   ...)
884b169a6bSchristos   ATTRIBUTE_PRINTF (2, 3)
894b169a6bSchristos   ATTRIBUTE_NORETURN;
904e98e3e1Schristos 
914e98e3e1Schristos void sim_io_poll_quit (SIM_DESC sd);
924e98e3e1Schristos 
934e98e3e1Schristos /* Returns -1 and sets (host) EAGAIN if not ready. */
944e98e3e1Schristos int sim_io_poll_read (SIM_DESC sd, int, char *, int);
954e98e3e1Schristos 
964e98e3e1Schristos int sim_io_stat (SIM_DESC sd, const char *path, struct stat *buf);
974e98e3e1Schristos 
984e98e3e1Schristos int sim_io_fstat (SIM_DESC sd, int fd, struct stat *buf);
994e98e3e1Schristos #endif
100