summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext4_utils/Android.bp2
-rw-r--r--ext4_utils/ext4_crypt_init_extensions.cpp2
-rw-r--r--ext4_utils/include/ext4_utils/key_control.h36
-rw-r--r--ext4_utils/key_control.cpp45
-rw-r--r--simpleperf/cmd_report_sample.cpp2
-rw-r--r--simpleperf/scripts/pprof_proto_generator.py16
6 files changed, 14 insertions, 89 deletions
diff --git a/ext4_utils/Android.bp b/ext4_utils/Android.bp
index a2987aa9..493fae5a 100644
--- a/ext4_utils/Android.bp
+++ b/ext4_utils/Android.bp
@@ -41,11 +41,11 @@ cc_library {
android: {
srcs: [
- "key_control.cpp",
"ext4_crypt.cpp",
],
shared_libs: [
"libbase",
+ "libkeyutils",
"libselinux",
],
diff --git a/ext4_utils/ext4_crypt_init_extensions.cpp b/ext4_utils/ext4_crypt_init_extensions.cpp
index 732060db..04d71193 100644
--- a/ext4_utils/ext4_crypt_init_extensions.cpp
+++ b/ext4_utils/ext4_crypt_init_extensions.cpp
@@ -30,10 +30,10 @@
#include <android-base/stringprintf.h>
#include <cutils/properties.h>
#include <cutils/sockets.h>
+#include <keyutils.h>
#include <logwrap/logwrap.h>
#include "ext4_utils/ext4_crypt.h"
-#include "ext4_utils/key_control.h"
#define TAG "ext4_utils"
diff --git a/ext4_utils/include/ext4_utils/key_control.h b/ext4_utils/include/ext4_utils/key_control.h
deleted file mode 100644
index fe6a6b5f..00000000
--- a/ext4_utils/include/ext4_utils/key_control.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _KEY_CONTROL_H_
-#define _KEY_CONTROL_H_
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-__BEGIN_DECLS
-
-// ext4enc:TODO - get these keyring standard definitions from proper system file
-// keyring serial number type
-typedef int32_t key_serial_t;
-
-// special process keyring shortcut IDs
-#define KEY_SPEC_THREAD_KEYRING (-1) // key ID for thread-specific keyring
-#define KEY_SPEC_PROCESS_KEYRING (-2) // key ID for process-specific keyring
-#define KEY_SPEC_SESSION_KEYRING (-3) // key ID for session-specific keyring
-#define KEY_SPEC_USER_KEYRING (-4) // key ID for UID-specific keyring
-#define KEY_SPEC_USER_SESSION_KEYRING (-5) // key ID for UID-session keyring
-#define KEY_SPEC_GROUP_KEYRING (-6) // key ID for GID-specific keyring
-
-key_serial_t add_key(const char *type,
- const char *description,
- const void *payload,
- size_t plen,
- key_serial_t ringid);
-
-long keyctl_revoke(key_serial_t id);
-
-long keyctl_setperm(key_serial_t id, int permissions);
-
-long keyctl_search(key_serial_t ringid, const char *type,
- const char *description, key_serial_t destringid);
-
-__END_DECLS
-
-#endif // _KEY_CONTROL_H_
diff --git a/ext4_utils/key_control.cpp b/ext4_utils/key_control.cpp
deleted file mode 100644
index de6bde2a..00000000
--- a/ext4_utils/key_control.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "ext4_utils/key_control.h"
-
-#include <stdarg.h>
-#include <unistd.h>
-#include <sys/syscall.h>
-#include <linux/keyctl.h>
-
-static long keyctl(int cmd, ...)
-{
- va_list va;
- unsigned long arg2, arg3, arg4, arg5;
-
- va_start(va, cmd);
- arg2 = va_arg(va, unsigned long);
- arg3 = va_arg(va, unsigned long);
- arg4 = va_arg(va, unsigned long);
- arg5 = va_arg(va, unsigned long);
- va_end(va);
- return syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5);
-}
-
-key_serial_t add_key(const char *type,
- const char *description,
- const void *payload,
- size_t plen,
- key_serial_t ringid)
-{
- return syscall(__NR_add_key, type, description, payload, plen, ringid);
-}
-
-long keyctl_revoke(key_serial_t id)
-{
- return keyctl(KEYCTL_REVOKE, id);
-}
-
-long keyctl_setperm(key_serial_t id, int permissions)
-{
- return keyctl(KEYCTL_SETPERM, id, permissions);
-}
-
-long keyctl_search(key_serial_t ringid, const char *type,
- const char *description, key_serial_t destringid)
-{
- return keyctl(KEYCTL_SEARCH, ringid, type, description, destringid);
-}
diff --git a/simpleperf/cmd_report_sample.cpp b/simpleperf/cmd_report_sample.cpp
index e28ea3b4..f43f6821 100644
--- a/simpleperf/cmd_report_sample.cpp
+++ b/simpleperf/cmd_report_sample.cpp
@@ -184,7 +184,6 @@ bool ReportSampleCommand::Run(const std::vector<std::string>& args) {
return false;
}
protobuf_coded_os.reset(nullptr);
- google::protobuf::ShutdownProtobufLibrary();
} else {
PrintLostSituation();
fflush(report_fp_);
@@ -331,7 +330,6 @@ bool ReportSampleCommand::DumpProtobufReport(const std::string& filename) {
return false;
}
}
- google::protobuf::ShutdownProtobufLibrary();
return true;
}
diff --git a/simpleperf/scripts/pprof_proto_generator.py b/simpleperf/scripts/pprof_proto_generator.py
index c09469ad..fa2fdb11 100644
--- a/simpleperf/scripts/pprof_proto_generator.py
+++ b/simpleperf/scripts/pprof_proto_generator.py
@@ -256,7 +256,10 @@ class PprofProfileGenerator(object):
self.lib = ReportLib()
if config.get('binary_cache_dir'):
- self.lib.SetSymfs(config['binary_cache_dir'])
+ if not os.path.isdir(config.get('binary_cache_dir')):
+ config['binary_cache_dir'] = ''
+ else:
+ self.lib.SetSymfs(config['binary_cache_dir'])
if config.get('record_file'):
self.lib.SetRecordFile(config['record_file'])
if config.get('kallsyms'):
@@ -315,7 +318,8 @@ class PprofProfileGenerator(object):
self.add_sample(sample)
# 2. Generate line info for locations and functions.
- self.gen_source_lines()
+ if self.config.get('binary_cache_dir'):
+ self.gen_source_lines()
# 3. Produce samples/locations/functions in profile
for sample in self.sample_list:
@@ -510,8 +514,12 @@ class PprofProfileGenerator(object):
profile_mapping.build_id = mapping.build_id_id
profile_mapping.has_filenames = True
profile_mapping.has_functions = True
- profile_mapping.has_line_numbers = True
- profile_mapping.has_inline_frames = True
+ if self.config.get('binary_cache_dir'):
+ profile_mapping.has_line_numbers = True
+ profile_mapping.has_inline_frames = True
+ else:
+ profile_mapping.has_line_numbers = False
+ profile_mapping.has_inline_frames = False
def gen_profile_location(self, location):
profile_location = self.profile.location.add()