summaryrefslogtreecommitdiffstats
path: root/tdm
diff options
context:
space:
mode:
authorDenis Kozadaev <[email protected]>2023-05-18 21:41:25 +0300
committerSlávek Banko <[email protected]>2023-05-22 20:07:54 +0200
commit4d58a4ea8daf1a3cb91b7d8c6e574dd6f5bdb685 (patch)
tree564b7622f7025d976f0a0ac1cd9ed82ea14239dd /tdm
parentbd5494bc81ed0034cde41a34e6a6e8b813b7814b (diff)
downloadtdebase-4d58a4ea8daf1a3cb91b7d8c6e574dd6f5bdb685.tar.gz
tdebase-4d58a4ea8daf1a3cb91b7d8c6e574dd6f5bdb685.zip
SunOS specific patches
Signed-off-by: Denis Kozadaev <[email protected]>
Diffstat (limited to 'tdm')
-rw-r--r--tdm/ConfigureChecks.cmake4
-rw-r--r--tdm/backend/CMakeLists.txt1
-rw-r--r--tdm/backend/dm.c29
-rw-r--r--tdm/backend/getfd.c7
4 files changed, 35 insertions, 6 deletions
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