git-svn-id: svn+ssh://jackaudio.org/trunk/jack@3794 0c269be4-1314-0410-8aa9-9f06e86f4224tags/0.118.0
@@ -66,10 +66,10 @@ int sanitycheck (int care_about_realtime, | |||||
fprintf(stderr, "--------------------------------------------------------------------------------\n\n"); | fprintf(stderr, "--------------------------------------------------------------------------------\n\n"); | ||||
} | } | ||||
if (system_memlock_is_unlimited()) { | if (system_memlock_is_unlimited()) { | ||||
fprintf(stderr, "\nMemory locking is unlimited - this is dangerous. Please alter the line"); | |||||
fprintf(stderr, " @audio - memlock unlimited"); | |||||
fprintf(stderr, "in your /etc/limits.conf to"); | |||||
fprintf(stderr, " @audio - memlock %llu\n", (system_available_physical_mem()*3)/4096); | |||||
fprintf(stderr, "\nMemory locking is unlimited - this is dangerous. You should probably alter the line:\n"); | |||||
fprintf(stderr, " @audio - memlock unlimited"); | |||||
fprintf(stderr, "\nin your /etc/limits.conf to read:\n"); | |||||
fprintf(stderr, " @audio - memlock %llu\n", (system_available_physical_mem()*3)/4096); | |||||
} else if (0==system_memlock_amount()) { | } else if (0==system_memlock_amount()) { | ||||
errors++; | errors++; | ||||
relogin++; | relogin++; | ||||
@@ -67,11 +67,11 @@ static int read_string(char* filename, char* buf, size_t buflen) { | |||||
int fd; | int fd; | ||||
ssize_t r=-1; | ssize_t r=-1; | ||||
memset(buf, 0, buflen); | |||||
memset (buf, 0, buflen); | |||||
fd = open(filename, O_RDONLY); | |||||
fd = open (filename, O_RDONLY); | |||||
if (-1<fd) { | if (-1<fd) { | ||||
r = read(fd, buf, buflen); | |||||
r = read (fd, buf, buflen-1); | |||||
(void) close(fd); | (void) close(fd); | ||||
if (-1==r) { | if (-1==r) { | ||||
@@ -272,26 +272,17 @@ int system_memlock_is_unlimited() { | |||||
long long unsigned int system_available_physical_mem() { | long long unsigned int system_available_physical_mem() { | ||||
int fd, i; | |||||
char buf[256]; | char buf[256]; | ||||
long long unsigned int res = 0; | long long unsigned int res = 0; | ||||
fd = open("/proc/meminfo", O_RDONLY); | |||||
if (0<fd) { | |||||
if (0<read(fd, buf, 256)) { | |||||
if (strcmp("MemTotal:", buf)) { | |||||
i=10; | |||||
while (buf[i]==' ') i++; | |||||
(void) sscanf(&buf[i], "%llu", &res); | |||||
} | |||||
} else { | |||||
perror("read from /proc/meminfo"); | |||||
if (0<read_string("/proc/meminfo", buf, sizeof (buf))) { | |||||
if (strncmp (buf, "MemTotal:", 9) == 0) { | |||||
if (sscanf (buf, "%*s %llu", &res) != 1) { | |||||
perror ("parse error in /proc/meminfo"); | |||||
} | |||||
} | } | ||||
(void) close(fd); | |||||
} else { | } else { | ||||
perror("open /proc/meminfo"); | |||||
perror("read from /proc/meminfo"); | |||||
} | } | ||||
return res*1024; | return res*1024; | ||||
@@ -661,15 +661,17 @@ main (int argc, char *argv[]) | |||||
} | } | ||||
} | } | ||||
if (do_sanity_checks && (0 < sanitycheck (realtime, (clock_source == JACK_TIMER_CYCLE_COUNTER)))) { | |||||
return -1; | |||||
} | |||||
if (show_version) { | if (show_version) { | ||||
printf ( "jackd version " VERSION | printf ( "jackd version " VERSION | ||||
" tmpdir " DEFAULT_TMP_DIR | " tmpdir " DEFAULT_TMP_DIR | ||||
" protocol " PROTOCOL_VERSION | " protocol " PROTOCOL_VERSION | ||||
"\n"); | "\n"); | ||||
return 0; | |||||
} | |||||
copyright (stdout); | |||||
if (do_sanity_checks && (0 < sanitycheck (realtime, (clock_source == JACK_TIMER_CYCLE_COUNTER)))) { | |||||
return -1; | return -1; | ||||
} | } | ||||
@@ -723,8 +725,6 @@ main (int argc, char *argv[]) | |||||
if (server_name == NULL) | if (server_name == NULL) | ||||
server_name = jack_default_server_name (); | server_name = jack_default_server_name (); | ||||
copyright (stdout); | |||||
rc = jack_register_server (server_name, replace_registry); | rc = jack_register_server (server_name, replace_registry); | ||||
switch (rc) { | switch (rc) { | ||||
case EEXIST: | case EEXIST: | ||||