Browse Source

move copyright message to be the first thing printed (except in the -V case); fix dangerous code in physmem determining code; change output if memory locking is unlimited; return 0 if -V is used

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@3794 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.118.0
paul 15 years ago
parent
commit
b8b74358d1
3 changed files with 19 additions and 28 deletions
  1. +4
    -4
      config/os/gnu-linux/sanitycheck.c
  2. +9
    -18
      config/os/gnu-linux/systemtest.c
  3. +6
    -6
      jackd/jackd.c

+ 4
- 4
config/os/gnu-linux/sanitycheck.c View File

@@ -66,10 +66,10 @@ int sanitycheck (int care_about_realtime,
fprintf(stderr, "--------------------------------------------------------------------------------\n\n");
}
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()) {
errors++;
relogin++;


+ 9
- 18
config/os/gnu-linux/systemtest.c View File

@@ -67,11 +67,11 @@ static int read_string(char* filename, char* buf, size_t buflen) {
int fd;
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) {
r = read(fd, buf, buflen);
r = read (fd, buf, buflen-1);
(void) close(fd);
if (-1==r) {
@@ -272,26 +272,17 @@ int system_memlock_is_unlimited() {


long long unsigned int system_available_physical_mem() {
int fd, i;
char buf[256];
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 {
perror("open /proc/meminfo");
perror("read from /proc/meminfo");
}

return res*1024;


+ 6
- 6
jackd/jackd.c View File

@@ -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) {
printf ( "jackd version " VERSION
" tmpdir " DEFAULT_TMP_DIR
" protocol " PROTOCOL_VERSION
"\n");
return 0;
}

copyright (stdout);

if (do_sanity_checks && (0 < sanitycheck (realtime, (clock_source == JACK_TIMER_CYCLE_COUNTER)))) {
return -1;
}

@@ -723,8 +725,6 @@ main (int argc, char *argv[])
if (server_name == NULL)
server_name = jack_default_server_name ();

copyright (stdout);

rc = jack_register_server (server_name, replace_registry);
switch (rc) {
case EEXIST:


Loading…
Cancel
Save