[4/6] Cleanup Linux sigqueue implementation

Message ID 1509745249-11404-4-git-send-email-adhemerval.zanella@linaro.org
State New
Headers show
Series
  • [1/6] Consolidate Linux sigprocmask implementation (BZ #22391)
Related show

Commit Message

Adhemerval Zanella Nov. 3, 2017, 9:40 p.m.
This patch simplify Linux sigqueue implementation by assuming
__NR_rt_sigqueueinfo existence due minimum kernel requirement.

Checked on x86_64-linux-gnu.

	* sysdeps/unix/sysv/linux/sigqueue.c (__sigqueue): Asssume
	__NR_rt_sigqueueinfo.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
---
 ChangeLog                          |  3 +++
 sysdeps/unix/sysv/linux/sigqueue.c | 10 ++--------
 2 files changed, 5 insertions(+), 8 deletions(-)

Comments

Zack Weinberg Nov. 5, 2017, 9:30 p.m. | #1
On Fri, Nov 3, 2017 at 5:40 PM, Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
> This patch simplify Linux sigqueue implementation by assuming
> __NR_rt_sigqueueinfo existence due minimum kernel requirement.
>
> Checked on x86_64-linux-gnu.
>
>         * sysdeps/unix/sysv/linux/sigqueue.c (__sigqueue): Asssume
>         __NR_rt_sigqueueinfo.

OK, but please state in the commit message the oldest kernel version
that provided __NR_rt_sigqueueinfo on all architectures.

zw
Adhemerval Zanella Nov. 6, 2017, 10:59 a.m. | #2
On 05/11/2017 19:30, Zack Weinberg wrote:
> On Fri, Nov 3, 2017 at 5:40 PM, Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>> This patch simplify Linux sigqueue implementation by assuming
>> __NR_rt_sigqueueinfo existence due minimum kernel requirement.
>>
>> Checked on x86_64-linux-gnu.
>>
>>         * sysdeps/unix/sysv/linux/sigqueue.c (__sigqueue): Asssume
>>         __NR_rt_sigqueueinfo.
> 
> OK, but please state in the commit message the oldest kernel version
> that provided __NR_rt_sigqueueinfo on all architectures.
> 
> zw
> 

I am trying to find out exactly when realtime signals were introduced
on Linux and it seems it pre-dates git and so Linux 2.6.12 (commit
1da177e4 added both the headers and the systbl linkage on alpha
for instance).  I think stating it is present on Linux 2.6 should
be suffice.
Zack Weinberg Nov. 6, 2017, 2:05 p.m. | #3
On Mon, Nov 6, 2017 at 5:59 AM, Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
> On 05/11/2017 19:30, Zack Weinberg wrote:
>> On Fri, Nov 3, 2017 at 5:40 PM, Adhemerval Zanella
>> <adhemerval.zanella@linaro.org> wrote:
>>> This patch simplify Linux sigqueue implementation by assuming
>>> __NR_rt_sigqueueinfo existence due minimum kernel requirement.
>>>
>>> Checked on x86_64-linux-gnu.
>>>
>>>         * sysdeps/unix/sysv/linux/sigqueue.c (__sigqueue): Asssume
>>>         __NR_rt_sigqueueinfo.
>>
>> OK, but please state in the commit message the oldest kernel version
>> that provided __NR_rt_sigqueueinfo on all architectures.
>
> I am trying to find out exactly when realtime signals were introduced
> on Linux and it seems it pre-dates git and so Linux 2.6.12 (commit
> 1da177e4 added both the headers and the systbl linkage on alpha
> for instance).  I think stating it is present on Linux 2.6 should
> be suffice.

Yeah, that's fine.  I just want there to be no confusion in the future.

I think you should go ahead and push the components of this patchset
that are fully reviewed and don't depend on other work, like this one
and the one cleaning up sigtimedwait and friends.

zw
Adhemerval Zanella Nov. 6, 2017, 3:42 p.m. | #4
On 06/11/2017 12:05, Zack Weinberg wrote:
> On Mon, Nov 6, 2017 at 5:59 AM, Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>> On 05/11/2017 19:30, Zack Weinberg wrote:
>>> On Fri, Nov 3, 2017 at 5:40 PM, Adhemerval Zanella
>>> <adhemerval.zanella@linaro.org> wrote:
>>>> This patch simplify Linux sigqueue implementation by assuming
>>>> __NR_rt_sigqueueinfo existence due minimum kernel requirement.
>>>>
>>>> Checked on x86_64-linux-gnu.
>>>>
>>>>         * sysdeps/unix/sysv/linux/sigqueue.c (__sigqueue): Asssume
>>>>         __NR_rt_sigqueueinfo.
>>>
>>> OK, but please state in the commit message the oldest kernel version
>>> that provided __NR_rt_sigqueueinfo on all architectures.
>>
>> I am trying to find out exactly when realtime signals were introduced
>> on Linux and it seems it pre-dates git and so Linux 2.6.12 (commit
>> 1da177e4 added both the headers and the systbl linkage on alpha
>> for instance).  I think stating it is present on Linux 2.6 should
>> be suffice.
> 
> Yeah, that's fine.  I just want there to be no confusion in the future.
> 
> I think you should go ahead and push the components of this patchset
> that are fully reviewed and don't depend on other work, like this one
> and the one cleaning up sigtimedwait and friends.
> 
> zw
> 

Right, I will push both the sigqueue and the sigtimedwait simplify.

Patch

diff --git a/sysdeps/unix/sysv/linux/sigqueue.c b/sysdeps/unix/sysv/linux/sigqueue.c
index 059e524..67bb6b2 100644
--- a/sysdeps/unix/sysv/linux/sigqueue.c
+++ b/sysdeps/unix/sysv/linux/sigqueue.c
@@ -17,13 +17,10 @@ 
 
 #include <errno.h>
 #include <signal.h>
-#include <unistd.h>
 #include <string.h>
-
+#include <unistd.h>
 #include <sysdep.h>
-#include <sys/syscall.h>
 
-#ifdef __NR_rt_sigqueueinfo
 /* Return any pending signal or wait for one for the given time.  */
 int
 __sigqueue (pid_t pid, int sig, const union sigval val)
@@ -40,9 +37,6 @@  __sigqueue (pid_t pid, int sig, const union sigval val)
   info.si_uid = __getuid ();
   info.si_value = val;
 
-  return INLINE_SYSCALL (rt_sigqueueinfo, 3, pid, sig, &info);
+  return INLINE_SYSCALL_CALL (rt_sigqueueinfo, pid, sig, &info);
 }
 weak_alias (__sigqueue, sigqueue)
-#else
-# include <signal/sigqueue.c>
-#endif