diff options
author | Rubin Xu <rubinxu@google.com> | 2016-01-19 20:40:16 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-01-19 20:40:16 +0000 |
commit | 95d1bd2421385b6ad8e3a9df985b100bb3c328af (patch) | |
tree | 3a5e86be3675556ef68a26b1348dc590fcb619c5 | |
parent | 818f757383c056d5970c8a205700c390ccc4292e (diff) | |
parent | d545d2930e042b9ff7fbbda52fea0da047148b26 (diff) | |
download | core-95d1bd2421385b6ad8e3a9df985b100bb3c328af.tar.gz core-95d1bd2421385b6ad8e3a9df985b100bb3c328af.tar.bz2 core-95d1bd2421385b6ad8e3a9df985b100bb3c328af.zip |
Merge "Add logd security buffer tag types and string write API."
-rw-r--r-- | include/log/logd.h | 1 | ||||
-rw-r--r-- | liblog/logd_write.c | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/include/log/logd.h b/include/log/logd.h index b7aedaff6..b27160253 100644 --- a/include/log/logd.h +++ b/include/log/logd.h @@ -45,6 +45,7 @@ int __android_log_btwrite(int32_t tag, char type, const void *payload, int __android_log_bswrite(int32_t tag, const char *payload); int __android_log_security_bwrite(int32_t tag, const void *payload, size_t len); +int __android_log_security_bswrite(int32_t tag, const char *payload); #ifdef __cplusplus } diff --git a/liblog/logd_write.c b/liblog/logd_write.c index 5406c50e1..55b965b91 100644 --- a/liblog/logd_write.c +++ b/liblog/logd_write.c @@ -668,3 +668,25 @@ int __android_log_bswrite(int32_t tag, const char *payload) return write_to_log(LOG_ID_EVENTS, vec, 4); } + +/* + * Like __android_log_security_bwrite, but used for writing strings to the + * security log. + */ +int __android_log_security_bswrite(int32_t tag, const char *payload) +{ + struct iovec vec[4]; + char type = EVENT_TYPE_STRING; + uint32_t len = strlen(payload); + + vec[0].iov_base = &tag; + vec[0].iov_len = sizeof(tag); + vec[1].iov_base = &type; + vec[1].iov_len = sizeof(type); + vec[2].iov_base = &len; + vec[2].iov_len = sizeof(len); + vec[3].iov_base = (void*)payload; + vec[3].iov_len = len; + + return write_to_log(LOG_ID_SECURITY, vec, 4); +} |