diff options
author | Denis Kozadaev <denis@dilos.org> | 2023-05-18 21:41:25 +0300 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-05-23 10:14:51 +0900 |
commit | d984205f2e2e53941bce2efb99252feb6a4c046e (patch) | |
tree | 71092a76f19990d9072233a2c02e687ee518da64 /kicker | |
parent | f3f71a018f383fe1cdf2d7e402c95325ba81c6a3 (diff) | |
download | tdebase-d984205f2e2e53941bce2efb99252feb6a4c046e.tar.gz tdebase-d984205f2e2e53941bce2efb99252feb6a4c046e.zip |
SunOS specific patches
Signed-off-by: Denis Kozadaev <denis@dilos.org>
(cherry picked from commit 4d58a4ea8daf1a3cb91b7d8c6e574dd6f5bdb685)
Diffstat (limited to 'kicker')
-rw-r--r-- | kicker/applets/naughty/NaughtyProcessMonitor.cpp | 31 | ||||
-rw-r--r-- | kicker/kicker/ui/k_new_mnu.cpp | 5 | ||||
-rw-r--r-- | kicker/taskbar/taskcontainer.cpp | 24 |
3 files changed, 47 insertions, 13 deletions
diff --git a/kicker/applets/naughty/NaughtyProcessMonitor.cpp b/kicker/applets/naughty/NaughtyProcessMonitor.cpp index 09c02cbf9..0239720fe 100644 --- a/kicker/applets/naughty/NaughtyProcessMonitor.cpp +++ b/kicker/applets/naughty/NaughtyProcessMonitor.cpp @@ -39,6 +39,10 @@ #include <signal.h> #include <unistd.h> +#ifdef Q_OS_SOLARIS +#include <procfs.h> +#endif + #include <tqfile.h> #include <tqstring.h> #include <tqstringlist.h> @@ -210,7 +214,7 @@ NaughtyProcessMonitor::_process(ulong pid, uint load) bool NaughtyProcessMonitor::canKill(ulong pid) const { -#ifdef __linux__ +#ifdef Q_OS_LINUX TQFile f("/proc/" + TQString::number(pid) + "/status"); if (!f.open(IO_ReadOnly)) @@ -240,6 +244,17 @@ NaughtyProcessMonitor::canKill(ulong pid) const return false ; return geteuid () == d->uidMap_[pid] ; +#elif defined(Q_OS_SOLARIS) + TQFile f("/proc/" + TQString::number(pid) + "/psinfo"); + TQByteArray raw; + psinfo_t *inf; + + if (!f.open(IO_ReadOnly)) + return false; + raw = f.readAll(); + f.close(); + inf = (psinfo_t *)raw.data(); + return geteuid() == inf->pr_euid; #else Q_UNUSED( pid ); return false; @@ -249,8 +264,9 @@ NaughtyProcessMonitor::canKill(ulong pid) const TQString NaughtyProcessMonitor::processName(ulong pid) const { -#if defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) -#ifdef __linux__ +#if defined(Q_OS_LINUX) || defined(__OpenBSD__) || defined(__NetBSD__) || \ + defined(Q_OS_SOLARIS) +#if defined(Q_OS_LINUX) || defined(Q_OS_SOLARIS) TQFile f("/proc/" + TQString::number(pid) + "/cmdline"); if (!f.open(IO_ReadOnly)) @@ -344,7 +360,7 @@ NaughtyProcessMonitor::processName(ulong pid) const uint NaughtyProcessMonitor::cpuLoad() const { -#ifdef __linux__ +#ifdef Q_OS_LINUX TQFile f("/proc/stat"); if (!f.open(IO_ReadOnly)) @@ -400,7 +416,7 @@ NaughtyProcessMonitor::cpuLoad() const TQValueList<ulong> NaughtyProcessMonitor::pidList() const { -#ifdef __linux__ +#if defined(Q_OS_LINUX) || defined(Q_OS_SOLARIS) TQStringList dl(TQDir("/proc").entryList()); TQValueList<ulong> pl; @@ -505,7 +521,7 @@ NaughtyProcessMonitor::pidList() const bool NaughtyProcessMonitor::getLoad(ulong pid, uint & load) const { -#ifdef __linux__ +#ifdef Q_OS_LINUX TQFile f("/proc/" + TQString::number(pid) + "/stat"); if (!f.open(IO_ReadOnly)) @@ -540,7 +556,8 @@ NaughtyProcessMonitor::getLoad(ulong pid, uint & load) const bool NaughtyProcessMonitor::kill(ulong pid) const { -#if defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) +#if defined(Q_OS_LINUX) || defined(__OpenBSD__) || defined(__NetBSD__) ||\ + defined(Q_OS_SOLARIS) return 0 == ::kill(pid, SIGKILL); #else Q_UNUSED( pid ); diff --git a/kicker/kicker/ui/k_new_mnu.cpp b/kicker/kicker/ui/k_new_mnu.cpp index 712868adb..86df79e24 100644 --- a/kicker/kicker/ui/k_new_mnu.cpp +++ b/kicker/kicker/ui/k_new_mnu.cpp @@ -31,6 +31,11 @@ #include <dmctl.h> #include <inttypes.h> +#ifdef Q_OS_SOLARIS +#include <sys/statvfs.h> +#define statfs statvfs +#endif /* Q_OS_SOLARIS */ + #include <tqimage.h> #include <tqpainter.h> #include <tqstyle.h> diff --git a/kicker/taskbar/taskcontainer.cpp b/kicker/taskbar/taskcontainer.cpp index 6ffd688d3..b0e00964c 100644 --- a/kicker/taskbar/taskcontainer.cpp +++ b/kicker/taskbar/taskcontainer.cpp @@ -26,6 +26,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <assert.h> +#ifdef Q_OS_SOLARIS +#include <procfs.h> +#endif /* SunOS */ + #include <tqbitmap.h> #include <tqcolor.h> #include <tqcursor.h> @@ -96,6 +100,18 @@ static void create_atoms(Display *d) { } bool is_process_resumable(pid_t pid) { +#ifdef Q_OS_SOLARIS + TQFile procStatFile(TQString("/proc/%1/lwp/1/lwpsinfo").arg(pid)); + if (procStatFile.open(IO_ReadOnly)) { + TQByteArray statRaw = procStatFile.readAll(); + lwpsinfo_t *inf = (lwpsinfo_t *)statRaw.data(); + + procStatFile.close(); + if( inf->pr_sname == 'T' ) { + return true; + } + } +#else /* default */ TQFile procStatFile(TQString("/proc/%1/stat").arg(pid)); if (procStatFile.open(IO_ReadOnly)) { TQByteArray statRaw = procStatFile.readAll(); @@ -107,13 +123,9 @@ bool is_process_resumable(pid_t pid) { if( state == "T" ) { return true; } - else { - return false; - } - } - else { - return false; } +#endif /* read process status */ + return false; } TaskContainer::TaskContainer(Task::Ptr task, TaskBar* bar, TaskBarSettings* settingsObject, TaskBarSettings* globalSettingsObject, TQWidget *parent, const char *name) |