+2013-07-01 Pedro Alves <palves@redhat.com>
+
+ * defs.h: Include "pathmax.h".
+ * utils.c: Don't include sys/param.h.
+ (gdb_realpath): Remove code that checks for MAXPATHLEN.
+ * solib-ia64-hpux.c (ia64_hpux_handle_load_event): Use PATH_MAX
+ instead of MAXPATHLEN.
+ * solib-sunos.c: Don't include sys/param.h.
+ * xcoffread.c: Don't include sys/param.h.
+ * bsd-kvm.c: Don't include sys/param.h.
+ * darwin-nat.c: Don't include sys/param.h.
+ (darwin_pid_to_exec_file): Use PATH_MAX instead of MAXPATHLEN.
+ * darwin-nat-info.c: Don't include sys/param.h.
+ * fbsd-nat.c (fbsd_pid_to_exec_file): Use PATH_MAX instead of
+ MAXPATHLEN.
+ * i386obsd-nat.c: Don't include sys/param.h.
+ * inf-child.c: Don't include sys/param.h.
+ (inf_child_fileio_readlink): Use PATH_MAX instead of MAXPATHLEN.
+ * linux-fork.c: Don't include sys/param.h.
+ (fork_save_infrun_state): Use PATH_MAX instead of MAXPATHLEN.
+ * linux-nat.c: Don't include sys/param.h.
+ (linux_child_pid_to_exec_file, linux_proc_pending_signals)
+ (linux_proc_pending_signals): Use PATH_MAX instead of MAXPATHLEN.
+ * m68klinux-nat.c: Don't include sys/param.h.
+ * nbsd-nat.c: Don't include sys/param.h.
+ (nbsd_pid_to_exec_file): Use PATH_MAX instead of MAXPATHLEN.
+ * ppc-linux-nat.c: Don't include sys/param.h.
+ * rs6000-nat.c: Don't include sys/param.h.
+ * spu-linux-nat.c. Don't include sys/param.h.
+ * windows-nat.c: Don't include sys/param.h.
+ * xtensa-linux-nat.c: Don't include sys/param.h.
+ * config/i386/nm-fbsd.h: Don't include sys/param.h.
+
2013-07-01 Pedro Alves <palves@redhat.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add pathmax.
#endif
#include <paths.h>
#include "readline/readline.h"
-#include <sys/param.h>
#include <sys/proc.h>
#include <sys/user.h>
#ifndef NM_FBSD_H
#define NM_FBSD_H
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-
#endif /* nm-fbsd.h */
#include "gdbcmd.h"
#include "inferior.h"
-#include <sys/param.h>
#include <sys/sysctl.h>
#include "darwin-nat.h"
#include <signal.h>
#include <string.h>
#include <ctype.h>
-#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/proc.h>
#include <libproc.h>
char *path;
int res;
- path = xmalloc (MAXPATHLEN);
+ path = xmalloc (PATH_MAX);
make_cleanup (xfree, path);
- res = proc_pidinfo (pid, PROC_PIDPATHINFO, 0, path, MAXPATHLEN);
+ res = proc_pidinfo (pid, PROC_PIDPATHINFO, 0, path, PATH_MAX);
if (res >= 0)
return path;
else
#endif
#include <unistd.h>
+
+/* For gnulib's PATH_MAX. */
+#include "pathmax.h"
+
#include <fcntl.h>
/* First include ansidecl.h so we can use the various macro definitions
char *
fbsd_pid_to_exec_file (int pid)
{
- size_t len = MAXPATHLEN;
+ size_t len = PATH_MAX;
char *buf = xcalloc (len, sizeof (char));
char *path;
#endif
path = xstrprintf ("/proc/%d/file", pid);
- if (readlink (path, buf, MAXPATHLEN - 1) == -1)
+ if (readlink (path, buf, PATH_MAX - 1) == -1)
{
xfree (buf);
buf = NULL;
+2013-07-01 Pedro Alves <palves@redhat.com>
+
+ * server.h: Include "pathmax.h".
+ * linux-low.c: Don't include sys/param.h.
+ (linux_pid_exe_is_elf_64_file): Use PATH_MAX instead of
+ MAXPATHLEN.
+ * win32-low.c: Don't include sys/param.h.
+ (win32_create_inferior): Use PATH_MAX instead of MAXPATHLEN.
+
2013-07-01 Pedro Alves <palves@redhat.com>
* event-loop.c: Don't check HAVE_UNISTD_H before including
#include "gdb_wait.h"
#include <stdio.h>
-#include <sys/param.h>
#include <sys/ptrace.h>
#include "linux-ptrace.h"
#include "linux-procfs.h"
int
linux_pid_exe_is_elf_64_file (int pid, unsigned int *machine)
{
- char file[MAXPATHLEN];
+ char file[PATH_MAX];
sprintf (file, "/proc/%d/exe", pid);
return elf_64_file_p (file, machine);
#endif
#include <setjmp.h>
+/* For gnulib's PATH_MAX. */
+#include "pathmax.h"
+
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <imagehlp.h>
#include <tlhelp32.h>
#include <psapi.h>
-#include <sys/param.h>
#include <process.h>
#ifndef USE_WIN32API
win32_create_inferior (char *program, char **program_args)
{
#ifndef USE_WIN32API
- char real_path[MAXPATHLEN];
+ char real_path[PATH_MAX];
char *orig_path, *new_path, *path_ptr;
#endif
BOOL ret;
cygwin_conv_path_list (CCP_POSIX_TO_WIN_A, path_ptr, new_path, size);
setenv ("PATH", new_path, 1);
}
- cygwin_conv_path (CCP_POSIX_TO_WIN_A, program, real_path,
- MAXPATHLEN);
+ cygwin_conv_path (CCP_POSIX_TO_WIN_A, program, real_path, PATH_MAX);
program = real_path;
#endif
#include "regcache.h"
#include "target.h"
-#include <sys/param.h>
#include <sys/sysctl.h>
#include <machine/frame.h>
#include <machine/pcb.h>
#include "gdb_wait.h"
#include "filestuff.h"
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h> /* for MAXPATHLEN */
-#endif
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
inf_child_fileio_readlink (const char *filename, int *target_errno)
{
/* We support readlink only on systems that also provide a compile-time
- maximum path length (MAXPATHLEN), at least for now. */
-#if defined (HAVE_READLINK) && defined (MAXPATHLEN)
- char buf[MAXPATHLEN - 1];
+ maximum path length (PATH_MAX), at least for now. */
+#if defined (HAVE_READLINK) && defined (PATH_MAX)
+ char buf[PATH_MAX];
int len;
char *ret;
#include <sys/ptrace.h>
#include "gdb_wait.h"
-#include <sys/param.h>
#include "gdb_dirent.h"
#include <ctype.h>
static void
fork_save_infrun_state (struct fork_info *fp, int clobber_regs)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
struct dirent *de;
DIR *d;
{
/* Now save the 'state' (file position) of all open file descriptors.
Unfortunately fork does not take care of that for us... */
- snprintf (path, MAXPATHLEN, "/proc/%ld/fd", (long) PIDGET (fp->ptid));
+ snprintf (path, PATH_MAX, "/proc/%ld/fd", (long) PIDGET (fp->ptid));
if ((d = opendir (path)) != NULL)
{
long tmp;
#include "inf-child.h"
#include "inf-ptrace.h"
#include "auxv.h"
-#include <sys/param.h> /* for MAXPATHLEN */
#include <sys/procfs.h> /* for elf_gregset etc. */
#include "elf-bfd.h" /* for elfcore_write_* */
#include "gregset.h" /* for gregset */
{
char *name1, *name2;
- name1 = xmalloc (MAXPATHLEN);
- name2 = xmalloc (MAXPATHLEN);
+ name1 = xmalloc (PATH_MAX);
+ name2 = xmalloc (PATH_MAX);
make_cleanup (xfree, name1);
make_cleanup (xfree, name2);
- memset (name2, 0, MAXPATHLEN);
+ memset (name2, 0, PATH_MAX);
sprintf (name1, "/proc/%d/exe", pid);
- if (readlink (name1, name2, MAXPATHLEN - 1) > 0)
+ if (readlink (name1, name2, PATH_MAX - 1) > 0)
return name2;
else
return name1;
sigset_t *blocked, sigset_t *ignored)
{
FILE *procfile;
- char buffer[MAXPATHLEN], fname[MAXPATHLEN];
+ char buffer[PATH_MAX], fname[PATH_MAX];
struct cleanup *cleanup;
sigemptyset (pending);
error (_("Could not open %s"), fname);
cleanup = make_cleanup_fclose (procfile);
- while (fgets (buffer, MAXPATHLEN, procfile) != NULL)
+ while (fgets (buffer, PATH_MAX, procfile) != NULL)
{
/* Normal queued signals are on the SigPnd line in the status
file. However, 2.6 kernels also have a "shared" pending
#include "m68k-tdep.h"
-#include <sys/param.h>
#include <sys/dir.h>
#include <signal.h>
#include <sys/ptrace.h>
#include "defs.h"
-#include <sys/param.h>
-
#include "nbsd-nat.h"
/* Return the name of a file that can be opened to get the symbols for
char *
nbsd_pid_to_exec_file (int pid)
{
- size_t len = MAXPATHLEN;
+ size_t len = PATH_MAX;
char *buf = xcalloc (len, sizeof (char));
char *path;
path = xstrprintf ("/proc/%d/exe", pid);
- if (readlink (path, buf, MAXPATHLEN - 1) == -1)
+ if (readlink (path, buf, PATH_MAX - 1) == -1)
{
xfree (buf);
buf = NULL;
#include <stdint.h>
#include <sys/types.h>
-#include <sys/param.h>
#include <signal.h>
#include <sys/user.h>
#include <sys/ioctl.h>
#include <sys/ptrace.h>
#include <sys/reg.h>
-#include <sys/param.h>
#include <sys/dir.h>
#include <sys/user.h>
#include <signal.h>
CORE_ADDR module_desc_addr;
ULONGEST module_desc_size;
CORE_ADDR so_path_addr;
- char so_path[MAXPATHLEN];
+ char so_path[PATH_MAX];
struct load_module_desc module_desc;
struct so_list *new_so;
sizeof (struct load_module_desc),
pulongest (module_desc_size));
- read_memory_string (so_path_addr, so_path, MAXPATHLEN);
+ read_memory_string (so_path_addr, so_path, PATH_MAX);
read_memory (module_desc_addr, (gdb_byte *) &module_desc,
sizeof (module_desc));
#include <sys/types.h>
#include <signal.h>
#include "gdb_string.h"
-#include <sys/param.h>
#include <fcntl.h>
/* SunOS shared libs need the nlist structure. */
#include <sys/ptrace.h>
#include <asm/ptrace.h>
#include <sys/types.h>
-#include <sys/param.h>
#include "spu-tdep.h"
#include "inferior.h" /* for signed_pointer_to_address */
-#include <sys/param.h> /* For MAXPATHLEN */
-
#include "gdb_curses.h"
#include "readline/readline.h"
path. Use that and realpath() to canonicalize the name. This is
the most common case. Note that, if there isn't a compile time
upper bound, you want to avoid realpath() at all costs. */
-#if defined(HAVE_REALPATH)
+#if defined (HAVE_REALPATH) && defined (PATH_MAX)
{
-# if defined (PATH_MAX)
char buf[PATH_MAX];
-# define USE_REALPATH
-# elif defined (MAXPATHLEN)
- char buf[MAXPATHLEN];
-# define USE_REALPATH
-# endif
-# if defined (USE_REALPATH)
const char *rp = realpath (filename, buf);
if (rp == NULL)
rp = filename;
return xstrdup (rp);
-# endif
}
#endif /* HAVE_REALPATH */
#include "gdb_string.h"
#include "gdbthread.h"
#include "gdbcmd.h"
-#include <sys/param.h>
#include <unistd.h>
#include "exec.h"
#include "solist.h"
#include <ctype.h>
#include "gdb_string.h"
-#include <sys/param.h>
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
#include <stdint.h>
#include <sys/types.h>
-#include <sys/param.h>
#include <signal.h>
#include <sys/user.h>
#include <sys/ioctl.h>