History log of /system/core/adb/fdevent.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
1c563d96f000876d77b2d33fbfb03c241bc503e1 30-Apr-2016 Chih-Hung Hsieh <chh@google.com> Fix google-explicit-constructor warnings.

Bug: 28341362
Change-Id: I4504e98a8db31e0edcbe63c23f9af43eb13e9d86
/system/core/adb/fdevent.cpp
022d447e9efcff59e22f0ab13764282116f235dd 10-Feb-2016 Josh Gao <jmgao@google.com> adb: make fdevent_test, socket_test compile on Windows.

Switch pthread_* to use the adb_thread_* abstractions to allow the fdevent
and socket tests to compile on Win32.

Bug: http://b/27105824
Change-Id: I6541bb1398780b999837e701837d7f86a5eee8ca
/system/core/adb/fdevent.cpp
3777d2ecc05d397ca501f4ee296e4e66568bb1bd 17-Feb-2016 Josh Gao <jmgao@google.com> adb: don't emulate fdevent or socketpair on Windows.

Change-Id: I16cf7d4427eb79f36db39e91f85402a268fa72f5
/system/core/adb/fdevent.cpp
c65fae9ef56163d17bcc86b6b6324be2b56b4aa5 20-Jan-2016 Josh Gao <jmgao@google.com> adbd: don't leave zombies when subprocess creation fails.

Bug: http://b/26660675
Change-Id: I8e65d51af73f409c30be47575f76bc6b0f227c54
/system/core/adb/fdevent.cpp
4f71319df011d796a60a43fc1bc68e16fbf7d321 05-Dec-2015 Elliott Hughes <enh@google.com> Track rename of base/ to android-base/.

Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
/system/core/adb/fdevent.cpp
b7b1edf974a93cc4bb9a2de7a5e9c9bce9ad178b 12-Nov-2015 Josh Gao <jmgao@google.com> adb: remove exit-time destructors.

On exit, these destructors get invoked while other threads might
still be using them, potentially causing a crash, and definitely
causing tsan to report a race condition.

Bug: http://b/23384853
Change-Id: I94de55d22f97f4edd1d7cc1f34e8c1f8dfd56a5a
/system/core/adb/fdevent.cpp
c288d485135b61653fda3b1aff3602affd6dd1d3 04-Nov-2015 Joon :ee <joonlee@google.com> Fix adb GCC build (for google3).

Allow adb to build using gcc by explicitly using global scope for the
type for pollfd. An alternative would be to rename the pollfd field to
different, but I did not have a better name in mind.

Change-Id: I7925df1dca7e1acc5a289256f228e5fc3755e86e
/system/core/adb/fdevent.cpp
fbfa84045d30a8288c3feab9d7ce7c0c20d7728b 31-Oct-2015 Yabin Cui <yabinc@google.com> adb: run reverse_service() in main thread.

reverse_service() calls handle_forward_request(), which calls
functions in fdevent.cpp. fdevent functions is only supposed
to be called in the main thread.
Add check in fdevent.cpp to make sure all operations come from
main thread.

Bug: 25355808
Change-Id: Iceb9273f3056acc0713eaafe086ac950ca80ff4f
/system/core/adb/fdevent.cpp
65fe2516b402ed8903f2ce39a86fa0bdc2b263a6 08-Oct-2015 Elliott Hughes <enh@google.com> Use const auto&/auto&& in adb.

Change-Id: I74a7e511302e15e207906f572d181634e0ed5604
/system/core/adb/fdevent.cpp
6dfef255b8fa77e3b5c0a69b7f276ea8e25e22cd 07-Oct-2015 Yabin Cui <yabinc@google.com> adb: keep file flags in fdevent_install.

Bug: 24615098
Change-Id: Ia791ecbe612f09aca3bbd5787513f121fae54da5
/system/core/adb/fdevent.cpp
888a748bf23f7afb19c026d96245b31ca0abdd15 30-Sep-2015 Spencer Low <CompareAndSwap@gmail.com> adb: fdevent fixes

* fdevent_{set,add,del}()

* CHECK() that the fdevent is FDE_ACTIVE, otherwise the caller would
be waiting for events that will never arrive.

* Remove ~ from "fde->events &= ~events" to keep desired bits instead
of turning off desired bits.

* fdevent_call_fdfunc()

* CHECK(FDE_PENDING) since it should always be true if the fdevent was
on the pending list, or if fdevent_subproc_event_func() is faking
things. The goal is to try to avoid losing events.

Change-Id: I979c2fffa0b3d6b635488cde11dc544691193018
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
/system/core/adb/fdevent.cpp
aa77e22d7384a97757e2d2194f4e265f7ad3b71a 29-Sep-2015 Yabin Cui <yabinc@google.com> adb: detect sockets in CLOSE_WAIT state to prevent socket leak on linux.

It is possible that the adb server on host has many sockets in
CLOSE_WAIT state. To prevent socket leak, always enable POLLRDHUP
in fdevent.cpp to detect sockets in CLOSE_WAIT state.

Update LocalSocketTest unit tests:
Change half_close_with_packet to read_from_closing_socket, as reading
from a SHUT_WR socket is not needed in adb.
Change close_with_no_events_installed to close_socket_in_CLOSE_WAIT_state,
as the latter is more close to the real situation in use.

Bug: 23314034

Change-Id: Ice4f4036624e5584eab6ba5848e7f169c92f037f
/system/core/adb/fdevent.cpp
aed3c61c4437ebb05eadfb3bf85d6962c30b9935 23-Sep-2015 Yabin Cui <yabinc@google.com> Adb: use VLOG() to replace D() for verbose logging.

As there are too many D(), we can keep both VLOG() and D() now, and get
rid of D() gradually.

Change-Id: I2f1cb70bcab3e82c99fed939341d03f6b2216076
/system/core/adb/fdevent.cpp
c1b1f6ff5de82b457923eea3f0bbad1ac2e459d7 16-Sep-2015 Yabin Cui <yabinc@google.com> Add unit tests for local socket.

Add has_write_error flag in asocket, so it will not wait on local_socket_closing_list
to write pending packets in local_socket_close(). Although it doesn't fix any problem,
it helps to make the code more stable.
Add a missing put_apacket() in error handling.
Add a check when adding local socket in local_socket_closing_list.

Bug: 23314034

Change-Id: I75b07ba8ee59b7f277fba2fb919db63065b291be
/system/core/adb/fdevent.cpp
a10801674cb9e23ae549fb7f861cb33d8c629e80 05-Sep-2015 Yabin Cui <yabinc@google.com> adb: move adb to poll.

It is reported that the registered fd can be bigger than FD_SETSIZE, and can't be
handled by select(). By moving to poll(), we can remove the limitation.
Although we can't ignore the possibility that there is a fd leak, but we can
still make the potential bug more explicit by moving to poll().
We didn't move to epoll() because it is not supported on mac.

Bug: 23820751

Change-Id: Icb39329c4984f1fef749472c9e088682ee8c3444
/system/core/adb/fdevent.cpp
7a3f8d6691b3fbd8014a98de8455dbcfcc9629e4 03-Sep-2015 Yabin Cui <yabinc@google.com> adb: clean up debug tracing a little.

Always use LOG() for debug tracing.
Remove useless D_lock. I believe it is useless to lock just before and after fprintf.

I verified the log output both on host and on device. The output looks fine to me.

Change-Id: I96ccfe408ff56864361551afe9ad464d197ae104
/system/core/adb/fdevent.cpp
8fcd8bc046188abe0b0e87754af472d4838b4c50 25-Aug-2015 Elliott Hughes <enh@google.com> EINTR is handled by adb_read/unix_read and friends.

No need to clutter the code with cases that won't happen.

Change-Id: I47c5a2e6170f902d2618719f44492234a4869567
/system/core/adb/fdevent.cpp
aa2454919098ee14cd232669f1e7dbb33ed07ccf 03-Aug-2015 Elliott Hughes <enh@google.com> adb sync cleanup.

We can double the speed of "adb sync" (on N9) if we increase SYNC_DATA_MAX
from 64KiB to 256KiB. This change doesn't do that, because I still haven't
managed to plumb through the information about whether we're a new adb/adbd
to file_sync_client.cpp and file_sync_service.cpp. But this is already a big
change with a lot of cleanup, so let's do the cleanup and worry about the
intended change another day...

This change does improve performance somewhat by halving the number of
lstat(2) calls made on the client side, and ensuring that most packets are
sent with a single write. This has the pleasing result of making the null
sync on an AOSP N9 go from just over 300ms to around 100ms, which means it
now seems instantaneous (https://en.wikipedia.org/wiki/Mental_chronometry).

Change-Id: If9f6d4c1f93ec752b95f71211bbbb1c513045166
/system/core/adb/fdevent.cpp
adbf442a515c51cb2acb34e20c1d2ea0e843c660 30-Jul-2015 Elliott Hughes <enh@google.com> Use _WIN32 rather than HAVE_WINSOCK.

Change-Id: I9855b6fe72e2f2f3a8360c0993a67cb988024ee4
/system/core/adb/fdevent.cpp
8d8126a705dd3c5734a0894f88c2c758784bd469 21-Jul-2015 Spencer Low <CompareAndSwap@gmail.com> adb: logging: newlines, thread ids, error code overwriting

Add missing \n to uses of legacy D() macro. This should make the legacy
logging easier to read (and harder to miss important stuff).

On POSIX, use gettid() from libcutils instead of pthread_self() so that
the output shows a more reasonable number instead of a pointer value.
This should be ok since libbase's logging already uses gettid().

Win32:

Don't let the Win32 last error get overwritten by API calls after the
original error'ing API. When encountering an unknown error, log the
specific error code.

Change-Id: Ib8f72754efa7ba895d2f1cd914251fec2a1d894c
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
/system/core/adb/fdevent.cpp
947cb3e8eeb5583654ceac95e97762f20ff62035 17-Jul-2015 Alex Vallée <avallee@chromium.org> Remove subproc events when ADB_HOST.

The code which triggers these events (via the SHELL_EXIT_NOTIFY_FD) are
only called from code which is already guarded by #if !ADB_HOST.

Change-Id: I184414f5e090c1f08ee117e4c8c434cd4a8b5221
/system/core/adb/fdevent.cpp
286bb6ddbd52584af0c6c76fbe0498f3dea4b944 09-Jul-2015 Dan Albert <danalbert@google.com> Revert "Turn on -Wformat-nonliteral."

One of my build aliases doesn't play nice with USE_MINGW=1, so my build lied to me. Will revert until I fix it up.

This reverts commit 459df8f3a14d4c614f0211049800cf7cad6d30ad.

Change-Id: I7905c5ae5ee85fb2d228ce63d81c79f140998c18
/system/core/adb/fdevent.cpp
459df8f3a14d4c614f0211049800cf7cad6d30ad 08-Jul-2015 Dan Albert <danalbert@google.com> Turn on -Wformat-nonliteral.

Apparently there are two classes of this warning in clang.
-Wformat-security is only emitted for cases of
`func(nonliteral_fmt_string)` (no args), and -Wformat-nonliteral is
emitted for cases *with* arguments. For whatever reason, the latter
isn't included in -Wextra and must be manually enabled.

To make this more easily portable to Windows, move the existing
gnu_printf/__printf__ decision into base/macros.h as ATTRIBUTE_FORMAT.

Change-Id: I3b0990e1d1f0a2e9c13b32f5cd60478946cb5fc6
/system/core/adb/fdevent.cpp
3313426fad9eaaf53017cdbde889ebcec91358ec 19-Mar-2015 Dan Albert <danalbert@google.com> File header cleanup.

* sysdeps.h should always be included first.
* TRACE_TAG needs to be defined before anything is included.
* Some files were missing copyright headers.
* Save precious bytes on my SSD by removing useless whitespace.

Change-Id: I88980e6e00b5be1093806cf286740d9e4a033b94
/system/core/adb/fdevent.cpp
abb80e0f95f43b3ca066d9f80f4fe060a87e3f80 03-Mar-2015 SungHyun Kwon <sh.kwon@lge.com> Fix memory leak on jdwp_process_free()

if many jdwp connection are created(), the memory will be leaked.

When it deletes heap memory on jdwp_process_free(),
the proc->fde just set to null.

so it need to free() in fdevent_destory().
/system/core/adb/fdevent.cpp
cc731cc76786b6bdc58764aad9924c0d0c8d645f 25-Feb-2015 Dan Albert <danalbert@google.com> Test readx/writex (now renamed).

Renamed readx/writex to ReadFdExactly/WriteFdExactly respectively.
These read/write a full fixed-size buffer. If the whole buffer cannot
be read/written, these functions return an error.

Rename write_string to WriteStringFully.

Move the TEMP_FAILURE_RETRY definition in sysdeps.h out of the
!Windows section. It seems Windows won't actually interrupt a call,
but it's easier to just define it than to #ifdef each call.

Change-Id: Ia8ddffa2a52764a2f9a281c96c937660e002b9b9
/system/core/adb/fdevent.cpp
630b9afeb0d7f0e5e053db0f900cfb65d914cb1a 25-Nov-2014 Dan Albert <danalbert@google.com> Begin moving code from adb to libadb.

Much of adb is duplicated in bootable/recovery/minadb and fastboot.
Changes made to adb rarely get ported to the other two, so the trees
have diverged a bit. We'd like to stop this because it is a
maintenance nightmare, but the divergence makes this difficult to do
all at once. For now, we will start small by moving common files into
a static library. Hopefully some day we can get enough of adb in here
that we no longer need minadb.

Bug: 17626262
Change-Id: Ic8d5653bfcc0fec4e1acbece124402355084b864
/system/core/adb/fdevent.cpp