[syscalls][docs] Make socket functions synopsis be generated, various locations match
Make parameter names follow
https://fuchsia.googlesource.com/docs/+/master/development/api/system.md#parameters
and make docs, abigen, and implementation match.
Fix up DESCRIPTION headings as well.
ZX-559 #comment [syscalls][docs] Make socket functions synopsis be generated, various locations match
ZX-968 #comment [syscalls][docs] Make socket functions synopsis be generated, various locations match
Test: CQ
Change-Id: Ie509d126637751c6c3cca2be16fb964e3c55cf31
diff --git a/docs/syscalls/socket_accept.md b/docs/syscalls/socket_accept.md
index ad292f2..d0d3663 100644
--- a/docs/syscalls/socket_accept.md
+++ b/docs/syscalls/socket_accept.md
@@ -8,13 +8,15 @@
## SYNOPSIS
+<!-- Updated by scripts/update-docs-from-abigen, do not edit this section manually. -->
+
```
#include <zircon/syscalls.h>
-zx_status_t zx_socket_accept(zx_handle_t socket, zx_handle_t* out_socket);
+zx_status_t zx_socket_accept(zx_handle_t handle, zx_handle_t* out_socket);
```
-### DESCRIPTION
+## DESCRIPTION
**socket_accept**() attempts to receive a new socket via an existing socket
connection. The signal **ZX_SOCKET_ACCEPT** is asserted when there is a new
@@ -34,11 +36,11 @@
## ERRORS
-**ZX_ERR_BAD_HANDLE** The handle *socket* is invalid.
+**ZX_ERR_BAD_HANDLE** *socket* is invalid.
-**ZX_ERR_WRONG_TYPE** The handle *socket* is not a socket handle.
+**ZX_ERR_WRONG_TYPE** *socket* is not a socket handle.
-**ZX_ERR_ACCESS_DENIED** The handle *socket* lacks **ZX_RIGHT_READ**.
+**ZX_ERR_ACCESS_DENIED** *socket* lacks **ZX_RIGHT_READ**.
**ZX_ERR_INVALID_ARGS** *out_socket* is an invalid pointer.
diff --git a/docs/syscalls/socket_share.md b/docs/syscalls/socket_share.md
index ea636e1..9572c11 100644
--- a/docs/syscalls/socket_share.md
+++ b/docs/syscalls/socket_share.md
@@ -8,21 +8,23 @@
## SYNOPSIS
+<!-- Updated by scripts/update-docs-from-abigen, do not edit this section manually. -->
+
```
#include <zircon/syscalls.h>
-zx_status_t zx_socket_share(zx_handle_t socket, zx_handle_t socket_to_send);
+zx_status_t zx_socket_share(zx_handle_t handle, zx_handle_t socket_to_share);
```
-### DESCRIPTION
+## DESCRIPTION
**socket_share**() attempts to send a new socket via an existing socket
connection. The signal **ZX_SOCKET_SHARE** is asserted when it is possible
to send a socket.
-On success, the *socket_to_send* is placed into the *socket*'s share
+On success, the *socket_to_share* is placed into the *handle*'s share
queue, and is no longer accessible to the caller's process. On any
-failure, *socket_to_send* is discarded rather than transferred.
+failure, *socket_to_share* is discarded rather than transferred.
## RIGHTS
@@ -39,21 +41,21 @@
## ERRORS
-**ZX_ERR_BAD_HANDLE** The handle *socket* or *socket_to_send* is invalid.
+**ZX_ERR_BAD_HANDLE** The handle *handle* or *socket_to_share* is invalid.
-**ZX_ERR_WRONG_TYPE** The handle *socket* or *socket_to_send* is not a socket handle.
+**ZX_ERR_WRONG_TYPE** The handle *handle* or *socket_to_share* is not a socket handle.
-**ZX_ERR_ACCESS_DENIED** The handle *socket* lacks **ZX_RIGHT_WRITE** or
-the handle *socket_to_send* lacks **ZX_RIGHT_TRANSFER**.
+**ZX_ERR_ACCESS_DENIED** The handle *handle* lacks **ZX_RIGHT_WRITE** or
+the handle *socket_to_share* lacks **ZX_RIGHT_TRANSFER**.
-**ZX_ERR_BAD_STATE** The *socket_to_send* was a handle to the same socket
-as *socket* or to the other endpoint of *socket* or the *socket_to_send* itself
+**ZX_ERR_BAD_STATE** The *socket_to_share* was a handle to the same socket
+as *handle* or to the other endpoint of *handle* or the *socket_to_share* itself
is capable of sharing.
**ZX_ERR_SHOULD_WAIT** There is already a socket in the share queue.
**ZX_ERR_NOT_SUPPORTED** This socket does not support the transfer of sockets.
-It was not created with the ZX_SOCKET_HAS_ACCEPT option.
+It was not created with the **ZX_SOCKET_HAS_ACCEPT** option.
**ZX_ERR_PEER_CLOSED** The socket endpoint's peer is closed.
diff --git a/kernel/syscalls/socket.cpp b/kernel/syscalls/socket.cpp
index 364da1a..12f9b31 100644
--- a/kernel/syscalls/socket.cpp
+++ b/kernel/syscalls/socket.cpp
@@ -119,17 +119,17 @@
}
// zx_status_t zx_socket_share
-zx_status_t sys_socket_share(zx_handle_t handle, zx_handle_t other) {
+zx_status_t sys_socket_share(zx_handle_t handle, zx_handle_t socket_to_share) {
auto up = ProcessDispatcher::GetCurrent();
fbl::RefPtr<SocketDispatcher> socket;
zx_status_t status = up->GetDispatcherWithRights(handle, ZX_RIGHT_WRITE, &socket);
if (status != ZX_OK) {
- up->RemoveHandle(other);
+ up->RemoveHandle(socket_to_share);
return status;
}
- HandleOwner other_handle = up->RemoveHandle(other);
+ HandleOwner other_handle = up->RemoveHandle(socket_to_share);
if (!other_handle) {
return ZX_ERR_BAD_HANDLE;
}
diff --git a/scripts/update-docs-from-abigen b/scripts/update-docs-from-abigen
index 2913793..f72f9e5 100755
--- a/scripts/update-docs-from-abigen
+++ b/scripts/update-docs-from-abigen
@@ -419,8 +419,10 @@
'port_create',
'process_create',
'process_start',
+ 'socket_accept',
'socket_create',
'socket_read',
+ 'socket_share',
'socket_shutdown',
'socket_write',
'system_get_num_cpus',