From: Lancelot SIX <Lancelot.Six@amd.com>
To: Pedro Alves <pedro@palves.net>, gdb-patches@sourceware.org
Cc: lsix@lancelotsix.com
Subject: Re: [PATCH] gdb/solib-rocm: limit the number of opened file descriptors
Date: Wed, 19 Jul 2023 18:17:36 +0100 [thread overview]
Message-ID: <63d4d548-9bbc-7f0c-3a3f-e2cb538500a7@amd.com> (raw)
In-Reply-To: <adc0644e-12d3-517c-9f6a-f97674a477ee@palves.net>
Hi Pedro,
Thanks for the review. I have addressed you minor remarks locally.
>> +
>> + if (it == m_cache.end ())
>> + {
>> + *target_errno = FILEIO_EBADF;
>> + return -1;
>
> Is this case ever not a bug? Should we assert instead?
>
> Also, AFAICT, no caller actually check the return value of close. Looks like
> we could simplify things a bit. There isn't usually much you can do if
> closing fails, so maybe here ...
>
>
>> + }
>> +
>> + it->second.refcnt--;
>> + if (it->second.refcnt == 0)
>> + {
>> + int ret = target_fileio_close (it->second.fd, target_errno);
>> + m_cache.erase (it);
>> + return ret;
>
> ... issue a warning, and return void?
>
Since this close method is similar to close(2) or target_fileio_close, I
think I prefer to keep its interface similar to the others, if that's ok
with you. I have updated the caller of this method to print a warning
if -1 is returned.
I'll send a V2 with those changed.
Best,
Lancelot.
next prev parent reply other threads:[~2023-07-19 17:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 14:44 Lancelot Six
2023-07-14 18:58 ` Pedro Alves
2023-07-19 17:17 ` Lancelot SIX [this message]
2023-07-19 19:23 ` Pedro Alves
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=63d4d548-9bbc-7f0c-3a3f-e2cb538500a7@amd.com \
--to=lancelot.six@amd.com \
--cc=gdb-patches@sourceware.org \
--cc=lsix@lancelotsix.com \
--cc=pedro@palves.net \
/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).