blob: 2532275119f975263fb0cf3b6084a7abaf7338a8 [file] [log] [blame]
aimitakeshi27ed8ad2010-07-29 10:12:27 +09001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Takeshi Aimi2272ee22010-09-20 23:40:41 +090017//#define LOG_NDEBUG 0
aimitakeshi27ed8ad2010-07-29 10:12:27 +090018#define LOG_TAG "DrmManagerService(Native)"
19#include <utils/Log.h>
20
Takeshi Aimi34738462010-11-16 13:56:11 +090021#include <private/android_filesystem_config.h>
James Dong8635b7b2011-03-14 17:01:38 -070022#include <media/MemoryLeakTrackUtil.h>
Takeshi Aimi34738462010-11-16 13:56:11 +090023
aimitakeshi27ed8ad2010-07-29 10:12:27 +090024#include <errno.h>
25#include <utils/threads.h>
26#include <binder/IServiceManager.h>
Takeshi Aimi34738462010-11-16 13:56:11 +090027#include <binder/IPCThreadState.h>
aimitakeshi27ed8ad2010-07-29 10:12:27 +090028#include <sys/stat.h>
29#include "DrmManagerService.h"
30#include "DrmManager.h"
31
Riley Spahnf785f492014-07-01 15:32:31 -070032#include <selinux/android.h>
33
aimitakeshi27ed8ad2010-07-29 10:12:27 +090034using namespace android;
35
Riley Spahnf785f492014-07-01 15:32:31 -070036static int selinux_enabled;
37static char *drmserver_context;
Takeshi Aimi34738462010-11-16 13:56:11 +090038static Vector<uid_t> trustedUids;
39
Riley Spahnf785f492014-07-01 15:32:31 -070040const char *const DrmManagerService::drm_perm_labels[] = {
41 "consumeRights",
42 "setPlaybackStatus",
43 "openDecryptSession",
44 "closeDecryptSession",
45 "initializeDecryptUnit",
46 "decrypt",
47 "finalizeDecryptUnit",
48 "pread"
49};
50
51const char *DrmManagerService::get_perm_label(drm_perm_t perm) {
52 unsigned int index = perm;
53
Aurimas Liutikasc9036842016-02-18 15:58:04 -080054 if (index >= (sizeof(drm_perm_labels) / sizeof(drm_perm_labels[0]))) {
Riley Spahnf785f492014-07-01 15:32:31 -070055 ALOGE("SELinux: Failed to retrieve permission label(perm=%d).\n", perm);
56 abort();
57 }
58 return drm_perm_labels[index];
59}
60
61bool DrmManagerService::selinuxIsProtectedCallAllowed(pid_t spid, drm_perm_t perm) {
62 if (selinux_enabled <= 0) {
63 return true;
64 }
65
66 char *sctx;
67 const char *selinux_class = "drmservice";
68 const char *str_perm = get_perm_label(perm);
69
70 if (getpidcon(spid, &sctx) != 0) {
71 ALOGE("SELinux: getpidcon(pid=%d) failed.\n", spid);
72 return false;
73 }
74
75 bool allowed = (selinux_check_access(sctx, drmserver_context, selinux_class,
76 str_perm, NULL) == 0);
77 freecon(sctx);
78
79 return allowed;
80}
81
82bool DrmManagerService::isProtectedCallAllowed(drm_perm_t perm) {
Jeff Tinker6868e982014-06-17 16:45:46 -070083 // TODO
84 // Following implementation is just for reference.
85 // Each OEM manufacturer should implement/replace with their own solutions.
86 IPCThreadState* ipcState = IPCThreadState::self();
87 uid_t uid = ipcState->getCallingUid();
Riley Spahnf785f492014-07-01 15:32:31 -070088 pid_t spid = ipcState->getCallingPid();
Jeff Tinker6868e982014-06-17 16:45:46 -070089
90 for (unsigned int i = 0; i < trustedUids.size(); ++i) {
91 if (trustedUids[i] == uid) {
Riley Spahnf785f492014-07-01 15:32:31 -070092 return selinuxIsProtectedCallAllowed(spid, perm);
Jeff Tinker6868e982014-06-17 16:45:46 -070093 }
94 }
95 return false;
Takeshi Aimi34738462010-11-16 13:56:11 +090096}
97
aimitakeshi27ed8ad2010-07-29 10:12:27 +090098void DrmManagerService::instantiate() {
Steve Block3856b092011-10-20 11:56:00 +010099 ALOGV("instantiate");
Takeshi Aimie943f842010-10-08 23:05:49 +0900100 defaultServiceManager()->addService(String16("drm.drmManager"), new DrmManagerService());
Takeshi Aimi34738462010-11-16 13:56:11 +0900101
102 if (0 >= trustedUids.size()) {
103 // TODO
104 // Following implementation is just for reference.
105 // Each OEM manufacturer should implement/replace with their own solutions.
106
107 // Add trusted uids here
108 trustedUids.push(AID_MEDIA);
109 }
Riley Spahnf785f492014-07-01 15:32:31 -0700110
111 selinux_enabled = is_selinux_enabled();
112 if (selinux_enabled > 0 && getcon(&drmserver_context) != 0) {
113 ALOGE("SELinux: DrmManagerService failed to get context for DrmManagerService. Aborting.\n");
114 abort();
115 }
116
117 union selinux_callback cb;
118 cb.func_log = selinux_log_callback;
119 selinux_set_callback(SELINUX_CB_LOG, cb);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900120}
121
Takeshi Aimie943f842010-10-08 23:05:49 +0900122DrmManagerService::DrmManagerService() :
123 mDrmManager(NULL) {
Steve Block3856b092011-10-20 11:56:00 +0100124 ALOGV("created");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900125 mDrmManager = new DrmManager();
Takeshi Aimie943f842010-10-08 23:05:49 +0900126 mDrmManager->loadPlugIns();
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900127}
128
129DrmManagerService::~DrmManagerService() {
Steve Block3856b092011-10-20 11:56:00 +0100130 ALOGV("Destroyed");
Takeshi Aimie943f842010-10-08 23:05:49 +0900131 mDrmManager->unloadPlugIns();
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900132 delete mDrmManager; mDrmManager = NULL;
133}
134
Gloria Wang8f001512011-07-21 15:10:22 -0700135int DrmManagerService::addUniqueId(bool isNative) {
136 return mDrmManager->addUniqueId(isNative);
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900137}
138
139void DrmManagerService::removeUniqueId(int uniqueId) {
140 mDrmManager->removeUniqueId(uniqueId);
141}
142
Takeshi Aimie943f842010-10-08 23:05:49 +0900143void DrmManagerService::addClient(int uniqueId) {
144 mDrmManager->addClient(uniqueId);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900145}
146
Takeshi Aimie943f842010-10-08 23:05:49 +0900147void DrmManagerService::removeClient(int uniqueId) {
148 mDrmManager->removeClient(uniqueId);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900149}
150
151status_t DrmManagerService::setDrmServiceListener(
152 int uniqueId, const sp<IDrmServiceListener>& drmServiceListener) {
Steve Block3856b092011-10-20 11:56:00 +0100153 ALOGV("Entering setDrmServiceListener");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900154 mDrmManager->setDrmServiceListener(uniqueId, drmServiceListener);
155 return DRM_NO_ERROR;
156}
157
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900158DrmConstraints* DrmManagerService::getConstraints(
159 int uniqueId, const String8* path, const int action) {
Steve Block3856b092011-10-20 11:56:00 +0100160 ALOGV("Entering getConstraints from content");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900161 return mDrmManager->getConstraints(uniqueId, path, action);
162}
163
Takeshi Aimi34738462010-11-16 13:56:11 +0900164DrmMetadata* DrmManagerService::getMetadata(int uniqueId, const String8* path) {
Steve Block3856b092011-10-20 11:56:00 +0100165 ALOGV("Entering getMetadata from content");
Takeshi Aimi34738462010-11-16 13:56:11 +0900166 return mDrmManager->getMetadata(uniqueId, path);
167}
168
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900169bool DrmManagerService::canHandle(int uniqueId, const String8& path, const String8& mimeType) {
Steve Block3856b092011-10-20 11:56:00 +0100170 ALOGV("Entering canHandle");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900171 return mDrmManager->canHandle(uniqueId, path, mimeType);
172}
173
174DrmInfoStatus* DrmManagerService::processDrmInfo(int uniqueId, const DrmInfo* drmInfo) {
Steve Block3856b092011-10-20 11:56:00 +0100175 ALOGV("Entering processDrmInfo");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900176 return mDrmManager->processDrmInfo(uniqueId, drmInfo);
177}
178
179DrmInfo* DrmManagerService::acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest) {
Steve Block3856b092011-10-20 11:56:00 +0100180 ALOGV("Entering acquireDrmInfo");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900181 return mDrmManager->acquireDrmInfo(uniqueId, drmInfoRequest);
182}
183
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900184status_t DrmManagerService::saveRights(
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900185 int uniqueId, const DrmRights& drmRights,
186 const String8& rightsPath, const String8& contentPath) {
Steve Block3856b092011-10-20 11:56:00 +0100187 ALOGV("Entering saveRights");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900188 return mDrmManager->saveRights(uniqueId, drmRights, rightsPath, contentPath);
189}
190
James Dongbf5b3b22012-07-30 17:57:39 -0700191String8 DrmManagerService::getOriginalMimeType(int uniqueId, const String8& path, int fd) {
Steve Block3856b092011-10-20 11:56:00 +0100192 ALOGV("Entering getOriginalMimeType");
James Dongbf5b3b22012-07-30 17:57:39 -0700193 return mDrmManager->getOriginalMimeType(uniqueId, path, fd);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900194}
195
196int DrmManagerService::getDrmObjectType(
197 int uniqueId, const String8& path, const String8& mimeType) {
Steve Block3856b092011-10-20 11:56:00 +0100198 ALOGV("Entering getDrmObjectType");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900199 return mDrmManager->getDrmObjectType(uniqueId, path, mimeType);
200}
201
202int DrmManagerService::checkRightsStatus(
203 int uniqueId, const String8& path, int action) {
Steve Block3856b092011-10-20 11:56:00 +0100204 ALOGV("Entering checkRightsStatus");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900205 return mDrmManager->checkRightsStatus(uniqueId, path, action);
206}
207
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900208status_t DrmManagerService::consumeRights(
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700209 int uniqueId, sp<DecryptHandle>& decryptHandle, int action, bool reserve) {
Steve Block3856b092011-10-20 11:56:00 +0100210 ALOGV("Entering consumeRights");
Riley Spahnf785f492014-07-01 15:32:31 -0700211 if (!isProtectedCallAllowed(CONSUME_RIGHTS)) {
James Dong328745b2012-02-28 13:55:55 -0800212 return DRM_ERROR_NO_PERMISSION;
213 }
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900214 return mDrmManager->consumeRights(uniqueId, decryptHandle, action, reserve);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900215}
216
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900217status_t DrmManagerService::setPlaybackStatus(
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700218 int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position) {
Steve Block3856b092011-10-20 11:56:00 +0100219 ALOGV("Entering setPlaybackStatus");
Riley Spahnf785f492014-07-01 15:32:31 -0700220 if (!isProtectedCallAllowed(SET_PLAYBACK_STATUS)) {
James Dong328745b2012-02-28 13:55:55 -0800221 return DRM_ERROR_NO_PERMISSION;
222 }
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900223 return mDrmManager->setPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900224}
225
226bool DrmManagerService::validateAction(
227 int uniqueId, const String8& path,
228 int action, const ActionDescription& description) {
Steve Block3856b092011-10-20 11:56:00 +0100229 ALOGV("Entering validateAction");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900230 return mDrmManager->validateAction(uniqueId, path, action, description);
231}
232
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900233status_t DrmManagerService::removeRights(int uniqueId, const String8& path) {
Steve Block3856b092011-10-20 11:56:00 +0100234 ALOGV("Entering removeRights");
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900235 return mDrmManager->removeRights(uniqueId, path);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900236}
237
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900238status_t DrmManagerService::removeAllRights(int uniqueId) {
Steve Block3856b092011-10-20 11:56:00 +0100239 ALOGV("Entering removeAllRights");
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900240 return mDrmManager->removeAllRights(uniqueId);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900241}
242
243int DrmManagerService::openConvertSession(int uniqueId, const String8& mimeType) {
Steve Block3856b092011-10-20 11:56:00 +0100244 ALOGV("Entering openConvertSession");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900245 return mDrmManager->openConvertSession(uniqueId, mimeType);
246}
247
248DrmConvertedStatus* DrmManagerService::convertData(
249 int uniqueId, int convertId, const DrmBuffer* inputData) {
Steve Block3856b092011-10-20 11:56:00 +0100250 ALOGV("Entering convertData");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900251 return mDrmManager->convertData(uniqueId, convertId, inputData);
252}
253
254DrmConvertedStatus* DrmManagerService::closeConvertSession(int uniqueId, int convertId) {
Steve Block3856b092011-10-20 11:56:00 +0100255 ALOGV("Entering closeConvertSession");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900256 return mDrmManager->closeConvertSession(uniqueId, convertId);
257}
258
259status_t DrmManagerService::getAllSupportInfo(
260 int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray) {
Steve Block3856b092011-10-20 11:56:00 +0100261 ALOGV("Entering getAllSupportInfo");
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900262 return mDrmManager->getAllSupportInfo(uniqueId, length, drmSupportInfoArray);
263}
264
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700265sp<DecryptHandle> DrmManagerService::openDecryptSession(
James Dong9d2f3862012-01-10 08:24:37 -0800266 int uniqueId, int fd, off64_t offset, off64_t length, const char* mime) {
Steve Block3856b092011-10-20 11:56:00 +0100267 ALOGV("Entering DrmManagerService::openDecryptSession");
Riley Spahnf785f492014-07-01 15:32:31 -0700268 if (isProtectedCallAllowed(OPEN_DECRYPT_SESSION)) {
James Dong9d2f3862012-01-10 08:24:37 -0800269 return mDrmManager->openDecryptSession(uniqueId, fd, offset, length, mime);
Takeshi Aimi34738462010-11-16 13:56:11 +0900270 }
271
272 return NULL;
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900273}
274
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700275sp<DecryptHandle> DrmManagerService::openDecryptSession(
James Dong9d2f3862012-01-10 08:24:37 -0800276 int uniqueId, const char* uri, const char* mime) {
Steve Block3856b092011-10-20 11:56:00 +0100277 ALOGV("Entering DrmManagerService::openDecryptSession with uri");
Riley Spahnf785f492014-07-01 15:32:31 -0700278 if (isProtectedCallAllowed(OPEN_DECRYPT_SESSION)) {
James Dong9d2f3862012-01-10 08:24:37 -0800279 return mDrmManager->openDecryptSession(uniqueId, uri, mime);
Takeshi Aimi34738462010-11-16 13:56:11 +0900280 }
281
282 return NULL;
Takeshi Aimie943f842010-10-08 23:05:49 +0900283}
284
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700285sp<DecryptHandle> DrmManagerService::openDecryptSession(
Kei Takahashicba7b322012-01-18 17:10:19 +0900286 int uniqueId, const DrmBuffer& buf, const String8& mimeType) {
287 ALOGV("Entering DrmManagerService::openDecryptSession for streaming");
Riley Spahnf785f492014-07-01 15:32:31 -0700288 if (isProtectedCallAllowed(OPEN_DECRYPT_SESSION)) {
Kei Takahashicba7b322012-01-18 17:10:19 +0900289 return mDrmManager->openDecryptSession(uniqueId, buf, mimeType);
290 }
291
292 return NULL;
293}
294
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700295status_t DrmManagerService::closeDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle) {
Steve Block3856b092011-10-20 11:56:00 +0100296 ALOGV("Entering closeDecryptSession");
Riley Spahnf785f492014-07-01 15:32:31 -0700297 if (!isProtectedCallAllowed(CLOSE_DECRYPT_SESSION)) {
James Dong328745b2012-02-28 13:55:55 -0800298 return DRM_ERROR_NO_PERMISSION;
299 }
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900300 return mDrmManager->closeDecryptSession(uniqueId, decryptHandle);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900301}
302
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700303status_t DrmManagerService::initializeDecryptUnit(int uniqueId, sp<DecryptHandle>& decryptHandle,
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900304 int decryptUnitId, const DrmBuffer* headerInfo) {
Steve Block3856b092011-10-20 11:56:00 +0100305 ALOGV("Entering initializeDecryptUnit");
Riley Spahnf785f492014-07-01 15:32:31 -0700306 if (!isProtectedCallAllowed(INITIALIZE_DECRYPT_UNIT)) {
James Dong328745b2012-02-28 13:55:55 -0800307 return DRM_ERROR_NO_PERMISSION;
308 }
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900309 return mDrmManager->initializeDecryptUnit(uniqueId,decryptHandle, decryptUnitId, headerInfo);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900310}
311
312status_t DrmManagerService::decrypt(
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700313 int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId,
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900314 const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
Steve Block3856b092011-10-20 11:56:00 +0100315 ALOGV("Entering decrypt");
Riley Spahnf785f492014-07-01 15:32:31 -0700316 if (!isProtectedCallAllowed(DECRYPT)) {
James Dong328745b2012-02-28 13:55:55 -0800317 return DRM_ERROR_NO_PERMISSION;
318 }
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900319 return mDrmManager->decrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900320}
321
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900322status_t DrmManagerService::finalizeDecryptUnit(
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700323 int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId) {
Steve Block3856b092011-10-20 11:56:00 +0100324 ALOGV("Entering finalizeDecryptUnit");
Riley Spahnf785f492014-07-01 15:32:31 -0700325 if (!isProtectedCallAllowed(FINALIZE_DECRYPT_UNIT)) {
James Dong328745b2012-02-28 13:55:55 -0800326 return DRM_ERROR_NO_PERMISSION;
327 }
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900328 return mDrmManager->finalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900329}
330
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700331ssize_t DrmManagerService::pread(int uniqueId, sp<DecryptHandle>& decryptHandle,
Gloria Wanga2cd44c2010-11-19 15:19:36 -0800332 void* buffer, ssize_t numBytes, off64_t offset) {
Steve Block3856b092011-10-20 11:56:00 +0100333 ALOGV("Entering pread");
Riley Spahnf785f492014-07-01 15:32:31 -0700334 if (!isProtectedCallAllowed(PREAD)) {
James Dong328745b2012-02-28 13:55:55 -0800335 return DRM_ERROR_NO_PERMISSION;
336 }
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900337 return mDrmManager->pread(uniqueId, decryptHandle, buffer, numBytes, offset);
338}
339
Andy Hung07b745e2016-05-23 16:21:07 -0700340status_t DrmManagerService::dump(int fd, const Vector<String16>& args)
James Dong8635b7b2011-03-14 17:01:38 -0700341{
342 const size_t SIZE = 256;
343 char buffer[SIZE];
344 String8 result;
345 if (checkCallingPermission(String16("android.permission.DUMP")) == false) {
346 snprintf(buffer, SIZE, "Permission Denial: "
347 "can't dump DrmManagerService from pid=%d, uid=%d\n",
348 IPCThreadState::self()->getCallingPid(),
349 IPCThreadState::self()->getCallingUid());
350 result.append(buffer);
351 } else {
352#if DRM_MEMORY_LEAK_TRACK
353 bool dumpMem = false;
354 for (size_t i = 0; i < args.size(); i++) {
355 if (args[i] == String16("-m")) {
356 dumpMem = true;
357 }
358 }
359 if (dumpMem) {
Andy Hung07b745e2016-05-23 16:21:07 -0700360 result.append("\nDumping memory:\n");
361 std::string s = dumpMemoryAddresses(100 /* limit */);
362 result.append(s.c_str(), s.size());
James Dong8635b7b2011-03-14 17:01:38 -0700363 }
Andy Hung07b745e2016-05-23 16:21:07 -0700364#else
365 (void)args;
James Dong8635b7b2011-03-14 17:01:38 -0700366#endif
367 }
368 write(fd, result.string(), result.size());
369 return NO_ERROR;
370}
371