generic: adjust to Katie changes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2020-12-25 01:19:19 +00:00
parent fb7510696c
commit 18254ddaef
11 changed files with 48 additions and 47 deletions

View file

@ -66,6 +66,8 @@ QString SystemInformation::fetchOSBasicInformation() const
return QLatin1String("NetBSD");
#elif defined(Q_OS_OPENBSD)
return QLatin1String("OpenBSD");
#elif defined(Q_OS_DRAGONFLY)
return QLatin1String("DragonFly BSD");
#elif defined(Q_OS_SOLARIS)
return QLatin1String("Solaris");
#else

View file

@ -31,7 +31,7 @@
#define __STRICT_ANSI__
#endif
#ifdef Q_OS_FREEBSD
#if defined(Q_OS_FREEBSD) || defined(Q_OS_DRAGONFLY)
#include <sys/joystick.h>
#endif

View file

@ -23,15 +23,15 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "os_base.h"
#ifdef __linux__
#ifdef Q_OS_LINUX
#include "info_linux.cpp"
#elif defined(__FreeBSD__) || defined(__DragonFly__)
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_DRAGONFLY)
#include "info_fbsd.cpp"
#elif defined(__NetBSD__)
#elif defined(Q_OS_NETBSD)
#include "info_netbsd.cpp"
#elif defined(__OpenBSD__)
#elif defined(Q_OS_OPENBSD)
#include "info_openbsd.cpp"
#elif defined(sun)
#elif defined(Q_OS_SOLARIS)
#include "info_solaris.cpp"
#else
#include "info_generic.cpp" /* Default for unsupported systems.... */

View file

@ -137,7 +137,7 @@ QGroupBox* KCMMemory::initializeText() {
case FREE_MEM:
title = i18n("Free physical memory:");
break;
#if !defined(sun) && !defined(__NetBSD__) && !defined(__OpenBSD__)
#if !defined(Q_OS_SOLARIS) && !defined(Q_OS_NETBSD) && !defined(Q_OS_OPENBSD)
case SHARED_MEM:
title = i18n("Shared memory:");
break;
@ -294,13 +294,13 @@ void KCMMemory::updateMemoryGraphics() {
/* Include system-specific code */
#ifdef __linux__
#ifdef Q_OS_LINUX
#include "memory_linux.cpp"
#elif defined(sun)
#elif defined(Q_OS_SOLARIS)
#include "memory_solaris.cpp"
#elif defined(__FreeBSD__) || defined(__DragonFly__)
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_DRAGONFLY)
#include "memory_fbsd.cpp"
#elif defined(__NetBSD__) || defined(__OpenBSD__)
#elif defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD)
#include "memory_netbsd.cpp"
#else

View file

@ -224,7 +224,7 @@ static bool get_dri_device()
return false;
}
#elif defined(Q_OS_FREEBSD)
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_DRAGONFLY)
static bool get_dri_device() {

View file

@ -27,7 +27,7 @@
#include <math.h>
#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_DRAGONFLY)
#include <sys/ioctl.h>
#include <sys/param.h>
#endif
@ -175,7 +175,7 @@ QString USBDevice::dump() {
if (!prname.isEmpty())
pr += "<td>(" + prname +")</td>";
r += i18n("<tr><td><i>Protocol</i></td>%1</tr>", pr);
#if !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD))
#if !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_DRAGONFLY))
r += ki18n("<tr><td><i>USB Version</i></td><td>%1.%2</td></tr>")
.subs(_verMajor,0,16).subs(_verMinor,2,16,QChar::fromLatin1('0'))
.toString();
@ -199,7 +199,7 @@ QString USBDevice::dump() {
r += i18n("<tr><td><i>Speed</i></td><td>%1 Mbit/s</td></tr>", _speed);
r += i18n("<tr><td><i>Channels</i></td><td>%1</td></tr>", _channels);
#if (defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)) && !defined(DISABLE_USBDEVICES_FREEBSD)
#if (defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_DRAGONFLY)) && !defined(DISABLE_USBDEVICES_FREEBSD)
if ( _power )
r += i18n("<tr><td><i>Power Consumption</i></td><td>%1 mA</td></tr>", _power);
else
@ -228,7 +228,7 @@ QString USBDevice::dump() {
return r;
}
#if !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD))
#if !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_DRAGONFLY))
bool USBDevice::parse(const QString &fname) {
_devices.clear();
@ -345,7 +345,7 @@ void USBDevice::collectData( int fd, int level, usb_device_info &di, int parent)
_channels = di.udi_nports;
// determine the speed
#if defined(__DragonFly__) || (defined(Q_OS_FREEBSD) && __FreeBSD_version > 490102) || defined(Q_OS_NETBSD)
#if defined(Q_OS_DRAGONFLY) || (defined(Q_OS_FREEBSD) && __FreeBSD_version > 490102) || defined(Q_OS_NETBSD)
switch (di.udi_speed) {
case USB_SPEED_LOW: _speed = 1.5; break;
case USB_SPEED_FULL: _speed = 12.0; break;
@ -432,4 +432,4 @@ bool USBDevice::parse(const QString &fname)
}
# endif // defined(DISABLE_USBDEVICES_FREEBSD)
#endif // !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD))
#endif // !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_DRAGONFLY))

View file

@ -14,7 +14,7 @@
#include <QList>
#include <QString>
#if defined(__DragonFly__)
#if defined(Q_OS_DRAGONFLY)
#include <bus/usb/usb.h>
#include <QStringList>
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)

View file

@ -19,23 +19,22 @@
*/
#if defined __linux__
#include "processes_linux_p.cpp"
#elif defined __FreeBSD__ || defined __FreeBSD_kernel__
#include "processes_freebsd_p.cpp"
#elif defined __DragonFly__
#include "processes_dragonfly_p.cpp"
#elif defined __OpenBSD__
#include "processes_openbsd_p.cpp"
#elif defined __NetBSD__
#include "processes_netbsd_p.cpp"
#elif defined __GNU__
#include "processes_gnu_p.cpp"
#else
// Use Qt's OS detection
// Use Katie's OS detection
#include <qglobal.h>
#ifdef Q_OS_SOLARIS
#if defined Q_OS_LINUX
#include "processes_linux_p.cpp"
#elif defined Q_OS_FREEBSD
#include "processes_freebsd_p.cpp"
#elif defined Q_OS_DRAGONFLY
#include "processes_dragonfly_p.cpp"
#elif defined Q_OS_OPENBSD
#include "processes_openbsd_p.cpp"
#elif defined Q_OS_NETBSD
#include "processes_netbsd_p.cpp"
#elif Q_OS_SOLARIS
#include "processes_solaris_p.cpp"
#endif
#elif defined Q_CC_GNU
#include "processes_gnu_p.cpp"
#endif

View file

@ -29,7 +29,7 @@
#include <sys/types.h>
#include <sys/user.h>
#include <sys/resource.h>
#if defined(__DragonFly__)
#if defined(Q_OS_DRAGONFLY)
#include <sys/resourcevar.h>
#include <err.h>
#endif
@ -78,11 +78,11 @@ void ProcessesLocal::Private::readProcStatus(struct kinfo_proc *p, Process *proc
process->setTracerpid(-1);
#if defined(__FreeBSD__) && __FreeBSD_version >= 500015
#if defined(Q_OS_FREEBSD) && __FreeBSD_version >= 500015
process->setUid(p->ki_uid);
process->setGid(p->ki_pgid);
process->setName(QString(p->ki_comm ? p->ki_comm : "????"));
#elif defined(__DragonFly__) && __DragonFly_version >= 190000
#elif defined(Q_OS_DRAGONFLY) && __DragonFly_version >= 190000
process->setUid(p->kp_uid);
process->setGid(p->kp_pgid);
process->setName(QString(p->kp_comm ? p->kp_comm : "????"));
@ -96,13 +96,13 @@ void ProcessesLocal::Private::readProcStat(struct kinfo_proc *p, Process *ps)
{
int status;
struct rusage pru;
#if defined(__FreeBSD__) && __FreeBSD_version >= 500015
#if defined(Q_OS_FREEBSD) && __FreeBSD_version >= 500015
ps->setUserTime(p->ki_runtime / 10000);
ps->setNiceLevel(p->ki_nice);
ps->setVmSize(p->ki_size);
ps->setVmRSS(p->ki_rssize * getpagesize());
status = p->ki_stat;
#elif defined(__DragonFly__) && __DragonFly_version >= 190000
#elif defined(Q_OS_DRAGONFLY) && __DragonFly_version >= 190000
if (!getrusage(p->kp_pid, &pru)) {
errx(1, "failed to get rusage info");
}
@ -185,9 +185,9 @@ long ProcessesLocal::getParentPid(long pid) {
struct kinfo_proc p;
if(d->readProc(pid, &p))
{
#if defined(__FreeBSD__) && __FreeBSD_version >= 500015
#if defined(Q_OS_FREEBSD) && __FreeBSD_version >= 500015
ppid = p.ki_ppid;
#elif defined(__DragonFly__) && __DragonFly_version >= 190000
#elif defined(Q_OS_DRAGONFLY) && __DragonFly_version >= 190000
ppid = p.kp_ppid;
#else
ppid = p.kp_eproc.e_ppid;
@ -224,9 +224,9 @@ QSet<long> ProcessesLocal::getAllPids( )
sysctl(mib, 3, p, &len, NULL, 0);
for (num = 0; num < len / sizeof(struct kinfo_proc); num++)
#if defined(__FreeBSD__) && __FreeBSD_version >= 500015
#if defined(Q_OS_FREEBSD) && __FreeBSD_version >= 500015
pids.insert(p[num].ki_pid);
#elif defined(__DragonFly__) && __DragonFly_version >= 190000
#elif defined(Q_OS_DRAGONFLY) && __DragonFly_version >= 190000
pids.insert(p[num].kp_pid);
#else
pids.insert(p[num].kp_proc.p_pid);

View file

@ -24,7 +24,7 @@
#include <unistd.h>
#ifndef _SC_PHYS_PAGES
#ifdef Q_OS_FREEBSD
#if defined(Q_OS_FREEBSD) || defined(Q_OS_DRAGONFLY)
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
@ -163,7 +163,7 @@ PlasmaApp::PlasmaApp()
int memorySize = sysconf(_SC_PHYS_PAGES);
memorySize *= sysconf(_SC_PAGESIZE) / 1024;
#else
#ifdef Q_OS_FREEBSD
#ifdef Q_OS_FREEBSD || defined(Q_OS_DRAGONFLY)
int sysctlbuf[2];
size_t size = sizeof(sysctlbuf);
int memorySize;

View file

@ -27,7 +27,7 @@
#include <sys/utsname.h>
#ifdef Q_OS_FREEBSD
#if defined(Q_OS_FREEBSD) || defined(Q_OS_DRAGONFLY)
#define USE_SYSCTL
#endif