Bug 886722 - Rename log/debug to LOG/DEBUG_LOG in faulty.lib. r=nfroyd

This commit is contained in:
Mike Hommey 2013-06-27 09:35:49 +09:00
parent a682d7fe75
commit 8fd281dcec
8 changed files with 175 additions and 175 deletions

View File

@ -62,14 +62,14 @@ namespace {
void debug_phdr(const char *type, const Phdr *phdr)
{
debug("%s @0x%08" PRIxAddr " ("
"filesz: 0x%08" PRIxAddr ", "
"memsz: 0x%08" PRIxAddr ", "
"offset: 0x%08" PRIxAddr ", "
"flags: %c%c%c)",
type, phdr->p_vaddr, phdr->p_filesz, phdr->p_memsz,
phdr->p_offset, phdr->p_flags & PF_R ? 'r' : '-',
phdr->p_flags & PF_W ? 'w' : '-', phdr->p_flags & PF_X ? 'x' : '-');
DEBUG_LOG("%s @0x%08" PRIxAddr " ("
"filesz: 0x%08" PRIxAddr ", "
"memsz: 0x%08" PRIxAddr ", "
"offset: 0x%08" PRIxAddr ", "
"flags: %c%c%c)",
type, phdr->p_vaddr, phdr->p_filesz, phdr->p_memsz,
phdr->p_offset, phdr->p_flags & PF_R ? 'r' : '-',
phdr->p_flags & PF_W ? 'w' : '-', phdr->p_flags & PF_X ? 'x' : '-');
}
} /* anonymous namespace */
@ -102,7 +102,7 @@ private:
TemporaryRef<LibHandle>
CustomElf::Load(Mappable *mappable, const char *path, int flags)
{
debug("CustomElf::Load(\"%s\", 0x%x) = ...", path, flags);
DEBUG_LOG("CustomElf::Load(\"%s\", 0x%x) = ...", path, flags);
if (!mappable)
return NULL;
/* Keeping a RefPtr of the CustomElf is going to free the appropriate
@ -142,14 +142,14 @@ CustomElf::Load(Mappable *mappable, const char *path, int flags)
if (!dyn) {
dyn = phdr;
} else {
log("%s: Multiple PT_DYNAMIC segments detected", elf->GetPath());
LOG("%s: Multiple PT_DYNAMIC segments detected", elf->GetPath());
return NULL;
}
break;
case PT_TLS:
debug_phdr("PT_TLS", phdr);
if (phdr->p_memsz) {
log("%s: TLS is not supported", elf->GetPath());
LOG("%s: TLS is not supported", elf->GetPath());
return NULL;
}
break;
@ -158,24 +158,24 @@ CustomElf::Load(Mappable *mappable, const char *path, int flags)
// Skip on Android until bug 706116 is fixed
#ifndef ANDROID
if (phdr->p_flags & PF_X) {
log("%s: Executable stack is not supported", elf->GetPath());
LOG("%s: Executable stack is not supported", elf->GetPath());
return NULL;
}
#endif
break;
default:
debug("%s: Warning: program header type #%d not handled",
elf->GetPath(), phdr->p_type);
DEBUG_LOG("%s: Warning: program header type #%d not handled",
elf->GetPath(), phdr->p_type);
}
}
if (min_vaddr != 0) {
log("%s: Unsupported minimal virtual address: 0x%08" PRIxAddr,
LOG("%s: Unsupported minimal virtual address: 0x%08" PRIxAddr,
elf->GetPath(), min_vaddr);
return NULL;
}
if (!dyn) {
log("%s: No PT_DYNAMIC segment found", elf->GetPath());
LOG("%s: No PT_DYNAMIC segment found", elf->GetPath());
return NULL;
}
@ -194,7 +194,7 @@ CustomElf::Load(Mappable *mappable, const char *path, int flags)
if ((elf->base == MAP_FAILED) ||
(mmap(elf->base, max_vaddr, PROT_NONE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0) != elf->base)) {
log("%s: Failed to mmap", elf->GetPath());
LOG("%s: Failed to mmap", elf->GetPath());
return NULL;
}
@ -219,15 +219,15 @@ CustomElf::Load(Mappable *mappable, const char *path, int flags)
return NULL;
elf->stats("oneLibLoaded");
debug("CustomElf::Load(\"%s\", 0x%x) = %p", path, flags,
static_cast<void *>(elf));
DEBUG_LOG("CustomElf::Load(\"%s\", 0x%x) = %p", path, flags,
static_cast<void *>(elf));
return elf;
}
CustomElf::~CustomElf()
{
debug("CustomElf::~CustomElf(%p [\"%s\"])",
reinterpret_cast<void *>(this), GetPath());
DEBUG_LOG("CustomElf::~CustomElf(%p [\"%s\"])",
reinterpret_cast<void *>(this), GetPath());
CallFini();
/* Normally, __cxa_finalize is called by the .fini function. However,
* Android NDK before r6b doesn't do that. Our wrapped cxa_finalize only
@ -270,8 +270,8 @@ CustomElf::GetSymbolPtr(const char *symbol, unsigned long hash) const
void *ptr = NULL;
if (sym && sym->st_shndx != SHN_UNDEF)
ptr = GetPtr(sym->st_value);
debug("CustomElf::GetSymbolPtr(%p [\"%s\"], \"%s\") = %p",
reinterpret_cast<const void *>(this), GetPath(), symbol, ptr);
DEBUG_LOG("CustomElf::GetSymbolPtr(%p [\"%s\"], \"%s\") = %p",
reinterpret_cast<const void *>(this), GetPath(), symbol, ptr);
return ptr;
}
@ -316,7 +316,7 @@ CustomElf::GetSymbolPtrInDeps(const char *symbol) const
* anyways. Moreover, on android, the main binary is dalvik. */
#ifdef __GLIBC__
sym = dlsym(RTLD_DEFAULT, symbol);
debug("dlsym(RTLD_DEFAULT, \"%s\") = %p", symbol, sym);
DEBUG_LOG("dlsym(RTLD_DEFAULT, \"%s\") = %p", symbol, sym);
if (sym)
return sym;
#endif
@ -379,7 +379,7 @@ bool
CustomElf::LoadSegment(const Phdr *pt_load) const
{
if (pt_load->p_type != PT_LOAD) {
debug("%s: Elf::LoadSegment only takes PT_LOAD program headers", GetPath());
DEBUG_LOG("%s: Elf::LoadSegment only takes PT_LOAD program headers", GetPath());
return false;;
}
@ -393,10 +393,10 @@ CustomElf::LoadSegment(const Phdr *pt_load) const
do {
Addr align_offset = pt_load->p_vaddr & (align - 1);
where = GetPtr(pt_load->p_vaddr - align_offset);
debug("%s: Loading segment @%p %c%c%c", GetPath(), where,
prot & PROT_READ ? 'r' : '-',
prot & PROT_WRITE ? 'w' : '-',
prot & PROT_EXEC ? 'x' : '-');
DEBUG_LOG("%s: Loading segment @%p %c%c%c", GetPath(), where,
prot & PROT_READ ? 'r' : '-',
prot & PROT_WRITE ? 'w' : '-',
prot & PROT_EXEC ? 'x' : '-');
mapped = mappable->mmap(where, pt_load->p_filesz + align_offset,
prot, MAP_PRIVATE | MAP_FIXED,
pt_load->p_offset - align_offset);
@ -408,15 +408,15 @@ CustomElf::LoadSegment(const Phdr *pt_load) const
* (p_vaddr == 0). But subsequent segments may not be 16k aligned
* and fail to mmap. In such case, try to mmap again at the p_align
* boundary instead of page boundary. */
debug("%s: Failed to mmap, retrying", GetPath());
DEBUG_LOG("%s: Failed to mmap, retrying", GetPath());
align = pt_load->p_align;
} while (1);
if (mapped != where) {
if (mapped == MAP_FAILED) {
log("%s: Failed to mmap", GetPath());
LOG("%s: Failed to mmap", GetPath());
} else {
log("%s: Didn't map at the expected location (wanted: %p, got: %p)",
LOG("%s: Didn't map at the expected location (wanted: %p, got: %p)",
GetPath(), where, mapped);
}
return false;
@ -446,7 +446,7 @@ CustomElf::LoadSegment(const Phdr *pt_load) const
Addr next_page = (file_end + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
if (mem_end > next_page) {
if (mprotect(GetPtr(next_page), mem_end - next_page, prot) < 0) {
log("%s: Failed to mprotect", GetPath());
LOG("%s: Failed to mprotect", GetPath());
return false;
}
}
@ -458,7 +458,7 @@ namespace {
void debug_dyn(const char *type, const Dyn *dyn)
{
debug("%s 0x%08" PRIxAddr, type, dyn->d_un.d_val);
DEBUG_LOG("%s 0x%08" PRIxAddr, type, dyn->d_un.d_val);
}
} /* anonymous namespace */
@ -497,12 +497,12 @@ CustomElf::InitDyn(const Phdr *pt_dyn)
case DT_SYMENT:
debug_dyn("DT_SYMENT", dyn);
if (dyn->d_un.d_val != sizeof(Sym)) {
log("%s: Unsupported DT_SYMENT", GetPath());
LOG("%s: Unsupported DT_SYMENT", GetPath());
return false;
}
break;
case DT_TEXTREL:
log("%s: Text relocations are not supported", GetPath());
LOG("%s: Text relocations are not supported", GetPath());
return false;
case DT_STRSZ: /* Ignored */
debug_dyn("DT_STRSZ", dyn);
@ -510,7 +510,7 @@ CustomElf::InitDyn(const Phdr *pt_dyn)
case UNSUPPORTED_RELOC():
case UNSUPPORTED_RELOC(SZ):
case UNSUPPORTED_RELOC(ENT):
log("%s: Unsupported relocations", GetPath());
LOG("%s: Unsupported relocations", GetPath());
return false;
case RELOC():
debug_dyn(STR_RELOC(), dyn);
@ -523,7 +523,7 @@ CustomElf::InitDyn(const Phdr *pt_dyn)
case RELOC(ENT):
debug_dyn(STR_RELOC(ENT), dyn);
if (dyn->d_un.d_val != sizeof(Reloc)) {
log("%s: Unsupported DT_RELENT", GetPath());
LOG("%s: Unsupported DT_RELENT", GetPath());
return false;
}
break;
@ -564,7 +564,7 @@ CustomElf::InitDyn(const Phdr *pt_dyn)
break;
case DT_PLTREL:
if (dyn->d_un.d_val != RELOC()) {
log("%s: Error: DT_PLTREL is not " STR_RELOC(), GetPath());
LOG("%s: Error: DT_PLTREL is not " STR_RELOC(), GetPath());
return false;
}
break;
@ -573,13 +573,13 @@ CustomElf::InitDyn(const Phdr *pt_dyn)
Addr flags = dyn->d_un.d_val;
/* Treat as a DT_TEXTREL tag */
if (flags & DF_TEXTREL) {
log("%s: Text relocations are not supported", GetPath());
LOG("%s: Text relocations are not supported", GetPath());
return false;
}
/* we can treat this like having a DT_SYMBOLIC tag */
flags &= ~DF_SYMBOLIC;
if (flags)
log("%s: Warning: unhandled flags #%" PRIxAddr" not handled",
LOG("%s: Warning: unhandled flags #%" PRIxAddr" not handled",
GetPath(), flags);
}
break;
@ -602,21 +602,21 @@ CustomElf::InitDyn(const Phdr *pt_dyn)
/* Ignored */
break;
default:
log("%s: Warning: dynamic header type #%" PRIxAddr" not handled",
LOG("%s: Warning: dynamic header type #%" PRIxAddr" not handled",
GetPath(), dyn->d_tag);
}
}
if (!buckets || !symnum) {
log("%s: Missing or broken DT_HASH", GetPath());
LOG("%s: Missing or broken DT_HASH", GetPath());
return false;
}
if (!strtab) {
log("%s: Missing DT_STRTAB", GetPath());
LOG("%s: Missing DT_STRTAB", GetPath());
return false;
}
if (!symtab) {
log("%s: Missing DT_SYMTAB", GetPath());
LOG("%s: Missing DT_SYMTAB", GetPath());
return false;
}
@ -637,7 +637,7 @@ CustomElf::InitDyn(const Phdr *pt_dyn)
bool
CustomElf::Relocate()
{
debug("Relocate %s @%p", GetPath(), static_cast<void *>(base));
DEBUG_LOG("Relocate %s @%p", GetPath(), static_cast<void *>(base));
for (Array<Reloc>::iterator rel = relocations.begin();
rel < relocations.end(); ++rel) {
/* Location of the relocation */
@ -661,7 +661,7 @@ CustomElf::Relocate()
}
if (symptr == NULL)
log("%s: Warning: relocation to NULL @0x%08" PRIxAddr,
LOG("%s: Warning: relocation to NULL @0x%08" PRIxAddr,
GetPath(), rel->r_offset);
/* Apply relocation */
@ -675,7 +675,7 @@ CustomElf::Relocate()
*(const char **) ptr = (const char *)symptr + rel->GetAddend(base);
break;
default:
log("%s: Unsupported relocation type: 0x%" PRIxAddr,
LOG("%s: Unsupported relocation type: 0x%" PRIxAddr,
GetPath(), ELF_R_TYPE(rel->r_info));
return false;
}
@ -694,7 +694,7 @@ CustomElf::RelocateJumps()
/* Only R_*_JMP_SLOT relocations are expected */
if (ELF_R_TYPE(rel->r_info) != R_JMP_SLOT) {
log("%s: Jump relocation type mismatch", GetPath());
LOG("%s: Jump relocation type mismatch", GetPath());
return false;
}
@ -707,7 +707,7 @@ CustomElf::RelocateJumps()
symptr = GetSymbolPtrInDeps(strtab.GetStringAt(sym.st_name));
if (symptr == NULL) {
log("%s: %s: relocation to NULL @0x%08" PRIxAddr " for symbol \"%s\"",
LOG("%s: %s: relocation to NULL @0x%08" PRIxAddr " for symbol \"%s\"",
GetPath(),
(ELF_ST_BIND(sym.st_info) == STB_WEAK) ? "Warning" : "Error",
rel->r_offset, strtab.GetStringAt(sym.st_name));

View File

@ -142,7 +142,7 @@ private:
void (*func)(void);
} f;
f.ptr = ptr;
debug("%s: Calling function @%p", GetPath(), ptr);
DEBUG_LOG("%s: Calling function @%p", GetPath(), ptr);
f.func();
}

View File

@ -233,12 +233,12 @@ SystemElf::Load(const char *path, int flags)
/* The Android linker returns a handle when the file name matches an
* already loaded library, even when the full path doesn't exist */
if (path && path[0] == '/' && (access(path, F_OK) == -1)){
debug("dlopen(\"%s\", 0x%x) = %p", path, flags, (void *)NULL);
DEBUG_LOG("dlopen(\"%s\", 0x%x) = %p", path, flags, (void *)NULL);
return NULL;
}
void *handle = dlopen(path, flags);
debug("dlopen(\"%s\", 0x%x) = %p", path, flags, handle);
DEBUG_LOG("dlopen(\"%s\", 0x%x) = %p", path, flags, handle);
ElfLoader::Singleton.lastError = dlerror();
if (handle) {
SystemElf *elf = new SystemElf(path, handle);
@ -252,7 +252,7 @@ SystemElf::~SystemElf()
{
if (!dlhandle)
return;
debug("dlclose(%p [\"%s\"])", dlhandle, GetPath());
DEBUG_LOG("dlclose(%p [\"%s\"])", dlhandle, GetPath());
dlclose(dlhandle);
ElfLoader::Singleton.lastError = dlerror();
ElfLoader::Singleton.Forget(this);
@ -262,7 +262,7 @@ void *
SystemElf::GetSymbolPtr(const char *symbol) const
{
void *sym = dlsym(dlhandle, symbol);
debug("dlsym(%p [\"%s\"], \"%s\") = %p", dlhandle, GetPath(), symbol, sym);
DEBUG_LOG("dlsym(%p [\"%s\"], \"%s\") = %p", dlhandle, GetPath(), symbol, sym);
ElfLoader::Singleton.lastError = dlerror();
return sym;
}
@ -353,9 +353,9 @@ ElfLoader::Load(const char *path, int flags, LibHandle *parent)
handle = SystemElf::Load(name, flags);
delete [] abs_path;
debug("ElfLoader::Load(\"%s\", 0x%x, %p [\"%s\"]) = %p", requested_path, flags,
reinterpret_cast<void *>(parent), parent ? parent->GetPath() : "",
static_cast<void *>(handle));
DEBUG_LOG("ElfLoader::Load(\"%s\", 0x%x, %p [\"%s\"]) = %p", requested_path, flags,
reinterpret_cast<void *>(parent), parent ? parent->GetPath() : "",
static_cast<void *>(handle));
return handle;
}
@ -420,14 +420,14 @@ ElfLoader::Forget(LibHandle *handle)
{
LibHandleList::iterator it = std::find(handles.begin(), handles.end(), handle);
if (it != handles.end()) {
debug("ElfLoader::Forget(%p [\"%s\"])", reinterpret_cast<void *>(handle),
handle->GetPath());
DEBUG_LOG("ElfLoader::Forget(%p [\"%s\"])", reinterpret_cast<void *>(handle),
handle->GetPath());
if (dbg && !handle->IsSystemElf())
dbg.Remove(static_cast<CustomElf *>(handle));
handles.erase(it);
} else {
debug("ElfLoader::Forget(%p [\"%s\"]): Handle not found",
reinterpret_cast<void *>(handle), handle->GetPath());
DEBUG_LOG("ElfLoader::Forget(%p [\"%s\"]): Handle not found",
reinterpret_cast<void *>(handle), handle->GetPath());
}
}
@ -459,13 +459,13 @@ ElfLoader::~ElfLoader()
for (LibHandleList::reverse_iterator it = list.rbegin();
it < list.rend(); ++it) {
if ((*it)->IsSystemElf()) {
debug("ElfLoader::~ElfLoader(): Remaining handle for \"%s\" "
"[%d direct refs, %d refs total]", (*it)->GetPath(),
(*it)->DirectRefCount(), (*it)->refCount());
DEBUG_LOG("ElfLoader::~ElfLoader(): Remaining handle for \"%s\" "
"[%d direct refs, %d refs total]", (*it)->GetPath(),
(*it)->DirectRefCount(), (*it)->refCount());
} else {
debug("ElfLoader::~ElfLoader(): Unexpected remaining handle for \"%s\" "
"[%d direct refs, %d refs total]", (*it)->GetPath(),
(*it)->DirectRefCount(), (*it)->refCount());
DEBUG_LOG("ElfLoader::~ElfLoader(): Unexpected remaining handle for \"%s\" "
"[%d direct refs, %d refs total]", (*it)->GetPath(),
(*it)->DirectRefCount(), (*it)->refCount());
/* Not removing, since it could have references to other libraries,
* destroying them as a side effect, and possibly leaving dangling
* pointers in the handle list we're scanning */
@ -521,8 +521,8 @@ void
ElfLoader::DestructorCaller::Call()
{
if (destructor) {
debug("ElfLoader::DestructorCaller::Call(%p, %p, %p)",
FunctionPtr(destructor), object, dso_handle);
DEBUG_LOG("ElfLoader::DestructorCaller::Call(%p, %p, %p)",
FunctionPtr(destructor), object, dso_handle);
destructor(object);
destructor = NULL;
}
@ -610,7 +610,7 @@ ElfLoader::DebuggerHelper::DebuggerHelper(): dbg(NULL)
}
if (!phdrs) {
debug("Couldn't find program headers");
DEBUG_LOG("Couldn't find program headers");
return;
}
@ -625,20 +625,20 @@ ElfLoader::DebuggerHelper::DebuggerHelper(): dbg(NULL)
/* If program headers aren't mapped, try to map them */
int fd = open("/proc/self/exe", O_RDONLY);
if (fd == -1) {
debug("Failed to open /proc/self/exe");
DEBUG_LOG("Failed to open /proc/self/exe");
return;
}
mem.Assign(mmap(base, PAGE_SIZE, PROT_READ, MAP_PRIVATE, fd, 0), PAGE_SIZE);
/* If we don't manage to map at the right address, just give up. */
if (mem != base) {
debug("Couldn't read program headers");
DEBUG_LOG("Couldn't read program headers");
return;
}
}
/* Sanity check: the first bytes at the base address should be an ELF
* header. */
if (!Elf::Ehdr::validate(base)) {
debug("Couldn't find program base");
DEBUG_LOG("Couldn't find program base");
return;
}
@ -657,7 +657,7 @@ ElfLoader::DebuggerHelper::DebuggerHelper(): dbg(NULL)
dyns.Init(base + phdr->p_vaddr, phdr->p_filesz);
}
if (!dyns) {
debug("Failed to find PT_DYNAMIC section in program");
DEBUG_LOG("Failed to find PT_DYNAMIC section in program");
return;
}
@ -668,7 +668,7 @@ ElfLoader::DebuggerHelper::DebuggerHelper(): dbg(NULL)
break;
}
}
debug("DT_DEBUG points at %p", static_cast<void *>(dbg));
DEBUG_LOG("DT_DEBUG points at %p", static_cast<void *>(dbg));
}
/**
@ -938,7 +938,7 @@ SEGVHandler::~SEGVHandler()
void SEGVHandler::handler(int signum, siginfo_t *info, void *context)
{
//ASSERT(signum == SIGSEGV);
debug("Caught segmentation fault @%p", info->si_addr);
DEBUG_LOG("Caught segmentation fault @%p", info->si_addr);
/* Check whether we segfaulted in the address space of a CustomElf. We're
* only expecting that to happen as an access error. */
@ -946,7 +946,7 @@ void SEGVHandler::handler(int signum, siginfo_t *info, void *context)
mozilla::RefPtr<LibHandle> handle =
ElfLoader::Singleton.GetHandleByPtr(info->si_addr);
if (handle && !handle->IsSystemElf()) {
debug("Within the address space of a CustomElf");
DEBUG_LOG("Within the address space of a CustomElf");
CustomElf *elf = static_cast<CustomElf *>(static_cast<LibHandle *>(handle));
if (elf->mappable->ensure(info->si_addr))
return;
@ -956,20 +956,20 @@ void SEGVHandler::handler(int signum, siginfo_t *info, void *context)
/* Redispatch to the registered handler */
SEGVHandler &that = ElfLoader::Singleton;
if (that.action.sa_flags & SA_SIGINFO) {
debug("Redispatching to registered handler @%p",
FunctionPtr(that.action.sa_sigaction));
DEBUG_LOG("Redispatching to registered handler @%p",
FunctionPtr(that.action.sa_sigaction));
that.action.sa_sigaction(signum, info, context);
} else if (that.action.sa_handler == SIG_DFL) {
debug("Redispatching to default handler");
DEBUG_LOG("Redispatching to default handler");
/* Reset the handler to the default one, and trigger it. */
sys_sigaction(signum, &that.action, NULL);
raise(signum);
} else if (that.action.sa_handler != SIG_IGN) {
debug("Redispatching to registered handler @%p",
FunctionPtr(that.action.sa_handler));
DEBUG_LOG("Redispatching to registered handler @%p",
FunctionPtr(that.action.sa_handler));
that.action.sa_handler(signum);
} else {
debug("Ignoring");
DEBUG_LOG("Ignoring");
}
}

View File

@ -7,7 +7,7 @@
#ifdef ANDROID
#include <android/log.h>
#define log(...) __android_log_print(ANDROID_LOG_ERROR, "GeckoLinker", __VA_ARGS__)
#define LOG(...) __android_log_print(ANDROID_LOG_ERROR, "GeckoLinker", __VA_ARGS__)
#else
#include <cstdio>
@ -24,22 +24,22 @@
#define MOZ_CONCAT1(a, b) MOZ_CONCAT2(a, b)
#define MOZ_CONCAT(a, b) MOZ_CONCAT1(a, b)
/* Some magic to choose between log1 and logm depending on the number of
/* Some magic to choose between LOG1 and LOGm depending on the number of
* arguments */
#define MOZ_CHOOSE_LOG(...) \
MOZ_MACRO_GLUE(MOZ_CONCAT(log, MOZ_ONE_OR_MORE_ARGS(__VA_ARGS__)), \
MOZ_MACRO_GLUE(MOZ_CONCAT(LOG, MOZ_ONE_OR_MORE_ARGS(__VA_ARGS__)), \
(__VA_ARGS__))
#define log1(format) fprintf(stderr, format "\n")
#define logm(format, ...) fprintf(stderr, format "\n", __VA_ARGS__)
#define log(...) MOZ_CHOOSE_LOG(__VA_ARGS__)
#define LOG1(format) fprintf(stderr, format "\n")
#define LOGm(format, ...) fprintf(stderr, format "\n", __VA_ARGS__)
#define LOG(...) MOZ_CHOOSE_LOG(__VA_ARGS__)
#endif
#ifdef MOZ_DEBUG_LINKER
#define debug log
#define DEBUG_LOG LOG
#else
#define debug(...)
#define DEBUG_LOG(...)
#endif
/* HAVE_64BIT_OS is not defined when building host tools, so use

View File

@ -77,7 +77,7 @@ MappableExtractFile::Create(const char *name, Zip *zip, Zip::Stream *stream)
{
const char *cachePath = getenv("MOZ_LINKER_CACHE");
if (!cachePath || !*cachePath) {
log("Warning: MOZ_LINKER_EXTRACT is set, but not MOZ_LINKER_CACHE; "
LOG("Warning: MOZ_LINKER_EXTRACT is set, but not MOZ_LINKER_CACHE; "
"not extracting");
return NULL;
}
@ -89,30 +89,30 @@ MappableExtractFile::Create(const char *name, Zip *zip, Zip::Stream *stream)
struct stat zipStat;
stat(zip->GetName(), &zipStat);
if (cacheStat.st_mtime > zipStat.st_mtime) {
debug("Reusing %s", static_cast<char *>(path));
DEBUG_LOG("Reusing %s", static_cast<char *>(path));
return MappableFile::Create(path);
}
}
debug("Extracting to %s", static_cast<char *>(path));
DEBUG_LOG("Extracting to %s", static_cast<char *>(path));
AutoCloseFD fd;
fd = open(path, O_TRUNC | O_RDWR | O_CREAT | O_NOATIME,
S_IRUSR | S_IWUSR);
if (fd == -1) {
log("Couldn't open %s to decompress library", path.get());
LOG("Couldn't open %s to decompress library", path.get());
return NULL;
}
AutoUnlinkFile file;
file = path.forget();
if (stream->GetType() == Zip::Stream::DEFLATE) {
if (ftruncate(fd, stream->GetUncompressedSize()) == -1) {
log("Couldn't ftruncate %s to decompress library", file.get());
LOG("Couldn't ftruncate %s to decompress library", file.get());
return NULL;
}
/* Map the temporary file for use as inflate buffer */
MappedPtr buffer(::mmap(NULL, stream->GetUncompressedSize(), PROT_WRITE,
MAP_SHARED, fd, 0), stream->GetUncompressedSize());
if (buffer == MAP_FAILED) {
log("Couldn't map %s to decompress library", file.get());
LOG("Couldn't map %s to decompress library", file.get());
return NULL;
}
@ -120,41 +120,41 @@ MappableExtractFile::Create(const char *name, Zip *zip, Zip::Stream *stream)
/* Decompress */
if (inflateInit2(&zStream, -MAX_WBITS) != Z_OK) {
log("inflateInit failed: %s", zStream.msg);
LOG("inflateInit failed: %s", zStream.msg);
return NULL;
}
if (inflate(&zStream, Z_FINISH) != Z_STREAM_END) {
log("inflate failed: %s", zStream.msg);
LOG("inflate failed: %s", zStream.msg);
return NULL;
}
if (inflateEnd(&zStream) != Z_OK) {
log("inflateEnd failed: %s", zStream.msg);
LOG("inflateEnd failed: %s", zStream.msg);
return NULL;
}
if (zStream.total_out != stream->GetUncompressedSize()) {
log("File not fully uncompressed! %ld / %d", zStream.total_out,
LOG("File not fully uncompressed! %ld / %d", zStream.total_out,
static_cast<unsigned int>(stream->GetUncompressedSize()));
return NULL;
}
} else if (stream->GetType() == Zip::Stream::STORE) {
SeekableZStream zStream;
if (!zStream.Init(stream->GetBuffer(), stream->GetSize())) {
log("Couldn't initialize SeekableZStream for %s", name);
LOG("Couldn't initialize SeekableZStream for %s", name);
return NULL;
}
if (ftruncate(fd, zStream.GetUncompressedSize()) == -1) {
log("Couldn't ftruncate %s to decompress library", file.get());
LOG("Couldn't ftruncate %s to decompress library", file.get());
return NULL;
}
MappedPtr buffer(::mmap(NULL, zStream.GetUncompressedSize(), PROT_WRITE,
MAP_SHARED, fd, 0), zStream.GetUncompressedSize());
if (buffer == MAP_FAILED) {
log("Couldn't map %s to decompress library", file.get());
LOG("Couldn't map %s to decompress library", file.get());
return NULL;
}
if (!zStream.Decompress(buffer, 0, zStream.GetUncompressedSize())) {
log("%s: failed to decompress", name);
LOG("%s: failed to decompress", name);
return NULL;
}
} else {
@ -213,8 +213,8 @@ public:
::mmap(reinterpret_cast<char *>(buf) + ((length + PAGE_SIZE - 1) & PAGE_MASK),
PAGE_SIZE, PROT_NONE, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS,
-1, 0);
debug("Decompression buffer of size %d in ashmem \"%s\", mapped @%p",
length, str, buf);
DEBUG_LOG("Decompression buffer of size %d in ashmem \"%s\", mapped @%p",
length, str, buf);
return new _MappableBuffer(fd.forget(), buf, length);
}
#else
@ -231,8 +231,8 @@ public:
void *buf = ::mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (buf != MAP_FAILED) {
debug("Decompression buffer of size %ld in \"%s\", mapped @%p",
length, path, buf);
DEBUG_LOG("Decompression buffer of size %ld in \"%s\", mapped @%p",
length, path, buf);
return new _MappableBuffer(fd.forget(), buf, length);
}
#endif
@ -300,26 +300,26 @@ MappableDeflate::mmap(const void *addr, size_t length, int prot, int flags, off_
zStream.avail_out = missing;
if ((*buffer == zStream.next_out) &&
(inflateInit2(&zStream, -MAX_WBITS) != Z_OK)) {
log("inflateInit failed: %s", zStream.msg);
LOG("inflateInit failed: %s", zStream.msg);
return MAP_FAILED;
}
int ret = inflate(&zStream, Z_SYNC_FLUSH);
if (ret < 0) {
log("inflate failed: %s", zStream.msg);
LOG("inflate failed: %s", zStream.msg);
return MAP_FAILED;
}
if (ret == Z_NEED_DICT) {
log("zstream requires a dictionary. %s", zStream.msg);
LOG("zstream requires a dictionary. %s", zStream.msg);
return MAP_FAILED;
}
zStream.avail_out = avail_out - missing + zStream.avail_out;
if (ret == Z_STREAM_END) {
if (inflateEnd(&zStream) != Z_OK) {
log("inflateEnd failed: %s", zStream.msg);
LOG("inflateEnd failed: %s", zStream.msg);
return MAP_FAILED;
}
if (zStream.total_out != buffer->GetLength()) {
log("File not fully uncompressed! %ld / %d", zStream.total_out,
LOG("File not fully uncompressed! %ld / %d", zStream.total_out,
static_cast<unsigned int>(buffer->GetLength()));
return MAP_FAILED;
}
@ -329,7 +329,7 @@ MappableDeflate::mmap(const void *addr, size_t length, int prot, int flags, off_
if (prot & PROT_EXEC) {
/* We just extracted data that may be executed in the future.
* We thus need to ensure Instruction and Data cache coherency. */
debug("cacheflush(%p, %p)", *buffer + offset, *buffer + (offset + length));
DEBUG_LOG("cacheflush(%p, %p)", *buffer + offset, *buffer + (offset + length));
cacheflush(reinterpret_cast<uintptr_t>(*buffer + offset),
reinterpret_cast<uintptr_t>(*buffer + (offset + length)), 0);
}
@ -445,7 +445,7 @@ private:
bool
MappableSeekableZStream::ensure(const void *addr)
{
debug("ensure @%p", addr);
DEBUG_LOG("ensure @%p", addr);
void *addrPage = reinterpret_cast<void *>
(reinterpret_cast<uintptr_t>(addr) & PAGE_MASK);
/* Find the mapping corresponding to the given page */
@ -499,7 +499,7 @@ MappableSeekableZStream::ensure(const void *addr)
if (map->prot & PROT_EXEC) {
/* We just extracted data that may be executed in the future.
* We thus need to ensure Instruction and Data cache coherency. */
debug("cacheflush(%p, %p)", *buffer + chunkStart, *buffer + (chunkStart + length));
DEBUG_LOG("cacheflush(%p, %p)", *buffer + chunkStart, *buffer + (chunkStart + length));
cacheflush(reinterpret_cast<uintptr_t>(*buffer + chunkStart),
reinterpret_cast<uintptr_t>(*buffer + (chunkStart + length)), 0);
}
@ -526,11 +526,11 @@ MappableSeekableZStream::ensure(const void *addr)
length = reinterpret_cast<uintptr_t>(end)
- reinterpret_cast<uintptr_t>(start);
debug("mprotect @%p, 0x%" PRIxSize ", 0x%x", start, length, map->prot);
DEBUG_LOG("mprotect @%p, 0x%" PRIxSize ", 0x%x", start, length, map->prot);
if (mprotect(const_cast<void *>(start), length, map->prot) == 0)
return true;
log("mprotect failed");
LOG("mprotect failed");
return false;
}
@ -538,8 +538,8 @@ void
MappableSeekableZStream::stats(const char *when, const char *name) const
{
size_t nEntries = zStream.GetChunksNum();
debug("%s: %s; %" PRIdSize "/%" PRIdSize " chunks decompressed",
name, when, chunkAvailNum, nEntries);
DEBUG_LOG("%s: %s; %" PRIdSize "/%" PRIdSize " chunks decompressed",
name, when, chunkAvailNum, nEntries);
size_t len = 64;
mozilla::ScopedDeleteArray<char> map;
@ -551,7 +551,7 @@ MappableSeekableZStream::stats(const char *when, const char *name) const
if ((j == len) || (i == nEntries - 1)) {
map[j + 1] = ']';
map[j + 2] = '\0';
debug("%s", static_cast<char *>(map));
DEBUG_LOG("%s", static_cast<char *>(map));
j = 0;
}
}

View File

@ -19,7 +19,7 @@ SeekableZStream::Init(const void *buf, size_t length)
{
const SeekableZStreamHeader *header = SeekableZStreamHeader::validate(buf);
if (!header) {
log("Not a seekable zstream");
LOG("Not a seekable zstream");
return false;
}
@ -41,7 +41,7 @@ SeekableZStream::Init(const void *buf, size_t length)
(lastChunkSize == 0) ||
(lastChunkSize > chunkSize) ||
(length < totalSize)) {
log("Malformed or broken seekable zstream");
LOG("Malformed or broken seekable zstream");
return false;
}
@ -66,7 +66,7 @@ bool
SeekableZStream::DecompressChunk(void *where, size_t chunk, size_t length)
{
if (chunk >= offsetTable.numElements()) {
log("DecompressChunk: chunk #%" PRIdSize " out of range [0-%" PRIdSize ")",
LOG("DecompressChunk: chunk #%" PRIdSize " out of range [0-%" PRIdSize ")",
chunk, offsetTable.numElements());
return false;
}
@ -78,7 +78,7 @@ SeekableZStream::DecompressChunk(void *where, size_t chunk, size_t length)
if (length == 0 || length > chunkLen)
length = chunkLen;
debug("DecompressChunk #%" PRIdSize " @%p (%" PRIdSize "/% " PRIdSize ")",
DEBUG_LOG("DecompressChunk #%" PRIdSize " @%p (%" PRIdSize "/% " PRIdSize ")",
chunk, where, length, chunkLen);
z_stream zStream;
memset(&zStream, 0, sizeof(zStream));
@ -90,21 +90,21 @@ SeekableZStream::DecompressChunk(void *where, size_t chunk, size_t length)
/* Decompress chunk */
if (inflateInit2(&zStream, windowBits) != Z_OK) {
log("inflateInit failed: %s", zStream.msg);
LOG("inflateInit failed: %s", zStream.msg);
return false;
}
if (dictionary && inflateSetDictionary(&zStream, dictionary,
dictionary.numElements()) != Z_OK) {
log("inflateSetDictionary failed: %s", zStream.msg);
LOG("inflateSetDictionary failed: %s", zStream.msg);
return false;
}
if (inflate(&zStream, (length == chunkLen) ? Z_FINISH : Z_SYNC_FLUSH)
!= (length == chunkLen) ? Z_STREAM_END : Z_OK) {
log("inflate failed: %s", zStream.msg);
LOG("inflate failed: %s", zStream.msg);
return false;
}
if (inflateEnd(&zStream) != Z_OK) {
log("inflateEnd failed: %s", zStream.msg);
LOG("inflateEnd failed: %s", zStream.msg);
return false;
}
if (filter)

View File

@ -18,25 +18,25 @@ Zip::Create(const char *filename)
/* Open and map the file in memory */
AutoCloseFD fd(open(filename, O_RDONLY));
if (fd == -1) {
log("Error opening %s: %s", filename, strerror(errno));
LOG("Error opening %s: %s", filename, strerror(errno));
return NULL;
}
struct stat st;
if (fstat(fd, &st) == -1) {
log("Error stating %s: %s", filename, strerror(errno));
LOG("Error stating %s: %s", filename, strerror(errno));
return NULL;
}
size_t size = st.st_size;
if (size <= sizeof(CentralDirectoryEnd)) {
log("Error reading %s: too short", filename);
LOG("Error reading %s: too short", filename);
return NULL;
}
void *mapped = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
if (mapped == MAP_FAILED) {
log("Error mmapping %s: %s", filename, strerror(errno));
LOG("Error mmapping %s: %s", filename, strerror(errno));
return NULL;
}
debug("Mapped %s @%p", filename, mapped);
DEBUG_LOG("Mapped %s @%p", filename, mapped);
return Create(filename, mapped, size);
}
@ -49,7 +49,7 @@ Zip::Create(const char *filename, void *mapped, size_t size)
// If neither the first Local File entry nor central directory entries
// have been found, the zip was invalid.
if (!zip->nextFile && !zip->entries) {
log("%s - Invalid zip", filename);
LOG("%s - Invalid zip", filename);
return NULL;
}
@ -76,7 +76,7 @@ Zip::~Zip()
ZipCollection::Forget(this);
if (name) {
munmap(mapped, size);
debug("Unmapped %s @%p", name, mapped);
DEBUG_LOG("Unmapped %s @%p", name, mapped);
free(name);
}
}
@ -84,7 +84,7 @@ Zip::~Zip()
bool
Zip::GetStream(const char *path, Zip::Stream *out) const
{
debug("%s - GetFile %s", name, path);
DEBUG_LOG("%s - GetFile %s", name, path);
/* Fast path: if the Local File header on store matches, we can return the
* corresponding stream right away.
* However, the Local File header may not contain enough information, in
@ -97,7 +97,7 @@ Zip::GetStream(const char *path, Zip::Stream *out) const
* normal condition for the bit to be set). */
if (nextFile && nextFile->GetName().Equals(path) &&
!entries && (nextFile->compressedSize != 0)) {
debug("%s - %s was next file: fast path", name, path);
DEBUG_LOG("%s - %s was next file: fast path", name, path);
/* Fill Stream info from Local File header content */
const char *data = reinterpret_cast<const char *>(nextFile->GetData());
out->compressedBuf = data;
@ -120,14 +120,14 @@ Zip::GetStream(const char *path, Zip::Stream *out) const
* Directory for the entry corresponding to the given path */
if (!nextDir || !nextDir->GetName().Equals(path)) {
const DirectoryEntry *entry = GetFirstEntry();
debug("%s - Scan directory entries in search for %s", name, path);
DEBUG_LOG("%s - Scan directory entries in search for %s", name, path);
while (entry && !entry->GetName().Equals(path)) {
entry = entry->GetNext();
}
nextDir = entry;
}
if (!nextDir) {
debug("%s - Couldn't find %s", name, path);
DEBUG_LOG("%s - Couldn't find %s", name, path);
return false;
}
@ -136,7 +136,7 @@ Zip::GetStream(const char *path, Zip::Stream *out) const
nextFile = LocalFile::validate(static_cast<const char *>(mapped)
+ nextDir->offset);
if (!nextFile) {
log("%s - Couldn't find the Local File header for %s", name, path);
LOG("%s - Couldn't find the Local File header for %s", name, path);
return false;
}
@ -167,14 +167,14 @@ Zip::GetFirstEntry() const
for (; _end > mapped && !end; _end--)
end = CentralDirectoryEnd::validate(_end);
if (!end) {
log("%s - Couldn't find end of central directory record", name);
LOG("%s - Couldn't find end of central directory record", name);
return NULL;
}
entries = DirectoryEntry::validate(static_cast<const char *>(mapped)
+ end->offset);
if (!entries) {
log("%s - Couldn't find central directory record", name);
LOG("%s - Couldn't find central directory record", name);
}
return entries;
}
@ -202,12 +202,12 @@ ZipCollection::Register(Zip *zip)
void
ZipCollection::Forget(Zip *zip)
{
debug("ZipCollection::Forget(\"%s\")", zip->GetName());
DEBUG_LOG("ZipCollection::Forget(\"%s\")", zip->GetName());
std::vector<Zip *>::iterator it = std::find(Singleton.zips.begin(),
Singleton.zips.end(), zip);
if (*it == zip) {
Singleton.zips.erase(it);
} else {
debug("ZipCollection::Forget: didn't find \"%s\" in bookkeeping", zip->GetName());
DEBUG_LOG("ZipCollection::Forget: didn't find \"%s\" in bookkeeping", zip->GetName());
}
}

View File

@ -128,7 +128,7 @@ public:
{
if (!size || !Resize(size))
return;
debug("Creating dictionary");
DEBUG_LOG("Creating dictionary");
piece *origBufPieces = reinterpret_cast<piece *>(
static_cast<void *>(inBuf));
std::map<piece, int> stats;
@ -208,7 +208,7 @@ int SzipDecompress::run(const char *name, Buffer &origBuf,
{
size_t origSize = origBuf.GetLength();
if (origSize < sizeof(SeekableZStreamHeader)) {
log("%s is not compressed", name);
LOG("%s is not compressed", name);
return 0;
}
@ -220,7 +220,7 @@ int SzipDecompress::run(const char *name, Buffer &origBuf,
/* Give enough room for the uncompressed data */
if (!outBuf.Resize(size)) {
log("Error resizing %s: %s", outName, strerror(errno));
LOG("Error resizing %s: %s", outName, strerror(errno));
return 1;
}
@ -236,20 +236,20 @@ int SzipCompress::run(const char *name, Buffer &origBuf,
{
size_t origSize = origBuf.GetLength();
if (origSize == 0) {
log("Won't compress %s: it's empty", name);
LOG("Won't compress %s: it's empty", name);
return 1;
}
if (SeekableZStreamHeader::validate(origBuf)) {
log("Skipping %s: it's already a szip", name);
LOG("Skipping %s: it's already a szip", name);
return 0;
}
bool compressed = false;
log("Size = %" PRIuSize, origSize);
LOG("Size = %" PRIuSize, origSize);
/* Allocate a buffer the size of the uncompressed data: we don't want
* a compressed file larger than that anyways. */
if (!outBuf.Resize(origSize)) {
log("Couldn't allocate output buffer: %s", strerror(errno));
LOG("Couldn't allocate output buffer: %s", strerror(errno));
return 1;
}
@ -272,7 +272,7 @@ int SzipCompress::run(const char *name, Buffer &origBuf,
FilteredBuffer *filteredTmp = NULL;
Buffer tmpBuf;
if (f != SeekableZStream::NONE) {
debug("Applying filter \"%s\"", filterName[f]);
DEBUG_LOG("Applying filter \"%s\"", filterName[f]);
filteredTmp = new FilteredBuffer();
filteredTmp->Filter(origBuf, f, chunkSize);
origData = filteredTmp;
@ -283,7 +283,7 @@ int SzipCompress::run(const char *name, Buffer &origBuf,
filteredBuf = filteredTmp;
break;
}
debug("Compressing with no dictionary");
DEBUG_LOG("Compressing with no dictionary");
if (do_compress(*origData, tmpBuf, NULL, 0, f) == 0) {
if (tmpBuf.GetLength() < outBuf.GetLength()) {
outBuf.Fill(tmpBuf);
@ -313,7 +313,7 @@ int SzipCompress::run(const char *name, Buffer &origBuf,
Buffer tmpBuf;
for (size_t d = firstDictSize; d <= lastDictSize; d += 4096) {
debug("Compressing with dictionary of size %" PRIuSize, d);
DEBUG_LOG("Compressing with dictionary of size %" PRIuSize, d);
if (do_compress(*origData, tmpBuf, static_cast<unsigned char *>(dict)
+ SzipCompress::winSize - d, d, filter))
continue;
@ -327,16 +327,16 @@ int SzipCompress::run(const char *name, Buffer &origBuf,
if (!compressed) {
outBuf.Fill(origBuf);
log("Not compressed");
LOG("Not compressed");
return 0;
}
if (dictSize == (size_t) -1)
dictSize = 0;
debug("Used filter \"%s\" and dictionary size of %" PRIuSize,
filterName[filter], dictSize);
log("Compressed size is %" PRIuSize, outBuf.GetLength());
DEBUG_LOG("Used filter \"%s\" and dictionary size of %" PRIuSize,
filterName[filter], dictSize);
LOG("Compressed size is %" PRIuSize, outBuf.GetLength());
/* Sanity check */
Buffer tmpBuf;
@ -346,11 +346,11 @@ int SzipCompress::run(const char *name, Buffer &origBuf,
size_t size = tmpBuf.GetLength();
if (size != origSize) {
log("Compression error: %" PRIuSize " != %" PRIuSize, size, origSize);
LOG("Compression error: %" PRIuSize " != %" PRIuSize, size, origSize);
return 1;
}
if (memcmp(static_cast<void *>(origBuf), static_cast<void *>(tmpBuf), size)) {
log("Compression error: content mismatch");
LOG("Compression error: content mismatch");
return 1;
}
return 0;
@ -377,7 +377,7 @@ int SzipCompress::do_compress(Buffer &origBuf, Buffer &outBuf,
/* Allocate a buffer the size of the uncompressed data: we don't want
* a compressed file larger than that anyways. */
if (!outBuf.Resize(origSize)) {
log("Couldn't allocate output buffer: %s", strerror(errno));
LOG("Couldn't allocate output buffer: %s", strerror(errno));
return 1;
}
@ -441,7 +441,7 @@ int SzipCompress::do_compress(Buffer &origBuf, Buffer &outBuf,
MOZ_ASSERT(header->totalSize == offset);
if (!outBuf.Resize(offset)) {
log("Error truncating output: %s", strerror(errno));
LOG("Error truncating output: %s", strerror(errno));
return 1;
}
@ -480,7 +480,7 @@ int main(int argc, char* argv[])
break;
if (!GetSize(firstArg[0], &chunkSize) || !chunkSize ||
(chunkSize % 4096) || (chunkSize > maxChunkSize)) {
log("Invalid chunk size");
LOG("Invalid chunk size");
return 1;
}
} else if (strcmp(firstArg[0], "-f") == 0) {
@ -497,7 +497,7 @@ int main(int argc, char* argv[])
}
}
if (!matched) {
log("Invalid filter");
LOG("Invalid filter");
return 1;
}
} else if (strcmp(firstArg[0], "-D") == 0) {
@ -508,14 +508,14 @@ int main(int argc, char* argv[])
if (strcmp(firstArg[0], "auto") == 0) {
dictSize = -1;
} else if (!GetSize(firstArg[0], &dictSize) || (dictSize >= 1 << 16)) {
log("Invalid dictionary size");
LOG("Invalid dictionary size");
return 1;
}
}
}
if (argc != 2 || !firstArg[0]) {
log("usage: %s [-d] [-c CHUNKSIZE] [-f FILTER] [-D DICTSIZE] file",
LOG("usage: %s [-d] [-c CHUNKSIZE] [-f FILTER] [-D DICTSIZE] file",
argv[0]);
return 1;
}
@ -524,11 +524,11 @@ int main(int argc, char* argv[])
action = new SzipCompress(chunkSize, filter, dictSize);
} else {
if (chunkSize) {
log("-c is incompatible with -d");
LOG("-c is incompatible with -d");
return 1;
}
if (dictSize) {
log("-D is incompatible with -d");
LOG("-D is incompatible with -d");
return 1;
}
action = new SzipDecompress();
@ -542,13 +542,13 @@ int main(int argc, char* argv[])
{
FileBuffer origBuf;
if (!origBuf.Init(firstArg[0])) {
log("Couldn't open %s: %s", firstArg[0], strerror(errno));
LOG("Couldn't open %s: %s", firstArg[0], strerror(errno));
return 1;
}
ret = fstat(origBuf.getFd(), &st);
if (ret == -1) {
log("Couldn't stat %s: %s", firstArg[0], strerror(errno));
LOG("Couldn't stat %s: %s", firstArg[0], strerror(errno));
return 1;
}
@ -556,14 +556,14 @@ int main(int argc, char* argv[])
/* Mmap the original file */
if (!origBuf.Resize(origSize)) {
log("Couldn't mmap %s: %s", firstArg[0], strerror(errno));
LOG("Couldn't mmap %s: %s", firstArg[0], strerror(errno));
return 1;
}
/* Create the compressed file */
FileBuffer outBuf;
if (!outBuf.Init(tmpOut.c_str(), true)) {
log("Couldn't open %s: %s", tmpOut.c_str(), strerror(errno));
LOG("Couldn't open %s: %s", tmpOut.c_str(), strerror(errno));
return 1;
}