git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Jeremiah Mahler <jmmahler@gmail.com>,
	Chris Packham <judge.packham@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v3 1/9] compat/mingw.c: expand MinGW support for sigaction
Date: Mon, 02 Jun 2014 07:57:35 +0200	[thread overview]
Message-ID: <538C124F.2010103@viscovery.net> (raw)
In-Reply-To: <d5fc7d72b2d51d1b90fb7f238eff120cb4c6d0e7.1401645403.git.jmmahler@gmail.com>

Am 6/1/2014 20:10, schrieb Jeremiah Mahler:
> Due to portability issues across UNIX versions sigaction(2) should be used
> instead of signal(2).
> 
>>From the signal(2) man page:
> 
>   The behavior of signal() varies across UNIX versions, and has also var‐
>   ied historically across different versions of Linux.   Avoid  its  use:
>   use sigaction(2) instead.
> 
> Unfortunately MinGW under Windows has limited support for signal and no
> support for sigaction.  And this prevents sigaction from being used across
> the entire Git project.
> 
> In compat/mingw.c there is a faux sigaction function but it only supports
> SIGALARM.  Hence the need for continuing to use signal() in other cases.
> 
> This patch expands the faux sigaction function so that it calls signal in
> cases other than SIGALRM.  Now sigaction can be used across the entire Git
> project and MinGW will still work with signal as it did before.
> 
> Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
> ---
>  compat/mingw.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/compat/mingw.c b/compat/mingw.c
> index e9892f8..e504cef 100644
> --- a/compat/mingw.c
> +++ b/compat/mingw.c
> @@ -1651,14 +1651,15 @@ int setitimer(int type, struct itimerval *in, struct itimerval *out)
>  
>  int sigaction(int sig, struct sigaction *in, struct sigaction *out)
>  {
> -	if (sig != SIGALRM)
> -		return errno = EINVAL,
> -			error("sigaction only implemented for SIGALRM");
>  	if (out != NULL)
>  		return errno = EINVAL,
>  			error("sigaction: param 3 != NULL not implemented");

A fix for this missing implementation is needed before patch 9/9 can be
applied.

>  
> -	timer_fn = in->sa_handler;
> +	if (sig == SIGALRM)
> +		timer_fn = in->sa_handler;
> +	else
> +		signal(sig, in->sa_handler);
> +
>  	return 0;
>  }
>  
> 

-- Hannes

  reply	other threads:[~2014-06-02  5:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-01 18:10 [PATCH v3 0/9] replace signal() with sigaction() Jeremiah Mahler
2014-06-01 18:10 ` [PATCH v3 1/9] compat/mingw.c: expand MinGW support for sigaction Jeremiah Mahler
2014-06-02  5:57   ` Johannes Sixt [this message]
2014-06-01 18:10 ` [PATCH v3 2/9] connect.c: replace signal() with sigaction() Jeremiah Mahler
2014-06-01 18:10 ` [PATCH v3 3/9] progress.c: " Jeremiah Mahler
2014-06-01 18:10 ` [PATCH v3 4/9] write_or_die.c: " Jeremiah Mahler
2014-06-01 18:10 ` [PATCH v3 5/9] daemon.c: " Jeremiah Mahler
2014-06-01 18:10 ` [PATCH v3 6/9] builtin/log.c: " Jeremiah Mahler
2014-06-01 18:10 ` [PATCH v3 7/9] builtin/merge-index.c: " Jeremiah Mahler
2014-06-01 18:10 ` [PATCH v3 8/9] builtin/verify-tag.c: " Jeremiah Mahler
2014-06-01 18:10 ` [PATCH v3 9/9] sigchain.c: " Jeremiah Mahler
2014-06-02 11:28 ` [PATCH v3 0/9] " Johannes Sixt
2014-06-02 14:39   ` Jeremiah Mahler
2014-06-02 19:05   ` Junio C Hamano
2014-06-02 20:25     ` Jeremiah Mahler

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=538C124F.2010103@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=jmmahler@gmail.com \
    --cc=judge.packham@gmail.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 NNTP newsgroup(s).