You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/02/22 05:42:54 UTC

[incubator-nuttx] branch master updated (2d67745 -> 84b8820)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 2d67745  .github/workflows/build.yml: Enable the "run" step in testbuild.sh
     new 1afdb06  nuttx/pty:pty FIONBIO pass to pipe control
     new c7c9148  nuttx/pty: pass read nonblock flag to pipe
     new 37730a1  nuttx/fcntl:pass O_NONBLOCK flag to ioctl
     new 88e871b  nuttx/pty: pty FIONBIO return -ENOTTY when pipe_ioctl return OK
     new 84b8820  serial/pty:Don't assert EBUSY when pty unregister driver

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 drivers/serial/ptmx.c |  2 +-
 drivers/serial/pty.c  | 19 ++++++++++++++++++-
 fs/vfs/fs_fcntl.c     | 13 +++++++++----
 fs/vfs/fs_ioctl.c     |  8 ++++----
 4 files changed, 32 insertions(+), 10 deletions(-)

[incubator-nuttx] 03/05: nuttx/fcntl:pass O_NONBLOCK flag to ioctl

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 37730a1fce987b5a997ee50f4553d6b30a158543
Author: fangzhenwei <fa...@xiaomi.com>
AuthorDate: Thu Nov 25 13:43:10 2021 +0800

    nuttx/fcntl:pass O_NONBLOCK flag to ioctl
    
    1. fix pty fcntl F_SETFL(O_NONBLOCK) fail issue
    
    Signed-off-by: fangzhenwei <fa...@xiaomi.com>
---
 fs/vfs/fs_fcntl.c | 13 +++++++++----
 fs/vfs/fs_ioctl.c |  8 ++++----
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/fs/vfs/fs_fcntl.c b/fs/vfs/fs_fcntl.c
index e38eef6..aaccd4d 100644
--- a/fs/vfs/fs_fcntl.c
+++ b/fs/vfs/fs_fcntl.c
@@ -159,11 +159,16 @@ static int file_vfcntl(FAR struct file *filep, int cmd, va_list ap)
 
         {
           int oflags = va_arg(ap, int);
+          int nonblock = !!(oflags & O_NONBLOCK);
 
-          oflags          &=  FFCNTL;
-          filep->f_oflags &= ~FFCNTL;
-          filep->f_oflags |=  oflags;
-          ret              =  OK;
+          ret = file_ioctl(filep, FIONBIO, &nonblock);
+          if (ret == OK)
+            {
+              oflags          &=  (FFCNTL & ~O_NONBLOCK);
+              filep->f_oflags &= ~(FFCNTL & ~O_NONBLOCK);
+              filep->f_oflags |=  oflags;
+              ret              =  OK;
+            }
         }
         break;
 
diff --git a/fs/vfs/fs_ioctl.c b/fs/vfs/fs_ioctl.c
index 689a69c..796cbcf 100644
--- a/fs/vfs/fs_ioctl.c
+++ b/fs/vfs/fs_ioctl.c
@@ -83,14 +83,14 @@ int file_vioctl(FAR struct file *filep, int req, va_list ap)
           FAR int *nonblock = (FAR int *)(uintptr_t)arg;
           if (nonblock && *nonblock)
             {
-              ret = file_fcntl(filep, F_SETFL,
-                              file_fcntl(filep, F_GETFL) | O_NONBLOCK);
+              filep->f_oflags |= O_NONBLOCK;
             }
           else
             {
-              ret = file_fcntl(filep, F_SETFL,
-                              file_fcntl(filep, F_GETFL) & ~O_NONBLOCK);
+              filep->f_oflags &= ~O_NONBLOCK;
             }
+
+          ret = OK;
         }
         break;
 

[incubator-nuttx] 02/05: nuttx/pty: pass read nonblock flag to pipe

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit c7c91488d15161ec5b6114b322cd050e403ad298
Author: fangzhenwei <fa...@xiaomi.com>
AuthorDate: Tue Nov 9 15:24:41 2021 +0800

    nuttx/pty: pass read nonblock flag to pipe
    
    Signed-off-by: fangzhenwei <fa...@xiaomi.com>
---
 drivers/serial/pty.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/serial/pty.c b/drivers/serial/pty.c
index 78cfafe..497b952 100644
--- a/drivers/serial/pty.c
+++ b/drivers/serial/pty.c
@@ -876,7 +876,11 @@ static int pty_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
 
       case FIONBIO:
         {
-          ret = file_ioctl(&dev->pd_sink, cmd, arg);
+          ret = file_ioctl(&dev->pd_src, cmd, arg);
+          if (ret >= 0 || ret == -ENOTTY)
+            {
+              ret = file_ioctl(&dev->pd_sink, cmd, arg);
+            }
         }
         break;
 

[incubator-nuttx] 05/05: serial/pty:Don't assert EBUSY when pty unregister driver

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 84b88205aba6467883c61dfb5668f725559a88ef
Author: fangzhenwei <fa...@xiaomi.com>
AuthorDate: Thu Feb 10 14:38:37 2022 +0800

    serial/pty:Don't assert EBUSY when pty unregister driver
    
    Signed-off-by: fangzhenwei <fa...@xiaomi.com>
---
 drivers/serial/ptmx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/serial/ptmx.c b/drivers/serial/ptmx.c
index cf372e0..05548df 100644
--- a/drivers/serial/ptmx.c
+++ b/drivers/serial/ptmx.c
@@ -220,7 +220,7 @@ static int ptmx_open(FAR struct file *filep)
    */
 
   ret = unregister_driver(devname);
-  DEBUGASSERT(ret >= 0);  /* unregister_driver() should never fail */
+  DEBUGASSERT(ret >= 0 || ret == -EBUSY);  /* unregister_driver() should never fail */
 
   nxsem_post(&g_ptmx.px_exclsem);
   return OK;

[incubator-nuttx] 04/05: nuttx/pty: pty FIONBIO return -ENOTTY when pipe_ioctl return OK

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 88e871b13ee22dea95e8bce5dde1ae0cd4182dcf
Author: fangzhenwei <fa...@xiaomi.com>
AuthorDate: Thu Nov 25 13:32:52 2021 +0800

    nuttx/pty: pty FIONBIO return -ENOTTY when pipe_ioctl return OK
    
    Signed-off-by: fangzhenwei <fa...@xiaomi.com>
---
 drivers/serial/pty.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/serial/pty.c b/drivers/serial/pty.c
index 497b952..5a3bb84 100644
--- a/drivers/serial/pty.c
+++ b/drivers/serial/pty.c
@@ -881,6 +881,13 @@ static int pty_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
             {
               ret = file_ioctl(&dev->pd_sink, cmd, arg);
             }
+
+          /* Let the default handler set O_NONBLOCK flags for us. */
+
+          if (ret >= 0)
+            {
+              ret = -ENOTTY;
+            }
         }
         break;
 

[incubator-nuttx] 01/05: nuttx/pty:pty FIONBIO pass to pipe control

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 1afdb06981b7a1e3bf51beca8e272de5694a7885
Author: fangzhenwei <fa...@xiaomi.com>
AuthorDate: Fri Nov 5 14:46:39 2021 +0800

    nuttx/pty:pty FIONBIO pass to pipe control
    
    1. pass FIONBIO ioctl to pipe
    2. resolve the return value error
    
    Signed-off-by: fangzhenwei <fa...@xiaomi.com>
---
 drivers/serial/pty.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/serial/pty.c b/drivers/serial/pty.c
index e8b5a22..78cfafe 100644
--- a/drivers/serial/pty.c
+++ b/drivers/serial/pty.c
@@ -874,6 +874,12 @@ static int pty_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
         }
         break;
 
+      case FIONBIO:
+        {
+          ret = file_ioctl(&dev->pd_sink, cmd, arg);
+        }
+        break;
+
       /* Any unrecognized IOCTL commands will be passed to the contained
        * pipe driver.
        *
@@ -892,7 +898,7 @@ static int pty_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
               ret = file_ioctl(&dev->pd_sink, cmd, arg);
             }
 #else
-          ret = ENOTTY;
+          ret = -ENOTTY;
 #endif
         }
         break;