summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-26 14:15:24 (UTC)
committer zecke <zecke>2004-09-26 14:15:24 (UTC)
commit31c049a24effde037c20ed9446d2725f3cb718c3 (patch) (side-by-side diff)
tree3f33fd5ef8ceb057a1066c4f1a09ff5869bde3f4
parent77441b90e9b5a4a23b080e7ac53a512abe96f8a9 (diff)
downloadopie-31c049a24effde037c20ed9446d2725f3cb718c3.zip
opie-31c049a24effde037c20ed9446d2725f3cb718c3.tar.gz
opie-31c049a24effde037c20ed9446d2725f3cb718c3.tar.bz2
Since some 2.6.8 kernel the Linux kernel one can set
the process name with prctl. Let us use this as well
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/tools/quicklauncher/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/tools/quicklauncher/main.cpp b/core/tools/quicklauncher/main.cpp
index fb2ca44..286aed2 100644
--- a/core/tools/quicklauncher/main.cpp
+++ b/core/tools/quicklauncher/main.cpp
@@ -23,48 +23,56 @@
/* OPIE */
#include <opie2/odebug.h>
using namespace Opie::Core;
/* QT */
#include <qpainter.h>
#include <qstrlist.h>
#include <qtimer.h>
#include <qguardedptr.h>
#include <qcopchannel_qws.h>
#ifdef private
# undef private
#endif
#define private public
#include <qtopia/qpeapplication.h>
#undef private
/* STD */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
+
+#ifdef _OS_LINUX_
+#include <sys/prctl.h>
+#ifndef PR_SET_NAME
+#define PR_SET_NAME 15
+#endif
+#endif
+
#include <unistd.h>
using QuickPrivate::PluginLoader;
static QPEApplication *app = 0;
static PluginLoader *loader = 0;
static ApplicationInterface *appIface = 0;
static QGuardedPtr<QWidget> mainWindow;
#ifdef _OS_LINUX_
static char **argv0 = 0;
static int argv_lth;
extern char **environ;
#ifndef SPT_BUFSIZE
#define SPT_BUFSIZE 2048
#endif
#include <stdarg.h>
void setproctitle (const char *fmt,...) {
int i;
char buf[SPT_BUFSIZE];
va_list ap;
if (!argv0)
@@ -145,48 +153,49 @@ private slots:
stream >> arg;
odebug << "QuickLauncher execute: " << arg << oendl;
QStrList argList;
argList.append( arg.utf8() );
doQuickLaunch( argList );
delete this;
}
}
private:
void doQuickLaunch( QStrList &argList )
{
static int myargc = argList.count();
static char **myargv = new char *[myargc + 1];
for ( int j = 0; j < myargc; j++ ) {
myargv[j] = new char [strlen(argList.at(j))+1];
strcpy( myargv[j], argList.at(j) );
}
myargv[myargc] = NULL;
#ifdef _OS_LINUX_
// Change name of process
setproctitle(myargv[0]);
+ prctl( PR_SET_NAME, (unsigned long)myargv[0], 0, 0, 0 );
#endif
connect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit()));
app->exit_loop();
app->initApp( myargc, myargv );
exec( myargc, myargv );
}
private:
QCopChannel *qlChannel;
};
int main( int argc, char** argv )
{
app = new QPEApplication( argc, argv );
loader = new PluginLoader( "application" );
unsetenv( "LD_BIND_NOW" );
QCString arg0 = argv[0];
int sep = arg0.findRev( '/' );
if ( sep > 0 )