summaryrefslogtreecommitdiff
path: root/audio/ardour/files/patch-gtk2_ardour-ardour_ui.cc
blob: b43a8672ea34a13b3491e9e8ba237a09e79d7c12 (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
--- gtk2_ardour/ardour_ui.cc.orig
+++ gtk2_ardour/ardour_ui.cc
@@ -31,6 +31,8 @@
 #include <iostream>
 
 #include <sys/resource.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
 
 #include <gtkmm/messagedialog.h>
 #include <gtkmm/accelmap.h>
@@ -696,8 +698,11 @@ ARDOUR_UI::check_memory_locking ()
 		struct rlimit limits;
 		int64_t ram;
 		long pages, page_size;
+		size_t pages_len=sizeof(pages);
+
+		if ((page_size = getpagesize()) < 0 ||
+			sysctlbyname("hw.availpages", &pages, &pages_len, NULL, 0)) {
 
-		if ((page_size = sysconf (_SC_PAGESIZE)) < 0 ||(pages = sysconf (_SC_PHYS_PAGES)) < 0) {
 			ram = 0;
 		} else {
 			ram = (int64_t) pages * (int64_t) page_size;
@@ -716,7 +721,7 @@ ARDOUR_UI::check_memory_locking ()
 								     "This might cause %1 to run out of memory before your system "
 								     "runs out of memory. \n\n"
 								     "You can view the memory limit with 'ulimit -l', "
-								     "and it is normally controlled by /etc/security/limits.conf"), PROGRAM_NAME));
+								     "and it is normally controlled by /etc/login.conf"), PROGRAM_NAME));
 						   
 				VBox* vbox = msg.get_vbox();
 				HBox hbox;