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 | |
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)
-rw-r--r-- | ConfigureChecks.cmake | 15 | ||||
-rw-r--r-- | config.h.cmake | 4 | ||||
-rw-r--r-- | kcontrol/info/CMakeLists.txt | 6 | ||||
-rw-r--r-- | kcontrol/info/ConfigureChecks.cmake | 21 | ||||
-rw-r--r-- | kcontrol/info/info_solaris.cpp | 26 | ||||
-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 | ||||
-rw-r--r-- | kpersonalizer/CMakeLists.txt | 2 | ||||
-rw-r--r-- | kpersonalizer/ksysinfo.cpp | 30 | ||||
-rw-r--r-- | ksysguard/ksysguardd/CMakeLists.txt | 2 | ||||
-rw-r--r-- | ksysguard/ksysguardd/Solaris/CMakeLists.txt | 25 | ||||
-rw-r--r-- | ksysguard/ksysguardd/modules.h | 4 | ||||
-rw-r--r-- | tdeioslave/media/medianotifier/medianotifier.cpp | 8 | ||||
-rw-r--r-- | tdesu/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tdesu/tdesud/tdesud.cpp | 6 | ||||
-rw-r--r-- | tdm/ConfigureChecks.cmake | 4 | ||||
-rw-r--r-- | tdm/backend/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tdm/backend/dm.c | 29 | ||||
-rw-r--r-- | tdm/backend/getfd.c | 7 | ||||
-rw-r--r-- | twin/client.cpp | 29 | ||||
-rw-r--r-- | twin/compton-tde/compton.c | 4 |
22 files changed, 244 insertions, 41 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index a637df137..fff59ab29 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -575,3 +575,18 @@ if( BUILD_KXKB ) endif( ) endif( ) + +if( BUILD_KCONTROL OR BUILD_TDM ) + # SunOS kstat + check_library_exists( kstat kstat_open "" HAVE_KSTAT ) + if( HAVE_KSTAT ) + set( KSTAT_LIBRARIES kstat ) + else() + if( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" ) + tde_message_fatal( "libkstat not found on SunOS platform!" ) + endif() + set( KSTAT_LIBRARIES "" ) + endif( ) +endif( BUILD_KCONTROL OR BUILD_TDM ) + +check_include_files( "sys/time.h;sys/loadavg.h" HAVE_SYS_LOADAVG_H ) diff --git a/config.h.cmake b/config.h.cmake index 044a48da5..09baec618 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -19,6 +19,8 @@ // kdesktop, konsole, kcontrol, kicker #cmakedefine HAVE_XRENDER 1 +#cmakedefine HAVE_SYS_LOADAVG_H 1 + // taskmanager, klipper #cmakedefine HAVE_XFIXES 1 @@ -137,6 +139,7 @@ // tdesu #cmakedefine HAVE_STRUCT_UCRED 1 #cmakedefine HAVE_GETPEEREID 1 +#cmakedefine HAVE_GETPEERUCRED 1 #cmakedefine HAVE_SYS_SELECT_H 1 #cmakedefine HAVE_SYS_WAIT_H 1 #cmakedefine DEFAULT_SUPER_USER_COMMAND "@DEFAULT_SUPER_USER_COMMAND@" @@ -163,6 +166,7 @@ #cmakedefine HAVE_INITGROUPS 1 #cmakedefine HAVE_MKSTEMP 1 #cmakedefine HAVE_SETPROCTITLE 1 +#cmakedefine HAVE_PTHREAD_SETNAME_NP 1 #cmakedefine HAVE_SYSINFO 1 #cmakedefine HAVE_STRNLEN 1 #cmakedefine HAVE_CRYPT 1 diff --git a/kcontrol/info/CMakeLists.txt b/kcontrol/info/CMakeLists.txt index dbedbfe4d..35064b574 100644 --- a/kcontrol/info/CMakeLists.txt +++ b/kcontrol/info/CMakeLists.txt @@ -39,10 +39,14 @@ tde_create_translated_desktop( ) +##### configure checks ########################## + +include( ConfigureChecks.cmake ) + ##### kcm_info (module) ######################### tde_add_kpart( kcm_info AUTOMOC SOURCES main.cpp memory.cpp ${OPENGL_SOURCES} - LINK tdeui-shared ${GL_LIBRARIES} ${GLU_LIBRARIES} + LINK tdeui-shared ${GL_LIBRARIES} ${GLU_LIBRARIES} ${KSTAT_LIBRARIES} ${DEVINFO_LIBRARIES} DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kcontrol/info/ConfigureChecks.cmake b/kcontrol/info/ConfigureChecks.cmake new file mode 100644 index 000000000..ec881f0f2 --- /dev/null +++ b/kcontrol/info/ConfigureChecks.cmake @@ -0,0 +1,21 @@ +################################################# +# +# (C) 2023 DilOS Team +# denis (AT) tambov (DOT) ru +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +# devinfo +check_library_exists( devinfo di_init "" HAVE_DEVINFO ) +if( HAVE_DEVINFO ) + set( DEVINFO_LIBRARIES devinfo ) +else() + if( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" ) + tde_message_fatal( "libdevinfo not found on SunOS platform!" ) + endif() + set( DEVINFO_LIBRARIES "" ) +endif( ) diff --git a/kcontrol/info/info_solaris.cpp b/kcontrol/info/info_solaris.cpp index 9f2b17e1b..f52927424 100644 --- a/kcontrol/info/info_solaris.cpp +++ b/kcontrol/info/info_solaris.cpp @@ -45,9 +45,9 @@ bool GetInfo_CPU( TQListView *lBox ) { char *ptr; uint32_t i, ncpus; unsigned long state_begin; - QString state; - QString mhz; - QString inst; + TQString state; + TQString mhz; + TQString inst; /* * get a kstat handle first and update the user's kstat chain @@ -167,8 +167,8 @@ bool GetInfo_Partitions( TQListView *lBox ) { struct mnttab mnt; struct statvfs statbuf; fsblkcnt_t tmp; - QString total; - QString avail; + TQString total; + TQString avail; time_t mnttime; char *timetxt; char *ptr; @@ -315,7 +315,7 @@ bool GetInfo_XServer_and_Video( TQListView *lBox ) { */ TQListViewItem *mktree( TQListViewItem *top, const char *path ) { - QListViewItem *parent, + TQListViewItem *parent, *previous, *result; char *str = strdup( path ), @@ -380,7 +380,7 @@ TQListViewItem *mktree( TQListViewItem *top, const char *path ) { /* * prop_type_str() -- return the property type as a string */ -char *prop_type_str( di_prop_t prop ) { +const char *prop_type_str( di_prop_t prop ) { switch( di_prop_type( prop )) { case DI_PROP_TYPE_UNDEF_IT: @@ -448,8 +448,8 @@ int prop_type_guess( uchar_t *data, int len ) { */ int dump_minor_node( di_node_t node, di_minor_t minor, void *arg ) { - QListViewItem *item; - QString majmin; + TQListViewItem *item; + TQString majmin; char *type; dev_t dev; @@ -466,7 +466,7 @@ int dump_minor_node( di_node_t node, di_minor_t minor, void *arg ) { (type == NULL) ? "NULL" : type ); if( (dev = di_minor_devt( minor )) != DDI_DEV_T_NONE ) { - majmin.sprintf( "%ld/%ld", major( dev ), minor( dev )); + majmin.sprintf( "%u/%u", major( dev ), minor( dev )); new TQListViewItem( item, i18n( "Major/Minor:" ), majmin ); } @@ -562,7 +562,7 @@ TQString propvalue( di_prop_t prop ) { */ int dump_node( di_node_t node, void *arg ) { - QListViewItem *top = (TQListViewItem *) arg, + TQListViewItem *top = (TQListViewItem *) arg, *parent, *previous; char *path; @@ -641,7 +641,7 @@ int dump_node( di_node_t node, void *arg ) { /* * property type & value */ - QListViewItem *tmp, + TQListViewItem *tmp, *prev; tmp = new TQListViewItem( previous, di_prop_name( prop )); tmp->setExpandable( true ); @@ -668,7 +668,7 @@ int dump_node( di_node_t node, void *arg ) { bool GetInfo_Devices( TQListView *lBox ) { - QListViewItem *top; + TQListViewItem *top; di_node_t root_node; /* 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) diff --git a/kpersonalizer/CMakeLists.txt b/kpersonalizer/CMakeLists.txt index 19c3a6698..6fe020c82 100644 --- a/kpersonalizer/CMakeLists.txt +++ b/kpersonalizer/CMakeLists.txt @@ -40,6 +40,6 @@ tde_add_executable( kpersonalizer AUTOMOC kpersonalizer.cpp main.cpp kfindlanguage.cpp kcountrypagedlg.ui kospagedlg.ui keyecandypagedlg.ui tdestylepagedlg.ui krefinepagedlg.ui ksysinfo.cpp - LINK tdeio-shared + LINK tdeio-shared ${KSTAT_LIBRARIES} DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/kpersonalizer/ksysinfo.cpp b/kpersonalizer/ksysinfo.cpp index 20a089b8f..551dad3f8 100644 --- a/kpersonalizer/ksysinfo.cpp +++ b/kpersonalizer/ksysinfo.cpp @@ -235,8 +235,36 @@ TQFont KSysInfo::getFixedWidthFont(){ /////////////////// /////////////////// -//#elif defined(__svr4__) && defined(sun) +#elif defined(Q_OS_SOLARIS) /////////////////// +#include <kstat.h> + + void KSysInfo::initHWInfo() { + kstat_ctl_t *kctl; + kstat_t *ksp; + kstat_named_t *kdata; + + m_cpu_speed = 0; + /* cpu_info:0:cpu_info0:current_clock_Hz */ + + kctl = kstat_open(); + if (kctl == NULL) + return; + if (kstat_chain_update(kctl) != 0) + goto out; + ksp = kstat_lookup(kctl, "cpu_info", 0, "cpu_info0"); + if (ksp == NULL) + goto out; + if (kstat_read(kctl, ksp, NULL) == -1 ) + goto out; + + kdata = (kstat_named_t *)kstat_data_lookup(ksp, + "clock_Hz"); + if (kdata != NULL) + m_cpu_speed = kdata->value.ui64; + out: + kstat_close(kctl); + } /////////////////// //#elif __svr4__ diff --git a/ksysguard/ksysguardd/CMakeLists.txt b/ksysguard/ksysguardd/CMakeLists.txt index f90bdadb0..16019bdc1 100644 --- a/ksysguard/ksysguardd/CMakeLists.txt +++ b/ksysguard/ksysguardd/CMakeLists.txt @@ -21,6 +21,8 @@ elseif( ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) set( OS_SPECIFIC_DIR FreeBSD ) elseif( ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD" ) set( OS_SPECIFIC_DIR NetBSD ) +elseif( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" ) + set( OS_SPECIFIC_DIR Solaris ) else() tde_message_fatal( "Your operating system (${CMAKE_SYSTEM_NAME}) is not supported yet." ) endif() diff --git a/ksysguard/ksysguardd/Solaris/CMakeLists.txt b/ksysguard/ksysguardd/Solaris/CMakeLists.txt new file mode 100644 index 000000000..aeeda9ac3 --- /dev/null +++ b/ksysguard/ksysguardd/Solaris/CMakeLists.txt @@ -0,0 +1,25 @@ +################################################# +# +# (C) 2023 Denis Kozadaev +# denis (AT) tambov (DOT) ru +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/ksysguard/CContLib + ${CMAKE_SOURCE_DIR}/ksysguard/ksysguardd +) + + +##### ksysguardd (static) ####################### + +tde_add_library( ksysguardd STATIC + SOURCES + Memory.c LoadAvg.c ProcessList.c NetDev.c +) diff --git a/ksysguard/ksysguardd/modules.h b/ksysguard/ksysguardd/modules.h index fe66ad537..6130f2a83 100644 --- a/ksysguard/ksysguardd/modules.h +++ b/ksysguard/ksysguardd/modules.h @@ -68,7 +68,7 @@ #include "netdev.h" #endif /* OSTYPE_NetBSD */ -#ifdef OSTYPE_Solaris +#if defined(OSTYPE_Solaris) || defined(OSTYPE_SunOS) #include "LoadAvg.h" #include "Memory.h" #include "NetDev.h" @@ -146,7 +146,7 @@ struct SensorModul SensorModulList[] = { { "NetDev", initNetDev, exitNetDev, updateNetDev, checkNetDev, 0, NULLTIME }, #endif /* OSTYPE_NetBSD */ -#ifdef OSTYPE_Solaris +#if defined(OSTYPE_Solaris) || defined(OSTYPE_SunOS) { "LoadAvg", initLoadAvg, exitLoadAvg, updateLoadAvg, NULLVVFUNC, 0, NULLTIME }, { "Memory", initMemory, exitMemory, updateMemory, NULLVVFUNC, 0, NULLTIME }, { "NetDev", initNetDev, exitNetDev, updateNetDev, NULLVVFUNC, 0, NULLTIME }, diff --git a/tdeioslave/media/medianotifier/medianotifier.cpp b/tdeioslave/media/medianotifier/medianotifier.cpp index 069e205de..1f2640807 100644 --- a/tdeioslave/media/medianotifier/medianotifier.cpp +++ b/tdeioslave/media/medianotifier/medianotifier.cpp @@ -19,14 +19,18 @@ #include "medianotifier.h" -#if defined (__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) +#if defined (__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)\ + || defined(Q_OS_SOLARIS) +#ifdef Q_OS_SOLARIS +#include <sys/types.h> +#endif /* Q_OS_SOLARIS */ #include <sys/statvfs.h> #include <sys/param.h> #include <sys/mount.h> #else #include <sys/vfs.h> #endif -#if defined(__NetBSD__) +#if defined(__NetBSD__) || defined(Q_OS_SOLARIS) #define statfs statvfs #endif diff --git a/tdesu/CMakeLists.txt b/tdesu/CMakeLists.txt index 4c33fb0d8..67ee4c645 100644 --- a/tdesu/CMakeLists.txt +++ b/tdesu/CMakeLists.txt @@ -40,6 +40,8 @@ else() endif() check_function_exists( getpeereid HAVE_GETPEEREID ) +check_function_exists( getpeerucred HAVE_GETPEERUCRED ) + check_include_file( "sys/select.h" HAVE_SYS_SELECT_H ) check_include_file( "sys/wait.h" HAVE_SYS_WAIT_H ) diff --git a/tdesu/tdesud/tdesud.cpp b/tdesu/tdesud/tdesud.cpp index d463a400a..950bb91b4 100644 --- a/tdesu/tdesud/tdesud.cpp +++ b/tdesu/tdesud/tdesud.cpp @@ -45,7 +45,8 @@ #include <pwd.h> #include <errno.h> -#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__) +#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__) &&\ + !defined(Q_OS_SOLARIS) #include <sys/prctl.h> #endif #include <sys/time.h> @@ -251,7 +252,8 @@ int create_socket() int main(int argc, char *argv[]) { -#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__) +#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__) &&\ + !defined(Q_OS_SOLARIS) prctl(PR_SET_DUMPABLE, 0); #endif diff --git a/tdm/ConfigureChecks.cmake b/tdm/ConfigureChecks.cmake index 335a37f63..563ac6c0a 100644 --- a/tdm/ConfigureChecks.cmake +++ b/tdm/ConfigureChecks.cmake @@ -10,11 +10,15 @@ ################################################# find_library( UTIL_LIBRARY util ) +if( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" ) + set( UTIL_LIBRARY "" ) +endif() check_function_exists( getdomainname HAVE_GETDOMAINNAME ) check_function_exists( initgroups HAVE_INITGROUPS ) check_function_exists( mkstemp HAVE_MKSTEMP ) check_function_exists( setproctitle HAVE_SETPROCTITLE ) +check_function_exists( pthread_setname_np HAVE_PTHREAD_SETNAME_NP ) check_function_exists( sysinfo HAVE_SYSINFO ) check_function_exists( strnlen HAVE_STRNLEN ) check_function_exists( getifaddrs HAVE_GETIFADDRS ) diff --git a/tdm/backend/CMakeLists.txt b/tdm/backend/CMakeLists.txt index 8f11c4b34..f09704486 100644 --- a/tdm/backend/CMakeLists.txt +++ b/tdm/backend/CMakeLists.txt @@ -18,6 +18,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/tdm/kfrontend ${XAU_INCLUDE_DIRS} ${XDMCP_INCLUDE_DIRS} + ${TQT_INCLUDE_DIRS} ) link_directories( diff --git a/tdm/backend/dm.c b/tdm/backend/dm.c index 605f0b1c4..ac2471a17 100644 --- a/tdm/backend/dm.c +++ b/tdm/backend/dm.c @@ -51,6 +51,12 @@ from the copyright holder. # include <sys/vt.h> #endif +#ifdef HAVE_PTHREAD_SETNAME_NP +#include <pthread.h> +#endif /* pthread_setname_np() */ + +#include <tqglobal.h> + // Limited by the number of VTs configured into the kernel or 256, whichever is less #define MAX_VT_NUMBER 48 @@ -66,7 +72,8 @@ static void MainLoop( void ); static int signalFds[2]; -#if !defined(HAVE_SETPROCTITLE) && !defined(NOXDMTITLE) +#if !defined(HAVE_SETPROCTITLE) && !defined(NOXDMTITLE) && \ + !defined(HAVE_PTHREAD_SETNAME_NP) static char *Title; static int TitleLen; #endif @@ -104,7 +111,7 @@ main( int argc, char **argv ) if (!StrDup( &progpath, argv[0] )) Panic( "Out of memory" ); } else -#ifdef __linux__ +#ifdef Q_OS_LINUX { /* note that this will resolve symlinks ... */ int len; @@ -114,6 +121,16 @@ main( int argc, char **argv ) if (!StrNDup( &progpath, fullpath, len )) Panic( "Out of memory" ); } +#elif defined(Q_OS_SOLARIS) + { + /* note that this will resolve symlinks ... */ + int len; + char fullpath[PATH_MAX]; + if ((len = readlink( "/proc/self/path/a.out", fullpath, sizeof(fullpath) )) < 0) + Panic( "Invoke with full path specification or mount /proc" ); + if (!StrNDup( &progpath, fullpath, len )) + Panic( "Out of memory" ); + } #else # if 0 Panic( "Must be invoked with full path specification" ); @@ -161,7 +178,8 @@ main( int argc, char **argv ) #endif prog = strrchr( progpath, '/' ) + 1; -#if !defined(HAVE_SETPROCTITLE) && !defined(NOXDMTITLE) +#if !defined(HAVE_SETPROCTITLE) && !defined(NOXDMTITLE) && \ + !defined(HAVE_PTHREAD_SETNAME_NP) Title = argv[0]; TitleLen = (argv[argc - 1] + strlen( argv[argc - 1] )) - Title; #endif @@ -1685,7 +1703,8 @@ UnlockPidFile( void ) void SetTitle( const char *name ) { -#if !defined(HAVE_SETPROCTITLE) && !defined(NOXDMTITLE) +#if !defined(HAVE_SETPROCTITLE) && !defined(NOXDMTITLE) && \ + !defined(HAVE_PTHREAD_SETNAME_NP) char *p; int left; #endif @@ -1694,6 +1713,8 @@ SetTitle( const char *name ) ReInitErrorLog(); #ifdef HAVE_SETPROCTITLE setproctitle( "%s", name ); +#elif defined(HAVE_PTHREAD_SETNAME_NP) + pthread_setname_np(pthread_self(), name); #elif !defined(NOXDMTITLE) p = Title; left = TitleLen; diff --git a/tdm/backend/getfd.c b/tdm/backend/getfd.c index aaad616b6..070ddd0cd 100644 --- a/tdm/backend/getfd.c +++ b/tdm/backend/getfd.c @@ -4,9 +4,11 @@ #include <fcntl.h> #include <errno.h> #include <sys/ioctl.h> -#ifdef __linux__ +#ifdef Q_OS_LINUX #include <linux/kd.h> #endif +#include <tqglobal.h> + #include "getfd.h" /* @@ -22,7 +24,8 @@ is_a_console(int fd) { char arg; arg = 0; -#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) ||\ + defined(Q_OS_SOLARIS) return arg; #else return (ioctl(fd, KDGKBTYPE, &arg) == 0 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 <tdelocale.h> #include <stdlib.h> +#ifdef Q_OS_SOLARIS +#include <procfs.h> +#include <libgen.h> +#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); |