[05/26] Linux: mq_* syscall numbers are always available

Message ID 3b395246aa4663de42d69868043bbabdd81e2929.1581279333.git.fweimer@redhat.com
State New
Headers show
Series
  • Linux cleanups enabled by built-in system call tables
Related show

Commit Message

Florian Weimer Feb. 9, 2020, 8:19 p.m.
Due to the built-in tables, __NR_mq_getsetattr, __NR_mq_notify,
__NR_mq_open, __NR_mq_timedreceive, __NR_mq_timedsend, __NR_mq_unlink
are always defined.
---
 sysdeps/unix/sysv/linux/mq_close.c   | 6 ------
 sysdeps/unix/sysv/linux/mq_getattr.c | 6 ------
 sysdeps/unix/sysv/linux/mq_notify.c  | 6 ------
 sysdeps/unix/sysv/linux/mq_open.c    | 5 -----
 sysdeps/unix/sysv/linux/mq_receive.c | 6 ------
 sysdeps/unix/sysv/linux/mq_send.c    | 6 ------
 sysdeps/unix/sysv/linux/mq_unlink.c  | 6 ------
 7 files changed, 41 deletions(-)

-- 
2.24.1

Comments

Adhemerval Zanella Feb. 27, 2020, 11:06 p.m. | #1
On 09/02/2020 17:19, Florian Weimer wrote:
> Due to the built-in tables, __NR_mq_getsetattr, __NR_mq_notify,

> __NR_mq_open, __NR_mq_timedreceive, __NR_mq_timedsend, __NR_mq_unlink

> are always defined.


LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>


> ---

>  sysdeps/unix/sysv/linux/mq_close.c   | 6 ------

>  sysdeps/unix/sysv/linux/mq_getattr.c | 6 ------

>  sysdeps/unix/sysv/linux/mq_notify.c  | 6 ------

>  sysdeps/unix/sysv/linux/mq_open.c    | 5 -----

>  sysdeps/unix/sysv/linux/mq_receive.c | 6 ------

>  sysdeps/unix/sysv/linux/mq_send.c    | 6 ------

>  sysdeps/unix/sysv/linux/mq_unlink.c  | 6 ------

>  7 files changed, 41 deletions(-)

> 

> diff --git a/sysdeps/unix/sysv/linux/mq_close.c b/sysdeps/unix/sysv/linux/mq_close.c

> index 6990182e68..e1b4898170 100644

> --- a/sysdeps/unix/sysv/linux/mq_close.c

> +++ b/sysdeps/unix/sysv/linux/mq_close.c

> @@ -19,8 +19,6 @@

>  #include <mqueue.h>

>  #include <sysdep.h>

>  

> -#ifdef __NR_mq_open

> -

>  /* Removes the association between message queue descriptor MQDES and its

>     message queue.  */

>  int

> @@ -28,7 +26,3 @@ mq_close (mqd_t mqdes)

>  {

>    return INLINE_SYSCALL (close, 1, mqdes);

>  }

> -

> -#else

> -# include <rt/mq_close.c>

> -#endif


Ok.

> diff --git a/sysdeps/unix/sysv/linux/mq_getattr.c b/sysdeps/unix/sysv/linux/mq_getattr.c

> index a8a17fd7bb..dc8acc5dcc 100644

> --- a/sysdeps/unix/sysv/linux/mq_getattr.c

> +++ b/sysdeps/unix/sysv/linux/mq_getattr.c

> @@ -20,15 +20,9 @@

>  #include <stddef.h>

>  #include <sysdep.h>

>  

> -#ifdef __NR_mq_getsetattr

> -

>  /* Query status and attributes of message queue MQDES.  */

>  int

>  mq_getattr (mqd_t mqdes, struct mq_attr *mqstat)

>  {

>    return mq_setattr (mqdes, NULL, mqstat);

>  }

> -

> -#else

> -# include <rt/mq_getattr.c>

> -#endif


Ok.

> diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c

> index f288bac477..61bbb03b64 100644

> --- a/sysdeps/unix/sysv/linux/mq_notify.c

> +++ b/sysdeps/unix/sysv/linux/mq_notify.c

> @@ -31,8 +31,6 @@

>  #include <nptl/pthreadP.h>

>  

>  

> -#ifdef __NR_mq_notify

> -

>  /* Defined in the kernel headers: */

>  #define NOTIFY_COOKIE_LEN	32	/* Length of the cookie used.  */

>  #define NOTIFY_WOKENUP		1	/* Code for notifcation.  */

> @@ -276,7 +274,3 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)

>  

>    return retval;

>  }

> -

> -#else

> -# include <rt/mq_notify.c>

> -#endif


Ok.

> diff --git a/sysdeps/unix/sysv/linux/mq_open.c b/sysdeps/unix/sysv/linux/mq_open.c

> index ebb1bfc8b6..c88dc580e4 100644

> --- a/sysdeps/unix/sysv/linux/mq_open.c

> +++ b/sysdeps/unix/sysv/linux/mq_open.c

> @@ -22,8 +22,6 @@

>  #include <stdio.h>

>  #include <sysdep.h>

>  

> -#ifdef __NR_mq_open

> -

>  /* Establish connection between a process and a message queue NAME and

>     return message queue descriptor or (mqd_t) -1 on error.  OFLAG determines

>     the type of access used.  If O_CREAT is on OFLAG, the third argument is

> @@ -61,6 +59,3 @@ __mq_open_2 (const char *name, int oflag)

>  

>    return __mq_open (name, oflag);

>  }

> -#else

> -# include <rt/mq_open.c>

> -#endif


Ok.

> diff --git a/sysdeps/unix/sysv/linux/mq_receive.c b/sysdeps/unix/sysv/linux/mq_receive.c

> index 5292c98b8b..282f486911 100644

> --- a/sysdeps/unix/sysv/linux/mq_receive.c

> +++ b/sysdeps/unix/sysv/linux/mq_receive.c

> @@ -20,8 +20,6 @@

>  #include <stddef.h>

>  #include <sysdep.h>

>  

> -#ifdef __NR_mq_timedreceive

> -

>  /* Receive the oldest from highest priority messages in message queue

>     MQDES.  */

>  ssize_t

> @@ -30,7 +28,3 @@ mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len,

>  {

>    return __mq_timedreceive (mqdes, msg_ptr, msg_len, msg_prio, NULL);

>  }

> -

> -#else

> -# include <rt/mq_receive.c>

> -#endif


Ok.

> diff --git a/sysdeps/unix/sysv/linux/mq_send.c b/sysdeps/unix/sysv/linux/mq_send.c

> index 8e297e6d99..38f320d3ab 100644

> --- a/sysdeps/unix/sysv/linux/mq_send.c

> +++ b/sysdeps/unix/sysv/linux/mq_send.c

> @@ -20,8 +20,6 @@

>  #include <stddef.h>

>  #include <sysdep.h>

>  

> -#ifdef __NR_mq_timedsend

> -

>  /* Add message pointed by MSG_PTR to message queue MQDES.  */

>  int

>  mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,

> @@ -29,7 +27,3 @@ mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,

>  {

>    return __mq_timedsend (mqdes, msg_ptr, msg_len, msg_prio, NULL);

>  }

> -

> -#else

> -# include <rt/mq_send.c>

> -#endif


Ok.

> diff --git a/sysdeps/unix/sysv/linux/mq_unlink.c b/sysdeps/unix/sysv/linux/mq_unlink.c

> index a0c3348744..feadaa29ec 100644

> --- a/sysdeps/unix/sysv/linux/mq_unlink.c

> +++ b/sysdeps/unix/sysv/linux/mq_unlink.c

> @@ -19,8 +19,6 @@

>  #include <mqueue.h>

>  #include <sysdep.h>

>  

> -#ifdef __NR_mq_unlink

> -

>  /* Remove message queue named NAME.  */

>  int

>  mq_unlink (const char *name)

> @@ -43,7 +41,3 @@ mq_unlink (const char *name)

>  

>    return ret;

>  }

> -

> -#else

> -# include <rt/mq_unlink.c>

> -#endif

> 


Ok.

Patch

diff --git a/sysdeps/unix/sysv/linux/mq_close.c b/sysdeps/unix/sysv/linux/mq_close.c
index 6990182e68..e1b4898170 100644
--- a/sysdeps/unix/sysv/linux/mq_close.c
+++ b/sysdeps/unix/sysv/linux/mq_close.c
@@ -19,8 +19,6 @@ 
 #include <mqueue.h>
 #include <sysdep.h>
 
-#ifdef __NR_mq_open
-
 /* Removes the association between message queue descriptor MQDES and its
    message queue.  */
 int
@@ -28,7 +26,3 @@  mq_close (mqd_t mqdes)
 {
   return INLINE_SYSCALL (close, 1, mqdes);
 }
-
-#else
-# include <rt/mq_close.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mq_getattr.c b/sysdeps/unix/sysv/linux/mq_getattr.c
index a8a17fd7bb..dc8acc5dcc 100644
--- a/sysdeps/unix/sysv/linux/mq_getattr.c
+++ b/sysdeps/unix/sysv/linux/mq_getattr.c
@@ -20,15 +20,9 @@ 
 #include <stddef.h>
 #include <sysdep.h>
 
-#ifdef __NR_mq_getsetattr
-
 /* Query status and attributes of message queue MQDES.  */
 int
 mq_getattr (mqd_t mqdes, struct mq_attr *mqstat)
 {
   return mq_setattr (mqdes, NULL, mqstat);
 }
-
-#else
-# include <rt/mq_getattr.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
index f288bac477..61bbb03b64 100644
--- a/sysdeps/unix/sysv/linux/mq_notify.c
+++ b/sysdeps/unix/sysv/linux/mq_notify.c
@@ -31,8 +31,6 @@ 
 #include <nptl/pthreadP.h>
 
 
-#ifdef __NR_mq_notify
-
 /* Defined in the kernel headers: */
 #define NOTIFY_COOKIE_LEN	32	/* Length of the cookie used.  */
 #define NOTIFY_WOKENUP		1	/* Code for notifcation.  */
@@ -276,7 +274,3 @@  mq_notify (mqd_t mqdes, const struct sigevent *notification)
 
   return retval;
 }
-
-#else
-# include <rt/mq_notify.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mq_open.c b/sysdeps/unix/sysv/linux/mq_open.c
index ebb1bfc8b6..c88dc580e4 100644
--- a/sysdeps/unix/sysv/linux/mq_open.c
+++ b/sysdeps/unix/sysv/linux/mq_open.c
@@ -22,8 +22,6 @@ 
 #include <stdio.h>
 #include <sysdep.h>
 
-#ifdef __NR_mq_open
-
 /* Establish connection between a process and a message queue NAME and
    return message queue descriptor or (mqd_t) -1 on error.  OFLAG determines
    the type of access used.  If O_CREAT is on OFLAG, the third argument is
@@ -61,6 +59,3 @@  __mq_open_2 (const char *name, int oflag)
 
   return __mq_open (name, oflag);
 }
-#else
-# include <rt/mq_open.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mq_receive.c b/sysdeps/unix/sysv/linux/mq_receive.c
index 5292c98b8b..282f486911 100644
--- a/sysdeps/unix/sysv/linux/mq_receive.c
+++ b/sysdeps/unix/sysv/linux/mq_receive.c
@@ -20,8 +20,6 @@ 
 #include <stddef.h>
 #include <sysdep.h>
 
-#ifdef __NR_mq_timedreceive
-
 /* Receive the oldest from highest priority messages in message queue
    MQDES.  */
 ssize_t
@@ -30,7 +28,3 @@  mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len,
 {
   return __mq_timedreceive (mqdes, msg_ptr, msg_len, msg_prio, NULL);
 }
-
-#else
-# include <rt/mq_receive.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mq_send.c b/sysdeps/unix/sysv/linux/mq_send.c
index 8e297e6d99..38f320d3ab 100644
--- a/sysdeps/unix/sysv/linux/mq_send.c
+++ b/sysdeps/unix/sysv/linux/mq_send.c
@@ -20,8 +20,6 @@ 
 #include <stddef.h>
 #include <sysdep.h>
 
-#ifdef __NR_mq_timedsend
-
 /* Add message pointed by MSG_PTR to message queue MQDES.  */
 int
 mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
@@ -29,7 +27,3 @@  mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
 {
   return __mq_timedsend (mqdes, msg_ptr, msg_len, msg_prio, NULL);
 }
-
-#else
-# include <rt/mq_send.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mq_unlink.c b/sysdeps/unix/sysv/linux/mq_unlink.c
index a0c3348744..feadaa29ec 100644
--- a/sysdeps/unix/sysv/linux/mq_unlink.c
+++ b/sysdeps/unix/sysv/linux/mq_unlink.c
@@ -19,8 +19,6 @@ 
 #include <mqueue.h>
 #include <sysdep.h>
 
-#ifdef __NR_mq_unlink
-
 /* Remove message queue named NAME.  */
 int
 mq_unlink (const char *name)
@@ -43,7 +41,3 @@  mq_unlink (const char *name)
 
   return ret;
 }
-
-#else
-# include <rt/mq_unlink.c>
-#endif