This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch gdbserver 7.6.1 only] Fix fd leak regression
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>, gdb-patches at sourceware dot org
- Date: Thu, 29 Aug 2013 18:46:58 +0100
- Subject: Re: [patch gdbserver 7.6.1 only] Fix fd leak regression
- Authentication-results: sourceware.org; auth=none
- References: <20130829111053 dot GA25662 at host2 dot jankratochvil dot net> <521F3B71 dot 1010007 at redhat dot com> <20130829130359 dot GA31063 at host2 dot jankratochvil dot net> <521F5804 dot 1080604 at redhat dot com> <87a9k0sgpf dot fsf at fleche dot redhat dot com> <521F5FD1 dot 8020107 at redhat dot com> <871u5csfrv dot fsf at fleche dot redhat dot com> <87li3kqunt dot fsf at fleche dot redhat dot com>
On 08/29/2013 06:22 PM, Tom Tromey wrote:
> Tom> Yeah, I meant the other filestuff.h code, like gdb_socket_cloexec and
> Tom> gdb_pipe_cloexec.
>
> second, the in process agent can't use gdb_socket_cloexec
But, why ?
> @@ -596,7 +596,7 @@ linux_create_inferior (char *program, char **allargs)
> if (remote_connection_is_stdio ())
> {
> close (0);
> - open ("/dev/null", O_RDONLY);
> + gdb_open_cloexec ("/dev/null", O_RDONLY, 0);
This is the child opening its stdin. Doesn't look
correct to close it on the subsequent exec.
>
> #include <ctype.h>
> #include <fcntl.h>
> @@ -147,6 +148,9 @@ trace_vdebug (const char *fmt, ...)
> # define ust_loaded gdb_agent_ust_loaded
> # define helper_thread_id gdb_agent_helper_thread_id
> # define cmd_buf gdb_agent_cmd_buf
> +
> +/* We don't want to use this one in IPA. */
"because ..." ?
> +# define gdb_socket_cloexec socket
> #endif
--
Pedro Alves