diff options
author | Tom Tromey <tromey@redhat.com> | 2013-04-22 16:46:15 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-04-22 16:46:15 +0000 |
commit | 614c279dda95dd69c3c14778fc600f4a265847d6 (patch) | |
tree | 9bd77eb734c303ecac4ffdc2477bf0c314b801f5 /gdb/common/linux-osdata.c | |
parent | 5fda2332f3403df3e1c37da3e3697d6fb6bc4706 (diff) | |
download | gdb-614c279dda95dd69c3c14778fc600f4a265847d6.zip gdb-614c279dda95dd69c3c14778fc600f4a265847d6.tar.gz gdb-614c279dda95dd69c3c14778fc600f4a265847d6.tar.bz2 |
PR gdb/7912:
* Makefile.in (SFILES): Add filestuff.c
(COMMON_OBS): Add filestuff.o.
(filestuff.o): New target.
* auto-load.c (auto_load_objfile_script_1): Use
gdb_fopen_cloexec.
* auxv.c (procfs_xfer_auxv): Use gdb_open_cloexec.
* cli/cli-cmds.c (shell_escape): Call close_most_fds.
* cli/cli-dump.c (fopen_with_cleanup): Use gdb_fopen_cloexec.
* common/agent.c (gdb_connect_sync_socket): Use
gdb_socket_cloexec.
* common/filestuff.c: New file.
* common/filestuff.h: New file.
* common/linux-osdata.c (linux_common_core_of_thread)
(command_from_pid, commandline_from_pid, print_source_lines)
(linux_xfer_osdata_shm, linux_xfer_osdata_sem)
(linux_xfer_osdata_msg, linux_xfer_osdata_modules): Use
gdb_fopen_cloexec.
* common/linux-procfs.c (linux_proc_get_int)
(linux_proc_pid_has_state): Use gdb_fopen_cloexec.
* config.in, configure: Rebuild.
* configure.ac: Don't check for sys/socket.h. Check for
fdwalk, pipe2.
* corelow.c (core_open): Use gdb_open_cloexec.
* dwarf2read.c (write_psymtabs_to_index): Use gdb_fopen_cloexec.
* fork-child.c (fork_inferior): Call close_most_fds.
* gdb_bfd.c (gdb_bfd_open): Use gdb_open_cloexec.
* inf-child.c (inf_child_fileio_readlink): Use gdb_open_cloexec.
* linux-nat.c (linux_nat_thread_name, linux_proc_pending_signals):
Use gdb_fopen_cloexec.
(linux_proc_xfer_partial, linux_proc_xfer_spu): Use
gdb_open_cloexec.
(linux_async_pipe): Use gdb_pipe_cloexec.
* remote-fileio.c (remote_fileio_func_open): Use
gdb_open_cloexec.
* remote.c (remote_file_put, remote_file_get): Use
gdb_fopen_cloexec.
* ser-pipe.c (pipe_open): Use gdb_socketpair_cloexec,
close_most_fds.
* ser-tcp.c (net_open): Use gdb_socket_cloexec.
* ser-unix.c (hardwire_open): Use gdb_open_cloexec.
* solib.c (solib_find): Use gdb_open_cloexec.
* source.c (openp, find_and_open_source): Use gdb_open_cloexec.
* tracepoint.c (tfile_start): Use gdb_fopen_cloexec.
(tfile_open): Use gdb_open_cloexec.
* tui/tui-io.c (tui_initialize_io): Use gdb_pipe_cloexec.
* ui-file.c (gdb_fopen): Use gdb_fopen_cloexec.
* xml-support.c (xml_fetch_content_from_file): Use
gdb_fopen_cloexec.
* main.c (captured_main): Call notice_open_fds.
gdbserver
* Makefile.in (SFILES): Add filestuff.c.
(OBS): Add filestuff.o.
(filestuff.o): New target.
* config.in, configure: Rebuild.
* configure.ac: Check for fdwalk, pipe2.
Diffstat (limited to 'gdb/common/linux-osdata.c')
-rw-r--r-- | gdb/common/linux-osdata.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/gdb/common/linux-osdata.c b/gdb/common/linux-osdata.c index d55470b..9723839 100644 --- a/gdb/common/linux-osdata.c +++ b/gdb/common/linux-osdata.c @@ -44,6 +44,7 @@ #include "gdb_assert.h" #include "gdb_dirent.h" #include "gdb_stat.h" +#include "filestuff.h" /* Define PID_T to be a fixed size that is at least as large as pid_t, so that reading pid values embedded in /proc works @@ -76,7 +77,7 @@ linux_common_core_of_thread (ptid_t ptid) sprintf (filename, "/proc/%lld/task/%lld/stat", (PID_T) ptid_get_pid (ptid), (PID_T) ptid_get_lwp (ptid)); - f = fopen (filename, "r"); + f = gdb_fopen_cloexec (filename, "r"); if (!f) return -1; @@ -125,7 +126,7 @@ static void command_from_pid (char *command, int maxlen, PID_T pid) { char *stat_path = xstrprintf ("/proc/%lld/stat", pid); - FILE *fp = fopen (stat_path, "r"); + FILE *fp = gdb_fopen_cloexec (stat_path, "r"); command[0] = '\0'; @@ -165,7 +166,7 @@ commandline_from_pid (PID_T pid) { char *pathname = xstrprintf ("/proc/%lld/cmdline", pid); char *commandline = NULL; - FILE *f = fopen (pathname, "r"); + FILE *f = gdb_fopen_cloexec (pathname, "r"); if (f) { @@ -860,7 +861,7 @@ print_sockets (unsigned short family, int tcp, struct buffer *buffer) else return; - fp = fopen (proc_file, "r"); + fp = gdb_fopen_cloexec (proc_file, "r"); if (fp) { char buf[8192]; @@ -1088,7 +1089,7 @@ linux_xfer_osdata_shm (gdb_byte *readbuf, buffer_init (&buffer); buffer_grow_str (&buffer, "<osdata type=\"shared memory\">\n"); - fp = fopen ("/proc/sysvipc/shm", "r"); + fp = gdb_fopen_cloexec ("/proc/sysvipc/shm", "r"); if (fp) { char buf[8192]; @@ -1216,7 +1217,7 @@ linux_xfer_osdata_sem (gdb_byte *readbuf, buffer_init (&buffer); buffer_grow_str (&buffer, "<osdata type=\"semaphores\">\n"); - fp = fopen ("/proc/sysvipc/sem", "r"); + fp = gdb_fopen_cloexec ("/proc/sysvipc/sem", "r"); if (fp) { char buf[8192]; @@ -1328,7 +1329,7 @@ linux_xfer_osdata_msg (gdb_byte *readbuf, buffer_init (&buffer); buffer_grow_str (&buffer, "<osdata type=\"message queues\">\n"); - fp = fopen ("/proc/sysvipc/msg", "r"); + fp = gdb_fopen_cloexec ("/proc/sysvipc/msg", "r"); if (fp) { char buf[8192]; @@ -1454,7 +1455,7 @@ linux_xfer_osdata_modules (gdb_byte *readbuf, buffer_init (&buffer); buffer_grow_str (&buffer, "<osdata type=\"modules\">\n"); - fp = fopen ("/proc/modules", "r"); + fp = gdb_fopen_cloexec ("/proc/modules", "r"); if (fp) { char buf[8192]; |