socket: separation error code EBADF and ENOTSOCK

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu
2022-10-27 18:17:35 +08:00
committed by Petro Karashchenko
parent 2c95c04f4e
commit f00c11aec4
16 changed files with 115 additions and 79 deletions
+8 -4
View File
@@ -527,14 +527,18 @@ int sockfd_allocate(FAR struct socket *psock, int oflags);
* Input Parameters:
* sockfd - The socket descriptor index to use.
*
* Returned Value:
* On success, a reference to the socket structure associated with the
* the socket descriptor is returned. NULL is returned on any failure.
* Returns zero (OK) on success. On failure, it returns a negated errno
* value to indicate the nature of the error.
*
* EBADF
* The file descriptor is not a valid index in the descriptor table.
* ENOTSOCK
* psock is a descriptor for a file, not a socket.
*
****************************************************************************/
FAR struct socket *file_socket(FAR struct file *filep);
FAR struct socket *sockfd_socket(int sockfd);
int sockfd_socket(int sockfd, FAR struct socket **socketp);
/****************************************************************************
* Name: psock_socket