From 4d58a4ea8daf1a3cb91b7d8c6e574dd6f5bdb685 Mon Sep 17 00:00:00 2001 From: Denis Kozadaev Date: Thu, 18 May 2023 21:41:25 +0300 Subject: SunOS specific patches Signed-off-by: Denis Kozadaev --- twin/client.cpp | 29 +++++++++++++++++++++++++++++ twin/compton-tde/compton.c | 4 ++++ 2 files changed, 33 insertions(+) (limited to 'twin') diff --git a/twin/client.cpp b/twin/client.cpp index b57cab35f..a58fd22f2 100644 --- a/twin/client.cpp +++ b/twin/client.cpp @@ -27,6 +27,11 @@ License. See the file "COPYING" for the exact licensing terms. #include #include +#ifdef Q_OS_SOLARIS +#include +#include +#endif /* SunOS */ + #include "bridge.h" #include "group.h" #include "workspace.h" @@ -1860,15 +1865,30 @@ bool Client::isSuspendable() const } else { +#ifdef Q_OS_SOLARIS + TQFile procStatFile(TQString("/proc/%1/lwp/1/lwpsinfo").arg(pid)); +#else /* default */ TQFile procStatFile(TQString("/proc/%1/stat").arg(pid)); +#endif if (procStatFile.open(IO_ReadOnly)) { TQByteArray statRaw = procStatFile.readAll(); procStatFile.close(); +#ifdef Q_OS_SOLARIS + lwpsinfo_t *inf = (lwpsinfo_t *)statRaw.data(); + char tbuf[PATH_MAX]; + TQString tcomm; + TQString state(TQChar(inf->pr_sname)); + + readlink(TQString("/proc/%1/path/a.out").arg(pid).latin1(), + tbuf, sizeof(tbuf)); + tcomm = basename(tbuf); +#else /* default */ TQString statString(statRaw); TQStringList statFields = TQStringList::split(" ", statString, TRUE); TQString tcomm = statFields[1]; TQString state = statFields[2]; +#endif /* default */ if( state != "T" ) { // Make sure no windows of this process are special @@ -1921,15 +1941,24 @@ bool Client::isResumeable() const } else { +#ifdef Q_OS_SOLARIS + TQFile procStatFile(TQString("/proc/%1/lwp/1/lwpsinfo").arg(pid)); +#else /* default */ TQFile procStatFile(TQString("/proc/%1/stat").arg(pid)); +#endif if (procStatFile.open(IO_ReadOnly)) { TQByteArray statRaw = procStatFile.readAll(); procStatFile.close(); +#ifdef Q_OS_SOLARIS + lwpsinfo_t *inf = (lwpsinfo_t *)statRaw.data(); + TQString state(TQChar(inf->pr_sname)); +#else /* default */ TQString statString(statRaw); TQStringList statFields = TQStringList::split(" ", statString, TRUE); TQString tcomm = statFields[1]; TQString state = statFields[2]; +#endif /* default */ if( state == "T" ) { return true; diff --git a/twin/compton-tde/compton.c b/twin/compton-tde/compton.c index 603402fc6..2e76cb6b3 100644 --- a/twin/compton-tde/compton.c +++ b/twin/compton-tde/compton.c @@ -161,7 +161,11 @@ void delete_pid_file() printf("compton-tde lost connection to X server, restarting...\n"); fflush(stdout); sleep(1); char me[2048]; +#ifdef Q_OS_SOLARIS + int chars = readlink("/proc/self/path/a.out", me, sizeof(me)); +#else /* default */ int chars = readlink("/proc/self/exe", me, sizeof(me)); +#endif /* self exe */ me[chars] = 0; me[2047] = 0; execl(me, basename(me), (char*)NULL); -- cgit v1.2.1