From ad9a8f3f0088e383aa284d3f654af2852ed59dac Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 8 Jun 2006 19:08:22 +0000 Subject: * remote-fileio.c (remote_fileio_reset): New. * remote-fileio.h (remote_fileio_reset): Prototype. * remote.c (extended_remote_restart, remote_open_1): Call it. --- gdb/remote-fileio.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'gdb/remote-fileio.c') diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c index 7056a34..d445d40 100644 --- a/gdb/remote-fileio.c +++ b/gdb/remote-fileio.c @@ -1355,6 +1355,28 @@ do_remote_fileio_request (struct ui_out *uiout, void *buf_arg) return 0; } +/* Close any open descriptors, and reinitialize the file mapping. */ + +void +remote_fileio_reset (void) +{ + int ix; + + for (ix = 0; ix != remote_fio_data.fd_map_size; ix++) + { + int fd = remote_fio_data.fd_map[ix]; + + if (fd >= 0) + close (fd); + } + if (remote_fio_data.fd_map) + { + free (remote_fio_data.fd_map); + remote_fio_data.fd_map = NULL; + remote_fio_data.fd_map_size = 0; + } +} + void remote_fileio_request (char *buf) { -- cgit v1.1