blob: 5990bf9336277df5d8279357bf1737a13002b072 [file] [log] [blame]
// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "memory_tool.h"
#include "process_with_id.h"
namespace debugd {
const char* kMemtesterpath = "/usr/sbin/memtester";
MemtesterTool::MemtesterTool() { }
MemtesterTool::~MemtesterTool() { }
std::string MemtesterTool::Start(const DBus::FileDescriptor& outfd,
const uint32_t& memory,
DBus::Error& error) {
ProcessWithId* p = CreateProcess(false);
if (!p)
return "";
p->AddArg(kMemtesterpath);
p->AddArg(StringPrintf("%u", memory));
p->AddArg("1");
p->BindFd(outfd.get(), STDOUT_FILENO);
p->BindFd(outfd.get(), STDERR_FILENO);
LOG(INFO) << "memtester: running process id: " << p->id();
p->Start();
return p->id();
}
}; // namespace debugd