aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches/110-upstream-fix-page-size-on-BSD.patch
blob: e73fcb29ebbb03145dfac2ac08ac11286c68c934 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Fix page size on BSD systems.
Index: htop/Process.c
===================================================================
--- htop.orig/Process.c	2009-03-29 20:03:00.601034016 +0300
+++ htop/Process.c	2009-03-29 20:03:56.029033456 +0300
@@ -33,8 +33,9 @@
 // This works only with glibc 2.1+. On earlier versions
 // the behavior is similar to have a hardcoded page size.
 #ifndef PAGE_SIZE
-#define PAGE_SIZE ( sysconf(_SC_PAGESIZE) / 1024 )
+#define PAGE_SIZE ( sysconf(_SC_PAGESIZE) )
 #endif
+#define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K )
 
 #define PROCESS_COMM_LEN 300
 
@@ -351,13 +352,13 @@
            : attr;
       break;
    }
-   case M_DRS: Process_printLargeNumber(this, str, this->m_drs * PAGE_SIZE); return;
-   case M_DT: Process_printLargeNumber(this, str, this->m_dt * PAGE_SIZE); return;
-   case M_LRS: Process_printLargeNumber(this, str, this->m_lrs * PAGE_SIZE); return;
-   case M_TRS: Process_printLargeNumber(this, str, this->m_trs * PAGE_SIZE); return;
-   case M_SIZE: Process_printLargeNumber(this, str, this->m_size * PAGE_SIZE); return;
-   case M_RESIDENT: Process_printLargeNumber(this, str, this->m_resident * PAGE_SIZE); return;
-   case M_SHARE: Process_printLargeNumber(this, str, this->m_share * PAGE_SIZE); return;
+   case M_DRS: Process_printLargeNumber(this, str, this->m_drs * PAGE_SIZE_KB); return;
+   case M_DT: Process_printLargeNumber(this, str, this->m_dt * PAGE_SIZE_KB); return;
+   case M_LRS: Process_printLargeNumber(this, str, this->m_lrs * PAGE_SIZE_KB); return;
+   case M_TRS: Process_printLargeNumber(this, str, this->m_trs * PAGE_SIZE_KB); return;
+   case M_SIZE: Process_printLargeNumber(this, str, this->m_size * PAGE_SIZE_KB); return;
+   case M_RESIDENT: Process_printLargeNumber(this, str, this->m_resident * PAGE_SIZE_KB); return;
+   case M_SHARE: Process_printLargeNumber(this, str, this->m_share * PAGE_SIZE_KB); return;
    case ST_UID: snprintf(buffer, n, "%4d ", this->st_uid); break;
    case USER: {
       if (Process_getuid != this->st_uid)

© 2014-2024 Faster IT GmbH | imprint | privacy policy