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 2020/09/16 06:04:16 UTC
[GitHub] [incubator-nuttx] sgysh opened a new pull request #1800: fs/vfs/fs_ioctl.c: Add FIOCLEX/FIONCLEX support
sgysh opened a new pull request #1800:
URL: https://github.com/apache/incubator-nuttx/pull/1800
## Summary
Add FIOCLEX/FIONCLEX support
## Impact
ioctl
## Testing
hifive1-revb:nsh
on QEMU
```
int main(int argc, FAR char *argv[])
{
int fd = open("/dev/null", O_RDONLY);
assert(fd != -1);
int flags = fcntl(fd, F_GETFD);
assert(flags != -1);
assert(0 == flags & FD_CLOEXEC);
int rc = ioctl(fd, FIOCLEX, NULL);
assert(0 == rc);
flags = fcntl(fd, F_GETFD);
assert(flags != -1);
assert(FD_CLOEXEC == flags & FD_CLOEXEC);
rc = ioctl(fd, FIONCLEX, NULL);
assert(0 == rc);
flags = fcntl(fd, F_GETFD);
assert(flags != -1);
assert(0 == flags & FD_CLOEXEC);
close(fd);
printf("OK\n");
return 0;
}
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] sgysh commented on a change in pull request #1800: fs/vfs/fs_ioctl.c: Add FIOCLEX/FIONCLEX support
Posted by GitBox <gi...@apache.org>.
sgysh commented on a change in pull request #1800:
URL: https://github.com/apache/incubator-nuttx/pull/1800#discussion_r489226981
##########
File path: fs/vfs/fs_ioctl.c
##########
@@ -194,6 +194,12 @@ int nx_vioctl(int fd, int req, va_list ap)
nx_fcntl(fd, F_GETFL) & ~O_NONBLOCK);
}
break;
+ case FIOCLEX:
+ ret = nx_fcntl(fd, F_SETFD, FD_CLOEXEC);
Review comment:
I will change them as follows
```
nx_fcntl(fd, F_GETFD) | FD_CLOEXEC
nx_fcntl(fd, F_GETFD) & ~FD_CLOEXEC
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] sgysh commented on a change in pull request #1800: fs/vfs/fs_ioctl.c: Add FIOCLEX/FIONCLEX support
Posted by GitBox <gi...@apache.org>.
sgysh commented on a change in pull request #1800:
URL: https://github.com/apache/incubator-nuttx/pull/1800#discussion_r489282053
##########
File path: fs/vfs/fs_ioctl.c
##########
@@ -194,6 +194,12 @@ int nx_vioctl(int fd, int req, va_list ap)
nx_fcntl(fd, F_GETFL) & ~O_NONBLOCK);
}
break;
+ case FIOCLEX:
+ ret = nx_fcntl(fd, F_SETFD, FD_CLOEXEC);
Review comment:
I changed them in the commit https://github.com/apache/incubator-nuttx/pull/1800/commits/ac0c605c57e86445ac2aebcb6005b18bf268425a
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1800: fs/vfs/fs_ioctl.c: Add FIOCLEX/FIONCLEX support
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #1800:
URL: https://github.com/apache/incubator-nuttx/pull/1800#discussion_r489217788
##########
File path: fs/vfs/fs_ioctl.c
##########
@@ -194,6 +194,12 @@ int nx_vioctl(int fd, int req, va_list ap)
nx_fcntl(fd, F_GETFL) & ~O_NONBLOCK);
}
break;
+ case FIOCLEX:
+ ret = nx_fcntl(fd, F_SETFD, FD_CLOEXEC);
Review comment:
should we call F_GETFL and then or with FD_CLOEXEC? to avoid clear other flag we will add in the future.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #1800: fs/vfs/fs_ioctl.c: Add FIOCLEX/FIONCLEX support
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #1800:
URL: https://github.com/apache/incubator-nuttx/pull/1800
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org