From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tom@tromey.com>
Cc: Simon Marchi <simon.marchi@ericsson.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH RFC 4/5] Introduce scoped_mmapped_file
Date: Thu, 10 May 2018 21:27:00 -0000 [thread overview]
Message-ID: <1601635db4edc8926dfcf2a82db65c3e@polymtl.ca> (raw)
In-Reply-To: <87y3grz0px.fsf@tromey.com>
On 2018-05-10 16:59, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
>
> Simon> + void reset (int new_fd)
> Simon> + {
> Simon> + destroy ();
> Simon> +
> Simon> + m_fd = new_fd;
> Simon> + }
>
> I was wondering if this should only destroy() when new_fd!=m_fd.
> That way self-resetting would not cause a bug.
It probably should, indeed.
> Simon> + /* Map FILENAME in memory. Throw an error if anything goes
> wrong. */
> Simon> + scoped_mmapped_file (const char *filename)
> Simon> + {
> Simon> + m_fd.reset (open (filename, 0, O_RDONLY));
>
> ... however, then I thought perhaps this question could be avoided by
> just initializing m_fd directly, like:
>
> scoped_mmapped_file (const char *filename)
> : m_fd (open (filename, 0, O_RDONLY))
>
> Then "reset" wouldn't be needed at all.
I can do that, but I am using reset() in the following patch anyway.
Though if you find a way of avoiding that usage, then we can remove the
method.
> Also I think that should be "open (filename, O_RDONLY)" -- no "0, ".
Right, thanks.
Simon
next prev parent reply other threads:[~2018-05-10 21:10 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-09 21:27 [PATCH RFC 0/5] Add a DWARF index cache Simon Marchi
2018-05-09 21:27 ` [PATCH RFC 1/5] Rename some functions, index -> gdb_index Simon Marchi
2018-05-10 20:40 ` Tom Tromey
2018-06-12 2:03 ` Simon Marchi
2018-05-09 21:27 ` [PATCH RFC 2/5] Remove mapped_index::total_size Simon Marchi
2018-05-09 23:08 ` Simon Marchi
2018-05-10 20:54 ` Tom Tromey
2018-05-18 20:26 ` Simon Marchi
2018-05-09 21:27 ` [PATCH RFC 3/5] Make index reading functions more modular Simon Marchi
2018-05-10 21:02 ` Tom Tromey
2018-05-10 21:18 ` Simon Marchi
2018-05-09 21:27 ` [PATCH RFC 4/5] Introduce scoped_mmapped_file Simon Marchi
2018-05-10 21:04 ` Tom Tromey
2018-05-10 21:27 ` Simon Marchi [this message]
2018-05-12 15:49 ` Tom Tromey
2018-06-13 1:36 ` Simon Marchi
2018-05-09 21:27 ` [PATCH RFC 5/5] Add DWARF index cache Simon Marchi
2018-05-10 22:24 ` Tom Tromey
2018-07-09 20:56 ` Simon Marchi
2018-05-09 21:57 ` [PATCH RFC 0/5] Add a " Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1601635db4edc8926dfcf2a82db65c3e@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@ericsson.com \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).