diff options
author | Justus Winter <justus@gnupg.org> | 2017-06-19 21:20:57 +0200 |
---|---|---|
committer | Justus Winter <justus@gnupg.org> | 2017-08-05 18:42:22 +0200 |
commit | 835b293d35a209d38047126443d41fa7090daa4c (patch) | |
tree | 5bf956895e6030f91cd618fb191b2151f6d25423 /procfs | |
parent | dc0b5a43224999223a246870912b0f292b1980e9 (diff) | |
download | hurd-835b293d35a209d38047126443d41fa7090daa4c.tar.gz hurd-835b293d35a209d38047126443d41fa7090daa4c.tar.bz2 hurd-835b293d35a209d38047126443d41fa7090daa4c.zip |
Use our own variant of 'assert' and 'assert_perror'.
Our variants print stack traces on failures. This will make locating
errors much easier.
Diffstat (limited to 'procfs')
-rw-r--r-- | procfs/main.c | 2 | ||||
-rw-r--r-- | procfs/netfs.c | 4 | ||||
-rw-r--r-- | procfs/procfs.c | 2 | ||||
-rw-r--r-- | procfs/proclist.c | 4 | ||||
-rw-r--r-- | procfs/rootdir.c | 4 |
5 files changed, 8 insertions, 8 deletions
diff --git a/procfs/main.c b/procfs/main.c index 87c726ff..0c87175a 100644 --- a/procfs/main.c +++ b/procfs/main.c @@ -314,6 +314,6 @@ int main (int argc, char **argv) netfs_startup (bootstrap, 0); netfs_server_loop (); - assert (0 /* netfs_server_loop returned after all */); + assert_backtrace (0 /* netfs_server_loop returned after all */); } diff --git a/procfs/netfs.c b/procfs/netfs.c index 0b3d31aa..9410bddd 100644 --- a/procfs/netfs.c +++ b/procfs/netfs.c @@ -110,7 +110,7 @@ error_t netfs_attempt_readlink (struct iouser *user, struct node *np, if (err) return err; - assert (contents_len == np->nn_stat.st_size); + assert_backtrace (contents_len == np->nn_stat.st_size); memcpy (buf, contents, contents_len); return 0; } @@ -172,7 +172,7 @@ error_t netfs_get_dirents (struct iouser *cred, struct node *dir, return err; /* We depend on the fact that CONTENTS is terminated. */ - assert (contents_len == 0 || contents[contents_len - 1] == '\0'); + assert_backtrace (contents_len == 0 || contents[contents_len - 1] == '\0'); /* Skip to the first requested entry. */ while (contents_len && entry--) diff --git a/procfs/procfs.c b/procfs/procfs.c index cae4a519..6d6d9649 100644 --- a/procfs/procfs.c +++ b/procfs/procfs.c @@ -120,7 +120,7 @@ procfs_make_ino (struct node *np, const char *filename) if (! strcmp (filename, "..")) return np->nn->parent ? np->nn->parent->nn_stat.st_ino : /* FIXME: */ 2; - assert (sizeof np->nn_stat.st_ino > sizeof x); + assert_backtrace (sizeof np->nn_stat.st_ino > sizeof x); memcpy (x, &np->nn_stat.st_ino, sizeof x); while (*filename) diff --git a/procfs/proclist.c b/procfs/proclist.c index 58b942dc..1ecf75b2 100644 --- a/procfs/proclist.c +++ b/procfs/proclist.c @@ -49,7 +49,7 @@ proclist_get_contents (void *hook, char **contents, ssize_t *contents_len) for (i=0; i < num_pids; i++) { int n = sprintf (*contents + *contents_len, "%d", pids[i]); - assert (n >= 0); + assert_backtrace (n >= 0); *contents_len += (n + 1); } } @@ -68,7 +68,7 @@ proclist_lookup (void *hook, const char *name, struct node **np) pid_t pid; /* Self-lookups should not end up here. */ - assert (name[0]); + assert_backtrace (name[0]); /* No leading zeros allowed */ if (name[0] == '0' && name[1]) diff --git a/procfs/rootdir.c b/procfs/rootdir.c index b654fa24..9f860a91 100644 --- a/procfs/rootdir.c +++ b/procfs/rootdir.c @@ -254,7 +254,7 @@ rootdir_gc_loadavg (void *hook, char **contents, ssize_t *contents_len) if (err) return err; - assert (cnt == HOST_LOAD_INFO_COUNT); + assert_backtrace (cnt == HOST_LOAD_INFO_COUNT); *contents_len = asprintf (contents, "%.2f %.2f %.2f 1/0 0\n", hli.avenrun[0] / (double) LOAD_SCALE, @@ -301,7 +301,7 @@ rootdir_gc_meminfo (void *hook, char **contents, ssize_t *contents_len) if (err) goto out; - assert (cnt == HOST_BASIC_INFO_COUNT); + assert_backtrace (cnt == HOST_BASIC_INFO_COUNT); fprintf (m, "MemTotal: %14lu kB\n" "MemFree: %14lu kB\n" |