1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-03 02:01:48 +02:00

printMsg(lvlError, ...) -> printError(...) etc.

This commit is contained in:
Eelco Dolstra 2016-09-21 16:11:01 +02:00
parent 4036185cb4
commit c55bf085eb
30 changed files with 140 additions and 140 deletions

View file

@ -20,12 +20,12 @@ void setAffinityTo(int cpu)
#if __linux__
if (sched_getaffinity(0, sizeof(cpu_set_t), &savedAffinity) == -1) return;
didSaveAffinity = true;
printMsg(lvlDebug, format("locking this thread to CPU %1%") % cpu);
debug(format("locking this thread to CPU %1%") % cpu);
cpu_set_t newAffinity;
CPU_ZERO(&newAffinity);
CPU_SET(cpu, &newAffinity);
if (sched_setaffinity(0, sizeof(cpu_set_t), &newAffinity) == -1)
printMsg(lvlError, format("failed to lock thread to CPU %1%") % cpu);
printError(format("failed to lock thread to CPU %1%") % cpu);
#endif
}
@ -47,7 +47,7 @@ void restoreAffinity()
#if __linux__
if (!didSaveAffinity) return;
if (sched_setaffinity(0, sizeof(cpu_set_t), &savedAffinity) == -1)
printMsg(lvlError, "failed to restore affinity %1%");
printError("failed to restore affinity %1%");
#endif
}

View file

@ -84,7 +84,7 @@ static void dump(const Path & path, Sink & sink, PathFilter & filter)
string name(i.name);
size_t pos = i.name.find(caseHackSuffix);
if (pos != string::npos) {
printMsg(lvlDebug, format("removing case hack suffix from %1%") % (path + "/" + i.name));
debug(format("removing case hack suffix from %1%") % (path + "/" + i.name));
name.erase(pos);
}
if (unhacked.find(name) != unhacked.end())
@ -248,7 +248,7 @@ static void parse(ParseSink & sink, Source & source, const Path & path)
if (useCaseHack) {
auto i = names.find(name);
if (i != names.end()) {
printMsg(lvlDebug, format("case collision between %1% and %2%") % i->first % name);
debug(format("case collision between %1% and %2%") % i->first % name);
name += caseHackSuffix;
name += std::to_string(++i->second);
} else

View file

@ -52,7 +52,7 @@ Verbosity verbosity = lvlInfo;
void warnOnce(bool & haveWarned, const FormatOrString & fs)
{
if (!haveWarned) {
printMsg(lvlError, format("warning: %1%") % fs.s);
printError(format("warning: %1%") % fs.s);
haveWarned = true;
}
}

View file

@ -49,7 +49,7 @@ size_t threshold = 256 * 1024 * 1024;
static void warnLargeDump()
{
printMsg(lvlError, "warning: dumping very large path (> 256 MiB); this may run out of memory");
printError("warning: dumping very large path (> 256 MiB); this may run out of memory");
}

View file

@ -87,7 +87,7 @@ void ThreadPool::workerEntry()
if (state->exception) {
if (!dynamic_cast<Interrupted*>(&e) &&
!dynamic_cast<ThreadPoolShutDown*>(&e))
printMsg(lvlError, format("error: %s") % e.what());
printError(format("error: %s") % e.what());
} else {
state->exception = std::current_exception();
work.notify_all();

View file

@ -724,20 +724,20 @@ void Pid::kill(bool quiet)
if (pid == -1 || pid == 0) return;
if (!quiet)
printMsg(lvlError, format("killing process %1%") % pid);
printError(format("killing process %1%") % pid);
/* Send the requested signal to the child. If it has its own
process group, send the signal to every process in the child
process group (which hopefully includes *all* its children). */
if (::kill(separatePG ? -pid : pid, killSignal) != 0)
printMsg(lvlError, (SysError(format("killing process %1%") % pid).msg()));
printError((SysError(format("killing process %1%") % pid).msg()));
/* Wait until the child dies, disregarding the exit status. */
int status;
while (waitpid(pid, &status, 0) == -1) {
checkInterrupt();
if (errno != EINTR) {
printMsg(lvlError,
printError(
(SysError(format("waiting for process %1%") % pid).msg()));
break;
}
@ -1125,7 +1125,7 @@ void ignoreException()
try {
throw;
} catch (std::exception & e) {
printMsg(lvlError, format("error (ignored): %1%") % e.what());
printError(format("error (ignored): %1%") % e.what());
}
}
@ -1228,7 +1228,7 @@ void callFailure(const std::function<void(std::exception_ptr exc)> & failure, st
try {
failure(exc);
} catch (std::exception & e) {
printMsg(lvlError, format("uncaught exception: %s") % e.what());
printError(format("uncaught exception: %s") % e.what());
abort();
}
}