Merge changes from topic "snapshotctl_log"
* changes: libsnapshot callstack files readable by dumpstate snapshotctl logs readable by dumpstate snapshotctl_log dir readable by dumpstate
This commit is contained in:
commit
da8a404473
3 changed files with 19 additions and 4 deletions
|
|
@ -232,7 +232,12 @@ bool SnapshotManager::RemoveAllUpdateState(LockedFile* lock) {
|
||||||
LOG(WARNING) << callstack_str.c_str();
|
LOG(WARNING) << callstack_str.c_str();
|
||||||
std::stringstream path;
|
std::stringstream path;
|
||||||
path << "/data/misc/snapshotctl_log/libsnapshot." << Now() << ".log";
|
path << "/data/misc/snapshotctl_log/libsnapshot." << Now() << ".log";
|
||||||
android::base::WriteStringToFile(callstack_str.c_str(), path.str());
|
std::string path_str = path.str();
|
||||||
|
android::base::WriteStringToFile(callstack_str.c_str(), path_str);
|
||||||
|
if (chmod(path_str.c_str(), 0644) == -1) {
|
||||||
|
PLOG(WARNING) << "Unable to chmod 0644 "
|
||||||
|
<< ", file maybe dropped from bugreport:" << path_str;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!RemoveAllSnapshots(lock)) {
|
if (!RemoveAllSnapshots(lock)) {
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,16 @@ class FileLogger {
|
||||||
ss << kLogFilePath << "snapshotctl." << Now() << ".log";
|
ss << kLogFilePath << "snapshotctl." << Now() << ".log";
|
||||||
fd_.reset(TEMP_FAILURE_RETRY(
|
fd_.reset(TEMP_FAILURE_RETRY(
|
||||||
open(ss.str().c_str(),
|
open(ss.str().c_str(),
|
||||||
O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW | O_SYNC, 0660)));
|
O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW | O_SYNC, 0644)));
|
||||||
|
if (fd_ == -1) {
|
||||||
|
PLOG(ERROR) << "Cannot open persistent log " << ss.str();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Explicitly chmod again because mode in open() may be masked by umask.
|
||||||
|
if (fchmod(fd_.get(), 0644) == -1) {
|
||||||
|
PLOG(ERROR) << "Cannot chmod 0644 persistent log " << ss.str();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Copy-contuctor needed to be converted to std::function.
|
// Copy-contuctor needed to be converted to std::function.
|
||||||
FileLogger(const FileLogger& other) { fd_.reset(dup(other.fd_)); }
|
FileLogger(const FileLogger& other) { fd_.reset(dup(other.fd_)); }
|
||||||
|
|
@ -108,7 +117,8 @@ bool MergeCmdHandler(int argc, char** argv) {
|
||||||
|
|
||||||
// 'snapshotctl merge' is stripped away from arguments to
|
// 'snapshotctl merge' is stripped away from arguments to
|
||||||
// Logger.
|
// Logger.
|
||||||
android::base::InitLogging(argv, MergeCmdLogger(argc - 2, argv + 2));
|
android::base::InitLogging(argv);
|
||||||
|
android::base::SetLogger(MergeCmdLogger(argc - 2, argv + 2));
|
||||||
|
|
||||||
auto state = SnapshotManager::New()->InitiateMergeAndWait();
|
auto state = SnapshotManager::New()->InitiateMergeAndWait();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -611,7 +611,7 @@ on post-fs-data
|
||||||
mkdir /data/misc/installd 0700 root root
|
mkdir /data/misc/installd 0700 root root
|
||||||
mkdir /data/misc/apexdata 0711 root root
|
mkdir /data/misc/apexdata 0711 root root
|
||||||
mkdir /data/misc/apexrollback 0700 root root
|
mkdir /data/misc/apexrollback 0700 root root
|
||||||
mkdir /data/misc/snapshotctl_log 0770 root root
|
mkdir /data/misc/snapshotctl_log 0755 root root
|
||||||
# create location to store pre-reboot information
|
# create location to store pre-reboot information
|
||||||
mkdir /data/misc/prereboot 0700 system system
|
mkdir /data/misc/prereboot 0700 system system
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue