summaryrefslogtreecommitdiff
path: root/libs/binder/FdTrigger.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Binder unique_fdTomasz Wasilczyk2023-11-171-1/+2
| | | | | | Test: mma Bug: 302723053 Change-Id: I52f14cadb027b3f854946d5315dce3d23aa21b19
* Use unique_fd::ok() instead of -1 comparisonTomasz Wasilczyk2023-11-141-1/+1
| | | | | | Test: mma Bug: 302723053 Change-Id: I744bdfe735624ad9f95a7d448919e7bd2e430098
* Revert^2 "Use std::unique_ptr instead of ScopeGuard"Tomasz Wasilczyk2023-11-041-3/+4
| | | | | | | | 25c1a3b8543dd1756308424dd65030f90bb7a99f Test: m Bug: 302723053 Change-Id: Id9355c10d78d0c55afb49f512b78bb0923fbc4f7
* Binder: migrate off libbase macrosTomasz Wasilczyk2023-11-031-2/+3
| | | | | | Test: mma Bug: 302723053 Change-Id: Ie7c13c324311f600d72bc8ecc4157ad6c46259a0
* Revert "Use std::unique_ptr instead of ScopeGuard"Sebastian Pickl2023-10-301-4/+3
| | | | | | | | | | | | Revert submission 2780893 Reason for revert: breaking boot tests Bug: 308214260 Reverted changes: /q/submissionid:2780893 Change-Id: I7a4ee9a45583a8a1d4a33447de55c63e6ce9d42a
* Use std::unique_ptr instead of ScopeGuardTomasz Wasilczyk2023-10-271-3/+4
| | | | | | Bug: 302723053 Test: mma Change-Id: I27226885b8b5e771d675ba2d83d0a2e14551d13e
* libbinder : Renaming TransportFd to RpcTransportFdPawan2022-08-261-1/+1
| | | | | | | Test: m Test: m libbinder binderRpcTest Bug: 218518615 Change-Id: I822bdb751f68c83e1b10c5fd16c9d8439646b771
* libbinder : Adding new type TransportFdPawan2022-08-261-4/+14
| | | | | | | | | | | | | | Adding a new struct TransportFd which will contain unique_fd and polling state of file descriptor. This will be useful in detecting if all the descriptors are being polled. unique_fd and borrowed_fd are replaced in these changes. Test: m Test: m libbinder binderRpcTest && atest binderRpcTest Test: trusty/vendor/google/aosp/scripts/build.py --test "boot-test:com.android.trusty.binder.test" qemu-generic-arm64-test-debug Bug: 218518615 Change-Id: Id108806b98184582e5d93186b3b1884017c441ea
* libbinder: add build option for single-threaded RPCAndrei Homescu2022-07-011-2/+24
| | | | | | | | | | Trusty does not support threading. This adds a build option to disable mutexes and other threading code from RpcState, RpcSession, and RpcServer. Bug: 224644083 Test: build Trusty Change-Id: Iaa78caca1ddee45be7c2def2755598decc0d4d15
* binder: FdTrigger ensure POLLERR / POLLNVAL is checkedYifan Hong2021-09-241-15/+49
| | | | | | | | | | | | | | | | | ... by aborting if incoming events is 0, so that it returns DEAD_OBJECT when POLLERR / POLLNVAL is hit on one of the FDs. Otherwise, if incoming events is 0, trigerrablePoll() may block forever. Also abort if poll() with infinite timeout returns 0. This way we can remove the while loop, making the code clearer. Also add a test on triggerablePoll. Test: binderRpcTest Fixes: 200999583 Change-Id: I2ae6c4ef2ee825e77e20b43e859df192238be724
* libbinder: RPC use DEAD_OBJECT over -ECANCELEDSteven Moreland2021-09-161-1/+1
| | | | | | | | | | | | | | | | | | | | When we shutdown a connection with FdTrigger, we return -ECANCELED. However, the next call to that FD will return with -EPIPE (DEAD_OBJECT). It's not really important: if your call happens to get interrupted, you'll get -ECANCELED or if your call happened to be scheduled slightly later, you'd get DEAD_OBJECT. Actually, we don't care to distinguish between these two cases because existing clients of libbinder only have and consider DEAD_OBJECT now. Whether the server is shutting down right now, or you make the call a tiny bit later, we want to return the exact same error code in order to be consistent w/ the behavior of libbinder when it uses the binder driver. This was causing a flake in a later CL (fixing the 'Die' race), when rpcSend failing causes the server to shutdown. Bug: 200167417 Test: binderRpcTest 'Callbacks' case repeated 100s of times Change-Id: Id2977f05eb249691326955e6f2424d4e5e08b417
* libbinder: RPC remove isTriggeredPolledSteven Moreland2021-09-141-15/+0
| | | | | | | | | We can get this information in-process, so we can avoid the syscall (and due to the way it is implemented, we also don't need locking). Bug: 182940634 Test: binderRpcTest Change-Id: I3a4f683f71f54972509e071f5dd349e15de54b08
* binder: libbinder_tls ensure to check trigger at least once.Yifan Hong2021-08-121-0/+15
| | | | | | | | | | If the SSL_write / SSL_read finishes in one round, we might have never checked the fdTrigger. Ensure to check it at least once before SSL_write / SSL_read. Test: binderRpcTest Bug: 190868302 Change-Id: I4588475354025f8f02d3eb998e9390d5babbc860
* binder: don't specify POLLHUP in .events for poll()Yifan Hong2021-08-101-1/+1
| | | | | | | | According to poll(2), POLLHUP is ignored in .events. Don't specify it. Test: pass Change-Id: Id9cc908f11bcb914a30dad9e407cb17c1ab00979
* binder: Refactor: move FdTrigger to its own file / class.Yifan Hong2021-08-061-0/+62
Also move interruptable*Fully functions to RpcTransport so that we no longer need pending() and pollSocket(). This also allows us to hide send() / recv(); callers should use interruptableWriteFully / interruptableReadFully instead, because those repsect the shutdown trigger. - Fix one place to use interruptableWriteFully() instead of send() when sending header. interruptable*Fully are marked as virtual functions because TLS will need to poll with events dynamically adjusted. See follow-up CLs for TLS implementation. Test: TH Bug: 190868302 Change-Id: I131eed3a637b3a30280b320966e466bbfac0fc45