From: "Torsten Bögershausen" <tboegi@web.de>
To: Michael Haggerty <mhagger@alum.mit.edu>,
Junio C Hamano <gitster@pobox.com>
Cc: "Johannes Sixt" <j6t@kdbg.org>,
"Torsten Bögershausen" <tboegi@web.de>,
"Jeff King" <peff@peff.net>,
"Ronnie Sahlberg" <sahlberg@google.com>,
"Jonathan Nieder" <jrnieder@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH 1/3] fdopen_lock_file(): access a lockfile using stdio
Date: Thu, 02 Oct 2014 11:29:22 +0200 [thread overview]
Message-ID: <542D1AF2.8050508@web.de> (raw)
In-Reply-To: <1412162089-3233-2-git-send-email-mhagger@alum.mit.edu>
On 01.10.14 13:14, Michael Haggerty wrote:
[]
Nice done, small comments inline
> diff --git a/lockfile.c b/lockfile.c
> index d27e61c..e046027 100644
> --- a/lockfile.c
> +++ b/lockfile.c
> @@ -7,20 +7,29 @@
>
> static struct lock_file *volatile lock_file_list;
>
> -static void remove_lock_files(void)
> +static void remove_lock_files(int skip_fclose)
Even if the motivation to skip is clear now and here,
I would consider to do it the other way around,
and actively order the fclose():
static void remove_lock_files(int call_fclose)
> {
> pid_t me = getpid();
>
> while (lock_file_list) {
> - if (lock_file_list->owner == me)
> + if (lock_file_list->owner == me) {
> + /* fclose() is not safe to call in a signal handler */
> + if (skip_fclose)
> + lock_file_list->fp = NULL;
> rollback_lock_file(lock_file_list);
> + }
> lock_file_list = lock_file_list->next;
> }
> }
>
> +static void remove_lock_files_on_exit(void)
> +{
> + remove_lock_files(0);
What does "0" mean ?
remove_lock_files(LK_DO_FCLOSE) ?
> +}
> +
> static void remove_lock_files_on_signal(int signo)
> {
> - remove_lock_files();
> + remove_lock_files(1);
And what does this "1" mean ?
remove_lock_files(LK_SKIP_FCLOSE) ?
We can even have an emum, or use #define
>
next prev parent reply other threads:[~2014-10-02 9:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 11:14 [PATCH 0/3] Support stdio access to lockfiles Michael Haggerty
2014-10-01 11:14 ` [PATCH 1/3] fdopen_lock_file(): access a lockfile using stdio Michael Haggerty
2014-10-01 12:48 ` Jeff King
2014-10-01 21:20 ` Junio C Hamano
2014-10-02 9:29 ` Torsten Bögershausen [this message]
2014-10-12 6:17 ` Michael Haggerty
2014-10-01 11:14 ` [PATCH 2/3] dump_marks(): reimplement using fdopen_lock_file() Michael Haggerty
2014-10-01 11:14 ` [PATCH 3/3] commit_packed_refs(): " Michael Haggerty
2014-10-01 12:52 ` [PATCH 0/3] Support stdio access to lockfiles Jeff King
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=542D1AF2.8050508@web.de \
--to=tboegi@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=jrnieder@gmail.com \
--cc=mhagger@alum.mit.edu \
--cc=peff@peff.net \
--cc=sahlberg@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.