From cc6f71cadfc169d9745d424ffb75e27c3cea1498 Mon Sep 17 00:00:00 2001
From: Marty Faltesek <mfaltesek@google.com>
Date: Sat, 27 Apr 2019 02:03:57 +0000
Subject: [PATCH] [zircon][async] Remove ZX_WAIT_ASYNC_REPEATING flag.

Disable the usage of ZX_WAIT_ASYNC_REPEATING, and print a message if
some previously built binary attempts to use it, to aid in debugging.

A subsequent CL will remove the implementation code after a refactor.

Bug: ZX-3090

Test: CQ.
Change-Id: I52f7a51a8b5ddcffcfa528780ba57046fe88bd97
---
 zircon/docs/syscalls/object_wait_async.md   | 27 ++++++---------------
 zircon/kernel/object/port_dispatcher.cpp    |  5 ++--
 zircon/system/public/zircon/syscalls/port.h |  1 -
 3 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/zircon/docs/syscalls/object_wait_async.md b/zircon/docs/syscalls/object_wait_async.md
index 2c500e7ef3a..fe8ab959b0a 100644
--- a/zircon/docs/syscalls/object_wait_async.md
+++ b/zircon/docs/syscalls/object_wait_async.md
@@ -28,32 +28,23 @@ Use [`zx_port_wait()`] to retrieve the packets.
 
 *handle* points to the object that is to be watched for changes and must be a waitable object.
 
-The *options* argument can be either **ZX_WAIT_ASYNC_ONCE** or **ZX_WAIT_ASYNC_REPEATING**.
-See notes below for **ZX_WAIT_ASYNC_REPEATING**.
+The *options* argument must be set to **ZX_WAIT_ASYNC_ONCE**.
 
-In both cases, *signals* indicates which signals on the object specified by *handle*
+The *signals* argument indicates which signals on the object specified by *handle*
 will cause a packet to be enqueued, and if **any** of those signals are asserted when
 `zx_object_wait_async()` is called, or become asserted afterwards, a packet will be
 enqueued on *port* containing all of the currently-asserted signals (not just the ones
-listed in the *signals* argument).
-
-In the case of **ZX_WAIT_ASYNC_ONCE**, once a packet has been enqueued the asynchronous
+listed in the *signals* argument).  Once a packet has been enqueued the asynchronous
 waiting ends.  No further packets will be enqueued.
 
-In the case of **ZX_WAIT_ASYNC_REPEATING** the asynchronous waiting continues until
-canceled. If any of *signals* are asserted and a packet is not currently in *port*'s
-queue on behalf of this wait, a packet is enqueued. If a packet is already in the
-queue, the packet's *observed* field is updated to include all of the currently-asserted
-signals (without removing the existing signals).
-
-In either mode, [`zx_port_cancel()`] will terminate the operation and if a packet was
+[`zx_port_cancel()`] will terminate the operation and if a packet was
 in the queue on behalf of the operation, that packet will be removed from the queue.
 
 If *handle* is closed, the operation will also be terminated, but packets already
 in the queue are not affected.
 
-Packets generated via this syscall will have *type* set to either **ZX_PKT_TYPE_SIGNAL_ONE**
-or **ZX_PKT_TYPE_SIGNAL_REP**, and the union is of type `zx_packet_signal_t`:
+Packets generated via this syscall will have *type* set to **ZX_PKT_TYPE_SIGNAL_ONE**
+and the union is of type `zx_packet_signal_t`:
 
 ```
 typedef struct zx_packet_signal {
@@ -82,7 +73,7 @@ therefore match *count* with the operation.
 
 ## ERRORS
 
-**ZX_ERR_INVALID_ARGS**  *options* is not **ZX_WAIT_ASYNC_ONCE** or **ZX_WAIT_ASYNC_REPEATING**.
+**ZX_ERR_INVALID_ARGS**  *options* is not **ZX_WAIT_ASYNC_ONCE**.
 
 **ZX_ERR_BAD_HANDLE**  *handle* is not a valid handle or *port* is not a valid handle.
 
@@ -101,10 +92,6 @@ In a future build this error will no longer occur.
 
 See [signals](../signals.md) for more information about signals and their terminology.
 
-**ZX_WAIT_ASYNC_REPEATING** is being deprecated and should not be used. After a
-packet has been retrieved, it can be re-armed with **ZX_WAIT_ASYNC_ONCE** to achieve
-similar behavior.
-
 ## SEE ALSO
 
  - [`zx_object_wait_many()`]
diff --git a/zircon/kernel/object/port_dispatcher.cpp b/zircon/kernel/object/port_dispatcher.cpp
index 8659f4752de..0faf9f0091d 100644
--- a/zircon/kernel/object/port_dispatcher.cpp
+++ b/zircon/kernel/object/port_dispatcher.cpp
@@ -425,8 +425,9 @@ zx_status_t PortDispatcher::MakeObserver(uint32_t options, Handle* handle, uint6
         case ZX_WAIT_ASYNC_ONCE:
             type = ZX_PKT_TYPE_SIGNAL_ONE;
             break;
-        case ZX_WAIT_ASYNC_REPEATING:
-            type = ZX_PKT_TYPE_SIGNAL_REP;
+        case 1u:
+            printf("ZX_WAIT_ASYNC_REPEATING no longer supported. Use ZX_WAIT_ASYNC_ONCE.\n");
+            return ZX_ERR_INVALID_ARGS;
             break;
         default:
             return ZX_ERR_INVALID_ARGS;
diff --git a/zircon/system/public/zircon/syscalls/port.h b/zircon/system/public/zircon/syscalls/port.h
index 755e213e078..a501fd88dcf 100644
--- a/zircon/system/public/zircon/syscalls/port.h
+++ b/zircon/system/public/zircon/syscalls/port.h
@@ -14,7 +14,6 @@ __BEGIN_CDECLS
 
 // zx_object_wait_async() options
 #define ZX_WAIT_ASYNC_ONCE          ((uint32_t)0u)
-#define ZX_WAIT_ASYNC_REPEATING     ((uint32_t)1u)
 
 // packet types.  zx_port_packet_t::type
 #define ZX_PKT_TYPE_USER            ((uint8_t)0x00u)
-- 
GitLab