pkarashchenko commented on code in PR #11857:
URL: https://github.com/apache/nuttx/pull/11857#discussion_r1517070590


##########
drivers/pipes/pipe.c:
##########
@@ -305,9 +303,9 @@ int pipe2(int fd[2], int flags)
 
   /* Clear O_NONBLOCK if it was set previously */
 
-  if ((flags & O_NONBLOCK) == 0)
+  if (!nonblock)
     {
-      ret = fcntl(fd[1], F_SETFL, flags & (~O_NONBLOCK));
+      ret = ioctl(fd[1], FIONBIO, &nonblock);

Review Comment:
   I mean that in `net/local/local_fifo.c` you have something that can be used 
here
   ```
   if ((flags & O_NONBLOCK) == 0)
   {
     ret = 1;
     ret = ioctl(fd[1], FIONBIO, &ret);
   }
   ```
   and get rid of `nonblock`, so my ask was basically why different places 
implement different approaches?



##########
net/local/local_fifo.c:
##########
@@ -294,7 +294,8 @@ static int local_tx_open(FAR struct local_conn_s *conn, FAR 
const char *path,
 
   if (nonblock == false)

Review Comment:
   Note: `if (!nonblock)`



##########
net/local/local_fifo.c:
##########
@@ -294,7 +294,8 @@ static int local_tx_open(FAR struct local_conn_s *conn, FAR 
const char *path,
 
   if (nonblock == false)
     {
-      ret = file_fcntl(&conn->lc_outfile, F_SETFL, O_WRONLY);
+      ret = nonblock;

Review Comment:
   `ret = nonblock;` -> `ret = 1;` to be more explicit



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to