/* Remote File-I/O communications
- Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 2003-2014 Free Software Foundation, Inc.
This file is part of GDB.
/* See the GDB User Guide for details of the GDB remote protocol. */
#include "defs.h"
-#include "gdb_string.h"
+#include <string.h>
#include "gdbcmd.h"
#include "remote.h"
#include "gdb/fileio.h"
#include "gdb_wait.h"
-#include "gdb_stat.h"
+#include <sys/stat.h>
#include "exceptions.h"
#include "remote-fileio.h"
#include "event-loop.h"
#include "target.h"
+#include "filenames.h"
+#include "filestuff.h"
#include <fcntl.h>
#include <sys/time.h>
#ifdef __CYGWIN__
-#include <sys/cygwin.h> /* For cygwin_conv_to_full_posix_path. */
-#include <cygwin/version.h>
-#if CYGWIN_VERSION_DLL_MAKE_COMBINED(CYGWIN_VERSION_API_MAJOR,CYGWIN_VERSION_API_MINOR) < 181
-# define CCP_POSIX_TO_WIN_A 0
-# define CCP_WIN_A_TO_POSIX 2
-# define cygwin_conv_path(op, from, to, size) \
- (op == CCP_WIN_A_TO_POSIX) ? \
- cygwin_conv_to_full_posix_path (from, to) : \
- cygwin_conv_to_win32_path (from, to)
-#endif
+#include <sys/cygwin.h> /* For cygwin_conv_path. */
#endif
#include <signal.h>
static void
async_remote_fileio_interrupt (gdb_client_data arg)
{
- deprecated_throw_reason (RETURN_QUIT);
+ quit ();
}
static void
}
remote_fio_no_longjmp = 1;
- fd = open (pathname, flags, mode);
+ fd = gdb_open_cloexec (pathname, flags, mode);
if (fd < 0)
{
remote_fileio_return_errno (-1);
long target_fd, num;
LONGEST lnum;
CORE_ADDR ptrval;
- int fd, ret, retlength;
+ int fd, ret;
gdb_byte *buffer;
size_t length;
off_t old_offset, new_offset;
cygwin_conv_path (CCP_WIN_A_TO_POSIX, newpath, newfullpath,
PATH_MAX);
len = strlen (oldfullpath);
- if (newfullpath[len] == '/'
- && !strncmp (oldfullpath, newfullpath, len))
+ if (IS_DIR_SEPARATOR (newfullpath[len])
+ && !filename_ncmp (oldfullpath, newfullpath, len))
errno = EINVAL;
else
errno = EEXIST;
remote_fileio_func_fstat (char *buf)
{
CORE_ADDR ptrval;
- int fd, ret, retlength;
+ int fd, ret;
long target_fd;
LONGEST lnum;
struct stat st;
{
LONGEST lnum;
CORE_ADDR ptrval;
- int ret, retlength;
+ int ret;
struct timeval tv;
struct fio_timeval ftv;
remote_fileio_func_system (char *buf)
{
CORE_ADDR ptrval;
- int ret, length, retlength;
+ int ret, length;
char *cmdline = NULL;
/* Parameter: Ptr to commandline / length incl. trailing zero */
remote_fio_ctrl_c_flag = 0;
remote_fio_no_longjmp = 0;
- ex = catch_exceptions (uiout, do_remote_fileio_request, (void *)buf,
+ ex = catch_exceptions (current_uiout,
+ do_remote_fileio_request, (void *)buf,
RETURN_MASK_ALL);
switch (ex)
{