[stgt] [PATCH 1/2] add signalfd support

ronnie sahlberg ronniesahlberg at gmail.com
Thu Sep 17 07:49:05 CEST 2009


This builds and runs on rhel5.2 but not on rhel5.4.

rhel5.4 has __NR_signalfd defined
asm-x86_64/unistd.h:#define __NR_signalfd               282
asm-x86_64/unistd.h:__SYSCALL(__NR_signalfd, sys_ni_syscall)

but it does not have
[root at rh54n2 usr]# make ISCSI=1
cc -c -DISCSI -D_GNU_SOURCE -I. -g -O2 -Wall -Wstrict-prototypes -fPIC
-DTGT_VERSION=\"0.9.8-git-2cf48f1\" iscsi/conn.c -o iscsi/conn.o
In file included from iscsi/conn.c:29:
./util.h:122:28: error: linux/signalfd.h: No such file or directory




On Tue, Sep 15, 2009  9:53 PM, FUJITA Tomonori
<fujita.tomonori at lab.ntt.co.jp> wrote:
> On Tue, 15 Sep 2009 14:31:15 +0300
> Or Gerlitz <ogerlitz at Voltaire.com> wrote:
>
>> The code doesn't get built on RHEL5.1, see below. Looking on the
>> patch, I didn't see an easy and not too much ugly (i.e fill the code
>> with ifdefs) way to make it work in both schemes, since some of the
>> code which comes with the patch uses signals wheres before that pipe
>> was used... anyway, maybe you'll have an idea how / what would be
>> the minimal abstraction here that will allow the code to function
>> whether signalfd is supported or not
>
> Duh, sorry about that.
>
> I like a cleaner abstraction but I know that I'll remove the pipe code
> in the future (probably when RHEL6.x is released) so how about the
> following workaround?
>
>
> diff --git a/usr/bs.c b/usr/bs.c
> index e7cfb05..d0fcce4 100644
> --- a/usr/bs.c
> +++ b/usr/bs.c
> @@ -31,7 +31,6 @@
>  #include <sys/types.h>
>  #include <sys/epoll.h>
>  #include <linux/types.h>
> -#include <linux/signalfd.h>
>
>  #include "list.h"
>  #include "tgtd.h"
> diff --git a/usr/util.h b/usr/util.h
> index acec418..4404a76 100644
> --- a/usr/util.h
> +++ b/usr/util.h
> @@ -8,6 +8,7 @@
>  #include <signal.h>
>  #include <syscall.h>
>  #include <unistd.h>
> +#include <linux/types.h>
>
>  #include "be_byteshift.h"
>
> @@ -118,6 +119,8 @@ static inline int __sync_file_range(int fd, __off64_t offset, __off64_t bytes)
>  #endif
>
>  #if defined(__NR_signalfd)
> +#include <linux/signalfd.h>
> +
>  static inline int __signalfd(int fd, const sigset_t *mask, int flags)
>  {
>        int fd2, ret;
> @@ -141,7 +144,9 @@ static inline int __signalfd(int fd, const sigset_t *mask, int flags)
>        return fd2;
>  }
>  #else
> -#define __signalfd() (-1)
> +#define __signalfd(fd, mask, flags) (-1)
> +struct signalfd_siginfo {
> +};
>  #endif
>
>  #endif
> --
> To unsubscribe from this list: send the line "unsubscribe stgt" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list