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 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.
/* 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. */
#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 **);
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)
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
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);
/* 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 */
/* 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;
}
/* 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.
>>>> 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;
int len;
int alloclen;
+ /* The open syscall MODE parameter is not specified. */
+ gdb_assert ((mode & O_CREAT) == 0);
+
if (!path)
path = ".";
{
filename = alloca (strlen (string) + 1);
strcpy (filename, string);
- fd = open (filename, mode, prot);
+ fd = open (filename, mode);
if (fd >= 0)
goto done;
}
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;
}
}
- 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;
/* 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)