Squashed commit of the following:

psock_close() and net_close() are internal OS functions and should not set the errno variable.

    psock_ioctl() and netdev_ioctl() are internal OS functions and should not set the errno variable.

    net_dupsd() and net_dupsd2() are internal OS functions and should not set the errno variable.

    net/ and fs/: net_vfcntl(), file_fcntl(), file_dup(), and file_dup2() are all internal OS interfaces and should not modify the errno value.
This commit is contained in:
Gregory Nutt
2017-09-30 10:41:21 -06:00
parent 2c2aa94b7d
commit e4dd33280d
18 changed files with 251 additions and 180 deletions
+41 -2
View File
@@ -606,6 +606,14 @@ void files_releaselist(FAR struct filelist *list);
* Assign an inode to a specific files structure. This is the heart of
* dup2.
*
* Equivalent to the non-standard fs_dupfd2() function except that it
* accepts struct file instances instead of file descriptors and it does
* not set the errno variable.
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is return on
* any failure.
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
@@ -625,6 +633,11 @@ int file_dup2(FAR struct file *filep1, FAR struct file *filep2);
* This alternative naming is used when dup could operate on both file and
* socket descriptors to avoid drawing unused socket support into the link.
*
* Returned Value:
* fs_dupfd is sometimes an OS internal function and sometimes is a direct
* substitute for dup(). So it must return an errno value as though it
* were dup().
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
@@ -639,6 +652,18 @@ int fs_dupfd(int fd, int minfd);
* accepts a struct file instance instead of a file descriptor. Currently
* used only by file_vfcntl();
*
/****************************************************************************
* Name: file_dup
*
* Description:
* Equivalent to the non-standard fs_dupfd() function except that it
* accepts a struct file instance instead of a file descriptor and does
* not set the errno variable.
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
* any failure.
*
****************************************************************************/
int file_dup(FAR struct file *filep, int minfd);
@@ -655,6 +680,11 @@ int file_dup(FAR struct file *filep, int minfd);
* This alternative naming is used when dup2 could operate on both file and
* socket descritors to avoid drawing unused socket support into the link.
*
* Returned Value:
* fs_dupfd2 is sometimes an OS internal function and sometimes is a direct
* substitute for dup2(). So it must return an errno value as though it
* were dup2().
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
@@ -965,8 +995,17 @@ int file_ioctl(FAR struct file *filep, int req, unsigned long arg);
*
* Description:
* Similar to the standard vfcntl function except that is accepts a struct
* struct file instance instead of a file descriptor. Currently used
* only by aio_fcntl();
* struct file instance instead of a file descriptor.
*
* Input Parameters:
* filep - Instance for struct file for the opened file.
* cmd - Indentifies the operation to be performed.
* ap - Variable argument following the command.
*
* Returned Value:
* The nature of the return value depends on the command. Non-negative
* values indicate success. Failures are reported as negated errno
* values.
*
****************************************************************************/
+18 -12
View File
@@ -459,7 +459,8 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock);
* sockfd Socket descriptor of socket
*
* Returned Value:
* 0 on success; -1 on error with errno set appropriately.
* Returns zero (OK) on success. On failure, it returns a negated errno
* value to indicate the nature of the error.
*
* Assumptions:
*
@@ -477,9 +478,8 @@ int net_close(int sockfd);
* psock Socket instance
*
* Returned Value:
* 0 on success; -1 on error with errno set appropriately.
*
* Assumptions:
* Returns zero (OK) on success. On failure, it returns a negated errno
* value to indicate the nature of the error.
*
****************************************************************************/
@@ -994,8 +994,8 @@ int psock_setsockopt(FAR struct socket *psock, int level, int option,
* arg The argument of the ioctl cmd
*
* Return:
* >=0 on success (positive non-zero values are cmd-specific)
* On a failure, -1 is returned with errno set appropriately
* A non-negative value is returned on success; a negated errno value is
* returned on any failure to indicate the nature of the failure:
*
* EBADF
* 'psock' is not a valid, connected socket structure.
@@ -1027,8 +1027,8 @@ int psock_ioctl(FAR struct socket *psock, int cmd, unsigned long arg);
* arg The argument of the ioctl cmd
*
* Return:
* >=0 on success (positive non-zero values are cmd-specific)
* On a failure, -1 is returned with errno set appropriately
* A non-negative value is returned on success; a negated errno value is
* returned on any failure to indicate the nature of the failure:
*
* EBADF
* 'sockfd' is not a valid socket descriptor.
@@ -1103,6 +1103,10 @@ int net_poll(int sockfd, struct pollfd *fds, bool setup);
* of socket file descriptors. If file descriptors are not implemented,
* then this function IS dup().
*
* Returned Value:
* On success, returns the number of characters sent. On any error,
* a negated errno value is returned:.
*
****************************************************************************/
int net_dupsd(int sockfd, int minsd);
@@ -1116,6 +1120,10 @@ int net_dupsd(int sockfd, int minsd);
* of socket file descriptors. If file descriptors are not implemented,
* then this function IS dup2().
*
* Returned Value:
* On success, returns the number of characters sent. On any error,
* a negated errno value is returned:.
*
****************************************************************************/
int net_dupsd2(int sockfd1, int sockfd2);
@@ -1190,8 +1198,6 @@ int net_clone(FAR struct socket *psock1, FAR struct socket *psock2);
* In this case the process will also receive a SIGPIPE unless
* MSG_NOSIGNAL is set.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_SENDFILE
@@ -1211,8 +1217,8 @@ ssize_t net_sendfile(int outfd, struct file *infile, off_t *offset, size_t count
* ap - Command-specific arguments
*
* Returned Value:
* Zero (OK) is returned on success; -1 (ERROR) is returned on failure and
* the errno value is set appropriately.
* Zero (OK) is returned on success; a negated errno value is returned on
* any failure to indicate the nature of the failure.
*
****************************************************************************/