diff --git a/local/recipes/kde/kf6-pty/source/CMakeLists.txt b/local/recipes/kde/kf6-pty/source/CMakeLists.txt index a0903742c..0aa1b2751 100644 --- a/local/recipes/kde/kf6-pty/source/CMakeLists.txt +++ b/local/recipes/kde/kf6-pty/source/CMakeLists.txt @@ -33,7 +33,7 @@ find_package(KF6CoreAddons ${KF_DEP_VERSION} REQUIRED) find_package(KF6I18n ${KF_DEP_VERSION} REQUIRED) if (UNIX) - find_package(UTEMPTER) + # find_package(UTEMPTER disabled on Redox) set_package_properties(UTEMPTER PROPERTIES TYPE OPTIONAL PURPOSE "Required by KPty for managing UTMP entries" @@ -57,7 +57,7 @@ ecm_setup_version( SOVERSION 6) add_definitions(-DTRANSLATION_DOMAIN=\"kpty6\") -ki18n_install(po) +#ki18n_install(po) ecm_set_disabled_deprecation_versions( QT 6.8.0 @@ -65,9 +65,9 @@ ecm_set_disabled_deprecation_versions( ) add_subdirectory( src ) -if (BUILD_TESTING) - add_subdirectory( autotests ) -endif() +##if (BUILD_TESTING) +## add_subdirectory( autotests ) +##endif() if (BUILD_QCH) ecm_install_qch_export( diff --git a/local/recipes/kde/kf6-pty/source/src/kpty.cpp b/local/recipes/kde/kf6-pty/source/src/kpty.cpp index c0d3905df..f3d246949 100644 --- a/local/recipes/kde/kf6-pty/source/src/kpty.cpp +++ b/local/recipes/kde/kf6-pty/source/src/kpty.cpp @@ -439,7 +439,7 @@ void KPty::setCTty() setsid(); // make our slave pty the new controlling terminal. - ioctl(d->slaveFd, TIOCSCTTY, 0); + ioctl(d->slaveFd, TIOCSCTTY, nullptr); // make our new process group the foreground group on the pty int pgrp = getpid(); @@ -448,6 +448,15 @@ void KPty::setCTty() void KPty::login(const char *user, const char *remotehost) { +#ifdef __redox__ + // Redox provides PTY allocation and terminal attributes, but it does not yet + // expose a utmp/wtmp database API. Keep KPty functional while making login + // accounting an explicit no-op on this target rather than referencing + // incomplete libc utmp declarations. + Q_UNUSED(user); + Q_UNUSED(remotehost); + return; +#else #ifdef UTEMPTER_PATH Q_D(KPty); @@ -533,10 +542,15 @@ void KPty::login(const char *user, const char *remotehost) #endif #endif #endif +#endif } void KPty::logout() { +#ifdef __redox__ + // See KPty::login(): there is no Redox utmp/wtmp backend to update yet. + return; +#else #ifdef UTEMPTER_PATH Q_D(KPty); @@ -612,6 +626,7 @@ void KPty::logout() #endif #endif #endif +#endif } bool KPty::tcGetAttr(struct ::termios *ttmode) const diff --git a/local/recipes/kde/kf6-pty/source/src/kptydevice.cpp b/local/recipes/kde/kf6-pty/source/src/kptydevice.cpp index 1bff13f3f..a668da8b1 100644 --- a/local/recipes/kde/kf6-pty/source/src/kptydevice.cpp +++ b/local/recipes/kde/kf6-pty/source/src/kptydevice.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -42,6 +43,18 @@ #define KMAXINT ((int)(~0U >> 1)) +static void currentTimeval(struct timeval *tv) +{ +#ifdef __redox__ + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / 1000; +#else + gettimeofday(tv, nullptr); +#endif +} + ///////////////////////////////////////////////////// // Helper. Remove when QRingBuffer becomes public. // ///////////////////////////////////////////////////// @@ -365,7 +378,7 @@ bool KPtyDevicePrivate::doWait(int msecs, bool reading) tv.tv_sec = msecs / 1000; tv.tv_usec = (msecs % 1000) * 1000; #ifndef Q_OS_LINUX - gettimeofday(&etv, nullptr); + currentTimeval(&etv); timeradd(&tv, &etv, &etv); #endif tvp = &tv; @@ -387,7 +400,7 @@ bool KPtyDevicePrivate::doWait(int msecs, bool reading) #ifndef Q_OS_LINUX if (tvp) { - gettimeofday(&tv, nullptr); + currentTimeval(&tv); timersub(&etv, &tv, &tv); if (tv.tv_sec < 0) { tv.tv_sec = tv.tv_usec = 0;