SunOS specific patches

Signed-off-by: Denis Kozadaev <denis@dilos.org>
pull/344/head
Denis Kozadaev 11 months ago committed by Slávek Banko
parent bd5494bc81
commit 4d58a4ea8d
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -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 )

@ -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

@ -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}
)

@ -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( )

@ -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;
/*

@ -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 );

@ -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>

@ -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)

@ -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}
)

@ -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__

@ -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()

@ -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
)

@ -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 },

@ -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

@ -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 )

@ -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

@ -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 )

@ -18,6 +18,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/tdm/kfrontend
${XAU_INCLUDE_DIRS}
${XDMCP_INCLUDE_DIRS}
${TQT_INCLUDE_DIRS}
)
link_directories(

@ -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;

@ -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

@ -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;

@ -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);

Loading…
Cancel
Save