You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/06/08 06:22:15 UTC

[GitHub] [incubator-nuttx] anchao opened a new pull request, #6389: sched/msgq: add support of System V message queue

anchao opened a new pull request, #6389:
URL: https://github.com/apache/incubator-nuttx/pull/6389

   ## Summary
   
   1. sched/msgq: add support of System V message queue
   
   https://man.openbsd.org/msgget.2
   
   2. libc/ipc: add ftok(3) support
   
   https://man.openbsd.org/ftok.3
   
   3. sys/ipc: correct definition value of IPC_*
   
   the definition of MSG_NOERROR and IPC_NOWAIT should not be aligned
   
   ------------------------------------------------------------------
   
   ```
   MSGOP(2)
   
   NAME
          msgrcv, msgsnd - System V message queue operations
   ...
   EXAMPLE
          The program below demonstrates the use of msgsnd() and msgrcv().
   ...
              if (msgrcv(qid, (void *) &msg, sizeof(msg.mtext), msgtype,
                         MSG_NOERROR | IPC_NOWAIT) == -1) {
   ...
   
   ```
   
   ## Impact
   
   ## Testing
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6389: libc/ipc: add ftok(3) support

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6389:
URL: https://github.com/apache/incubator-nuttx/pull/6389#discussion_r893259563


##########
include/sys/ipc.h:
##########
@@ -35,10 +35,10 @@
 
 /* Mode bits:  The lower order 9-bit bits are the standard mode bits */
 
-#define IPC_MODE    0x01ff     /* Mode bit mask */
-#define IPC_CREAT   (1 << 10)  /* Create entry if key does not exist */
-#define IPC_EXCL    (1 << 11)  /* Fail if key exists */
-#define IPC_NOWAIT  (1 << 12)  /* Error if request must wait */
+#define IPC_MODE   0x0fff /* Mode bit mask */

Review Comment:
   why mode is changed from `0x01ff` to `0x0fff`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6389: libc/ipc: add ftok(3) support

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6389:
URL: https://github.com/apache/incubator-nuttx/pull/6389#discussion_r893466926


##########
include/sys/types.h:
##########
@@ -158,7 +158,7 @@ typedef int          id_t;
  * semaphores. A key is simply an integer of type key_t
  */
 
-typedef int16_t      key_t;
+typedef uint32_t     key_t;

Review Comment:
   uint32_t -> int32_t



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6389: libc/ipc: add ftok(3) support

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6389:
URL: https://github.com/apache/incubator-nuttx/pull/6389#discussion_r892379840


##########
include/sys/ipc.h:
##########
@@ -35,10 +35,10 @@
 
 /* Mode bits:  The lower order 9-bit bits are the standard mode bits */
 
-#define IPC_MODE    0x01ff     /* Mode bit mask */
-#define IPC_CREAT   (1 << 10)  /* Create entry if key does not exist */
-#define IPC_EXCL    (1 << 11)  /* Fail if key exists */
-#define IPC_NOWAIT  (1 << 12)  /* Error if request must wait */
+#define IPC_MODE    0x01ff  /* Mode bit mask */
+#define IPC_CREAT   01000   /* Create key if key does not exist. */
+#define IPC_EXCL    02000   /* Fail if key exists.  */
+#define IPC_NOWAIT  04000   /* Return error on wait.  */

Review Comment:
   can we use hex constant variant?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] anchao commented on a diff in pull request #6389: libc/ipc: add ftok(3) support

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #6389:
URL: https://github.com/apache/incubator-nuttx/pull/6389#discussion_r893247614


##########
include/sys/types.h:
##########
@@ -158,7 +158,7 @@ typedef int          id_t;
  * semaphores. A key is simply an integer of type key_t
  */
 
-typedef int16_t      key_t;
+typedef long         key_t;

Review Comment:
   Done



##########
include/sys/ipc.h:
##########
@@ -35,10 +35,10 @@
 
 /* Mode bits:  The lower order 9-bit bits are the standard mode bits */
 
-#define IPC_MODE    0x01ff     /* Mode bit mask */
-#define IPC_CREAT   (1 << 10)  /* Create entry if key does not exist */
-#define IPC_EXCL    (1 << 11)  /* Fail if key exists */
-#define IPC_NOWAIT  (1 << 12)  /* Error if request must wait */
+#define IPC_MODE    0x01ff  /* Mode bit mask */
+#define IPC_CREAT   01000   /* Create key if key does not exist. */
+#define IPC_EXCL    02000   /* Fail if key exists.  */
+#define IPC_NOWAIT  04000   /* Return error on wait.  */

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6389: libc/ipc: add ftok(3) support

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6389:
URL: https://github.com/apache/incubator-nuttx/pull/6389#discussion_r893473593


##########
include/sys/types.h:
##########
@@ -158,7 +158,7 @@ typedef int          id_t;
  * semaphores. A key is simply an integer of type key_t
  */
 
-typedef int16_t      key_t;
+typedef int          key_t;

Review Comment:
   maybe still `int32_t`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko merged pull request #6389: libc/ipc: add ftok(3) support

Posted by GitBox <gi...@apache.org>.
pkarashchenko merged PR #6389:
URL: https://github.com/apache/incubator-nuttx/pull/6389


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6389: libc/ipc: add ftok(3) support

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6389:
URL: https://github.com/apache/incubator-nuttx/pull/6389#discussion_r892378319


##########
include/sys/types.h:
##########
@@ -158,7 +158,7 @@ typedef int          id_t;
  * semaphores. A key is simply an integer of type key_t
  */
 
-typedef int16_t      key_t;
+typedef long         key_t;

Review Comment:
   is it reasonable to use fixed length type like `uint32_t` instead?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] anchao commented on a diff in pull request #6389: libc/ipc: add ftok(3) support

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #6389:
URL: https://github.com/apache/incubator-nuttx/pull/6389#discussion_r893478625


##########
include/sys/types.h:
##########
@@ -158,7 +158,7 @@ typedef int          id_t;
  * semaphores. A key is simply an integer of type key_t
  */
 
-typedef int16_t      key_t;
+typedef int          key_t;

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6389: libc/ipc: add ftok(3) support

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6389:
URL: https://github.com/apache/incubator-nuttx/pull/6389#discussion_r892379840


##########
include/sys/ipc.h:
##########
@@ -35,10 +35,10 @@
 
 /* Mode bits:  The lower order 9-bit bits are the standard mode bits */
 
-#define IPC_MODE    0x01ff     /* Mode bit mask */
-#define IPC_CREAT   (1 << 10)  /* Create entry if key does not exist */
-#define IPC_EXCL    (1 << 11)  /* Fail if key exists */
-#define IPC_NOWAIT  (1 << 12)  /* Error if request must wait */
+#define IPC_MODE    0x01ff  /* Mode bit mask */
+#define IPC_CREAT   01000   /* Create key if key does not exist. */
+#define IPC_EXCL    02000   /* Fail if key exists.  */
+#define IPC_NOWAIT  04000   /* Return error on wait.  */

Review Comment:
   can we use hex versions?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] anchao commented on a diff in pull request #6389: libc/ipc: add ftok(3) support

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #6389:
URL: https://github.com/apache/incubator-nuttx/pull/6389#discussion_r893317118


##########
include/sys/ipc.h:
##########
@@ -35,10 +35,10 @@
 
 /* Mode bits:  The lower order 9-bit bits are the standard mode bits */
 
-#define IPC_MODE    0x01ff     /* Mode bit mask */
-#define IPC_CREAT   (1 << 10)  /* Create entry if key does not exist */
-#define IPC_EXCL    (1 << 11)  /* Fail if key exists */
-#define IPC_NOWAIT  (1 << 12)  /* Error if request must wait */
+#define IPC_MODE   0x0fff /* Mode bit mask */

Review Comment:
   ipc mode is a private implementation of nuttx, which is used as a mask in the source code. dur to changes in other IPC_* definitions, IPC_MODE also needs to be modified accordingly



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] anchao commented on a diff in pull request #6389: libc/ipc: add ftok(3) support

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #6389:
URL: https://github.com/apache/incubator-nuttx/pull/6389#discussion_r893433953


##########
include/sys/ipc.h:
##########
@@ -35,10 +35,10 @@
 
 /* Mode bits:  The lower order 9-bit bits are the standard mode bits */
 
-#define IPC_MODE    0x01ff     /* Mode bit mask */
-#define IPC_CREAT   (1 << 10)  /* Create entry if key does not exist */
-#define IPC_EXCL    (1 << 11)  /* Fail if key exists */
-#define IPC_NOWAIT  (1 << 12)  /* Error if request must wait */
+#define IPC_MODE   0x0fff /* Mode bit mask */

Review Comment:
   sorry for confuses, MODE mask should be aligned to mode permissions, so the change here is wrong, let me restore this change
   https://github.com/apache/incubator-nuttx/blob/master/include/sys/stat.h#L50-L63



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org