The ADB (Android Debug Bridge) daemon suffers from a file descriptor leak.
When transfering file descriptors, opened by the adbd daemon, to a JDWP
process for debugging through sendmsg, the file descriptor is duplicated
by the kernel and a copy is transfered to the JDWP process.
Adbd neglects to close it's copy of the descriptor after the sendmsg call
which causes a file descriptor leak in the process.
Eventually this causes the daemon to hit its maximum roof of opened file
descriptors thus making it impossible for the process to serve any new
commands from the adb server.
Jdwp_service.c has been modified to close the file descriptor after the
send message call has succeded.
Also, the socket used for transfering the file descriptor is set to blocking
mode before the sendmsg call since the adbd processes needs to know when the
duplication has been completed by the kernel.
The flags are reset to its original state after the sendmsg call.
Change-Id: I76b15460301ac01e432f5ce8678ff58c658c16f2
Signed-off-by: Christian Bejram <christian.bejram@stericsson.com>
... as memory was already obtained zero'ed by calloc().
Change-Id: Ic73bad09b54cb778fd40bdf86bb40888ea504c5f
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Port number is now optional. Will use default port 5555 if not specified.
"adb disconnect" with no additional arguments will disconnect all TCP devices.
Change-Id: I7fc26528ed85e66a73b8f6254cea7bf83d98109f
Signed-off-by: Mike Lockwood <lockwood@android.com>
The linenoise library is from http://github.com/antirez/linenoise
This patch also disables command-line editing and history from adb. The
adb implementation was shadowing the Android shell's implementation.
The adb implementation was also shadowing the editing and history
implementation in alternative shells such as BusyBox's ash.
Change-Id: I7ebd4cb391d0ce966c0ce0e707d80ecd659f9079
- adb can now connect to an emulator configured with an arbitrary
pair of <console port, adb port>. These two ports do not have to be
adjacent.
This can be done from the commandline at any time using
adb connect emu:<console_port>,<adb_port>
- Emulators running on ports outside the normal range
(5554/5555-5584/5585) register themselves on startup if they follow
the convention "console port+1==abd port".
- Emulators outside the normal port range will not be auto-detected on
adb startup as these ports are not probed.
- The index into local_transports[] array in transport_local.c does no
longer indicate the port number of the local transport. Use the altered
atransport struct to get the port number.
- I have chosen not to document the adb connect emu:console_port,adb_port
syntax on adb's help screen as this might be confusing to most readers
and useful to very few.
- I don't expect this to introduce any (backwards) compatibility issues.
Change-Id: Iad3eccb2dcdde174b24ef0644d705ecfbff6e59d
Signed-off-by: Mike Lockwood <lockwood@android.com>
This is the first CL of a somewhat larger effort which, among other things,
will involve changing the emulator and ddms to talk to adb running on a
configurable port.
The port can be configured using environment variable ANDROID_ADB_SERVER_PORT.
Further CLs will also address the set of ports used for the local transport.
Change-Id: Ib2f431801f0adcd9f2dd290a28005644a36a780a
This was used for adb networking, which no longer exists.
This code also failed when adb was not running as root.
Change-Id: Ied86fb1930094d5ae5009684d25e15385fd31d03
Signed-off-by: Mike Lockwood <lockwood@android.com>
This helps us recover when things go wrong during automated testing.
Change-Id: I006dbfaff7f70d51398ff12fbddcaee751453b78
Signed-off-by: Mike Lockwood <lockwood@android.com>
Merge commit 'b419c35c660d7421e18a9efef38eca11966b44c7' into froyo-plus-aosp
* commit 'b419c35c660d7421e18a9efef38eca11966b44c7':
Fix adb, fastboot to compile in Windows SDK under Linux.
In addition to service.adb.tcp.port, you can now set persist.adb.tcp.port
to specify the port number for adb to listen to instead of USB.
This allows the adb TCP configuration to persist across reboots.
Change-Id: I897ffcb019e8dd1785996d2f3c571cfc2f8ded38
Signed-off-by: Mike Lockwood <lockwood@android.com>
This helps us recover when things go wrong during automated testing.
Change-Id: I006dbfaff7f70d51398ff12fbddcaee751453b78
Signed-off-by: Mike Lockwood <lockwood@android.com>
indirectly via system service) rather than "dumpstate", that way
even when adb is not running as root, dumpstate does run as root,
and can do things like collect VM traces.
Merge commit '1873adc2b12d5a9045bae90650bb331c7c7aa3c7' into eclair-plus-aosp
* commit '1873adc2b12d5a9045bae90650bb331c7c7aa3c7':
ADB: Garmin-Asus's USB Vendor ID
indirectly via system service) rather than "dumpstate", that way
even when adb is not running as root, dumpstate does run as root,
and can do things like collect VM traces.
Merge commit 'ef063fe3066153dab5389b6baba6cb4e36888106'
* commit 'ef063fe3066153dab5389b6baba6cb4e36888106':
Add support for Acer devices
FreeBSD support for usb-connected devices in adb
Make get_my_path() safer
Fix use of memset function
FreeBSD (and other systems as well) may use libusb to work with USB devices.
libusb is integrated in FreeBSD base system in recent builds (8.0+),
however in other systems it may need include libusb.h like <libusb/libusb.h>
and install library from devel/libusb port or other repository.
Submitted change not supports events (attach/detach) as libusb 1.0 lacks
such functionality and in order to make code more portable I've not used
workarounds as in earlier changeset.
Code was tested on FreeBSD 8.0-RC1, HTC Hero (1.0.0.A6288, Android 1.5)
Also check that device is not already connected in "adb connect"
Change-Id: I5f84b56b63d8c6932f23791cac319fd6bc39d36c
Signed-off-by: Mike Lockwood <lockwood@android.com>
Also check that device is not already connected in "adb connect"
Change-Id: I5f84b56b63d8c6932f23791cac319fd6bc39d36c
Signed-off-by: Mike Lockwood <lockwood@android.com>