2014-07-27 03:11:09 +02:00
|
|
|
diff --git a/src/kdeinit/kinit.cpp b/src/kdeinit/kinit.cpp
|
|
|
|
index 296ebfd..dedbc9c 100644
|
|
|
|
--- a/src/kdeinit/kinit.cpp
|
|
|
|
+++ b/src/kdeinit/kinit.cpp
|
|
|
|
@@ -448,7 +448,7 @@ static void reset_oom_protect()
|
2014-07-26 14:57:14 +02:00
|
|
|
if (write(oom_pipe, &pid, sizeof(pid_t)) > 0) {
|
|
|
|
sigsuspend(&oldsigs); // wait for the signal to come
|
|
|
|
} else {
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "Failed to reset OOM protection: %d\n", pid);
|
|
|
|
#endif
|
|
|
|
}
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -512,7 +512,7 @@ static pid_t launch(int argc, const char *_name, const char *args,
|
2014-07-26 14:57:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: preparing to launch '%s'\n", libpath.isEmpty()
|
|
|
|
? execpath.constData() : libpath.toUtf8().constData());
|
|
|
|
#endif
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -742,7 +742,7 @@ static pid_t launch(int argc, const char *_name, const char *args,
|
2014-07-26 14:57:14 +02:00
|
|
|
d.n = read(d.fd[0], &d.result, 1);
|
|
|
|
if (d.n == 1) {
|
|
|
|
if (d.result == 2) {
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
//fprintf(stderr, "kdeinit5: no kdeinit module, trying exec....\n");
|
|
|
|
#endif
|
|
|
|
exec = true;
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1020,7 +1020,7 @@ static void start_klauncher()
|
2014-07-26 14:57:14 +02:00
|
|
|
sprintf(args + 5, "%d", d.launcher[1]);
|
|
|
|
d.launcher_pid = launch(2, "klauncher", args);
|
|
|
|
close(d.launcher[1]);
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: Launched KLauncher, pid = %ld, result = %d\n",
|
|
|
|
(long) d.launcher_pid, d.result);
|
|
|
|
#endif
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1036,7 +1036,7 @@ static void launcher_died()
|
2014-07-26 14:57:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// KLauncher died... restart
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: KLauncher died unexpectedly.\n");
|
|
|
|
#endif
|
|
|
|
// Make sure it's really dead.
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1055,7 +1055,7 @@ static void launcher_died()
|
2014-07-26 14:57:14 +02:00
|
|
|
|
|
|
|
static bool handle_launcher_request(int sock, const char *who)
|
|
|
|
{
|
|
|
|
- (void)who; // for NDEBUG
|
|
|
|
+ (void)who; // for NODEBUG
|
|
|
|
|
|
|
|
klauncher_header request_header;
|
|
|
|
char *request_data = 0L;
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1098,7 +1098,7 @@ static bool handle_launcher_request(int sock, const char *who)
|
2014-07-26 14:57:14 +02:00
|
|
|
int avoid_loops = 0;
|
|
|
|
const char *startup_id_str = "0"; // krazy:exclude=doublequote_chars
|
|
|
|
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: Got %s '%s' from %s.\n",
|
|
|
|
commandToString(request_header.cmd),
|
|
|
|
name, who);
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1148,7 +1148,7 @@ static bool handle_launcher_request(int sock, const char *who)
|
2014-07-26 14:57:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((arg_n - request_data) != request_header.arg_length) {
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: EXEC request has invalid format.\n");
|
|
|
|
#endif
|
|
|
|
free(request_data);
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1208,13 +1208,13 @@ static bool handle_launcher_request(int sock, const char *who)
|
2014-07-26 14:57:14 +02:00
|
|
|
env_name = request_data;
|
|
|
|
env_value = env_name + strlen(env_name) + 1;
|
|
|
|
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: Got SETENV '%s=%s' from %s.\n", env_name, env_value, who);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (request_header.arg_length !=
|
|
|
|
(int)(strlen(env_name) + strlen(env_value) + 2)) {
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: SETENV request has invalid format.\n");
|
|
|
|
#endif
|
|
|
|
free(request_data);
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1222,14 +1222,14 @@ static bool handle_launcher_request(int sock, const char *who)
|
2014-07-26 14:57:14 +02:00
|
|
|
}
|
|
|
|
qputenv(env_name, env_value);
|
|
|
|
} else if (request_header.cmd == LAUNCHER_TERMINATE_KDE) {
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: terminate KDE.\n");
|
|
|
|
#endif
|
|
|
|
#if HAVE_X11
|
|
|
|
kdeinit_xio_errhandler(0L);
|
|
|
|
#endif
|
|
|
|
} else if (request_header.cmd == LAUNCHER_TERMINATE_KDEINIT) {
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: Got termination request (PID %ld).\n", (long) getpid());
|
|
|
|
#endif
|
|
|
|
if (d.launcher_pid) {
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1242,14 +1242,14 @@ static bool handle_launcher_request(int sock, const char *who)
|
2014-07-26 14:57:14 +02:00
|
|
|
if (children) {
|
|
|
|
close(d.wrapper);
|
|
|
|
d.wrapper = -1;
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: Closed sockets, but not exiting until all children terminate.\n");
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
raise(SIGTERM);
|
|
|
|
}
|
|
|
|
} else if (request_header.cmd == LAUNCHER_DEBUG_WAIT) {
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: Debug wait activated.\n");
|
|
|
|
#endif
|
|
|
|
d.debug_wait = true;
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1293,7 +1293,7 @@ static void handle_requests(pid_t waitForPid)
|
2014-07-26 14:57:14 +02:00
|
|
|
do {
|
|
|
|
exit_pid = waitpid(-1, &exit_status, WNOHANG);
|
|
|
|
if (exit_pid > 0) {
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: PID %ld terminated.\n", (long) exit_pid);
|
|
|
|
#endif
|
|
|
|
if (waitForPid && (exit_pid == waitForPid)) {
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1308,7 +1308,7 @@ static void handle_requests(pid_t waitForPid)
|
2014-07-26 14:57:14 +02:00
|
|
|
child_died(exit_pid, exit_status);
|
|
|
|
|
|
|
|
if (d.wrapper < 0 && !children) {
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: Last child terminated, exiting (PID %ld).\n",
|
|
|
|
(long) getpid());
|
|
|
|
#endif
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1463,7 +1463,7 @@ int kdeinit_xio_errhandler(Display *disp)
|
2014-07-26 14:57:14 +02:00
|
|
|
|
|
|
|
int kdeinit_x_errhandler(Display *dpy, XErrorEvent *err)
|
|
|
|
{
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
char errstr[256];
|
|
|
|
// kdeinit almost doesn't use X, and therefore there shouldn't be any X error
|
|
|
|
XGetErrorText(dpy, err->error_code, errstr, 256);
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1536,7 +1536,7 @@ static int initXconnection()
|
2014-07-26 14:57:14 +02:00
|
|
|
0,
|
|
|
|
BlackPixelOfScreen(DefaultScreenOfDisplay(X11display)),
|
|
|
|
BlackPixelOfScreen(DefaultScreenOfDisplay(X11display)));
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: opened connection to %s\n", DisplayString(X11display));
|
|
|
|
#endif
|
|
|
|
int fd = XConnectionNumber(X11display);
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1595,7 +1595,7 @@ mac_fork_and_reexec_self()
|
2014-07-26 14:57:14 +02:00
|
|
|
switch (x_fork_result) {
|
|
|
|
|
|
|
|
case -1:
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "Mac OS X workaround fork() failed!\n");
|
|
|
|
#endif
|
|
|
|
::_exit(255);
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1766,7 +1766,7 @@ int main(int argc, char **argv)
|
2014-07-26 14:57:14 +02:00
|
|
|
l.setLoadHints(QLibrary::ExportExternalSymbolsHint);
|
|
|
|
(void)l.load();
|
|
|
|
}
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
else {
|
|
|
|
fprintf(stderr, "%s was not found.\n", extra_libs[i]);
|
|
|
|
}
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1799,7 +1799,7 @@ int main(int argc, char **argv)
|
2014-07-26 14:57:14 +02:00
|
|
|
qputenv("KDED_STARTED_BY_KDEINIT", "1");
|
|
|
|
pid = launch(1, KDED_EXENAME, 0);
|
|
|
|
unsetenv("KDED_STARTED_BY_KDEINIT");
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: Launched KDED, pid = %ld result = %d\n", (long) pid, d.result);
|
|
|
|
#endif
|
|
|
|
d.kded_pid = pid;
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1810,7 +1810,7 @@ int main(int argc, char **argv)
|
2014-07-26 14:57:14 +02:00
|
|
|
for (int i = 1; i < argc; i++) {
|
|
|
|
if (safe_argv[i][0] == '+') {
|
|
|
|
pid = launch(1, safe_argv[i] + 1, 0);
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: Launched '%s', pid = %ld result = %d\n", safe_argv[i] + 1, (long) pid, d.result);
|
|
|
|
#endif
|
|
|
|
handle_requests(pid);
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1822,7 +1822,7 @@ int main(int argc, char **argv)
|
2014-07-26 14:57:14 +02:00
|
|
|
// Ignore
|
|
|
|
} else {
|
|
|
|
pid = launch(1, safe_argv[i], 0);
|
|
|
|
-#ifndef NDEBUG
|
|
|
|
+#ifndef NODEBUG
|
|
|
|
fprintf(stderr, "kdeinit5: Launched '%s', pid = %ld result = %d\n", safe_argv[i], (long) pid, d.result);
|
|
|
|
#endif
|
|
|
|
}
|
2014-07-27 03:11:09 +02:00
|
|
|
diff --git a/src/klauncher/klauncher.cpp b/src/klauncher/klauncher.cpp
|
|
|
|
index 31498e0..fbcb064 100644
|
|
|
|
--- a/src/klauncher/klauncher.cpp
|
|
|
|
+++ b/src/klauncher/klauncher.cpp
|
2014-07-26 14:57:14 +02:00
|
|
|
@@ -65,7 +65,7 @@
|
|
|
|
// Dispose slaves after being idle for SLAVE_MAX_IDLE seconds
|
|
|
|
#define SLAVE_MAX_IDLE 30
|
|
|
|
|
|
|
|
-// #define KLAUNCHER_VERBOSE_OUTPUT
|
|
|
|
+#define KLAUNCHER_VERBOSE_OUTPUT
|
|
|
|
|
|
|
|
static const char *const s_DBusStartupTypeToString[] =
|
|
|
|
{ "DBusNone", "DBusUnique", "DBusMulti", "ERROR" };
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -617,7 +617,7 @@ KLauncher::requestStart(KLaunchRequest *request)
|
2014-07-26 15:01:28 +02:00
|
|
|
request_header.arg_length = requestData.length();
|
|
|
|
|
|
|
|
#ifdef KLAUNCHER_VERBOSE_OUTPUT
|
|
|
|
- // qDebug() << "Asking kdeinit to start" << request->name << request->arg_list
|
|
|
|
+ qDebug() << "Asking kdeinit to start" << request->name << request->arg_list
|
|
|
|
<< "cmd=" << commandToString(request_header.cmd);
|
|
|
|
#endif
|
|
|
|
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -782,7 +782,7 @@ KLauncher::start_service(KService::Ptr service, const QStringList &_urls,
|
2014-07-26 15:04:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef KLAUNCHER_VERBOSE_OUTPUT
|
|
|
|
- // qDebug() << "name=" << request->name << "dbus_name=" << request->dbus_name
|
|
|
|
+ qDebug() << "name=" << request->name << "dbus_name=" << request->dbus_name
|
|
|
|
<< "startup type=" << s_DBusStartupTypeToString[request->dbus_startup_type];
|
|
|
|
#endif
|
|
|
|
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -957,7 +957,7 @@ KLauncher::slotDequeue()
|
2014-07-26 15:04:04 +02:00
|
|
|
if (request->status != KLaunchRequest::Launching) {
|
|
|
|
// Request handled.
|
|
|
|
#ifdef KLAUNCHER_VERBOSE_OUTPUT
|
|
|
|
- // qDebug() << "Request handled already";
|
|
|
|
+ qDebug() << "Request handled already";
|
|
|
|
#endif
|
|
|
|
requestDone(request);
|
|
|
|
continue;
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1063,8 +1063,8 @@ KLauncher::requestSlave(const QString &protocol,
|
2014-07-26 15:04:04 +02:00
|
|
|
QString name = slaveModulePath;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
- // qDebug() << "KLauncher: launching new slave " << name << " with protocol=" << protocol
|
|
|
|
- // << " args=" << arg_list << endl;
|
|
|
|
+ qDebug() << "KLauncher: launching new slave " << name << " with protocol=" << protocol
|
|
|
|
+ << " args=" << arg_list << endl;
|
|
|
|
|
|
|
|
#ifdef Q_OS_UNIX
|
|
|
|
#ifndef USE_KPROCESS_FOR_KIOSLAVES
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1104,7 +1104,7 @@ KLauncher::requestSlave(const QString &protocol,
|
2014-07-26 15:04:04 +02:00
|
|
|
requestStart(request);
|
|
|
|
pid_t pid = request->pid;
|
|
|
|
|
|
|
|
-// qDebug() << "Slave launched, pid = " << pid;
|
|
|
|
+ qDebug() << "Slave launched, pid = " << pid;
|
|
|
|
|
|
|
|
// We don't care about this request any longer....
|
|
|
|
requestDone(request);
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1208,7 +1208,7 @@ KLauncher::slotGotOutput()
|
2014-07-26 15:04:04 +02:00
|
|
|
#ifdef USE_KPROCESS_FOR_KIOSLAVES
|
|
|
|
QProcess *p = static_cast<QProcess *>(sender());
|
|
|
|
QByteArray _stdout = p->readAllStandardOutput();
|
|
|
|
- // qDebug() << _stdout.data();
|
|
|
|
+ qDebug() << _stdout.data();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-07-27 03:11:09 +02:00
|
|
|
@@ -1217,12 +1217,12 @@ KLauncher::slotFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
2014-07-26 15:04:04 +02:00
|
|
|
{
|
|
|
|
#ifdef USE_KPROCESS_FOR_KIOSLAVES
|
|
|
|
QProcess *p = static_cast<QProcess *>(sender());
|
|
|
|
- // qDebug() << "process finished exitcode=" << exitCode << "exitStatus=" << exitStatus;
|
|
|
|
+ qDebug() << "process finished exitcode=" << exitCode << "exitStatus=" << exitStatus;
|
|
|
|
|
|
|
|
foreach (KLaunchRequest *request, requestList) {
|
|
|
|
if (request->process == p) {
|
|
|
|
#ifdef KLAUNCHER_VERBOSE_OUTPUT
|
|
|
|
- // qDebug() << "found KProcess, request done";
|
|
|
|
+ qDebug() << "found KProcess, request done";
|
|
|
|
#endif
|
|
|
|
if (exitCode == 0 && exitStatus == QProcess::NormalExit) {
|
|
|
|
request->status = KLaunchRequest::Done;
|