Re: tgt on arm64 and USE_SIGNALFD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, 14 Feb 2024 17:14:42 -0300
Andreas Hasenack <andreas@xxxxxxxxxxxxx> wrote:

> is USE_SIGNALFD meant to be supported on arm64? The check in
> bs/util.h[1] is looking for __NR_signalfd, but arm64 only has the
> newer __NR_signalfd4[2]:
> 
> #if defined(__NR_signalfd) && defined(USE_SIGNALFD)
> ...
> #else
> #define __signalfd(fd, mask, flags) (-1)
> struct signalfd_siginfo {
> };
> #endif

I think that we don't need this hack anymore (it was necessary when
the signalfd feature was introduced). I've not tested on arm64 but
I guess that simply using sys/signalfd.h works like the following?


diff --git a/usr/bs.c b/usr/bs.c
index 8171a32..8da5a9b 100644
--- a/usr/bs.c
+++ b/usr/bs.c
@@ -311,7 +311,7 @@ static int bs_init_signalfd(void)
 	sigaddset(&mask, SIGUSR2);
 	sigprocmask(SIG_BLOCK, &mask, NULL);
 
-	sig_fd = __signalfd(-1, &mask, 0);
+	sig_fd = signalfd(-1, &mask, 0);
 	if (sig_fd < 0)
 		return 1;
 
diff --git a/usr/util.h b/usr/util.h
index c709f9b..8aef6ab 100644
--- a/usr/util.h
+++ b/usr/util.h
@@ -14,11 +14,12 @@
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
+#include <linux/fs.h>
 #include <linux/types.h>
 #include <sys/ioctl.h>
-#include <linux/fs.h>
-#include <sys/types.h>
+#include <sys/signalfd.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 
 #include "be_byteshift.h"
 
@@ -103,44 +104,6 @@ static inline int between(uint32_t seq1, uint32_t seq2, uint32_t seq3)
 
 extern unsigned long pagesize, pageshift;
 
-#if defined(__NR_signalfd) && defined(USE_SIGNALFD)
-
-/*
- * workaround for broken linux/signalfd.h including
- * usr/include/linux/fcntl.h
- */
-#define _LINUX_FCNTL_H
-
-#include <linux/signalfd.h>
-
-static inline int __signalfd(int fd, const sigset_t *mask, int flags)
-{
-	int fd2, ret;
-
-	fd2 = syscall(__NR_signalfd, fd, mask, _NSIG / 8);
-	if (fd2 < 0)
-		return fd2;
-
-	ret = fcntl(fd2, F_GETFL);
-	if (ret < 0) {
-		close(fd2);
-		return -1;
-	}
-
-	ret = fcntl(fd2, F_SETFL, ret | O_NONBLOCK);
-	if (ret < 0) {
-		close(fd2);
-		return -1;
-	}
-
-	return fd2;
-}
-#else
-#define __signalfd(fd, mask, flags) (-1)
-struct signalfd_siginfo {
-};
-#endif
-
 /* convert string to integer, check for validity of the string numeric format
  * and the natural boundaries of the integer value type (first get a 64-bit
  * value and check that it fits the range of the destination integer).




[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux