aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2009-05-19 13:51:37 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2009-05-19 13:51:37 +0000
commitfbdebf465713844d23625ae09e0ae4995418328b (patch)
tree7af6455b1a462e3cba7eb1710604a7d2ea94be37 /gdb
parent5fd62852f643d6fa71d7a0225237c7874868b695 (diff)
downloadgdb-fbdebf465713844d23625ae09e0ae4995418328b.zip
gdb-fbdebf465713844d23625ae09e0ae4995418328b.tar.gz
gdb-fbdebf465713844d23625ae09e0ae4995418328b.tar.bz2
gdb/
Remove the PROT parameter from openp. * source.c (openp): Remove the parameter PROT. Assertion check MODE. defs.h (openp): Update the prototype. Update all the openp callers.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/cli/cli-cmds.c2
-rw-r--r--gdb/defs.h2
-rw-r--r--gdb/exec.c4
-rw-r--r--gdb/nto-tdep.c2
-rw-r--r--gdb/solib.c8
-rw-r--r--gdb/source.c17
-rw-r--r--gdb/symfile.c4
8 files changed, 28 insertions, 18 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fc55a20..cf44f2a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2009-05-19 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Remove the PROT parameter from openp.
+ * source.c (openp): Remove the parameter PROT. Assertion check MODE.
+ defs.h (openp): Update the prototype.
+ Update all the openp callers.
+
2009-05-19 Pedro Alves <pedro@codesourcery.com>
* inflow.c (kill_command): Moved to infcmd.c.
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 18d34bf..0211489 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -451,7 +451,7 @@ source_script (char *file, int from_tty)
/* Search for and open 'file' on the search path used for source
files. Put the full location in 'full_pathname'. */
fd = openp (source_path, OPF_TRY_CWD_FIRST,
- file, O_RDONLY, 0, &full_pathname);
+ file, O_RDONLY, &full_pathname);
make_cleanup (xfree, full_pathname);
/* Use the full path name, if it is found. */
diff --git a/gdb/defs.h b/gdb/defs.h
index ee80659..abf4b02 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -619,7 +619,7 @@ extern void print_address (CORE_ADDR, struct ui_file *);
#define OPF_TRY_CWD_FIRST 0x01
#define OPF_SEARCH_IN_PATH 0x02
-extern int openp (const char *, int, const char *, int, int, char **);
+extern int openp (const char *, int, const char *, int, char **);
extern int source_full_path_of (const char *, char **);
diff --git a/gdb/exec.c b/gdb/exec.c
index a9a53ce..fc3d526 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -197,7 +197,7 @@ exec_file_attach (char *filename, int from_tty)
int scratch_chan;
scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename,
- write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY, 0,
+ write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
&scratch_pathname);
#if defined(__GO32__) || defined(_WIN32) || defined(__CYGWIN__)
if (scratch_chan < 0)
@@ -205,7 +205,7 @@ exec_file_attach (char *filename, int from_tty)
char *exename = alloca (strlen (filename) + 5);
strcat (strcpy (exename, filename), ".exe");
scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, exename,
- write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY, 0,
+ write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
&scratch_pathname);
}
#endif
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 193f83c..29c81d9 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -145,7 +145,7 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
else
base++; /* Skip over '/'. */
- ret = openp (buf, 1, base, o_flags, 0, temp_pathname);
+ ret = openp (buf, 1, base, o_flags, temp_pathname);
if (ret < 0 && base != solib)
{
sprintf (arch_path, "/%s", solib);
diff --git a/gdb/solib.c b/gdb/solib.c
index 8b330b1..18bec09 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -210,14 +210,14 @@ solib_find (char *in_pathname, int *fd)
/* If not found, search the solib_search_path (if any). */
if (found_file < 0 && solib_search_path != NULL)
found_file = openp (solib_search_path, OPF_TRY_CWD_FIRST,
- in_pathname, O_RDONLY | O_BINARY, 0, &temp_pathname);
+ in_pathname, O_RDONLY | O_BINARY, &temp_pathname);
/* If not found, next search the solib_search_path (if any) for the basename
only (ignoring the path). This is to allow reading solibs from a path
that differs from the opened path. */
if (found_file < 0 && solib_search_path != NULL)
found_file = openp (solib_search_path, OPF_TRY_CWD_FIRST,
- lbasename (in_pathname), O_RDONLY | O_BINARY, 0,
+ lbasename (in_pathname), O_RDONLY | O_BINARY,
&temp_pathname);
/* If not found, try to use target supplied solib search method */
@@ -228,14 +228,14 @@ solib_find (char *in_pathname, int *fd)
/* If not found, next search the inferior's $PATH environment variable. */
if (found_file < 0 && gdb_sysroot_is_empty)
found_file = openp (get_in_environ (inferior_environ, "PATH"),
- OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0,
+ OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY,
&temp_pathname);
/* If not found, next search the inferior's $LD_LIBRARY_PATH
environment variable. */
if (found_file < 0 && gdb_sysroot_is_empty)
found_file = openp (get_in_environ (inferior_environ, "LD_LIBRARY_PATH"),
- OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0,
+ OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY,
&temp_pathname);
*fd = found_file;
diff --git a/gdb/source.c b/gdb/source.c
index 50f3510..e1bbb7f 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -658,7 +658,8 @@ is_regular_file (const char *name)
}
/* Open a file named STRING, searching path PATH (dir names sep by some char)
- using mode MODE and protection bits PROT in the calls to open.
+ using mode MODE in the calls to open. You cannot use this function to
+ create files (O_CREAT).
OPTS specifies the function behaviour in specific cases.
@@ -685,8 +686,7 @@ is_regular_file (const char *name)
>>>> eg executable, non-directory */
int
openp (const char *path, int opts, const char *string,
- int mode, int prot,
- char **filename_opened)
+ int mode, char **filename_opened)
{
int fd;
char *filename;
@@ -695,6 +695,9 @@ openp (const char *path, int opts, const char *string,
int len;
int alloclen;
+ /* The open syscall MODE parameter is not specified. */
+ gdb_assert ((mode & O_CREAT) == 0);
+
if (!path)
path = ".";
@@ -708,7 +711,7 @@ openp (const char *path, int opts, const char *string,
{
filename = alloca (strlen (string) + 1);
strcpy (filename, string);
- fd = open (filename, mode, prot);
+ fd = open (filename, mode);
if (fd >= 0)
goto done;
}
@@ -827,7 +830,7 @@ source_full_path_of (const char *filename, char **full_pathname)
int fd;
fd = openp (source_path, OPF_TRY_CWD_FIRST | OPF_SEARCH_IN_PATH, filename,
- O_RDONLY, 0, full_pathname);
+ O_RDONLY, full_pathname);
if (fd < 0)
{
*full_pathname = NULL;
@@ -1017,13 +1020,13 @@ find_and_open_source (struct objfile *objfile,
}
}
- result = openp (path, OPF_SEARCH_IN_PATH, filename, OPEN_MODE, 0, fullname);
+ result = openp (path, OPF_SEARCH_IN_PATH, filename, OPEN_MODE, fullname);
if (result < 0)
{
/* Didn't work. Try using just the basename. */
p = lbasename (filename);
if (p != filename)
- result = openp (path, OPF_SEARCH_IN_PATH, p, OPEN_MODE, 0, fullname);
+ result = openp (path, OPF_SEARCH_IN_PATH, p, OPEN_MODE, fullname);
}
return result;
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 774101d..fb7f143 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1585,14 +1585,14 @@ symfile_bfd_open (char *name)
/* Look down path for it, allocate 2nd new malloc'd copy. */
desc = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, name,
- O_RDONLY | O_BINARY, 0, &absolute_name);
+ O_RDONLY | O_BINARY, &absolute_name);
#if defined(__GO32__) || defined(_WIN32) || defined (__CYGWIN__)
if (desc < 0)
{
char *exename = alloca (strlen (name) + 5);
strcat (strcpy (exename, name), ".exe");
desc = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, exename,
- O_RDONLY | O_BINARY, 0, &absolute_name);
+ O_RDONLY | O_BINARY, &absolute_name);
}
#endif
if (desc < 0)