• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


コミットメタ情報

リビジョン85f740eb6ddaab64983085fb0c7bb8ae850ef828 (tree)
日時2016-11-10 04:59:30
作者Jessica Wagantall <jwagantall@cyng...>
コミッターJessica Wagantall

ログメッセージ

Android 6.0.1 release 74
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEABECAAYFAlgczu4ACgkQ6K0/gZqxDnitCgCePSzI1XB1U5uYTh/Zi64YsrlT
N+8An0LYcv78UQ/41XTrnjQDUrHXtObc
=d0tS
-----END PGP SIGNATURE-----

Merge tag 'android-6.0.1_r74' into HEAD

CYNGNOS-3303

Android 6.0.1 release 74

Change-Id: I2dade45f30d4ca2fa8c6efa5c7242de1a02f5c15

変更サマリ

差分

--- a/include/android/log.h
+++ b/include/android/log.h
@@ -89,6 +89,11 @@ typedef enum android_LogPriority {
8989 } android_LogPriority;
9090
9191 /*
92+ * Release any logger resources (a new log write will immediately re-acquire)
93+ */
94+void __android_log_close();
95+
96+/*
9297 * Send a simple string to the log.
9398 */
9499 int __android_log_write(int prio, const char *tag, const char *text);
--- a/liblog/logd_write.c
+++ b/liblog/logd_write.c
@@ -323,6 +323,48 @@ const char *android_log_id_to_name(log_id_t log_id)
323323 }
324324 #endif
325325
326+/*
327+ * Release any logger resources. A new log write will immediately re-acquire.
328+ */
329+void __android_log_close()
330+{
331+#if FAKE_LOG_DEVICE
332+ int i;
333+#endif
334+
335+#ifdef HAVE_PTHREADS
336+ pthread_mutex_lock(&log_init_lock);
337+#endif
338+
339+ write_to_log = __write_to_log_init;
340+
341+ /*
342+ * Threads that are actively writing at this point are not held back
343+ * by a lock and are at risk of dropping the messages with a return code
344+ * -EBADF. Prefer to return error code than add the overhead of a lock to
345+ * each log writing call to guarantee delivery. In addition, anyone
346+ * calling this is doing so to release the logging resources and shut down,
347+ * for them to do so with outstanding log requests in other threads is a
348+ * disengenuous use of this function.
349+ */
350+#if FAKE_LOG_DEVICE
351+ for (i = 0; i < LOG_ID_MAX; i++) {
352+ fakeLogClose(log_fds[i]);
353+ log_fds[i] = -1;
354+ }
355+#else
356+ close(logd_fd);
357+ logd_fd = -1;
358+
359+ close(pstore_fd);
360+ pstore_fd = -1;
361+#endif
362+
363+#ifdef HAVE_PTHREADS
364+ pthread_mutex_unlock(&log_init_lock);
365+#endif
366+}
367+
326368 static int __write_to_log_init(log_id_t log_id, struct iovec *vec, size_t nr)
327369 {
328370 #if !defined(_WIN32)
--- a/liblog/logd_write_kern.c
+++ b/liblog/logd_write_kern.c
@@ -106,6 +106,41 @@ static int __write_to_log_kernel(log_id_t log_id, struct iovec *vec, size_t nr)
106106 return ret;
107107 }
108108
109+/*
110+ * Release any logger resources. A new log write will immediately re-acquire.
111+ */
112+void __android_log_close()
113+{
114+#ifdef HAVE_PTHREADS
115+ pthread_mutex_lock(&log_init_lock);
116+#endif
117+
118+ write_to_log = __write_to_log_init;
119+
120+ /*
121+ * Threads that are actively writing at this point are not held back
122+ * by a lock and are at risk of dropping the messages with a return code
123+ * -EBADF. Prefer to return error code than add the overhead of a lock to
124+ * each log writing call to guarantee delivery. In addition, anyone
125+ * calling this is doing so to release the logging resources and shut down,
126+ * for them to do so with outstanding log requests in other threads is a
127+ * disengenuous use of this function.
128+ */
129+
130+ log_close(log_fds[LOG_ID_MAIN]);
131+ log_fds[LOG_ID_MAIN] = -1;
132+ log_close(log_fds[LOG_ID_RADIO]);
133+ log_fds[LOG_ID_RADIO] = -1;
134+ log_close(log_fds[LOG_ID_EVENTS]);
135+ log_fds[LOG_ID_EVENTS] = -1;
136+ log_close(log_fds[LOG_ID_SYSTEM]);
137+ log_fds[LOG_ID_SYSTEM] = -1;
138+
139+#ifdef HAVE_PTHREADS
140+ pthread_mutex_unlock(&log_init_lock);
141+#endif
142+}
143+
109144 static int __write_to_log_init(log_id_t log_id, struct iovec *vec, size_t nr)
110145 {
111146 pthread_mutex_lock(&log_init_lock);
--- a/liblog/tests/liblog_test.cpp
+++ b/liblog/tests/liblog_test.cpp
@@ -127,12 +127,17 @@ TEST(liblog, __android_log_btwrite__android_logger_list_read) {
127127 ASSERT_TRUE(NULL != (logger_list = android_logger_list_open(
128128 LOG_ID_EVENTS, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK, 1000, pid)));
129129
130+ // Check that we can close and reopen the logger
130131 log_time ts(CLOCK_MONOTONIC);
131-
132132 ASSERT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts)));
133+ __android_log_close();
134+
135+ log_time ts1(CLOCK_MONOTONIC);
136+ ASSERT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts1, sizeof(ts1)));
133137 usleep(1000000);
134138
135139 int count = 0;
140+ int second_count = 0;
136141
137142 for (;;) {
138143 log_msg log_msg;
@@ -156,10 +161,13 @@ TEST(liblog, __android_log_btwrite__android_logger_list_read) {
156161 log_time tx(eventData + 4 + 1);
157162 if (ts == tx) {
158163 ++count;
164+ } else if (ts1 == tx) {
165+ ++second_count;
159166 }
160167 }
161168
162169 EXPECT_EQ(1, count);
170+ EXPECT_EQ(1, second_count);
163171
164172 android_logger_list_close(logger_list);
165173 }