summaryrefslogtreecommitdiffstats
path: root/adb/mutex_list.h
diff options
context:
space:
mode:
authorJP Abgrall <jpa@google.com>2011-03-16 15:57:42 -0700
committerJP Abgrall <jpa@google.com>2011-03-28 14:12:22 -0700
commit408fa57864c01113deaa213e5c1848a9c594ae92 (patch)
treed7bd9d8bee63f2feb03cd3397784436e4f8f00f0 /adb/mutex_list.h
parentcdae7a1df8f118404689b656003f4313b62987f2 (diff)
downloadsystem_core-408fa57864c01113deaa213e5c1848a9c594ae92.tar.gz
system_core-408fa57864c01113deaa213e5c1848a9c594ae92.tar.bz2
system_core-408fa57864c01113deaa213e5c1848a9c594ae92.zip
adb: fix subprocess exit handling, oom adjust fixes, extra debugging.
* Add support for correctly handling subprocess termination in shell service (b/3400254 b/3482112 b/2249397) - have a waitpid() track the subprocess, then notify the fdevent via a socket - force an eof on the pty master in fdevent's new subproc handler. - modify fdevent to force-read the pty after an exit. * Migrate the "shell:blabla" handling to "#if !ADB_HOST" sections, where it belongs. * Fix the race around OOM adjusting. - Do it in the child before exec() instead of the in the parent as the child could already have started or not (no /proc/pid/... yet). * Allow for multi-threaded D() invocations to not clobber each other. - Allow locks across object files. - Add lock within D() - Make sure sysdesp init (mutex init also) is called early. * Add some missing close(fd) calls - Match similar existing practices near dup2() * Add extra D() invocations related to FD handling. * Warn about using debugging as stderr/stdout is used for protocol. * Fix some errno handling and make D() correctly handle it. * Add new adb trace_mask: services. * Make fdevent_loop's handle BADFDs more gracefully (could occur some subproc closed its pts explicitely). * Remove obsolete commandline args reported in help. (b/3509092) Change-Id: I928287fdf4f1a86777e22ce105f9581685f46e35
Diffstat (limited to 'adb/mutex_list.h')
-rw-r--r--adb/mutex_list.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/adb/mutex_list.h b/adb/mutex_list.h
index eebe0dfcb..652dd7341 100644
--- a/adb/mutex_list.h
+++ b/adb/mutex_list.h
@@ -1,8 +1,11 @@
-/* the list of mutexes used by addb */
+/* the list of mutexes used by adb */
+/* #ifndef __MUTEX_LIST_H
+ * Do not use an include-guard. This file is included once to declare the locks
+ * and once in win32 to actually do the runtime initialization.
+ */
#ifndef ADB_MUTEX
#error ADB_MUTEX not defined when including this file
#endif
-
ADB_MUTEX(dns_lock)
ADB_MUTEX(socket_list_lock)
ADB_MUTEX(transport_lock)
@@ -11,4 +14,13 @@ ADB_MUTEX(local_transports_lock)
#endif
ADB_MUTEX(usb_lock)
+// Sadly logging to /data/adb/adb-... is not thread safe.
+// After modifying adb.h::D() to count invocations:
+// DEBUG(jpa):0:Handling main()
+// DEBUG(jpa):1:[ usb_init - starting thread ]
+// (Oopsies, no :2:, and matching message is also gone.)
+// DEBUG(jpa):3:[ usb_thread - opening device ]
+// DEBUG(jpa):4:jdwp control socket started (10)
+ADB_MUTEX(D_lock)
+
#undef ADB_MUTEX