summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--auth/auth.c6
-rw-r--r--boot/boot.c10
-rw-r--r--console-client/console.c2
-rw-r--r--console-client/ncursesw.c16
-rw-r--r--console-client/pc-kbd.c8
-rw-r--r--console-client/vga-dynacolor.c10
-rw-r--r--console-client/vga-dynafont.c6
-rw-r--r--console-client/vga-support.c4
-rw-r--r--console-client/vga.c2
-rw-r--r--console-client/xkb/compose.c6
-rw-r--r--console-client/xkb/kstoucs.c4
-rw-r--r--console-client/xkb/xkbtimer.c4
-rw-r--r--console/console.c10
-rw-r--r--console/display.c14
-rw-r--r--console/pager.c10
-rw-r--r--daemons/Makefile2
-rw-r--r--daemons/runttys.c8
-rw-r--r--defpager/backing.c4
-rw-r--r--eth-multiplexer/ethernet.c6
-rw-r--r--exec/elfcore.c14
-rw-r--r--exec/exec.c2
-rw-r--r--exec/hostarch.c2
-rw-r--r--exec/main.c14
-rw-r--r--exec/priv.h2
-rw-r--r--ext2fs/balloc.c10
-rw-r--r--ext2fs/dir.c58
-rw-r--r--ext2fs/ext2fs.h12
-rw-r--r--ext2fs/getblk.c2
-rw-r--r--ext2fs/hyper.c4
-rw-r--r--ext2fs/ialloc.c8
-rw-r--r--ext2fs/inode.c18
-rw-r--r--ext2fs/pager.c46
-rw-r--r--ext2fs/pokel.c6
-rw-r--r--ext2fs/truncate.c2
-rw-r--r--ext2fs/xattr.c4
-rw-r--r--fatfs/dir.c36
-rw-r--r--fatfs/fat.c28
-rw-r--r--fatfs/inode.c20
-rw-r--r--fatfs/main.c6
-rw-r--r--fatfs/pager.c8
-rw-r--r--fatfs/virt-inode.c8
-rw-r--r--ftpfs/conn.c4
-rw-r--r--ftpfs/dir.c2
-rw-r--r--ftpfs/node.c2
-rw-r--r--hostmux/leaf.c2
-rw-r--r--isofs/inode.c2
-rw-r--r--isofs/lookup.c4
-rw-r--r--isofs/main.c4
-rw-r--r--isofs/pager.c8
-rw-r--r--isofs/rr.c10
-rw-r--r--libcons/cons-switch.c4
-rw-r--r--libcons/dir-changed.c8
-rw-r--r--libcons/file-changed.c4
-rw-r--r--libcons/vcons-close.c4
-rw-r--r--libcons/vcons-refresh.c2
-rw-r--r--libcons/vcons-remove.c4
-rw-r--r--libdiskfs/boot-start.c102
-rw-r--r--libdiskfs/console.c6
-rw-r--r--libdiskfs/dir-clear.c8
-rw-r--r--libdiskfs/dir-init.c4
-rw-r--r--libdiskfs/dir-link.c2
-rw-r--r--libdiskfs/dir-lookup.c4
-rw-r--r--libdiskfs/dir-renamed.c12
-rw-r--r--libdiskfs/disk-pager.c10
-rw-r--r--libdiskfs/diskfs-pager.h2
-rw-r--r--libdiskfs/diskfs.h2
-rw-r--r--libdiskfs/file-get-trans.c8
-rw-r--r--libdiskfs/file-getfh.c2
-rw-r--r--libdiskfs/file-set-trans.c6
-rw-r--r--libdiskfs/init-main.c4
-rw-r--r--libdiskfs/init-startup.c6
-rw-r--r--libdiskfs/io-map-cntl.c2
-rw-r--r--libdiskfs/io-reauthenticate.c2
-rw-r--r--libdiskfs/io-write.c2
-rw-r--r--libdiskfs/lookup.c2
-rw-r--r--libdiskfs/name-cache.c4
-rw-r--r--libdiskfs/node-cache.c10
-rw-r--r--libdiskfs/node-drop.c6
-rw-r--r--libdiskfs/priv.h2
-rw-r--r--libdiskfs/protid-make.c6
-rw-r--r--libdiskfs/rdwr-internal.c2
-rw-r--r--libdiskfs/trans-callback.c2
-rw-r--r--libfshelp/fetch-control.c4
-rw-r--r--libfshelp/fetch-root.c4
-rw-r--r--libfshelp/get-identity.c4
-rw-r--r--libfshelp/lock-acquire.c12
-rw-r--r--libfshelp/start-translator-long.c4
-rw-r--r--libhurd-slab/slab.c10
-rw-r--r--libnetfs/dir-lookup.c4
-rw-r--r--libnetfs/file-set-translator.c6
-rw-r--r--libnetfs/io-reauthenticate.c2
-rw-r--r--libnetfs/netfs.h2
-rw-r--r--libnetfs/trans-callback.c2
-rw-r--r--libpager/data-return.c6
-rw-r--r--libpager/demuxer.c12
-rw-r--r--libpager/pager-attr.c2
-rw-r--r--libpager/pager-memcpy.c26
-rw-r--r--libpipe/pipe.c4
-rw-r--r--libports/claim-right.c4
-rw-r--r--libports/complete-deallocate.c6
-rw-r--r--libports/create-internal.c6
-rw-r--r--libports/destroy-right.c4
-rw-r--r--libports/get-right.c4
-rw-r--r--libports/get-send-right.c4
-rw-r--r--libports/import-port.c4
-rw-r--r--libports/interrupt-on-notify.c4
-rw-r--r--libports/manage-multithread.c2
-rw-r--r--libports/port-deref-deferred.c12
-rw-r--r--libports/port-deref-weak.c2
-rw-r--r--libports/port-deref.c2
-rw-r--r--libports/port-ref-weak.c2
-rw-r--r--libports/port-ref.c2
-rw-r--r--libports/reallocate-from-external.c14
-rw-r--r--libports/reallocate-port.c14
-rw-r--r--libports/resume-all-rpcs.c4
-rw-r--r--libports/resume-bucket-rpcs.c4
-rw-r--r--libports/resume-class-rpcs.c4
-rw-r--r--libports/resume-port-rpcs.c4
-rw-r--r--libports/transfer-right.c10
-rw-r--r--libps/context.c2
-rw-r--r--libps/filters.c2
-rw-r--r--libps/fmt.c2
-rw-r--r--libps/host.c2
-rw-r--r--libps/proclist.c2
-rw-r--r--libps/procstat.c2
-rw-r--r--libps/spec.c3
-rw-r--r--libps/tty.c2
-rw-r--r--libps/user.c2
-rw-r--r--libshouldbeinlibc/idvec-verify.c4
-rw-r--r--libstore/argp.c4
-rw-r--r--libstore/derive.c6
-rw-r--r--libstore/device.c6
-rw-r--r--libstore/memobj.c4
-rw-r--r--libstore/part.c8
-rw-r--r--libthreads/cancel-cond.c4
-rw-r--r--libthreads/cprocs.c4
-rw-r--r--libthreads/rwlock.h6
-rw-r--r--libtreefs/dir-lookup.c2
-rw-r--r--libtreefs/fsys-startup.c2
-rw-r--r--libtreefs/treefs.h10
-rw-r--r--libtrivfs/dir-lookup.c2
-rw-r--r--libtrivfs/file-set-size.c4
-rw-r--r--libtrivfs/fsys-getroot.c2
-rw-r--r--libtrivfs/io-async-icky.c2
-rw-r--r--libtrivfs/io-async.c2
-rw-r--r--libtrivfs/io-map.c2
-rw-r--r--libtrivfs/io-modes-get.c2
-rw-r--r--libtrivfs/io-modes-off.c4
-rw-r--r--libtrivfs/io-modes-on.c4
-rw-r--r--libtrivfs/io-modes-set.c4
-rw-r--r--libtrivfs/io-owner-get.c2
-rw-r--r--libtrivfs/io-owner-mod.c2
-rw-r--r--libtrivfs/io-read.c4
-rw-r--r--libtrivfs/io-readable.c4
-rw-r--r--libtrivfs/io-reauthenticate.c4
-rw-r--r--libtrivfs/io-seek.c4
-rw-r--r--libtrivfs/io-select.c6
-rw-r--r--libtrivfs/io-write.c4
-rw-r--r--libtrivfs/startup.c2
-rw-r--r--login/utmp.c2
-rw-r--r--mach-defpager/Makefile2
-rw-r--r--mach-defpager/default_pager.c42
-rw-r--r--mach-defpager/setup.c16
-rw-r--r--nfs/cache.c4
-rw-r--r--nfs/ops.c10
-rw-r--r--nfs/rpc.c12
-rw-r--r--nfs/storage-info.c6
-rw-r--r--nfsd/cache.c8
-rw-r--r--pfinet/dummy.c2
-rw-r--r--pfinet/ethernet.c18
-rw-r--r--pfinet/glue-include/linux/interrupt.h6
-rw-r--r--pfinet/glue-include/linux/kernel.h8
-rw-r--r--pfinet/glue-include/linux/sched.h14
-rw-r--r--pfinet/glue-include/linux/socket.h6
-rw-r--r--pfinet/glue-include/linux/types.h2
-rw-r--r--pfinet/io-ops.c4
-rw-r--r--pfinet/main.c4
-rw-r--r--pfinet/socket.c6
-rw-r--r--pfinet/tunnel.c12
-rw-r--r--pflocal/connq.c20
-rw-r--r--pflocal/io.c2
-rw-r--r--pflocal/sock.c8
-rw-r--r--pflocal/sock.h6
-rw-r--r--proc/host.c16
-rw-r--r--proc/info.c8
-rw-r--r--proc/main.c10
-rw-r--r--proc/mgt.c20
-rw-r--r--proc/msg.c2
-rw-r--r--proc/pgrp.c4
-rw-r--r--proc/stubs.c6
-rw-r--r--proc/wait.c3
-rw-r--r--procfs/main.c2
-rw-r--r--procfs/netfs.c4
-rw-r--r--procfs/procfs.c2
-rw-r--r--procfs/proclist.c4
-rw-r--r--procfs/rootdir.c4
-rw-r--r--startup/startup.c62
-rw-r--r--storeio/dev.c8
-rw-r--r--storeio/pager.c4
-rw-r--r--storeio/storeio.c2
-rw-r--r--sutils/bless.c4
-rw-r--r--sutils/fsck.c6
-rw-r--r--sutils/swapon.c2
-rw-r--r--term/devio.c20
-rw-r--r--term/hurdio.c2
-rw-r--r--term/main.c2
-rw-r--r--term/munge.c6
-rw-r--r--term/term.h6
-rw-r--r--term/users.c6
-rw-r--r--tmpfs/dir.c18
-rw-r--r--tmpfs/node.c28
-rw-r--r--tmpfs/tmpfs.c2
-rw-r--r--trans/crash.c6
-rw-r--r--trans/fakeroot.c16
-rw-r--r--trans/magic.c8
-rw-r--r--trans/new-fifo.c8
-rw-r--r--trans/password.c6
-rw-r--r--trans/random.c4
-rw-r--r--trans/streamio.c14
-rw-r--r--usermux/leaf.c2
-rw-r--r--utils/Makefile2
-rw-r--r--utils/fakeauth.c6
-rw-r--r--utils/login.c6
-rw-r--r--utils/ps.c2
-rw-r--r--utils/rpctrace.c76
-rw-r--r--utils/settrans.c4
-rw-r--r--utils/shd.c8
-rw-r--r--utils/vmallocate.c4
229 files changed, 872 insertions, 865 deletions
diff --git a/NEWS b/NEWS
index 9482185b..009e4e42 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@ The random translator has been reimplemented using the SHAKE128
algorithm from the SHA-3 family as the underlying cryptographic
primitive.
+The Hurd now uses its own variant of 'assert' that prints a stack
+trace on failures.
+
Version 0.9 (2016-12-18)
The 'boot' program can now be run as unprivileged user, allowing any
diff --git a/auth/auth.c b/auth/auth.c
index d5ef5876..bc5e87aa 100644
--- a/auth/auth.c
+++ b/auth/auth.c
@@ -29,7 +29,7 @@
#include <hurd/ports.h>
#include <hurd/ihash.h>
#include <idvec.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <argp.h>
#include <error.h>
#include <version.h>
@@ -496,7 +496,7 @@ main (int argc, char **argv)
/* Create the initial root auth handle. */
err = create_authhandle (&firstauth);
- assert_perror (err);
+ assert_perror_backtrace (err);
idvec_add (&firstauth->euids, 0);
idvec_add (&firstauth->auids, 0);
idvec_add (&firstauth->auids, 0);
@@ -505,7 +505,7 @@ main (int argc, char **argv)
/* Fetch our bootstrap port and contact the bootstrap filesystem. */
err = task_get_bootstrap_port (mach_task_self (), &boot);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (boot == MACH_PORT_NULL)
error (2, 0, "auth server can only be run by init during boot");
err = startup_authinit (boot, ports_get_right (firstauth),
diff --git a/boot/boot.c b/boot/boot.c
index 978f56e6..6fbc0ae4 100644
--- a/boot/boot.c
+++ b/boot/boot.c
@@ -66,7 +66,7 @@
#include <termios.h>
#include <error.h>
#include <hurd.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include "private.h"
@@ -428,7 +428,7 @@ allocate_pseudo_ports (void)
MACH_NOTIFY_NO_SENDERS, 1,
pseudo_privileged_host_port,
MACH_MSG_TYPE_MAKE_SEND_ONCE, &old);
- assert (old == MACH_PORT_NULL);
+ assert_backtrace (old == MACH_PORT_NULL);
/* Allocate a port that we hand out as the privileged processor set
port. */
@@ -684,7 +684,7 @@ main (int argc, char **argv, char **envp)
char *msg;
asprintf (&msg, "cannot set boot-script variable %s: %s\n",
word, boot_script_error_string (err));
- assert (msg);
+ assert_backtrace (msg);
write (2, msg, strlen (msg));
free (msg);
host_exit (1);
@@ -1652,7 +1652,7 @@ S_io_reauthenticate (mach_port_t object,
err = mach_port_insert_right (mach_task_self (), object, object,
MACH_MSG_TYPE_MAKE_SEND);
- assert_perror (err);
+ assert_perror_backtrace (err);
do
err = auth_server_authenticate (authserver,
@@ -2043,7 +2043,7 @@ S_mach_notify_new_task (mach_port_t notify,
&previous);
if (err)
goto fail;
- assert (! MACH_PORT_VALID (previous));
+ assert_backtrace (! MACH_PORT_VALID (previous));
mach_port_mod_refs (mach_task_self (), task, MACH_PORT_RIGHT_SEND, +1);
err = hurd_ihash_add (&task_ihash,
diff --git a/console-client/console.c b/console-client/console.c
index 2fa05339..5335156b 100644
--- a/console-client/console.c
+++ b/console-client/console.c
@@ -23,7 +23,7 @@
#include <string.h>
#include <wchar.h>
#include <error.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pthread.h>
#if HAVE_DAEMON
diff --git a/console-client/ncursesw.c b/console-client/ncursesw.c
index 881acad7..8e8962fd 100644
--- a/console-client/ncursesw.c
+++ b/console-client/ncursesw.c
@@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
@@ -324,7 +324,7 @@ input_loop (void *unused)
console_exit ();
break;
case 23: /* ^W */
- assert (size < 100);
+ assert_backtrace (size < 100);
buf[size++] = ret;
break;
case '1':
@@ -397,7 +397,7 @@ input_loop (void *unused)
{
if (keycodes[i].cons)
{
- assert (size
+ assert_backtrace (size
< 101 - strlen (keycodes[i].cons));
strcpy (&buf[size], keycodes[i].cons);
size += strlen (keycodes[i].cons);
@@ -408,7 +408,7 @@ input_loop (void *unused)
}
if (!found)
{
- assert (size < 100);
+ assert_backtrace (size < 100);
buf[size++] = ret;
}
break;
@@ -472,7 +472,7 @@ mvwputsn (conchar_t *str, size_t len, off_t x, off_t y)
{
printf ("setcchar failed: %s\n", strerror (errno));
printf ("[%lc]\n", wch[0]);
- assert (!"Do something if setcchar fails.");
+ assert_backtrace (!"Do something if setcchar fails.");
}
#endif
ret = wadd_wch (conspad, &chr);
@@ -481,7 +481,7 @@ mvwputsn (conchar_t *str, size_t len, off_t x, off_t y)
{
printf ("add_wch failed: %i, %s\n", ret, strerror (errno));
printf ("[%lc]\n", wch[0]);
- assert (!"Do something if add_wchr fails.");
+ assert_backtrace (!"Do something if add_wchr fails.");
}
#endif
}
@@ -505,7 +505,7 @@ static error_t
ncursesw_set_cursor_pos (void *handle, uint32_t col, uint32_t row)
{
pthread_mutex_lock (&ncurses_lock);
- assert (current_width && current_height);
+ assert_backtrace (current_width && current_height);
if (autoscroll)
{
/* Autoscroll to the right. */
@@ -569,7 +569,7 @@ static error_t
ncursesw_scroll (void *handle, int delta)
{
/* XXX We don't support scrollback for now. */
- assert (delta >= 0);
+ assert_backtrace (delta >= 0);
pthread_mutex_lock (&ncurses_lock);
idlok (conspad, TRUE);
diff --git a/console-client/pc-kbd.c b/console-client/pc-kbd.c
index 2fc7608f..85f3a5cd 100644
--- a/console-client/pc-kbd.c
+++ b/console-client/pc-kbd.c
@@ -19,7 +19,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <errno.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include <iconv.h>
#include <sys/mman.h>
@@ -1084,12 +1084,12 @@ input_loop (void *unused)
if (!sc_to_kc[sc][modifier][0])
{
/* Special meaning, emit NUL. */
- assert (size < 100);
+ assert_backtrace (size < 100);
buf[size++] = '\0';
}
else
{
- assert (size
+ assert_backtrace (size
< 101 - strlen(sc_to_kc[sc][modifier]));
strcpy (&buf[size], sc_to_kc[sc][modifier]);
size += strlen (sc_to_kc[sc][modifier]);
@@ -1162,7 +1162,7 @@ input_loop (void *unused)
{
if (modifier >= 0 && sc_x1_to_kc[sc][modifier])
{
- assert (size < 101 - strlen(sc_x1_to_kc[sc][modifier]));
+ assert_backtrace (size < 101 - strlen(sc_x1_to_kc[sc][modifier]));
strcpy (&buf[size], sc_x1_to_kc[sc][modifier]);
size += strlen (sc_x1_to_kc[sc][modifier]);
}
diff --git a/console-client/vga-dynacolor.c b/console-client/vga-dynacolor.c
index 9289e1eb..ef952478 100644
--- a/console-client/vga-dynacolor.c
+++ b/console-client/vga-dynacolor.c
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/console.h>
@@ -290,18 +290,18 @@ dynacolor_replace_colors (dynacolor_t *dc,
}
}
- assert (res_bgcol >= 0);
+ assert_backtrace (res_bgcol >= 0);
new_bgcol = pref[bgcol][i];
}
if (fgcol == bgcol)
{
- assert (res_fgcol == -1);
+ assert_backtrace (res_fgcol == -1);
/* Acquire another reference. */
res_fgcol = dynacolor_lookup (*dc, new_bgcol);
}
else
- assert (res_fgcol != res_bgcol);
+ assert_backtrace (res_fgcol != res_bgcol);
if (res_fgcol == -1)
{
@@ -315,7 +315,7 @@ dynacolor_replace_colors (dynacolor_t *dc,
break;
}
}
- assert (res_fgcol >= 0);
+ assert_backtrace (res_fgcol >= 0);
}
*r_fgcol = res_fgcol;
*r_bgcol = res_bgcol;
diff --git a/console-client/vga-dynafont.c b/console-client/vga-dynafont.c
index 2cee47ed..c6627721 100644
--- a/console-client/vga-dynafont.c
+++ b/console-client/vga-dynafont.c
@@ -19,7 +19,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <stddef.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <malloc.h>
#include <wchar.h>
#include <stdlib.h>
@@ -848,7 +848,7 @@ dynafont_lookup_internal (dynafont_t df, bdf_font_t font,
}
while (pos != start_pos);
- assert (found);
+ assert_backtrace (found);
df->vga_font_free_indices_lgc--;
df->vga_font_last_free_index_lgc = pos;
}
@@ -872,7 +872,7 @@ dynafont_lookup_internal (dynafont_t df, bdf_font_t font,
}
while (pos != start_pos);
- assert (found);
+ assert_backtrace (found);
df->vga_font_free_indices--;
df->vga_font_last_free_index = pos;
}
diff --git a/console-client/vga-support.c b/console-client/vga-support.c
index 3a2d7586..32ede46d 100644
--- a/console-client/vga-support.c
+++ b/console-client/vga-support.c
@@ -19,7 +19,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <errno.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/io.h>
@@ -225,7 +225,7 @@ vga_read_write_font_buffer (int write, int buffer, int index,
char saved_gfx_misc;
int offset = buffer * VGA_FONT_SIZE + index * VGA_FONT_HEIGHT;
- assert (offset >= 0 && offset + datalen <= VGA_VIDEO_MEM_LENGTH);
+ assert_backtrace (offset >= 0 && offset + datalen <= VGA_VIDEO_MEM_LENGTH);
/* Select plane 2 for sequential writing. You might think it is not
necessary for reading, but it is. Likewise for read settings
diff --git a/console-client/vga.c b/console-client/vga.c
index 2d74aae3..9d751a7f 100644
--- a/console-client/vga.c
+++ b/console-client/vga.c
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <errno.h>
#include <error.h>
#include <fcntl.h>
diff --git a/console-client/xkb/compose.c b/console-client/xkb/compose.c
index fb3f07ca..17f30014 100644
--- a/console-client/xkb/compose.c
+++ b/console-client/xkb/compose.c
@@ -28,7 +28,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <locale.h>
-#include <assert.h>
+#include <assert-backtrace.h>
/* Tokens that can be recognised by the scanner. */
enum tokentype
@@ -427,8 +427,8 @@ map_iterate(const char *map_path, map_callback action, void *context)
size_t buffer_size = 0;
size_t line_length = 0;
- assert (map_path != NULL);
- assert (action != NULL);
+ assert_backtrace (map_path != NULL);
+ assert_backtrace (action != NULL);
map = fopen (map_path, "r");
diff --git a/console-client/xkb/kstoucs.c b/console-client/xkb/kstoucs.c
index eb47bdeb..59af1e9f 100644
--- a/console-client/xkb/kstoucs.c
+++ b/console-client/xkb/kstoucs.c
@@ -1,4 +1,4 @@
-#include <assert.h>
+#include <assert-backtrace.h>
struct ksmap {
int keysym;
@@ -13,7 +13,7 @@ find_ucs (int keysym, struct ksmap *first, struct ksmap *last)
{
struct ksmap *middle = first + (last - first) / 2;
- assert (first <= last);
+ assert_backtrace (first <= last);
if (middle->keysym == keysym)
return middle->ucs; /* base case: needle found. */
diff --git a/console-client/xkb/xkbtimer.c b/console-client/xkb/xkbtimer.c
index 24791e9e..28e1c685 100644
--- a/console-client/xkb/xkbtimer.c
+++ b/console-client/xkb/xkbtimer.c
@@ -19,7 +19,7 @@
#include <mach.h>
#include <errno.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include "xkb.h"
#include <timer.h>
@@ -123,7 +123,7 @@ key_timing (void *handle)
switch (per_key_timers[current_key].enable_status)
{
case timer_stopped:
- assert ("Stopped timer triggered timer event\n");
+ assert_backtrace ("Stopped timer triggered timer event\n");
break;
case timer_slowkeys:
per_key_timers[current_key].enable_timer.expires
diff --git a/console/console.c b/console/console.c
index 9c5869dd..94de0049 100644
--- a/console/console.c
+++ b/console/console.c
@@ -459,7 +459,7 @@ void
netfs_node_norefs (struct node *np)
{
/* The root node does never go away. */
- assert (!np->nn->cons && np->nn->vcons);
+ assert_backtrace (!np->nn->cons && np->nn->vcons);
free (np->nn);
free (np);
@@ -654,7 +654,7 @@ netfs_attempt_lookup (struct iouser *user, struct node *dir,
/* This is a virtual console directory node. */
vcons_t vcons = dir->nn->vcons;
int ref_vcons = 0;
- assert (dir == vcons->dir_node);
+ assert_backtrace (dir == vcons->dir_node);
if (!strcmp (name, "console"))
{
@@ -1057,7 +1057,7 @@ netfs_attempt_set_size (struct iouser *cred, struct node *np, off_t size)
|| np == vcons->disp_node)
return EOPNOTSUPP;
- assert (np == vcons->cons_node || np == vcons->inpt_node);
+ assert_backtrace (np == vcons->cons_node || np == vcons->inpt_node);
return 0;
}
@@ -1140,7 +1140,7 @@ netfs_attempt_read (struct iouser *cred, struct node *np,
{
/* Pass display content to caller. */
ssize_t amt = *len;
- assert (np == vcons->disp_node);
+ assert_backtrace (np == vcons->disp_node);
if (offset + amt > np->nn_stat.st_size)
amt = np->nn_stat.st_size - offset;
@@ -1187,7 +1187,7 @@ netfs_attempt_write (struct iouser *cred, struct node *np,
int amt;
/* The input driver is writing to the input device. Feed the
data into the input queue. */
- assert (np == vcons->inpt_node);
+ assert_backtrace (np == vcons->inpt_node);
amt = input_enqueue (vcons->input,
/* cred->po->openstat & O_NONBLOCK */ 1,
diff --git a/console/display.c b/console/display.c
index ed5571e6..20914955 100644
--- a/console/display.c
+++ b/console/display.c
@@ -26,7 +26,7 @@
#include <iconv.h>
#include <argp.h>
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <error.h>
#include <pthread.h>
@@ -325,7 +325,7 @@ do_mach_notify_port_deleted (struct port_info *pi, mach_port_t name)
{
/* As we cancel the dead-name notification before deallocating the
port, this should not happen. */
- assert (0);
+ assert_backtrace (0);
}
/* We request dead name notifications for the user ports. */
@@ -376,7 +376,7 @@ do_mach_notify_dead_name (struct port_info *pi, mach_port_t dead_name)
error_t
do_mach_notify_port_destroyed (struct port_info *pi, mach_port_t rights)
{
- assert (0);
+ assert_backtrace (0);
}
error_t
@@ -409,7 +409,7 @@ do_mach_notify_msg_accepted (struct port_info *pi, mach_port_t send)
case. */
if (!send)
{
- assert(0);
+ assert_backtrace (0);
return 0;
}
@@ -424,7 +424,7 @@ do_mach_notify_msg_accepted (struct port_info *pi, mach_port_t send)
here. */
if (! *preq)
{
- assert(0);
+ assert_backtrace (0);
pthread_mutex_unlock (&display->lock);
return 0;
}
@@ -526,7 +526,7 @@ display_notice_changes (display_t display, mach_port_t notify)
pthread_mutex_unlock (&display->lock);
return err;
}
- assert (old == MACH_PORT_NULL);
+ assert_backtrace (old == MACH_PORT_NULL);
req->port = notify;
req->pending = 0;
@@ -1820,7 +1820,7 @@ display_output_some (display_t display, char **buffer, size_t *length)
#define UNICODE_REPLACEMENT_CHARACTER ((wchar_t) 0xfffd)
if (saved_err == EILSEQ)
{
- assert (*length);
+ assert_backtrace (*length);
(*length)--;
(*buffer)++;
display_output_one (display, UNICODE_REPLACEMENT_CHARACTER);
diff --git a/console/pager.c b/console/pager.c
index d60935a1..a18d4d13 100644
--- a/console/pager.c
+++ b/console/pager.c
@@ -19,7 +19,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <errno.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <error.h>
#include <stdio.h>
@@ -80,7 +80,7 @@ error_t
pager_write_page (struct user_pager_info *upi, vm_offset_t page,
vm_address_t buf)
{
- assert (upi->memobj_pages[page / vm_page_size] == (vm_address_t) NULL);
+ assert_backtrace (upi->memobj_pages[page / vm_page_size] == (vm_address_t) NULL);
upi->memobj_pages[page / vm_page_size] = buf;
return 0;
}
@@ -90,7 +90,7 @@ error_t
pager_unlock_page (struct user_pager_info *pager,
vm_offset_t address)
{
- assert (!"unlocking requested on unlocked page");
+ assert_backtrace (!"unlocking requested on unlocked page");
return 0;
}
@@ -99,7 +99,7 @@ void
pager_notify_evict (struct user_pager_info *pager,
vm_offset_t page)
{
- assert (!"unrequested notification on eviction");
+ assert_backtrace (!"unrequested notification on eviction");
}
@@ -207,7 +207,7 @@ user_pager_get_filemap (struct user_pager *user_pager, vm_prot_t prot)
/* Add a reference for each call, the caller will deallocate it. */
err = mach_port_mod_refs (mach_task_self (), user_pager->memobj,
MACH_PORT_RIGHT_SEND, +1);
- assert_perror (err);
+ assert_perror_backtrace (err);
return user_pager->memobj;
}
diff --git a/daemons/Makefile b/daemons/Makefile
index 289fbf63..6d030717 100644
--- a/daemons/Makefile
+++ b/daemons/Makefile
@@ -41,7 +41,7 @@ mail.local: lmail.o ../libshouldbeinlibc/libshouldbeinlibc.a
console-run: console-run.o ../libfshelp/libfshelp.a ../libports/libports.a \
../libihash/libihash.a ../libshouldbeinlibc/libshouldbeinlibc.a
-runttys: runttys.o
+runttys: runttys.o ../libshouldbeinlibc/libshouldbeinlibc.a
runttys-LDLIBS = -lutil
runsystem: runsystem.sh
diff --git a/daemons/runttys.c b/daemons/runttys.c
index 7efb7b7a..baefdbef 100644
--- a/daemons/runttys.c
+++ b/daemons/runttys.c
@@ -17,7 +17,7 @@
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <argz.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <errno.h>
#include <error.h>
#include <fcntl.h>
@@ -239,8 +239,8 @@ static int
startup_terminal (struct terminal *t)
{
pid_t pid;
- assert (t->on);
- assert (t->getty_argv);
+ assert_backtrace (t->on);
+ assert_backtrace (t->getty_argv);
if (t->window_argv)
{
@@ -494,7 +494,7 @@ main ()
error (1, waiterr, "waitpid");
}
- assert (pid > 0);
+ assert_backtrace (pid > 0);
/* We have reaped a dead child. Restart that tty line. */
restart_terminal (pid);
diff --git a/defpager/backing.c b/defpager/backing.c
index 7383c915..aa9810c0 100644
--- a/defpager/backing.c
+++ b/defpager/backing.c
@@ -92,7 +92,7 @@ allocate_backing_page ()
/* Find which bit */
bit = ffs (*bmap_rotor);
- assert (bit);
+ assert_backtrace (bit);
bit--;
/* Mark it */
@@ -123,7 +123,7 @@ return_backing_pages (off_t *map, int maplen)
b = bmap + pfn & ~7;
bit = pfn & 7;
- assert ((*b & (1 << bit)) == 0);
+ assert_backtrace ((*b & (1 << bit)) == 0);
*b |= 1 << bit;
}
pthread_mutex_unlock (&bmap_lock);
diff --git a/eth-multiplexer/ethernet.c b/eth-multiplexer/ethernet.c
index 1f3a57c4..ce46c599 100644
--- a/eth-multiplexer/ethernet.c
+++ b/eth-multiplexer/ethernet.c
@@ -24,7 +24,7 @@
#include <string.h>
#include <error.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <net/if.h>
#include <sys/ioctl.h>
@@ -112,7 +112,7 @@ get_ethernet_address (mach_port_t port, char *address)
error_t err;
int net_address[2];
size_t count = 2;
- assert (count * sizeof (int) >= ETH_ALEN);
+ assert_backtrace (count * sizeof (int) >= ETH_ALEN);
err = device_get_status (port, NET_ADDRESS, net_address, &count);
if (err)
@@ -130,7 +130,7 @@ int ethernet_open (char *dev_name, device_t master_device,
{
error_t err;
- assert (ether_port == MACH_PORT_NULL);
+ assert_backtrace (ether_port == MACH_PORT_NULL);
err = ports_create_port (etherreadclass, etherport_bucket,
sizeof (struct port_info), &readpt);
diff --git a/exec/elfcore.c b/exec/elfcore.c
index 3e4551e5..12ecf34f 100644
--- a/exec/elfcore.c
+++ b/exec/elfcore.c
@@ -40,7 +40,7 @@
#endif
#include <mach/thread_status.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#ifdef i386_THREAD_STATE
# define ELF_MACHINE EM_386
@@ -56,9 +56,9 @@ fetch_thread_regset (thread_t thread, prgregset_t *gregs)
prgregset_t gregs;
} *u = (void *) gregs;
mach_msg_type_number_t count = i386_THREAD_STATE_COUNT;
- assert (sizeof (struct i386_thread_state) < sizeof (prgregset_t));
- assert (offsetof (struct i386_thread_state, gs) == REG_GS * 4);
- assert (offsetof (struct i386_thread_state, eax) == REG_EAX * 4);
+ assert_backtrace (sizeof (struct i386_thread_state) < sizeof (prgregset_t));
+ assert_backtrace (offsetof (struct i386_thread_state, gs) == REG_GS * 4);
+ assert_backtrace (offsetof (struct i386_thread_state, eax) == REG_EAX * 4);
(void) thread_get_state (thread, i386_THREAD_STATE,
(thread_state_t) &u->state, &count);
@@ -82,7 +82,7 @@ fetch_thread_fpregset (thread_t thread, prfpregset_t *fpregs)
(thread_state_t) &st, &count);
if (err == 0 && st.initialized)
{
- assert (sizeof *fpregs >= sizeof st.hw_state);
+ assert_backtrace (sizeof *fpregs >= sizeof st.hw_state);
memcpy (fpregs, st.hw_state, sizeof st.hw_state);
}
}
@@ -96,7 +96,7 @@ static inline void
fetch_thread_regset (thread_t thread, prgregset_t *gregs)
{
mach_msg_type_number_t count = ALPHA_THREAD_STATE_COUNT;
- assert (sizeof (struct alpha_thread_state) <= sizeof (prgregset_t));
+ assert_backtrace (sizeof (struct alpha_thread_state) <= sizeof (prgregset_t));
(void) thread_get_state (thread, ALPHA_THREAD_STATE,
(thread_state_t) gregs, &count);
/* XXX
@@ -110,7 +110,7 @@ static inline void
fetch_thread_fpregset (thread_t thread, prfpregset_t *fpregs)
{
mach_msg_type_number_t count = ALPHA_FLOAT_STATE_COUNT;
- assert (sizeof (struct alpha_float_state) == sizeof *fpregs);
+ assert_backtrace (sizeof (struct alpha_float_state) == sizeof *fpregs);
(void) thread_get_state (thread, ALPHA_FLOAT_STATE,
(thread_state_t) fpregs, &count);
}
diff --git a/exec/exec.c b/exec/exec.c
index d6dd5d88..f5995ac5 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -368,7 +368,7 @@ map (struct execdata *e, off_t posn, size_t len)
char *buffer = map_buffer (e);
mach_msg_type_number_t nread = map_vsize (e);
- assert (e->file_data == NULL); /* Must be first or second case. */
+ assert_backtrace (e->file_data == NULL); /* Must be first or second case. */
/* Read as much as we can get into the buffer right now. */
e->error = io_read (e->file, &buffer, &nread, posn, round_page (len));
diff --git a/exec/hostarch.c b/exec/hostarch.c
index a5650279..363fda69 100644
--- a/exec/hostarch.c
+++ b/exec/hostarch.c
@@ -42,7 +42,7 @@ elf_machine_matches_host (ElfW(Half) e_machine)
(host_info_t) &hostinfo, &hostinfocnt);
if (err)
return err;
- assert (hostinfocnt == HOST_BASIC_INFO_COUNT);
+ assert_backtrace (hostinfocnt == HOST_BASIC_INFO_COUNT);
}
#define CACHE(test) ({ __label__ here; host_type = &&here; \
diff --git a/exec/main.c b/exec/main.c
index 2658df59..30b20da3 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -199,7 +199,7 @@ main (int argc, char **argv)
if (MACH_PORT_VALID (opt_device_master))
{
err = open_console (opt_device_master);
- assert_perror (err);
+ assert_perror_backtrace (err);
mach_port_deallocate (mach_task_self (), opt_device_master);
}
@@ -322,9 +322,9 @@ S_exec_init (struct trivfs_protid *protid,
mach_port_t right;
err = iohelp_create_empty_iouser (&user);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = trivfs_open (fsys, user, 0, MACH_PORT_NULL, &cred);
- assert_perror (err);
+ assert_perror_backtrace (err);
right = ports_get_send_right (cred);
proc_execdata_notify (procserver, right, MACH_MSG_TYPE_COPY_SEND);
@@ -332,10 +332,10 @@ S_exec_init (struct trivfs_protid *protid,
}
err = get_privileged_ports (&host_priv, &device_master);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = open_console (device_master);
- assert_perror (err);
+ assert_perror_backtrace (err);
mach_port_deallocate (mach_task_self (), device_master);
proc_register_version (procserver, host_priv, "exec", "", HURD_VERSION);
@@ -347,7 +347,7 @@ S_exec_init (struct trivfs_protid *protid,
/* Fall back to abusing the message port lookup. */
err = proc_getmsgport (procserver, HURD_PID_STARTUP, &startup);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
mach_port_deallocate (mach_task_self (), procserver);
@@ -355,7 +355,7 @@ S_exec_init (struct trivfs_protid *protid,
run once we call it. */
err = startup_essential_task (startup, mach_task_self (), MACH_PORT_NULL,
"exec", host_priv);
- assert_perror (err);
+ assert_perror_backtrace (err);
mach_port_deallocate (mach_task_self (), startup);
mach_port_deallocate (mach_task_self (), host_priv);
diff --git a/exec/priv.h b/exec/priv.h
index 733f35c0..be085803 100644
--- a/exec/priv.h
+++ b/exec/priv.h
@@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with the GNU Hurd; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/ext2fs/balloc.c b/ext2fs/balloc.c
index 0b9e5a52..8ebd11cd 100644
--- a/ext2fs/balloc.c
+++ b/ext2fs/balloc.c
@@ -166,7 +166,7 @@ ext2_new_block (block_t goal,
ext2_debug ("goal=%u", goal);
repeat:
- assert (bh == NULL);
+ assert_backtrace (bh == NULL);
/*
* First, test whether the goal block is free.
*/
@@ -272,7 +272,7 @@ repeat:
pthread_spin_unlock (&global_lock);
return 0;
}
- assert (bh == NULL);
+ assert_backtrace (bh == NULL);
bh = disk_cache_block_ref (gdp->bg_block_bitmap);
r = memscan (bh, 0, sblock->s_blocks_per_group >> 3);
j = (r - bh) << 3;
@@ -291,7 +291,7 @@ repeat:
}
search_back:
- assert (bh != NULL);
+ assert_backtrace (bh != NULL);
/*
* We have succeeded in finding a free byte in the block
* bitmap. Now search backwards up to 7 bits to find the
@@ -300,7 +300,7 @@ search_back:
for (k = 0; k < 7 && j > 0 && !test_bit (j - 1, bh); k++, j--);
got_block:
- assert (bh != NULL);
+ assert_backtrace (bh != NULL);
ext2_debug ("using block group %d (%d)", i, gdp->bg_free_blocks_count);
@@ -383,7 +383,7 @@ got_block:
sblock_dirty = 1;
sync_out:
- assert (bh == NULL);
+ assert_backtrace (bh == NULL);
pthread_spin_unlock (&global_lock);
alloc_sync (0);
diff --git a/ext2fs/dir.c b/ext2fs/dir.c
index 87a8a04d..bcf90469 100644
--- a/ext2fs/dir.c
+++ b/ext2fs/dir.c
@@ -153,7 +153,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
int looped;
if ((type == REMOVE) || (type == RENAME))
- assert (npp);
+ assert_backtrace (npp);
if (npp)
*npp = 0;
@@ -318,7 +318,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
goto out;
}
else
- assert (0);
+ assert_backtrace (0);
}
if ((type == CREATE || type == RENAME) && !inum && ds && ds->stat == LOOKING)
@@ -349,7 +349,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
if (np)
{
- assert (npp);
+ assert_backtrace (npp);
if (err)
{
if (!spec_dotdot)
@@ -494,7 +494,7 @@ dirscanblock (vm_address_t blockaddr, struct node *dp, int idx,
diskfs_node_disknode (dp)->dirents[i] = -1;
}
/* Make sure the count is correct if there is one now. */
- assert (diskfs_node_disknode (dp)->dirents[idx] == -1
+ assert_backtrace (diskfs_node_disknode (dp)->dirents[idx] == -1
|| diskfs_node_disknode (dp)->dirents[idx] == nentries);
diskfs_node_disknode (dp)->dirents[idx] = nentries;
@@ -537,9 +537,9 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
error_t err;
size_t oldsize = 0;
- assert (ds->type == CREATE);
+ assert_backtrace (ds->type == CREATE);
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
dp->dn_set_mtime = 1;
@@ -551,7 +551,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
{
case TAKE:
/* We are supposed to consume this slot. */
- assert (ds->entry->inode == 0 && ds->entry->rec_len >= needed);
+ assert_backtrace (ds->entry->inode == 0 && ds->entry->rec_len >= needed);
new = ds->entry;
break;
@@ -560,7 +560,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
/* We are supposed to take the extra space at the end
of this slot. */
oldneeded = EXT2_DIR_REC_LEN (ds->entry->name_len);
- assert (ds->entry->rec_len - oldneeded >= needed);
+ assert_backtrace (ds->entry->rec_len - oldneeded >= needed);
new = (struct ext2_dir_entry_2 *) ((vm_address_t) ds->entry + oldneeded);
@@ -583,7 +583,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
if (from->inode != 0)
{
- assert (fromoff >= tooff);
+ assert_backtrace (fromoff >= tooff);
memmove (to, from, fromreclen);
to->rec_len = EXT2_DIR_REC_LEN (to->name_len);
@@ -594,7 +594,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
}
totfreed = (vm_address_t) ds->entry + DIRBLKSIZ - tooff;
- assert (totfreed >= needed);
+ assert_backtrace (totfreed >= needed);
new = (struct ext2_dir_entry_2 *) tooff;
new->rec_len = totfreed;
@@ -602,7 +602,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
case EXTEND:
/* Extend the file. */
- assert (needed <= DIRBLKSIZ);
+ assert_backtrace (needed <= DIRBLKSIZ);
oldsize = dp->dn_stat.st_size;
if ((off_t)(oldsize + DIRBLKSIZ) != (dp->dn_stat.st_size + DIRBLKSIZ))
@@ -639,7 +639,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
default:
new = 0;
- assert (! "impossible: bogus status field in dirstat");
+ assert_backtrace (! "impossible: bogus status field in dirstat");
}
/* NEW points to the directory entry being written, and its
@@ -716,16 +716,16 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
error_t
diskfs_dirremove_hard (struct node *dp, struct dirstat *ds)
{
- assert (ds->type == REMOVE);
- assert (ds->stat == HERE_TIS);
+ assert_backtrace (ds->type == REMOVE);
+ assert_backtrace (ds->stat == HERE_TIS);
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
if (ds->preventry == 0)
ds->entry->inode = 0;
else
{
- assert ((vm_address_t) ds->entry - (vm_address_t) ds->preventry
+ assert_backtrace ((vm_address_t) ds->entry - (vm_address_t) ds->preventry
== ds->preventry->rec_len);
ds->preventry->rec_len += ds->entry->rec_len;
}
@@ -756,10 +756,10 @@ diskfs_dirremove_hard (struct node *dp, struct dirstat *ds)
error_t
diskfs_dirrewrite_hard (struct node *dp, struct node *np, struct dirstat *ds)
{
- assert (ds->type == RENAME);
- assert (ds->stat == HERE_TIS);
+ assert_backtrace (ds->type == RENAME);
+ assert_backtrace (ds->stat == HERE_TIS);
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
ds->entry->inode = np->cache_id;
dp->dn_set_mtime = 1;
@@ -790,7 +790,7 @@ diskfs_dirempty (struct node *dp, struct protid *cred)
err = vm_map (mach_task_self (), &buf, dp->dn_stat.st_size, 0,
1, memobj, 0, 0, VM_PROT_READ, VM_PROT_READ, 0);
mach_port_deallocate (mach_task_self (), memobj);
- assert (!err);
+ assert_backtrace (!err);
diskfs_set_node_atime (dp);
@@ -823,7 +823,7 @@ diskfs_drop_dirstat (struct node *dp, struct dirstat *ds)
{
if (ds->type != LOOKUP)
{
- assert (ds->mapbuf);
+ assert_backtrace (ds->mapbuf);
munmap ((caddr_t) ds->mapbuf, ds->mapextent);
ds->type = LOOKUP;
}
@@ -843,13 +843,13 @@ count_dirents (struct node *dp, block_t nb, char *buf)
int count = 0;
error_t err;
- assert (diskfs_node_disknode (dp)->dirents);
- assert ((nb + 1) * DIRBLKSIZ <= dp->dn_stat.st_size);
+ assert_backtrace (diskfs_node_disknode (dp)->dirents);
+ assert_backtrace ((nb + 1) * DIRBLKSIZ <= dp->dn_stat.st_size);
err = diskfs_node_rdwr (dp, buf, nb * DIRBLKSIZ, DIRBLKSIZ, 0, 0, &amt);
if (err)
return err;
- assert (amt == DIRBLKSIZ);
+ assert_backtrace (amt == DIRBLKSIZ);
for (offinblk = buf;
offinblk < buf + DIRBLKSIZ;
@@ -860,7 +860,7 @@ count_dirents (struct node *dp, block_t nb, char *buf)
count++;
}
- assert (diskfs_node_disknode (dp)->dirents[nb] == -1
+ assert_backtrace (diskfs_node_disknode (dp)->dirents[nb] == -1
|| diskfs_node_disknode (dp)->dirents[nb] == count);
diskfs_node_disknode (dp)->dirents[nb] = count;
return 0;
@@ -977,7 +977,7 @@ diskfs_get_directs (struct node *dp,
0, 0, &checklen);
if (err)
return err;
- assert (checklen == DIRBLKSIZ);
+ assert_backtrace (checklen == DIRBLKSIZ);
bufvalid = 1;
}
for (i = 0, bufp = buf;
@@ -985,7 +985,7 @@ diskfs_get_directs (struct node *dp,
bufp += ((struct ext2_dir_entry_2 *)bufp)->rec_len, i++)
;
/* Make sure we didn't run off the end. */
- assert (bufp - buf < DIRBLKSIZ);
+ assert_backtrace (bufp - buf < DIRBLKSIZ);
}
i = 0;
@@ -1002,7 +1002,7 @@ diskfs_get_directs (struct node *dp,
0, 0, &checklen);
if (err)
return err;
- assert (checklen == DIRBLKSIZ);
+ assert_backtrace (checklen == DIRBLKSIZ);
bufvalid = 1;
bufp = buf;
}
@@ -1027,7 +1027,7 @@ diskfs_get_directs (struct node *dp,
/* See if this record would run over the end of the return buffer. */
if (bufsiz == 0)
/* It shouldn't ever, as we calculated the worst case size. */
- assert (datap + rec_len <= *data + allocsize);
+ assert_backtrace (datap + rec_len <= *data + allocsize);
else
/* It's ok if it does, just leave off returning this entry. */
if (datap + rec_len > *data + allocsize)
diff --git a/ext2fs/ext2fs.h b/ext2fs/ext2fs.h
index 2104dba3..08cb510a 100644
--- a/ext2fs/ext2fs.h
+++ b/ext2fs/ext2fs.h
@@ -29,7 +29,7 @@
#include <hurd/store.h>
#include <hurd/diskfs.h>
#include <hurd/ihash.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pthread.h>
#include <sys/mman.h>
@@ -362,7 +362,7 @@ boffs_ptr (off_t offset)
pthread_mutex_lock (&disk_cache_lock);
char *ptr = hurd_ihash_find (disk_cache_bptr, block);
pthread_mutex_unlock (&disk_cache_lock);
- assert (ptr);
+ assert_backtrace (ptr);
ptr += offset % block_size;
ext2_debug ("(%lld) = %p", offset, ptr);
return ptr;
@@ -374,11 +374,11 @@ bptr_offs (void *ptr)
{
vm_offset_t mem_offset = (char *)ptr - (char *)disk_cache;
off_t offset;
- assert (mem_offset < disk_cache_size);
+ assert_backtrace (mem_offset < disk_cache_size);
pthread_mutex_lock (&disk_cache_lock);
offset = (off_t) disk_cache_info[boffs_block (mem_offset)].block
<< log2_block_size;
- assert (offset || mem_offset < block_size);
+ assert_backtrace (offset || mem_offset < block_size);
offset += mem_offset % block_size;
pthread_mutex_unlock (&disk_cache_lock);
ext2_debug ("(%p) = %lld", ptr, offset);
@@ -481,7 +481,7 @@ record_global_poke (void *ptr)
block_t block = boffs_block (bptr_offs (ptr));
void *block_ptr = bptr (block);
ext2_debug ("(%p = %p)", ptr, block_ptr);
- assert (disk_cache_block_is_ref (block));
+ assert_backtrace (disk_cache_block_is_ref (block));
global_block_modified (block);
pokel_add (&global_pokel, block_ptr, block_size);
}
@@ -507,7 +507,7 @@ record_indir_poke (struct node *node, void *ptr)
block_t block = boffs_block (bptr_offs (ptr));
void *block_ptr = bptr (block);
ext2_debug ("(%llu, %p)", node->cache_id, ptr);
- assert (disk_cache_block_is_ref (block));
+ assert_backtrace (disk_cache_block_is_ref (block));
global_block_modified (block);
pokel_add (&diskfs_node_disknode (node)->indir_pokel, block_ptr, block_size);
}
diff --git a/ext2fs/getblk.c b/ext2fs/getblk.c
index 0d0fab12..43daf6c9 100644
--- a/ext2fs/getblk.c
+++ b/ext2fs/getblk.c
@@ -122,7 +122,7 @@ inode_getblk (struct node *node, int nr, int create, int zero,
block_t hint;
#endif
- assert (0 <= nr && nr < EXT2_N_BLOCKS);
+ assert_backtrace (0 <= nr && nr < EXT2_N_BLOCKS);
*result = diskfs_node_disknode (node)->info.i_data[nr];
if (*result)
diff --git a/ext2fs/hyper.c b/ext2fs/hyper.c
index 91d9d12f..6ef2b8c3 100644
--- a/ext2fs/hyper.c
+++ b/ext2fs/hyper.c
@@ -45,7 +45,7 @@ allocate_mod_map (void)
mod_map_size = sblock->s_blocks_count >> 3;
modified_global_blocks = mmap (0, mod_map_size, PROT_READ|PROT_WRITE,
MAP_ANON, 0, 0);
- assert (modified_global_blocks != (void *) -1);
+ assert_backtrace (modified_global_blocks != (void *) -1);
}
else
modified_global_blocks = 0;
@@ -161,7 +161,7 @@ get_hypermetadata (void)
if (zeroblock == 0)
{
zeroblock = (vm_address_t) mmap (0, block_size, PROT_READ, MAP_ANON, 0, 0);
- assert (zeroblock != (vm_address_t) MAP_FAILED);
+ assert_backtrace (zeroblock != (vm_address_t) MAP_FAILED);
}
}
diff --git a/ext2fs/ialloc.c b/ext2fs/ialloc.c
index 71bfb8cb..b14ddeec 100644
--- a/ext2fs/ialloc.c
+++ b/ext2fs/ialloc.c
@@ -58,7 +58,7 @@ diskfs_free_node (struct node *np, mode_t old_mode)
struct ext2_group_desc *gdp;
ino_t inum = np->cache_id;
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
ext2_debug ("freeing inode %u", inum);
@@ -125,7 +125,7 @@ ext2_alloc_inode (ino_t dir_inum, mode_t mode)
pthread_spin_lock (&global_lock);
repeat:
- assert (bh == NULL);
+ assert_backtrace (bh == NULL);
gdp = NULL;
i = 0;
@@ -267,7 +267,7 @@ repeat:
sblock_dirty = 1;
sync_out:
- assert (bh == NULL);
+ assert_backtrace (bh == NULL);
pthread_spin_unlock (&global_lock);
alloc_sync (0);
@@ -298,7 +298,7 @@ diskfs_alloc_node (struct node *dir, mode_t mode, struct node **node)
struct stat *st;
ino_t inum;
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
inum = ext2_alloc_inode (dir->cache_id, mode);
diff --git a/ext2fs/inode.c b/ext2fs/inode.c
index 17dded6a..472c1b43 100644
--- a/ext2fs/inode.c
+++ b/ext2fs/inode.c
@@ -74,7 +74,7 @@ diskfs_node_norefs (struct node *np)
{
if (diskfs_node_disknode (np)->dirents)
free (diskfs_node_disknode (np)->dirents);
- assert (!diskfs_node_disknode (np)->pager);
+ assert_backtrace (!diskfs_node_disknode (np)->pager);
/* Move any pending writes of indirect blocks. */
pokel_inherit (&global_pokel, &diskfs_node_disknode (np)->indir_pokel);
@@ -362,7 +362,7 @@ write_node (struct node *np)
{
struct ext2_inode_info *info = &diskfs_node_disknode (np)->info;
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
ext2_debug ("writing inode %d to disk", np->cache_id);
@@ -395,10 +395,10 @@ write_node (struct node *np)
else
/* No hurd extensions should be turned on. */
{
- assert ((st->st_uid & ~0xFFFF) == 0);
- assert ((st->st_gid & ~0xFFFF) == 0);
- assert ((st->st_mode & ~0xFFFF) == 0);
- assert (np->author_tracks_uid && st->st_author == st->st_uid);
+ assert_backtrace ((st->st_uid & ~0xFFFF) == 0);
+ assert_backtrace ((st->st_gid & ~0xFFFF) == 0);
+ assert_backtrace ((st->st_mode & ~0xFFFF) == 0);
+ assert_backtrace (np->author_tracks_uid && st->st_author == st->st_uid);
}
di->i_links_count = st->st_nlink;
@@ -551,7 +551,7 @@ diskfs_set_translator (struct node *np, const char *name, unsigned namelen,
{
error_t err;
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
if (sblock->s_creator_os != EXT2_OS_HURD)
return EOPNOTSUPP;
@@ -769,7 +769,7 @@ write_symlink (struct node *node, const char *target)
if (len > MAX_INODE_SYMLINK)
return EINVAL;
- assert (node->dn_stat.st_blocks == 0);
+ assert_backtrace (node->dn_stat.st_blocks == 0);
memcpy (diskfs_node_disknode (node)->info.i_data, target, len);
node->dn_stat.st_size = len - 1;
@@ -786,7 +786,7 @@ read_symlink (struct node *node, char *target)
if (node->dn_stat.st_blocks)
return EINVAL;
- assert (node->dn_stat.st_size < MAX_INODE_SYMLINK);
+ assert_backtrace (node->dn_stat.st_size < MAX_INODE_SYMLINK);
memcpy (target, diskfs_node_disknode (node)->info.i_data,
node->dn_stat.st_size);
diff --git a/ext2fs/pager.c b/ext2fs/pager.c
index fd93dcb8..a47c53ce 100644
--- a/ext2fs/pager.c
+++ b/ext2fs/pager.c
@@ -108,7 +108,7 @@ get_page_buf ()
}
else
{
- assert (free_page_bufs == 0);
+ assert_backtrace (free_page_bufs == 0);
buf = mmap (0, vm_page_size * FREE_PAGE_BUFS,
PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
if (buf == MAP_FAILED)
@@ -409,7 +409,7 @@ file_pager_write_page (struct node *node, vm_offset_t offset, void *buf)
err = find_block (node, offset, &block, &lock);
if (err)
break;
- assert (block);
+ assert_backtrace (block);
pending_blocks_add (&pb, block);
offset += block_size;
left -= block_size;
@@ -469,13 +469,13 @@ disk_pager_write_page (vm_offset_t page, void *buf)
int index = offset >> log2_block_size;
pthread_mutex_lock (&disk_cache_lock);
- assert (disk_cache_info[index].block != DC_NO_BLOCK);
+ assert_backtrace (disk_cache_info[index].block != DC_NO_BLOCK);
offset = ((store_offset_t) disk_cache_info[index].block << log2_block_size)
+ offset % block_size;
#ifdef DEBUG_DISK_CACHE /* Not strictly needed. */
- assert ((disk_cache_info[index].last_read ^ DISK_CACHE_LAST_READ_XOR)
+ assert_backtrace ((disk_cache_info[index].last_read ^ DISK_CACHE_LAST_READ_XOR)
== disk_cache_info[index].last_read_xor);
- assert (disk_cache_info[index].last_read
+ assert_backtrace (disk_cache_info[index].last_read
== disk_cache_info[index].block);
#endif
pthread_mutex_unlock (&disk_cache_lock);
@@ -657,7 +657,7 @@ error_t
diskfs_grow (struct node *node, off_t size, struct protid *cred)
{
diskfs_check_readonly ();
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
if (size > node->allocsize)
{
@@ -794,7 +794,7 @@ inline error_t
pager_report_extent (struct user_pager_info *pager,
vm_address_t *offset, vm_size_t *size)
{
- assert (pager->type == DISK || pager->type == FILE_DATA);
+ assert_backtrace (pager->type == DISK || pager->type == FILE_DATA);
*offset = 0;
@@ -817,7 +817,7 @@ pager_clear_user_data (struct user_pager_info *upi)
pthread_spin_lock (&node_to_page_lock);
pager = diskfs_node_disknode (upi->node)->pager;
- assert (!pager || pager_get_upi (pager) != upi);
+ assert_backtrace (!pager || pager_get_upi (pager) != upi);
pthread_spin_unlock (&node_to_page_lock);
diskfs_nrele_light (upi->node);
@@ -944,11 +944,11 @@ disk_cache_init (void)
+ (round_block ((sizeof *group_desc_image) * groups_count)
>> log2_block_size);
ext2_debug ("%u-%u\n", fixed_first, fixed_last);
- assert (fixed_last - fixed_first + 1 <= (block_t)disk_cache_blocks + 3);
+ assert_backtrace (fixed_last - fixed_first + 1 <= (block_t)disk_cache_blocks + 3);
for (block_t i = fixed_first; i <= fixed_last; i++)
{
disk_cache_block_ref (i);
- assert (disk_cache_info[i-fixed_first].block == i);
+ assert_backtrace (disk_cache_info[i-fixed_first].block == i);
disk_cache_info[i-fixed_first].flags |= DC_FIXED;
}
}
@@ -1020,7 +1020,7 @@ disk_cache_block_ref (block_t block)
void *bptr;
hurd_ihash_locp_t slot;
- assert (block < store->size >> log2_block_size);
+ assert_backtrace (block < store->size >> log2_block_size);
ext2_debug ("(%u)", block);
@@ -1048,7 +1048,7 @@ retry_ref:
}
/* Just increment reference and return. */
- assert (disk_cache_info[index].ref_count + 1
+ assert_backtrace (disk_cache_info[index].ref_count + 1
> disk_cache_info[index].ref_count);
disk_cache_info[index].ref_count++;
@@ -1113,7 +1113,7 @@ retry_ref:
pthread_mutex_lock (&diskfs_disk_pager->interlock);
int page = (bptr - disk_cache) / vm_page_size;
- assert (page >= 0);
+ assert_backtrace (page >= 0);
int is_incore = (page < diskfs_disk_pager->pagemapsize
&& (diskfs_disk_pager->pagemap[page] & PM_INCORE));
pthread_mutex_unlock (&diskfs_disk_pager->interlock);
@@ -1134,9 +1134,9 @@ retry_ref:
if (disk_cache_info[index].block != DC_NO_BLOCK)
/* Remove old association. */
hurd_ihash_remove (disk_cache_bptr, disk_cache_info[index].block);
- assert (! (disk_cache_info[index].flags & DC_DONT_REUSE & ~DC_UNTOUCHED));
+ assert_backtrace (! (disk_cache_info[index].flags & DC_DONT_REUSE & ~DC_UNTOUCHED));
disk_cache_info[index].block = block;
- assert (! disk_cache_info[index].ref_count);
+ assert_backtrace (! disk_cache_info[index].ref_count);
disk_cache_info[index].ref_count = 1;
/* All data structures are set up. */
@@ -1184,11 +1184,11 @@ disk_cache_block_ref_ptr (void *ptr)
pthread_mutex_lock (&disk_cache_lock);
index = bptr_index (ptr);
- assert (disk_cache_info[index].ref_count >= 1);
- assert (disk_cache_info[index].ref_count + 1
+ assert_backtrace (disk_cache_info[index].ref_count >= 1);
+ assert_backtrace (disk_cache_info[index].ref_count + 1
> disk_cache_info[index].ref_count);
disk_cache_info[index].ref_count++;
- assert (! (disk_cache_info[index].flags & DC_UNTOUCHED));
+ assert_backtrace (! (disk_cache_info[index].flags & DC_UNTOUCHED));
ext2_debug ("(%p) (ref_count = %hu, flags = %#hx)",
ptr,
disk_cache_info[index].ref_count,
@@ -1201,7 +1201,7 @@ _disk_cache_block_deref (void *ptr)
{
int index;
- assert (disk_cache <= ptr && ptr <= disk_cache + disk_cache_size);
+ assert_backtrace (disk_cache <= ptr && ptr <= disk_cache + disk_cache_size);
pthread_mutex_lock (&disk_cache_lock);
index = bptr_index (ptr);
@@ -1209,8 +1209,8 @@ _disk_cache_block_deref (void *ptr)
ptr,
disk_cache_info[index].ref_count - 1,
disk_cache_info[index].flags);
- assert (! (disk_cache_info[index].flags & DC_UNTOUCHED));
- assert (disk_cache_info[index].ref_count >= 1);
+ assert_backtrace (! (disk_cache_info[index].flags & DC_UNTOUCHED));
+ assert_backtrace (disk_cache_info[index].ref_count >= 1);
disk_cache_info[index].ref_count--;
if (disk_cache_info[index].ref_count == 0 &&
!(disk_cache_info[index].flags & DC_DONT_REUSE))
@@ -1298,7 +1298,7 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot)
{
mach_port_t right;
- assert (S_ISDIR (node->dn_stat.st_mode)
+ assert_backtrace (S_ISDIR (node->dn_stat.st_mode)
|| S_ISREG (node->dn_stat.st_mode)
|| (S_ISLNK (node->dn_stat.st_mode)));
@@ -1309,7 +1309,7 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot)
if (pager)
{
right = pager_get_port (pager);
- assert (MACH_PORT_VALID (right));
+ assert_backtrace (MACH_PORT_VALID (right));
pager_get_upi (pager)->max_prot |= prot;
}
else
diff --git a/ext2fs/pokel.c b/ext2fs/pokel.c
index 53dc513a..38209428 100644
--- a/ext2fs/pokel.c
+++ b/ext2fs/pokel.c
@@ -102,7 +102,7 @@ pokel_add (struct pokel *pokel, void *loc, vm_size_t length)
if (pl == NULL)
{
pl = malloc (sizeof (struct poke));
- assert (pl);
+ assert_backtrace (pl);
}
else
pokel->free_pokes = pl->next;
@@ -173,8 +173,8 @@ pokel_inherit (struct pokel *pokel, struct pokel *from)
{
struct poke *pokes, *last;
- assert (pokel->pager == from->pager);
- assert (pokel->image == from->image);
+ assert_backtrace (pokel->pager == from->pager);
+ assert_backtrace (pokel->image == from->image);
/* Take all pokes from FROM... */
pthread_spin_lock (&from->lock);
diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c
index 6941f6b7..265f7f2c 100644
--- a/ext2fs/truncate.c
+++ b/ext2fs/truncate.c
@@ -286,7 +286,7 @@ diskfs_truncate (struct node *node, off_t length)
off_t offset;
diskfs_check_readonly ();
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
if (length >= node->dn_stat.st_size)
return 0;
diff --git a/ext2fs/xattr.c b/ext2fs/xattr.c
index 45969195..bfc34028 100644
--- a/ext2fs/xattr.c
+++ b/ext2fs/xattr.c
@@ -445,7 +445,7 @@ ext2_free_xattr_block (struct node *np)
goto cleanup;
}
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
block = disk_cache_block_ref (blkno);
header = EXT2_XATTR_HEADER (block);
@@ -697,7 +697,7 @@ ext2_set_xattr (struct node *np, const char *name, const char *value,
/* Allocate and initialize new block */
block_t goal;
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
goal = sblock->s_first_data_block + np->dn->info.i_block_group *
EXT2_BLOCKS_PER_GROUP (sblock);
diff --git a/fatfs/dir.c b/fatfs/dir.c
index b9b7ae55..2679a0ce 100644
--- a/fatfs/dir.c
+++ b/fatfs/dir.c
@@ -191,7 +191,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
int looped;
if ((type == REMOVE) || (type == RENAME))
- assert (npp);
+ assert_backtrace (npp);
if (npp)
*npp = 0;
@@ -352,7 +352,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
goto out;
}
else
- assert (0);
+ assert_backtrace (0);
}
if ((type == CREATE || type == RENAME) && !inum && ds && ds->stat == LOOKING)
@@ -383,7 +383,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
if (np)
{
- assert (npp);
+ assert_backtrace (npp);
if (err)
{
if (!spec_dotdot)
@@ -590,9 +590,9 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
error_t err;
loff_t oldsize = 0;
- assert (ds->type == CREATE);
+ assert_backtrace (ds->type == CREATE);
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
dp->dn_set_mtime = 1;
@@ -604,7 +604,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
{
case TAKE:
/* We are supposed to consume this slot. */
- assert ((char)ds->entry->name[0] == FAT_DIR_NAME_LAST
+ assert_backtrace ((char)ds->entry->name[0] == FAT_DIR_NAME_LAST
|| (char)ds->entry->name[0] == FAT_DIR_NAME_DELETED);
new = ds->entry;
@@ -612,7 +612,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
case EXTEND:
/* Extend the file. */
- assert (needed <= bytes_per_cluster);
+ assert_backtrace (needed <= bytes_per_cluster);
oldsize = dp->dn_stat.st_size;
while (oldsize + bytes_per_cluster > dp->allocsize)
@@ -636,7 +636,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
case SHRINK:
case COMPRESS:
default:
- assert(0);
+ assert_backtrace (0);
/* COMPRESS will be used later, with long filenames, but shrink
does not make sense on fat, as all entries have fixed
@@ -689,10 +689,10 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
error_t
diskfs_dirremove_hard (struct node *dp, struct dirstat *ds)
{
- assert (ds->type == REMOVE);
- assert (ds->stat == HERE_TIS);
+ assert_backtrace (ds->type == REMOVE);
+ assert_backtrace (ds->stat == HERE_TIS);
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
dp->dn_set_mtime = 1;
@@ -729,22 +729,22 @@ diskfs_dirrewrite_hard (struct node *dp, struct node *np, struct dirstat *ds)
entry_key.dir_inode = dp->cache_id;
entry_key.dir_offset = ((int) ds->entry) - ((int) ds->mapbuf);
err = vi_rlookup (entry_key, &inode, &vinode, 0);
- assert (err != EINVAL);
+ assert_backtrace (err != EINVAL);
if (err)
return err;
/* Lookup the node, we already have a reference. */
oldnp = diskfs_cached_ifind (inode);
- assert (ds->type == RENAME);
- assert (ds->stat == HERE_TIS);
+ assert_backtrace (ds->type == RENAME);
+ assert_backtrace (ds->stat == HERE_TIS);
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
/* The link count must be 0 so the file will be removed and
the node will be dropped. */
oldnp->dn_stat.st_nlink--;
- assert (!oldnp->dn_stat.st_nlink);
+ assert_backtrace (!oldnp->dn_stat.st_nlink);
/* Close the file, free the referenced held by clients. */
fshelp_fetch_control (&oldnp->transbox, &control);
@@ -784,7 +784,7 @@ diskfs_dirempty (struct node *dp, struct protid *cred)
err = vm_map (mach_task_self (), &buf, dp->dn_stat.st_size, 0,
1, memobj, 0, 0, VM_PROT_READ, VM_PROT_READ, 0);
mach_port_deallocate (mach_task_self (), memobj);
- assert (!err);
+ assert_backtrace (!err);
diskfs_set_node_atime (dp);
@@ -817,7 +817,7 @@ diskfs_drop_dirstat (struct node *dp, struct dirstat *ds)
{
if (ds->type != LOOKUP)
{
- assert (ds->mapbuf);
+ assert_backtrace (ds->mapbuf);
munmap ((caddr_t) ds->mapbuf, ds->mapextent);
ds->type = LOOKUP;
}
diff --git a/fatfs/fat.c b/fatfs/fat.c
index 4c98f623..e191cfc4 100644
--- a/fatfs/fat.c
+++ b/fatfs/fat.c
@@ -22,7 +22,7 @@
#include <error.h>
#include <limits.h>
#include <errno.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <ctype.h>
#include <time.h>
@@ -214,7 +214,7 @@ fat_write_next_cluster(cluster_t cluster, cluster_t next_cluster)
cluster_t data;
/* First data cluster is cluster 2. */
- assert (cluster >= 2 && cluster < nr_of_clusters + 2);
+ assert_backtrace (cluster >= 2 && cluster < nr_of_clusters + 2);
switch (fat_type)
{
@@ -267,7 +267,7 @@ fat_get_next_cluster(cluster_t cluster, cluster_t *next_cluster)
loff_t fat_entry_offset;
/* First data cluster is cluster 2. */
- assert (cluster >= 2 && cluster < nr_of_clusters + 2);
+ assert_backtrace (cluster >= 2 && cluster < nr_of_clusters + 2);
switch (fat_type)
{
@@ -321,7 +321,7 @@ fat_allocate_cluster (cluster_t content, cluster_t *cluster)
int wrapped = 0;
cluster_t found_cluster = FAT_FREE_CLUSTER;
- assert (content != FAT_FREE_CLUSTER);
+ assert_backtrace (content != FAT_FREE_CLUSTER);
pthread_spin_lock (&allocate_free_cluster_lock);
old_next_free_cluster = next_free_cluster;
@@ -483,17 +483,17 @@ fat_getcluster (struct node *node, cluster_t cluster, int create,
return err;
if (cluster >= node->dn->length_of_chain)
{
- assert (!create);
+ assert_backtrace (!create);
return EINVAL;
}
}
chain = node->dn->first;
while (chains_to_go--)
{
- assert (chain);
+ assert_backtrace (chain);
chain = chain->next;
}
- assert (chain);
+ assert_backtrace (chain);
*disk_cluster = chain->cluster[offs];
return 0;
}
@@ -508,14 +508,14 @@ fat_truncate_node (struct node *node, cluster_t clusters_to_keep)
/* The root dir of a FAT12/16 fs is of fixed size, while the root
dir of a FAT32 fs must never decease to exist. */
- assert (! (((fat_type == FAT12 || fat_type == FAT16) && node == diskfs_root_node)
+ assert_backtrace (! (((fat_type == FAT12 || fat_type == FAT16) && node == diskfs_root_node)
|| (fat_type == FAT32 && node == diskfs_root_node && clusters_to_keep == 0)));
/* Expand the cluster chain, because we have to know the complete tail. */
fat_extend_chain (node, FAT_EOC, 0);
if (clusters_to_keep == node->dn->length_of_chain)
return;
- assert (clusters_to_keep < node->dn->length_of_chain);
+ assert_backtrace (clusters_to_keep < node->dn->length_of_chain);
/* Truncation happens here. */
next = node->dn->first;
@@ -532,7 +532,7 @@ fat_truncate_node (struct node *node, cluster_t clusters_to_keep)
offs = (clusters_to_keep - 1) & (CLUSTERS_PER_TABLE - 1);
while (count-- > 0)
{
- assert (next);
+ assert_backtrace (next);
/* This cluster is now the last cluster in the chain. */
if (count == 0)
@@ -540,7 +540,7 @@ fat_truncate_node (struct node *node, cluster_t clusters_to_keep)
next = next->next;
}
- assert (next);
+ assert_backtrace (next);
fat_write_next_cluster (next->cluster[offs++], FAT_EOC);
pos = clusters_to_keep;
}
@@ -553,7 +553,7 @@ fat_truncate_node (struct node *node, cluster_t clusters_to_keep)
{
offs = 0;
next = next->next;
- assert(next);
+ assert_backtrace (next);
}
fat_write_next_cluster(next->cluster[offs++], 0);
pos++;
@@ -567,10 +567,10 @@ fat_truncate_node (struct node *node, cluster_t clusters_to_keep)
offs = (clusters_to_keep - 1) & (CLUSTERS_PER_TABLE - 1);
while (count-- > 0)
{
- assert (next);
+ assert_backtrace (next);
next = next->next;
}
- assert (next);
+ assert_backtrace (next);
next = next->next;
}
while (next)
diff --git a/fatfs/inode.c b/fatfs/inode.c
index 4f28d144..e92922f6 100644
--- a/fatfs/inode.c
+++ b/fatfs/inode.c
@@ -98,7 +98,7 @@ diskfs_node_norefs (struct node *np)
if (np->dn->dirnode)
diskfs_nrele (np->dn->dirnode);
- assert (!np->dn->pager);
+ assert_backtrace (!np->dn->pager);
free (np);
}
@@ -178,7 +178,7 @@ diskfs_user_read_node (struct node *np, struct lookup_context *ctx)
by libdiskfs. The only case it is not locked is for NFS
(fsys_getfile) and we disabled that. */
dp = diskfs_cached_ifind (vk.dir_inode);
- assert (dp);
+ assert_backtrace (dp);
/* Map in the directory contents. */
memobj = diskfs_get_filemap (dp, prot);
@@ -339,13 +339,13 @@ write_node (struct node *np)
if (vk.dir_inode == 0 || np == diskfs_root_node)
return;
- assert (!np->dn_set_ctime && !np->dn_set_atime && !np->dn_set_mtime);
+ assert_backtrace (!np->dn_set_ctime && !np->dn_set_atime && !np->dn_set_mtime);
if (np->dn_stat_dirty)
{
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
dp = np->dn->dirnode;
- assert (dp);
+ assert_backtrace (dp);
pthread_mutex_lock (&dp->lock);
@@ -474,14 +474,14 @@ diskfs_set_translator (struct node *node,
const char *name, u_int namelen,
struct protid *cred)
{
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
return EOPNOTSUPP;
}
error_t
diskfs_get_translator (struct node *node, char **namep, u_int *namelen)
{
- assert(0);
+ assert_backtrace (0);
}
void
@@ -503,7 +503,7 @@ diskfs_truncate (struct node *node, loff_t length)
loff_t offset;
diskfs_check_readonly ();
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
if (length >= node->dn_stat.st_size)
return 0;
@@ -565,7 +565,7 @@ diskfs_S_file_get_storage_info (struct protid *cred,
void
diskfs_free_node (struct node *np, mode_t old_mode)
{
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
vi_free(np->dn->inode);
}
@@ -584,7 +584,7 @@ diskfs_alloc_node (struct node *dir, mode_t mode, struct node **node)
struct node *np;
struct lookup_context ctx = { dir: dir };
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
/* FIXME: We use a magic key here that signals read_node that we are
not entered in any directory yet. */
diff --git a/fatfs/main.c b/fatfs/main.c
index 00c56bc5..f0b3aa88 100644
--- a/fatfs/main.c
+++ b/fatfs/main.c
@@ -189,7 +189,7 @@ fetch_root ()
break;
default:
- assert(!"don't know how to set size of root dir");
+ assert_backtrace (!"don't know how to set size of root dir");
};
/* The magic vi_key {0, 1} for the root directory is distinguished
@@ -197,14 +197,14 @@ fetch_root ()
normal virtual inode keys (in the dir_inode value). Enter the
disknode into the inode table. */
err = vi_new ((struct vi_key) {0, 1}, &inum, &ctx.inode);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* Allocate a node for the root directory disknode in
diskfs_root_node. */
if (!err)
err = diskfs_cached_lookup_context (inum, &diskfs_root_node, &ctx);
- assert_perror (err);
+ assert_perror_backtrace (err);
pthread_mutex_unlock (&diskfs_root_node->lock);
}
diff --git a/fatfs/pager.c b/fatfs/pager.c
index bef8dbeb..53b5bbc1 100644
--- a/fatfs/pager.c
+++ b/fatfs/pager.c
@@ -608,7 +608,7 @@ void
pager_notify_evict (struct user_pager_info *pager,
vm_offset_t page)
{
- assert (!"unrequested notification on eviction");
+ assert_backtrace (!"unrequested notification on eviction");
}
/* Grow the disk allocated to locked node NODE to be at least SIZE
@@ -621,7 +621,7 @@ error_t
diskfs_grow (struct node *node, loff_t size, struct protid *cred)
{
diskfs_check_readonly ();
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
if (size > node->allocsize)
{
@@ -718,7 +718,7 @@ inline error_t
pager_report_extent (struct user_pager_info *pager,
vm_address_t *offset, vm_size_t *size)
{
- assert (pager->type == FAT || pager->type == FILE_DATA);
+ assert_backtrace (pager->type == FAT || pager->type == FILE_DATA);
*offset = 0;
@@ -815,7 +815,7 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot)
{
mach_port_t right;
- assert (S_ISDIR (node->dn_stat.st_mode)
+ assert_backtrace (S_ISDIR (node->dn_stat.st_mode)
|| S_ISREG (node->dn_stat.st_mode)
|| (S_ISLNK (node->dn_stat.st_mode)));
diff --git a/fatfs/virt-inode.c b/fatfs/virt-inode.c
index 71381699..7267cbe0 100644
--- a/fatfs/virt-inode.c
+++ b/fatfs/virt-inode.c
@@ -25,7 +25,7 @@
up-to-date. When a table page can be freed, do so. */
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include <pthread.h>
#include "virt-inode.h"
@@ -117,7 +117,7 @@ vi_new(vi_key_t key, ino_t *inode, inode_t *v_inode)
{
error_t err;
- assert (memcmp(&vi_zero_key, &key, sizeof (vi_key_t)));
+ assert_backtrace (memcmp(&vi_zero_key, &key, sizeof (vi_key_t)));
pthread_spin_lock (&inode_table_lock);
err = _vi_new(key, inode, v_inode);
@@ -171,7 +171,7 @@ vi_rlookup(vi_key_t key, ino_t *inode, inode_t *v_inode, int create)
int page = 0;
int offset = 0;
- assert (memcmp(&vi_zero_key, &key, sizeof (vi_key_t)));
+ assert_backtrace (memcmp(&vi_zero_key, &key, sizeof (vi_key_t)));
pthread_spin_lock (&inode_table_lock);
@@ -211,7 +211,7 @@ vi_key_t vi_change(inode_t v_inode, vi_key_t key)
{
vi_key_t okey = v_inode->key;
- assert (memcmp(&vi_zero_key, &key, sizeof (vi_key_t)));
+ assert_backtrace (memcmp(&vi_zero_key, &key, sizeof (vi_key_t)));
v_inode->key = key;
return okey;
}
diff --git a/ftpfs/conn.c b/ftpfs/conn.c
index 0f1b0973..2cd1384a 100644
--- a/ftpfs/conn.c
+++ b/ftpfs/conn.c
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <stdint.h>
#include "ftpfs.h"
@@ -101,6 +101,6 @@ ftpfs_release_ftp_conn (struct ftpfs *fs, struct ftp_conn *conn)
fs->free_conns = fsc;
break;
}
- assert (fsc);
+ assert_backtrace (fsc);
pthread_spin_unlock (&fs->conn_lock);
}
diff --git a/ftpfs/dir.c b/ftpfs/dir.c
index 2ea29b53..44c85509 100644
--- a/ftpfs/dir.c
+++ b/ftpfs/dir.c
@@ -30,7 +30,7 @@
void
free_entry (struct ftpfs_dir_entry *e)
{
- assert (e->deleted);
+ assert_backtrace (e->deleted);
free (e->name);
if (e->symlink_target)
free (e->symlink_target);
diff --git a/ftpfs/node.c b/ftpfs/node.c
index cc9bf433..fb85fe5b 100644
--- a/ftpfs/node.c
+++ b/ftpfs/node.c
@@ -91,7 +91,7 @@ netfs_node_norefs (struct node *node)
if (nn->dir)
{
- assert (nn->dir->num_live_entries == 0);
+ assert_backtrace (nn->dir->num_live_entries == 0);
ftpfs_dir_free (nn->dir);
}
diff --git a/hostmux/leaf.c b/hostmux/leaf.c
index fb53622f..ebe9190e 100644
--- a/hostmux/leaf.c
+++ b/hostmux/leaf.c
@@ -27,7 +27,7 @@
error_t
netfs_attempt_readlink (struct iouser *user, struct node *node, char *buf)
{
- assert (node->nn->name);
+ assert_backtrace (node->nn->name);
memcpy (buf, node->nn->name->canon, node->nn_stat.st_size);
fshelp_touch (&node->nn_stat, TOUCH_ATIME, hostmux_maptime);
return 0;
diff --git a/isofs/inode.c b/isofs/inode.c
index eef2a6a4..0783385f 100644
--- a/isofs/inode.c
+++ b/isofs/inode.c
@@ -328,7 +328,7 @@ diskfs_node_norefs (struct node *np)
if (np->dn->translator)
free (np->dn->translator);
- assert (!np->dn->fileinfo);
+ assert_backtrace (!np->dn->fileinfo);
free (np);
}
diff --git a/isofs/lookup.c b/isofs/lookup.c
index f375212a..3590f2d5 100644
--- a/isofs/lookup.c
+++ b/isofs/lookup.c
@@ -78,7 +78,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
ino_t id;
if ((type == REMOVE) || (type == RENAME))
- assert (npp);
+ assert_backtrace (npp);
if (npp)
*npp = 0;
@@ -127,7 +127,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
else if (spec_dotdot)
{
/* renames and removes can't get this far. */
- assert (type == LOOKUP);
+ assert_backtrace (type == LOOKUP);
diskfs_nput (dp);
err = diskfs_cached_lookup_context (id, npp, &ctx);
}
diff --git a/isofs/main.c b/isofs/main.c
index c07cf3ff..db16e2a1 100644
--- a/isofs/main.c
+++ b/isofs/main.c
@@ -57,11 +57,11 @@ fetch_root ()
rrip_lookup (ctx.dr, &ctx.rr, 1);
err = cache_id (ctx.dr, &ctx.rr, &id);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* And fetch the node. */
err = diskfs_cached_lookup_context (id, &diskfs_root_node, &ctx);
- assert_perror (err);
+ assert_perror_backtrace (err);
pthread_mutex_unlock (&diskfs_root_node->lock);
}
diff --git a/isofs/pager.c b/isofs/pager.c
index 42cad8db..259581e8 100644
--- a/isofs/pager.c
+++ b/isofs/pager.c
@@ -64,7 +64,7 @@ pager_read_page (struct user_pager_info *upi,
}
else
{
- assert (upi->type == DISK);
+ assert_backtrace (upi->type == DISK);
addr = page >> store->log2_block_size;
}
@@ -87,7 +87,7 @@ pager_write_page (struct user_pager_info *pager,
vm_offset_t page,
vm_address_t buf)
{
- assert (0);
+ assert_backtrace (0);
}
/* Never permit unlocks to succeed. */
@@ -102,7 +102,7 @@ void
pager_notify_evict (struct user_pager_info *pager,
vm_offset_t page)
{
- assert (!"unrequested notification on eviction");
+ assert_backtrace (!"unrequested notification on eviction");
}
/* Tell how big the file is. */
@@ -166,7 +166,7 @@ diskfs_get_filemap (struct node *np, vm_prot_t prot)
struct user_pager_info *upi;
mach_port_t right;
- assert (S_ISDIR (np->dn_stat.st_mode)
+ assert_backtrace (S_ISDIR (np->dn_stat.st_mode)
|| S_ISREG (np->dn_stat.st_mode)
|| S_ISLNK (np->dn_stat.st_mode));
diff --git a/isofs/rr.c b/isofs/rr.c
index 59205da1..85aa5695 100644
--- a/isofs/rr.c
+++ b/isofs/rr.c
@@ -280,7 +280,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr,
nmbuf = malloc ((nmbufsize = nmlen) + 1);
else
nmbuf = realloc (nmbuf, (nmbufsize += nmlen) + 1);
- assert (nmbuf);
+ assert_backtrace (nmbuf);
memcpy (nmbuf + nmbufsize - nmlen, nm->name, nmlen);
@@ -307,7 +307,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr,
if (name != nmbuf)
{
rr->name = strdup (name);
- assert (rr->name);
+ assert_backtrace (rr->name);
}
else
{
@@ -373,7 +373,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr,
}
else while (targused + cnamelen > targalloced)
rr->target = realloc (rr->target, targalloced *= 2);
- assert (rr->target);
+ assert_backtrace (rr->target);
memcpy (rr->target + targused, cname, cnamelen);
targused += cnamelen;
@@ -389,7 +389,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr,
slbuf = malloc (slbufsize = crlen);
else
slbuf = realloc (slbuf, slbufsize += crlen);
- assert (slbuf);
+ assert_backtrace (slbuf);
memcpy (slbuf + slbufsize - crlen, sl->data, crlen);
@@ -572,7 +572,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr,
rr->translen = tr->len;
rr->trans = malloc (rr->translen);
- assert (rr->trans);
+ assert_backtrace (rr->trans);
memcpy (tr->data, rr->trans, rr->translen);
rr->valid |= VALID_TR;
diff --git a/libcons/cons-switch.c b/libcons/cons-switch.c
index d8af50af..c46dfb46 100644
--- a/libcons/cons-switch.c
+++ b/libcons/cons-switch.c
@@ -19,7 +19,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <errno.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pthread.h>
#include "cons.h"
@@ -56,7 +56,7 @@ cons_switch (vcons_t vcons, int id, int delta, vcons_t *r_vcons)
}
else
{
- assert (delta < 0);
+ assert_backtrace (delta < 0);
vcons_entry = vcons->vcons_entry;
while (delta++ < 0)
{
diff --git a/libcons/dir-changed.c b/libcons/dir-changed.c
index 8498649c..06c29701 100644
--- a/libcons/dir-changed.c
+++ b/libcons/dir-changed.c
@@ -20,7 +20,7 @@
#include <errno.h>
#include <dirent.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <mach.h>
#include <pthread.h>
@@ -88,14 +88,14 @@ cons_S_dir_changed (cons_notify_t notify, natural_t tickno,
}
while (dent && !err);
if (err)
- assert ("Unexpected error"); /* XXX */
+ assert_backtrace ("Unexpected error"); /* XXX */
}
break;
case DIR_CHANGED_NEW:
{
err = add_one (cons, name);
if (err)
- assert ("Unexpected error"); /* XXX */
+ assert_backtrace ("Unexpected error"); /* XXX */
}
break;
case DIR_CHANGED_UNLINK:
@@ -120,7 +120,7 @@ cons_S_dir_changed (cons_notify_t notify, natural_t tickno,
break;
case DIR_CHANGED_RENUMBER:
default:
- assert ("Unexpected dir-changed type.");
+ assert_backtrace ("Unexpected dir-changed type.");
pthread_mutex_unlock (&cons->lock);
return EINVAL;
}
diff --git a/libcons/file-changed.c b/libcons/file-changed.c
index fa5cebd7..e3e35635 100644
--- a/libcons/file-changed.c
+++ b/libcons/file-changed.c
@@ -19,7 +19,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <errno.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pthread.h>
#include <mach.h>
@@ -198,7 +198,7 @@ cons_S_file_changed (cons_notify_t notify, natural_t tickno,
vcons->state.screen.scr_lines
= vcons->display->screen.scr_lines;
if (vcons->state.screen.scr_lines < vcons->scrolling)
- assert (!"Implement shrinking scrollback buffer! XXX");
+ assert_backtrace (!"Implement shrinking scrollback buffer! XXX");
}
if (change.what.bell_audible)
{
diff --git a/libcons/vcons-close.c b/libcons/vcons-close.c
index 554bfa80..1a2a6024 100644
--- a/libcons/vcons-close.c
+++ b/libcons/vcons-close.c
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd.h>
#include <hurd/ports.h>
@@ -35,7 +35,7 @@ cons_vcons_close (vcons_t vcons)
pthread_mutex_lock (&cons->lock);
/* The same virtual console should never be opened twice. */
- assert (vcons_entry->vcons == vcons);
+ assert_backtrace (vcons_entry->vcons == vcons);
vcons_entry->vcons = NULL;
pthread_mutex_unlock (&cons->lock);
diff --git a/libcons/vcons-refresh.c b/libcons/vcons-refresh.c
index ce6807fe..beb36d85 100644
--- a/libcons/vcons-refresh.c
+++ b/libcons/vcons-refresh.c
@@ -19,7 +19,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <errno.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include "cons.h"
#include "priv.h"
diff --git a/libcons/vcons-remove.c b/libcons/vcons-remove.c
index 273c5a0f..39df86a6 100644
--- a/libcons/vcons-remove.c
+++ b/libcons/vcons-remove.c
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include "cons.h"
@@ -27,5 +27,5 @@
void __attribute__ ((weak))
cons_vcons_remove (cons_t cons, vcons_list_t vcons_entry)
{
- assert (!vcons_entry->vcons);
+ assert_backtrace (!vcons_entry->vcons);
}
diff --git a/libdiskfs/boot-start.c b/libdiskfs/boot-start.c
index f048badf..d0044478 100644
--- a/libdiskfs/boot-start.c
+++ b/libdiskfs/boot-start.c
@@ -73,18 +73,18 @@ get_console ()
void
_diskfs_boot_privports (void)
{
- assert (diskfs_boot_filesystem ());
+ assert_backtrace (diskfs_boot_filesystem ());
if (_hurd_host_priv == MACH_PORT_NULL)
{
/* We are the boot command run by the real bootstrap filesystem.
We get the privileged ports from it as init would. */
mach_port_t bootstrap;
error_t err = task_get_bootstrap_port (mach_task_self (), &bootstrap);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = fsys_getpriv (bootstrap, &_hurd_host_priv, &_hurd_device_master,
&parent_task);
mach_port_deallocate (mach_task_self (), bootstrap);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
}
@@ -113,10 +113,10 @@ diskfs_start_bootstrap ()
/* Create the port for current and root directory. */
err = diskfs_make_peropen (diskfs_root_node, O_READ | O_EXEC, 0,
&rootpo);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = diskfs_create_protid (rootpo, 0, &rootpi);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* Get us a send right to copy around. */
root_pt = ports_get_send_right (rootpi);
@@ -128,8 +128,8 @@ diskfs_start_bootstrap ()
Our parent (the real bootstrap filesystem) provides us a root
directory where we look up /servers/exec like any non-bootstrap
filesystem would. */
- assert (_hurd_ports);
- assert (_hurd_ports[INIT_PORT_CRDIR].port != MACH_PORT_NULL);
+ assert_backtrace (_hurd_ports);
+ assert_backtrace (_hurd_ports[INIT_PORT_CRDIR].port != MACH_PORT_NULL);
diskfs_exec = file_name_lookup (_SERVERS_EXEC, 0, 0);
if (diskfs_exec == MACH_PORT_NULL)
error (1, errno, "%s", _SERVERS_EXEC);
@@ -139,7 +139,7 @@ diskfs_start_bootstrap ()
/* Make sure this is really a port to another server. */
struct port_info *pi = ports_lookup_port (diskfs_port_bucket,
diskfs_exec, 0);
- assert (!pi);
+ assert_backtrace (!pi);
#endif
}
@@ -165,16 +165,16 @@ diskfs_start_bootstrap ()
start_execserver ();
pthread_cond_wait (&execstarted, &execstartlock);
pthread_mutex_unlock (&execstartlock);
- assert (diskfs_exec_ctl != MACH_PORT_NULL);
+ assert_backtrace (diskfs_exec_ctl != MACH_PORT_NULL);
/* Contact the exec server. */
err = fsys_getroot (diskfs_exec_ctl, root_pt, MACH_MSG_TYPE_COPY_SEND,
idlist, 3, idlist, 3, 0,
&retry, retry_name, &diskfs_exec);
- assert_perror (err);
- assert (retry == FS_RETRY_NORMAL);
- assert (retry_name[0] == '\0');
- assert (diskfs_exec != MACH_PORT_NULL);
+ assert_perror_backtrace (err);
+ assert_backtrace (retry == FS_RETRY_NORMAL);
+ assert_backtrace (retry_name[0] == '\0');
+ assert_backtrace (diskfs_exec != MACH_PORT_NULL);
/* Attempt to set the active translator for the exec server so that
filesystems other than the bootstrap can find it. */
@@ -187,14 +187,14 @@ diskfs_start_bootstrap ()
}
else
{
- assert (retry == FS_RETRY_NORMAL);
- assert (retry_name[0] == '\0');
- assert (execnode != MACH_PORT_NULL);
+ assert_backtrace (retry == FS_RETRY_NORMAL);
+ assert_backtrace (retry_name[0] == '\0');
+ assert_backtrace (execnode != MACH_PORT_NULL);
err = file_set_translator (execnode, 0, FS_TRANS_SET, 0, 0, 0,
diskfs_exec_ctl, MACH_MSG_TYPE_COPY_SEND);
mach_port_deallocate (mach_task_self (), diskfs_exec_ctl);
mach_port_deallocate (mach_task_self (), execnode);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
diskfs_exec_ctl = MACH_PORT_NULL; /* Not used after this. */
}
@@ -206,7 +206,7 @@ diskfs_start_bootstrap ()
{
/* We have a boot command line to run instead of init. */
err = argz_create (_diskfs_boot_command, &exec_argv, &exec_argvlen);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
else
{
@@ -216,11 +216,11 @@ diskfs_start_bootstrap ()
initname++;
int len = asprintf (&exec_argv, "/%s%c", initname, '\0');
- assert (len != -1);
+ assert_backtrace (len != -1);
exec_argvlen = (size_t) len;
err = argz_add_sep (&exec_argv, &exec_argvlen,
diskfs_boot_command_line, ' ');
- assert_perror (err);
+ assert_perror_backtrace (err);
}
err = task_create (mach_task_self (),
@@ -228,7 +228,7 @@ diskfs_start_bootstrap ()
NULL, 0, /* OSF Mach */
#endif
0, &newt);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (MACH_PORT_VALID (diskfs_kernel_task))
{
@@ -246,11 +246,11 @@ diskfs_start_bootstrap ()
diskfs_kernel_task = MACH_PORT_NULL;
len = snprintf (buf, sizeof buf, "--kernel-task=%d", kernel_task_name);
- assert (len < sizeof buf);
+ assert_backtrace (len < sizeof buf);
/* Insert as second argument. */
err = argz_insert (&exec_argv, &exec_argvlen,
argz_next (exec_argv, exec_argvlen, exec_argv), buf);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
initname = exec_argv;
@@ -267,11 +267,11 @@ diskfs_start_bootstrap ()
initname, strerror (err));
fflush (stdout);
free (exec_argv);
- assert_perror (err); /* XXX this won't reboot properly */
+ assert_perror_backtrace (err); /* XXX this won't reboot properly */
}
else if (retry == FS_RETRY_MAGICAL && pathbuf[0] == '/')
{
- assert (sysconf (_SC_SYMLOOP_MAX) < 0 ||
+ assert_backtrace (sysconf (_SC_SYMLOOP_MAX) < 0 ||
init_lookups < sysconf (_SC_SYMLOOP_MAX));
/* INITNAME is a symlink with an absolute target, so try again. */
@@ -279,12 +279,12 @@ diskfs_start_bootstrap ()
goto lookup_init;
}
- assert (retry == FS_RETRY_NORMAL);
- assert (pathbuf[0] == '\0');
+ assert_backtrace (retry == FS_RETRY_NORMAL);
+ assert_backtrace (pathbuf[0] == '\0');
err = ports_create_port (diskfs_initboot_class, diskfs_port_bucket,
sizeof (struct port_info), &bootinfo);
- assert_perror (err);
+ assert_perror_backtrace (err);
bootpt = ports_get_send_right (bootinfo);
ports_port_deref (bootinfo);
@@ -298,7 +298,7 @@ diskfs_start_bootstrap ()
fdarray[0] = fdarray[1] = fdarray[2] = get_console (); /* XXX */
err = argz_create (environ, &exec_env, &exec_envlen);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (_diskfs_boot_pause)
{
@@ -383,10 +383,10 @@ diskfs_S_exec_startup_get_info (struct bootinfo *upt,
*intarraylen = 0;
err = diskfs_make_peropen (diskfs_root_node, O_READ | O_EXEC, 0, &rootpo);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = diskfs_create_protid (rootpo, 0, &rootpi);
- assert_perror (err);
+ assert_perror_backtrace (err);
rootport = ports_get_right (rootpi);
ports_port_deref (rootpi);
@@ -425,17 +425,17 @@ diskfs_execboot_fsys_startup (mach_port_t port, int flags,
return EOPNOTSUPP;
err = diskfs_make_peropen (diskfs_root_node, flags, 0, &rootpo);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = diskfs_create_protid (rootpo, 0, &rootpi);
- assert_perror (err);
+ assert_perror_backtrace (err);
rootport = ports_get_send_right (rootpi);
ports_port_deref (rootpi);
err = dir_lookup (rootport, _SERVERS_EXEC, flags|O_NOTRANS, 0,
&retry, pathbuf, real);
- assert_perror (err);
- assert (retry == FS_RETRY_NORMAL);
- assert (pathbuf[0] == '\0');
+ assert_perror_backtrace (err);
+ assert_backtrace (retry == FS_RETRY_NORMAL);
+ assert_backtrace (pathbuf[0] == '\0');
*realpoly = MACH_MSG_TYPE_MOVE_SEND;
mach_port_deallocate (mach_task_self (), rootport);
@@ -506,10 +506,10 @@ diskfs_S_fsys_init (struct diskfs_control *pt,
for the library itself. */
err = mach_port_mod_refs (mach_task_self (),
procserver, MACH_PORT_RIGHT_SEND, +1);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = mach_port_mod_refs (mach_task_self (),
authhandle, MACH_PORT_RIGHT_SEND, +1);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (diskfs_auth_server_port != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), diskfs_auth_server_port);
@@ -519,7 +519,7 @@ diskfs_S_fsys_init (struct diskfs_control *pt,
{
process_t execprocess;
err = proc_task2proc (procserver, diskfs_exec_server_task, &execprocess);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* Declare that the exec server is our child. */
proc_child (procserver, diskfs_exec_server_task);
@@ -541,7 +541,7 @@ diskfs_S_fsys_init (struct diskfs_control *pt,
mach_port_t bootstrap;
process_t parent_proc;
- assert (parent_task != MACH_PORT_NULL);
+ assert_backtrace (parent_task != MACH_PORT_NULL);
/* Tell the proc server that our parent task is our child. This
makes the process hierarchy fail to represent the real order of
@@ -553,12 +553,12 @@ diskfs_S_fsys_init (struct diskfs_control *pt,
we send it fsys_init (below). */
err = proc_child (procserver, parent_task);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* Get the parent's proc server port so we can send it in the fsys_init
RPC just as init would. */
err = proc_task2proc (procserver, parent_task, &parent_proc);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* We don't need this anymore. */
mach_port_deallocate (mach_task_self (), parent_task);
@@ -569,20 +569,20 @@ diskfs_S_fsys_init (struct diskfs_control *pt,
/* Give our parent (the real bootstrap filesystem) an fsys_init
RPC of its own, as init would have sent it. */
err = task_get_bootstrap_port (mach_task_self (), &bootstrap);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = fsys_init (bootstrap, parent_proc, MACH_MSG_TYPE_COPY_SEND,
authhandle);
mach_port_deallocate (mach_task_self (), parent_proc);
mach_port_deallocate (mach_task_self (), bootstrap);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
/* Get a port to the root directory to put in the library's
data structures. */
err = diskfs_make_peropen (diskfs_root_node, O_READ|O_EXEC, 0, &rootpo);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = diskfs_create_protid (rootpo, 0, &rootpi);
- assert_perror (err);
+ assert_perror_backtrace (err);
root_pt = ports_get_send_right (rootpi);
ports_port_deref (rootpi);
@@ -656,17 +656,17 @@ start_execserver (void)
extern task_t diskfs_exec_server_task; /* Set in opts-std-startup.c. */
struct port_info *execboot_info;
- assert (diskfs_exec_server_task != MACH_PORT_NULL);
+ assert_backtrace (diskfs_exec_server_task != MACH_PORT_NULL);
err = ports_create_port (diskfs_execboot_class, diskfs_port_bucket,
sizeof (struct port_info), &execboot_info);
- assert_perror (err);
+ assert_perror_backtrace (err);
right = ports_get_send_right (execboot_info);
ports_port_deref (execboot_info);
err = task_set_special_port (diskfs_exec_server_task, TASK_BOOTSTRAP_PORT, right);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = mach_port_deallocate (mach_task_self (), right);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (_diskfs_boot_pause)
{
@@ -675,7 +675,7 @@ start_execserver (void)
getc (stdin);
}
err = task_resume (diskfs_exec_server_task);
- assert_perror (err);
+ assert_perror_backtrace (err);
printf (" exec");
fflush (stdout);
diff --git a/libdiskfs/console.c b/libdiskfs/console.c
index a4c3a1af..74715b8b 100644
--- a/libdiskfs/console.c
+++ b/libdiskfs/console.c
@@ -24,7 +24,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <mach/mach.h>
#include <device/device.h>
@@ -60,10 +60,10 @@ diskfs_console_stdio ()
if (diskfs_boot_filesystem ())
_diskfs_boot_privports ();
err = get_privileged_ports (NULL, &dev);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = device_open (dev, D_READ|D_WRITE, "console", &cons);
mach_port_deallocate (mach_task_self (), dev);
- assert_perror (err);
+ assert_perror_backtrace (err);
stdin = mach_open_devstream (cons, "r");
stdout = stderr = mach_open_devstream (cons, "w");
mach_port_deallocate (mach_task_self (), cons);
diff --git a/libdiskfs/dir-clear.c b/libdiskfs/dir-clear.c
index 7cf32358..02a800ed 100644
--- a/libdiskfs/dir-clear.c
+++ b/libdiskfs/dir-clear.c
@@ -31,10 +31,10 @@ diskfs_clear_directory (struct node *dp,
/* Find and remove the `.' entry. */
err = diskfs_lookup (dp, ".", REMOVE, &np, ds, cred);
- assert (err != ENOENT);
+ assert_backtrace (err != ENOENT);
if (!err)
{
- assert (np == dp);
+ assert_backtrace (np == dp);
err = diskfs_dirremove (dp, np, ".", ds);
diskfs_nrele (np);
}
@@ -49,10 +49,10 @@ diskfs_clear_directory (struct node *dp,
/* Find and remove the `..' entry. */
err = diskfs_lookup (dp, "..", REMOVE | SPEC_DOTDOT, &np, ds, cred);
- assert (err != ENOENT);
+ assert_backtrace (err != ENOENT);
if (!err)
{
- assert (np == pdp);
+ assert_backtrace (np == pdp);
err = diskfs_dirremove (dp, np, "..", ds);
}
else
diff --git a/libdiskfs/dir-init.c b/libdiskfs/dir-init.c
index 8301ca1b..a085a00a 100644
--- a/libdiskfs/dir-init.c
+++ b/libdiskfs/dir-init.c
@@ -43,7 +43,7 @@ diskfs_init_dir (struct node *dp, struct node *pdp, struct protid *cred)
dp->dn_stat.st_nlink++; /* for `.' */
dp->dn_set_ctime = 1;
err = diskfs_lookup (dp, ".", CREATE, &foo, ds, &lookupcred);
- assert (err == ENOENT);
+ assert_backtrace (err == ENOENT);
err = diskfs_direnter (dp, ".", dp, ds, cred);
if (err)
{
@@ -55,7 +55,7 @@ diskfs_init_dir (struct node *dp, struct node *pdp, struct protid *cred)
pdp->dn_stat.st_nlink++; /* for `..' */
pdp->dn_set_ctime = 1;
err = diskfs_lookup (dp, "..", CREATE, &foo, ds, &lookupcred);
- assert (err == ENOENT);
+ assert_backtrace (err == ENOENT);
err = diskfs_direnter (dp, "..", pdp, ds, cred);
if (err)
{
diff --git a/libdiskfs/dir-link.c b/libdiskfs/dir-link.c
index ca5dd561..403e9d5c 100644
--- a/libdiskfs/dir-link.c
+++ b/libdiskfs/dir-link.c
@@ -106,7 +106,7 @@ diskfs_S_dir_link (struct protid *dircred,
/* Attach it */
if (tnp)
{
- assert (!excl);
+ assert_backtrace (!excl);
err = diskfs_dirrewrite (dnp, tnp, np, name, ds);
if (!err)
{
diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c
index 8b43e27b..3c7198fb 100644
--- a/libdiskfs/dir-lookup.c
+++ b/libdiskfs/dir-lookup.c
@@ -100,7 +100,7 @@ diskfs_S_dir_lookup (struct protid *dircred,
do
{
- assert (!lastcomp);
+ assert_backtrace (!lastcomp);
/* Find the name of the next pathname component */
nextname = index (filename, '/');
@@ -377,7 +377,7 @@ diskfs_S_dir_lookup (struct protid *dircred,
0, np->dn_stat.st_size, 0,
dircred, &amt);
if (!err)
- assert (amt == np->dn_stat.st_size);
+ assert_backtrace (amt == np->dn_stat.st_size);
}
if (err)
goto out;
diff --git a/libdiskfs/dir-renamed.c b/libdiskfs/dir-renamed.c
index a4878f3d..772258d2 100644
--- a/libdiskfs/dir-renamed.c
+++ b/libdiskfs/dir-renamed.c
@@ -93,7 +93,7 @@ diskfs_rename_dir (struct node *fdp, struct node *fnp, const char *fromname,
/* 1: Lookup target; if it exists, make sure it's an empty directory. */
ds = buf;
err = diskfs_lookup (tdp, toname, RENAME, &tnp, ds, tocred);
- assert (err != EAGAIN); /* <-> assert (TONAME != "..") */
+ assert_backtrace (err != EAGAIN); /* <-> assert_backtrace (TONAME != "..") */
if (err && err != ENOENT)
goto out;
@@ -110,7 +110,7 @@ diskfs_rename_dir (struct node *fdp, struct node *fnp, const char *fromname,
/* Check permissions to remove FROMNAME and lock FNP. */
tmpds = alloca (diskfs_dirstat_size);
err = diskfs_lookup (fdp, fromname, REMOVE, &tmpnp, tmpds, fromcred);
- assert (!tmpnp || tmpnp == fnp);
+ assert_backtrace (!tmpnp || tmpnp == fnp);
if (tmpnp)
diskfs_nrele (tmpnp);
diskfs_drop_dirstat (fdp, tmpds);
@@ -144,13 +144,13 @@ diskfs_rename_dir (struct node *fdp, struct node *fnp, const char *fromname,
tmpds = alloca (diskfs_dirstat_size);
err = diskfs_lookup (fnp, "..", RENAME | SPEC_DOTDOT,
&tmpnp, tmpds, fromcred);
- assert (err != ENOENT);
+ assert_backtrace (err != ENOENT);
if (err)
{
diskfs_drop_dirstat (fnp, tmpds);
goto out;
}
- assert (tmpnp == fdp);
+ assert_backtrace (tmpnp == fdp);
err = diskfs_dirrewrite (fnp, fdp, tdp, "..", tmpds);
if (diskfs_synchronous)
@@ -207,12 +207,12 @@ diskfs_rename_dir (struct node *fdp, struct node *fnp, const char *fromname,
ds = buf;
pthread_mutex_unlock (&fnp->lock);
err = diskfs_lookup (fdp, fromname, REMOVE, &tmpnp, ds, fromcred);
- assert (!tmpnp || tmpnp == fnp);
+ assert_backtrace (!tmpnp || tmpnp == fnp);
if (tmpnp)
diskfs_nrele (tmpnp);
if (err)
{
- assert (!tmpnp);
+ assert_backtrace (!tmpnp);
/* diskfs_lookup has not locked fnp then, do not unlock it. */
fnp = NULL;
goto out;
diff --git a/libdiskfs/disk-pager.c b/libdiskfs/disk-pager.c
index 434ceed9..1a5d8bf2 100644
--- a/libdiskfs/disk-pager.c
+++ b/libdiskfs/disk-pager.c
@@ -93,10 +93,10 @@ fault_handler (int sig, long int sigcode, struct sigcontext *scp)
sig, sigcode,
preemptor.first, preemptor.last,
scp->sc_pc, scp->sc_error);
- assert (scp->sc_error == EKERN_MEMORY_ERROR);
+ assert_backtrace (scp->sc_error == EKERN_MEMORY_ERROR);
err = pager_get_error (diskfs_disk_pager, sigcode);
- assert (err);
- assert_perror (err);
+ assert_backtrace (err);
+ assert_perror_backtrace (err);
}
#endif
@@ -104,9 +104,9 @@ fault_handler (int sig, long int sigcode, struct sigcontext *scp)
diskfs_exception_diu = NULL;
/* Fetch the error code from the pager. */
- assert (scp->sc_error == EKERN_MEMORY_ERROR);
+ assert_backtrace (scp->sc_error == EKERN_MEMORY_ERROR);
err = pager_get_error (diskfs_disk_pager, sigcode);
- assert (err);
+ assert_backtrace (err);
/* Make `diskfault_catch' return the error code. */
longjmp (diskfs_exception_diu->env, err);
diff --git a/libdiskfs/diskfs-pager.h b/libdiskfs/diskfs-pager.h
index 550ca644..e8227413 100644
--- a/libdiskfs/diskfs-pager.h
+++ b/libdiskfs/diskfs-pager.h
@@ -24,7 +24,7 @@
#include <setjmp.h>
#include <pthread.h>
#include <errno.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <stdlib.h>
extern __thread struct disk_image_user *diskfs_exception_diu;
diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h
index 106aeb06..ea79a1d2 100644
--- a/libdiskfs/diskfs.h
+++ b/libdiskfs/diskfs.h
@@ -20,7 +20,7 @@
#ifndef _HURD_DISKFS
#define _HURD_DISKFS
-#include <assert.h>
+#include <assert-backtrace.h>
#include <unistd.h>
#include <pthread.h>
#include <hurd/ports.h>
diff --git a/libdiskfs/file-get-trans.c b/libdiskfs/file-get-trans.c
index e6e994df..be07605c 100644
--- a/libdiskfs/file-get-trans.c
+++ b/libdiskfs/file-get-trans.c
@@ -42,7 +42,7 @@ diskfs_S_file_get_translator (struct protid *cred,
{
unsigned int len = sizeof _HURD_SYMLINK + np->dn_stat.st_size + 1;
size_t amt;
- assert (diskfs_shortcut_symlink);
+ assert_backtrace (diskfs_shortcut_symlink);
if (len > *translen)
*trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
memcpy (*trans, _HURD_SYMLINK, sizeof _HURD_SYMLINK);
@@ -55,7 +55,7 @@ diskfs_S_file_get_translator (struct protid *cred,
err = diskfs_node_rdwr (np, *trans + sizeof _HURD_SYMLINK,
0, np->dn_stat.st_size, 0, cred, &amt);
if (!err)
- assert (amt == np->dn_stat.st_size);
+ assert_backtrace (amt == np->dn_stat.st_size);
}
if (!err)
{
@@ -71,9 +71,9 @@ diskfs_S_file_get_translator (struct protid *cred,
unsigned int buflen;
if (S_ISCHR (np->dn_stat.st_mode))
- assert (diskfs_shortcut_chrdev);
+ assert_backtrace (diskfs_shortcut_chrdev);
else
- assert (diskfs_shortcut_blkdev);
+ assert_backtrace (diskfs_shortcut_blkdev);
buflen = asprintf (&buf, "%s%c%d%c%d",
(S_ISCHR (np->dn_stat.st_mode)
diff --git a/libdiskfs/file-getfh.c b/libdiskfs/file-getfh.c
index e4bc8921..ce5c1998 100644
--- a/libdiskfs/file-getfh.c
+++ b/libdiskfs/file-getfh.c
@@ -37,7 +37,7 @@ diskfs_S_file_getfh (struct protid *cred, char **fh, size_t *fh_len)
if (! idvec_contains (cred->user->uids, 0))
return EPERM;
- assert (sizeof *f == sizeof f->bytes);
+ assert_backtrace (sizeof *f == sizeof f->bytes);
node = cred->po->np;
diff --git a/libdiskfs/file-set-trans.c b/libdiskfs/file-set-trans.c
index 3238037a..6a73e23c 100644
--- a/libdiskfs/file-set-trans.c
+++ b/libdiskfs/file-set-trans.c
@@ -141,7 +141,7 @@ diskfs_S_file_set_translator (struct protid *cred,
char *arg;
arg = passive + strlen (passive) + 1;
- assert (arg <= passive + passivelen);
+ assert_backtrace (arg <= passive + passivelen);
if (arg == passive + passivelen)
{
pthread_mutex_unlock (&np->lock);
@@ -150,7 +150,7 @@ diskfs_S_file_set_translator (struct protid *cred,
major = strtol (arg, 0, 0);
arg = arg + strlen (arg) + 1;
- assert (arg < passive + passivelen);
+ assert_backtrace (arg < passive + passivelen);
if (arg == passive + passivelen)
{
pthread_mutex_unlock (&np->lock);
@@ -185,7 +185,7 @@ diskfs_S_file_set_translator (struct protid *cred,
if (newmode == S_IFLNK)
{
char *arg = passive + strlen (passive) + 1;
- assert (arg <= passive + passivelen);
+ assert_backtrace (arg <= passive + passivelen);
if (arg == passive + passivelen)
{
pthread_mutex_unlock (&np->lock);
diff --git a/libdiskfs/init-main.c b/libdiskfs/init-main.c
index 3e03ae4e..5c29b7b8 100644
--- a/libdiskfs/init-main.c
+++ b/libdiskfs/init-main.c
@@ -19,7 +19,7 @@
#include "diskfs.h"
#include <argp.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <error.h>
#include <hurd/store.h>
@@ -37,7 +37,7 @@ diskfs_init_main (struct argp *startup_argp,
err = argp_parse (startup_argp ?: &diskfs_store_startup_argp,
argc, argv, ARGP_IN_ORDER, NULL,
&store_params);
- assert_perror (err);
+ assert_perror_backtrace (err);
*store_parsed = store_params.result;
err = store_parsed_name (*store_parsed, &diskfs_disk_name);
diff --git a/libdiskfs/init-startup.c b/libdiskfs/init-startup.c
index c1407ed4..a2e3638d 100644
--- a/libdiskfs/init-startup.c
+++ b/libdiskfs/init-startup.c
@@ -56,9 +56,9 @@ diskfs_startup_diskfs (mach_port_t bootstrap, int flags)
/* Create a protid we can use in diskfs_lookup. */
err = diskfs_make_peropen (diskfs_root_node, O_READ|O_EXEC,
0, &rootpo);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = diskfs_create_protid (rootpo, 0, &rootpi);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* Look up the directory name. */
err = diskfs_lookup (diskfs_root_node, _diskfs_chroot_directory,
@@ -185,7 +185,7 @@ _diskfs_init_completed ()
If we get an error, print an informational message. */
proc = getproc ();
- assert (proc);
+ assert_backtrace (proc);
err = ports_create_port (diskfs_shutdown_notification_class,
diskfs_port_bucket, sizeof (struct port_info),
diff --git a/libdiskfs/io-map-cntl.c b/libdiskfs/io-map-cntl.c
index 2e9b9e98..4a9b1f61 100644
--- a/libdiskfs/io-map-cntl.c
+++ b/libdiskfs/io-map-cntl.c
@@ -28,7 +28,7 @@ diskfs_S_io_map_cntl (struct protid *cred,
if (!cred)
return EOPNOTSUPP;
- assert (__vm_page_size >= sizeof (struct shared_io));
+ assert_backtrace (__vm_page_size >= sizeof (struct shared_io));
pthread_mutex_lock (&cred->po->np->lock);
if (!cred->mapped)
{
diff --git a/libdiskfs/io-reauthenticate.c b/libdiskfs/io-reauthenticate.c
index 985db498..1b88a3b2 100644
--- a/libdiskfs/io-reauthenticate.c
+++ b/libdiskfs/io-reauthenticate.c
@@ -47,7 +47,7 @@ diskfs_S_io_reauthenticate (struct protid *cred,
}
newright = ports_get_send_right (newcred);
- assert (newright != MACH_PORT_NULL);
+ assert_backtrace (newright != MACH_PORT_NULL);
/* Release the node lock while blocking on the auth server and client. */
pthread_mutex_unlock (&cred->po->np->lock);
diff --git a/libdiskfs/io-write.c b/libdiskfs/io-write.c
index 2967c4c8..f3e191b6 100644
--- a/libdiskfs/io-write.c
+++ b/libdiskfs/io-write.c
@@ -40,7 +40,7 @@ diskfs_S_io_write (struct protid *cred,
pthread_mutex_lock (&np->lock);
- assert (!S_ISDIR(np->dn_stat.st_mode));
+ assert_backtrace (!S_ISDIR(np->dn_stat.st_mode));
iohelp_get_conch (&np->conch);
diff --git a/libdiskfs/lookup.c b/libdiskfs/lookup.c
index 486fedce..b6193657 100644
--- a/libdiskfs/lookup.c
+++ b/libdiskfs/lookup.c
@@ -78,7 +78,7 @@ diskfs_lookup (struct node *dp, const char *name, enum lookup_type type,
struct node *cached;
if (type == REMOVE || type == RENAME)
- assert (np);
+ assert_backtrace (np);
if (!S_ISDIR (dp->dn_stat.st_mode))
{
diff --git a/libdiskfs/name-cache.c b/libdiskfs/name-cache.c
index 53935ab3..99591754 100644
--- a/libdiskfs/name-cache.c
+++ b/libdiskfs/name-cache.c
@@ -20,7 +20,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "priv.h"
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/ihash.h>
#include <string.h>
@@ -93,7 +93,7 @@ add_entry (struct cache_bucket *b, int i,
free (charp (b->name[i]));
b->name[i] = (unsigned long) strdup (name);
- assert ((b->name[i] & 3) == 0);
+ assert_backtrace ((b->name[i] & 3) == 0);
if (b->name[i] == 0)
return;
diff --git a/libdiskfs/node-cache.c b/libdiskfs/node-cache.c
index ee7e6fdb..d2815883 100644
--- a/libdiskfs/node-cache.c
+++ b/libdiskfs/node-cache.c
@@ -105,7 +105,7 @@ diskfs_cached_lookup_context (ino_t inum, struct node **npp,
err = hurd_ihash_locp_add (&nodecache, slot,
(hurd_ihash_key_t) &np->cache_id, np);
- assert_perror (err);
+ assert_perror_backtrace (err);
diskfs_nref_light (np);
pthread_rwlock_unlock (&nodecache_lock);
@@ -138,7 +138,7 @@ diskfs_cached_ifind (ino_t inum)
np = hurd_ihash_find (&nodecache, (hurd_ihash_key_t) &inum);
pthread_rwlock_unlock (&nodecache_lock);
- assert (np);
+ assert_backtrace (np);
return np;
}
@@ -233,7 +233,7 @@ diskfs_node_iterate (error_t (*fun)(struct node *))
error_t __attribute__ ((weak))
diskfs_user_make_node (struct node **npp, struct lookup_context *ctx)
{
- assert (! "diskfs_user_make_node not implemented");
+ assert_backtrace (! "diskfs_user_make_node not implemented");
}
/* The user must define this function if she wants to use the node
@@ -241,7 +241,7 @@ diskfs_user_make_node (struct node **npp, struct lookup_context *ctx)
error_t __attribute__ ((weak))
diskfs_user_read_node (struct node *np, struct lookup_context *ctx)
{
- assert (! "diskfs_user_read_node not implemented");
+ assert_backtrace (! "diskfs_user_read_node not implemented");
}
/* The user must define this function if she wants to use the node
@@ -250,5 +250,5 @@ diskfs_user_read_node (struct node *np, struct lookup_context *ctx)
void __attribute__ ((weak))
diskfs_user_try_dropping_softrefs (struct node *np)
{
- assert (! "diskfs_user_try_dropping_softrefs not implemented");
+ assert_backtrace (! "diskfs_user_try_dropping_softrefs not implemented");
}
diff --git a/libdiskfs/node-drop.c b/libdiskfs/node-drop.c
index 455031bc..aa00cf05 100644
--- a/libdiskfs/node-drop.c
+++ b/libdiskfs/node-drop.c
@@ -41,7 +41,7 @@ diskfs_drop_node (struct node *np)
if (np->dn_stat.st_nlink == 0)
{
diskfs_check_readonly ();
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
if (np->dn_stat.st_mode & S_IPTRANS)
diskfs_set_translator (np, 0, 0, 0);
@@ -70,7 +70,7 @@ diskfs_drop_node (struct node *np)
return;
}
- assert (np->dn_stat.st_size == 0);
+ assert_backtrace (np->dn_stat.st_size == 0);
savemode = np->dn_stat.st_mode;
np->dn_stat.st_mode = 0;
@@ -89,7 +89,7 @@ diskfs_drop_node (struct node *np)
if (np->filemod_reqs)
free_modreqs (np->filemod_reqs);
- assert (!np->sockaddr);
+ assert_backtrace (!np->sockaddr);
pthread_mutex_unlock(&np->lock);
pthread_mutex_destroy(&np->lock);
diff --git a/libdiskfs/priv.h b/libdiskfs/priv.h
index 276d0931..bece45a0 100644
--- a/libdiskfs/priv.h
+++ b/libdiskfs/priv.h
@@ -27,7 +27,7 @@
#include <hurd/fshelp.h>
#include <hurd/iohelp.h>
#include <hurd/port.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <argp.h>
#include "diskfs.h"
diff --git a/libdiskfs/protid-make.c b/libdiskfs/protid-make.c
index 0b092994..f8b5dcbd 100644
--- a/libdiskfs/protid-make.c
+++ b/libdiskfs/protid-make.c
@@ -17,7 +17,7 @@
#include "priv.h"
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
/* Build and return in CRED a protid which has no user identification, for
peropen PO. On success, consume a reference to PO. */
@@ -48,11 +48,11 @@ diskfs_finish_protid (struct protid *cred, struct iouser *user)
err = iohelp_create_simple_iouser (&cred->user, 0, 0);
else
err = iohelp_dup_iouser (&cred->user, user);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = mach_port_move_member (mach_task_self (), cred->pi.port_right,
diskfs_port_bucket->portset);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
/* Create and return a protid for an existing peropen PO in CRED for
diff --git a/libdiskfs/rdwr-internal.c b/libdiskfs/rdwr-internal.c
index 0d405517..eec0d6a0 100644
--- a/libdiskfs/rdwr-internal.c
+++ b/libdiskfs/rdwr-internal.c
@@ -39,7 +39,7 @@ _diskfs_rdwr_internal (struct node *np,
error_t err = 0;
if (dir)
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
if (*amt == 0)
/* Zero-length writes do not update mtime or anything else, by POSIX. */
diff --git a/libdiskfs/trans-callback.c b/libdiskfs/trans-callback.c
index 15e8f9a1..d08f91c6 100644
--- a/libdiskfs/trans-callback.c
+++ b/libdiskfs/trans-callback.c
@@ -38,7 +38,7 @@ _diskfs_translator_callback1_fn (void *cookie1, void *cookie2,
err = diskfs_get_translator (np, argz, (u_int *) argz_len);
if (err)
{
- assert (err != EOPNOTSUPP);
+ assert_backtrace (err != EOPNOTSUPP);
return err;
}
diff --git a/libfshelp/fetch-control.c b/libfshelp/fetch-control.c
index 91c65bb0..0a11197a 100644
--- a/libfshelp/fetch-control.c
+++ b/libfshelp/fetch-control.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "fshelp.h"
-#include <assert.h>
+#include <assert-backtrace.h>
error_t
fshelp_fetch_control (struct transbox *box,
@@ -34,7 +34,7 @@ fshelp_fetch_control (struct transbox *box,
if (err == KERN_INVALID_RIGHT)
{
err = mach_port_deallocate (mach_task_self (), *control);
- assert_perror (err);
+ assert_perror_backtrace (err);
*control = box->active = MACH_PORT_NULL;
}
diff --git a/libfshelp/fetch-root.c b/libfshelp/fetch-root.c
index 75aa2d37..0248f11d 100644
--- a/libfshelp/fetch-root.c
+++ b/libfshelp/fetch-root.c
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/fsys.h>
#include <hurd/paths.h>
#include <hurd/ports.h>
@@ -47,7 +47,7 @@ fshelp_fetch_root (struct transbox *box, void *cookie,
start_over:
if (box->active != MACH_PORT_NULL)
- assert ((box->flags & TRANSBOX_STARTING) == 0);
+ assert_backtrace ((box->flags & TRANSBOX_STARTING) == 0);
else
{
uid_t uid, gid;
diff --git a/libfshelp/get-identity.c b/libfshelp/get-identity.c
index 2dbd254c..17244dee 100644
--- a/libfshelp/get-identity.c
+++ b/libfshelp/get-identity.c
@@ -23,7 +23,7 @@
#include <hurd/ports.h>
#include <hurd/ihash.h>
#include <stddef.h>
-#include <assert.h>
+#include <assert-backtrace.h>
static struct port_class *idclass = 0;
static pthread_mutex_t idlock = PTHREAD_MUTEX_INITIALIZER;
@@ -49,7 +49,7 @@ id_clean (void *cookie)
static void
id_initialize ()
{
- assert (!idclass);
+ assert_backtrace (!idclass);
idclass = ports_create_class (id_clean, NULL);
}
diff --git a/libfshelp/lock-acquire.c b/libfshelp/lock-acquire.c
index 07df4283..47a63dab 100644
--- a/libfshelp/lock-acquire.c
+++ b/libfshelp/lock-acquire.c
@@ -19,7 +19,7 @@
/* Written by Michael I. Bushnell. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <sys/file.h>
#include "fshelp.h"
@@ -60,9 +60,9 @@ fshelp_acquire_lock (struct lock_box *box, int *user, pthread_mutex_t *mut,
if (*user & LOCK_UN)
return 0;
- assert (*user == box->type ||
+ assert_backtrace (*user == box->type ||
(*user == LOCK_SH && box->type == (LOCK_SH | LOCK_EX)));
- assert (*user == LOCK_SH || *user == LOCK_EX ||
+ assert_backtrace (*user == LOCK_SH || *user == LOCK_EX ||
*user == (LOCK_SH | LOCK_EX));
if (*user == LOCK_SH)
@@ -153,10 +153,10 @@ fshelp_acquire_lock (struct lock_box *box, int *user, pthread_mutex_t *mut,
return EINTR;
}
- assert ((flags & LOCK_SH) || (flags & LOCK_EX));
+ assert_backtrace ((flags & LOCK_SH) || (flags & LOCK_EX));
if (flags & LOCK_SH)
{
- assert (!(box->type & LOCK_EX));
+ assert_backtrace (!(box->type & LOCK_EX));
*user = LOCK_SH;
box->type = LOCK_SH;
box->shcount++;
@@ -182,7 +182,7 @@ fshelp_acquire_lock (struct lock_box *box, int *user, pthread_mutex_t *mut,
}
if (*user == LOCK_SH)
{
- assert (box->shcount == 1);
+ assert_backtrace (box->shcount == 1);
box->shcount = 0;
}
box->type = LOCK_EX;
diff --git a/libfshelp/start-translator-long.c b/libfshelp/start-translator-long.c
index da6f52e3..e1aea3c4 100644
--- a/libfshelp/start-translator-long.c
+++ b/libfshelp/start-translator-long.c
@@ -26,7 +26,7 @@
#include <fcntl.h>
#include <stdint.h>
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include "fshelp.h"
@@ -247,7 +247,7 @@ fshelp_start_translator_long (fshelp_open_fn_t underlying_open_fn,
if (err)
goto lose_task;
- assert (ports_len > INIT_PORT_BOOTSTRAP);
+ assert_backtrace (ports_len > INIT_PORT_BOOTSTRAP);
switch (ports_type)
{
case MACH_MSG_TYPE_MAKE_SEND:
diff --git a/libhurd-slab/slab.c b/libhurd-slab/slab.c
index 5a12a43a..f66bfddf 100644
--- a/libhurd-slab/slab.c
+++ b/libhurd-slab/slab.c
@@ -25,7 +25,7 @@
#include <stdlib.h>
#include <errno.h>
#include <sys/mman.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
@@ -107,7 +107,7 @@ deallocate_buffer (struct hurd_slab_space *space, void *buffer, size_t size)
static void
insert_slab (struct hurd_slab_space *space, struct hurd_slab *slab)
{
- assert (slab->refcount == 0);
+ assert_backtrace (slab->refcount == 0);
if (space->slab_first == 0)
space->slab_first = space->slab_last = slab;
else
@@ -214,7 +214,7 @@ init_space (hurd_slab_space_t space)
/* If SIZE is so big that one object can not fit into a page
something gotta be really wrong. */
size = (size + alignment - 1) & ~(alignment - 1);
- assert (size <= (space->slab_size
+ assert_backtrace (size <= (space->slab_size
- sizeof (struct hurd_slab)
- sizeof (union hurd_bufctl)));
@@ -488,7 +488,7 @@ put_on_slab_list (struct hurd_slab *slab, union hurd_bufctl *bufctl)
bufctl->next = slab->free_list;
slab->free_list = bufctl;
slab->refcount--;
- assert (slab->refcount >= 0);
+ assert_backtrace (slab->refcount >= 0);
}
@@ -499,7 +499,7 @@ hurd_slab_dealloc (hurd_slab_space_t space, void *buffer)
struct hurd_slab *slab;
union hurd_bufctl *bufctl;
- assert (space->initialized);
+ assert_backtrace (space->initialized);
pthread_mutex_lock (&space->lock);
diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c
index 731e53cb..c24a4989 100644
--- a/libnetfs/dir-lookup.c
+++ b/libnetfs/dir-lookup.c
@@ -20,7 +20,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <fcntl.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include <stdio.h>
#include <hurd/paths.h>
@@ -92,7 +92,7 @@ netfs_S_dir_lookup (struct protid *dircred,
do
{
- assert (!lastcomp);
+ assert_backtrace (!lastcomp);
/* Find the name of the next pathname component */
nextname = index (filename, '/');
diff --git a/libnetfs/file-set-translator.c b/libnetfs/file-set-translator.c
index 02c55836..bac950e3 100644
--- a/libnetfs/file-set-translator.c
+++ b/libnetfs/file-set-translator.c
@@ -122,7 +122,7 @@ netfs_S_file_set_translator (struct protid *user,
/* Find the device number from the arguments
of the translator. */
arg = passive + strlen (passive) + 1;
- assert (arg <= passive + passivelen);
+ assert_backtrace (arg <= passive + passivelen);
if (arg == passive + passivelen)
{
pthread_mutex_unlock (&np->lock);
@@ -131,7 +131,7 @@ netfs_S_file_set_translator (struct protid *user,
major = strtol (arg, 0, 0);
arg = arg + strlen (arg) + 1;
- assert (arg < passive + passivelen);
+ assert_backtrace (arg < passive + passivelen);
if (arg == passive + passivelen)
{
pthread_mutex_unlock (&np->lock);
@@ -147,7 +147,7 @@ netfs_S_file_set_translator (struct protid *user,
case S_IFLNK:
arg = passive + strlen (passive) + 1;
- assert (arg <= passive + passivelen);
+ assert_backtrace (arg <= passive + passivelen);
if (arg == passive + passivelen)
{
pthread_mutex_unlock (&np->lock);
diff --git a/libnetfs/io-reauthenticate.c b/libnetfs/io-reauthenticate.c
index b2d4a440..4351545b 100644
--- a/libnetfs/io-reauthenticate.c
+++ b/libnetfs/io-reauthenticate.c
@@ -47,7 +47,7 @@ netfs_S_io_reauthenticate (struct protid *user, mach_port_t rend_port)
}
newright = ports_get_send_right (newpi);
- assert (newright != MACH_PORT_NULL);
+ assert_backtrace (newright != MACH_PORT_NULL);
/* Release the node lock while blocking on the auth server and client. */
pthread_mutex_unlock (&user->po->np->lock);
diff --git a/libnetfs/netfs.h b/libnetfs/netfs.h
index e988d90e..afd4a060 100644
--- a/libnetfs/netfs.h
+++ b/libnetfs/netfs.h
@@ -22,7 +22,7 @@
#include <hurd/ports.h>
#include <hurd/fshelp.h>
#include <hurd/iohelp.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pthread.h>
/* This library supports client-side network file system
diff --git a/libnetfs/trans-callback.c b/libnetfs/trans-callback.c
index 99f4dc05..de436995 100644
--- a/libnetfs/trans-callback.c
+++ b/libnetfs/trans-callback.c
@@ -38,7 +38,7 @@ _netfs_translator_callback1_fn (void *cookie1, void *cookie2,
err = netfs_get_translator (np, argz, argz_len);
if (err)
{
- assert (err != EOPNOTSUPP);
+ assert_backtrace (err != EOPNOTSUPP);
return err;
}
diff --git a/libpager/data-return.c b/libpager/data-return.c
index 01f3db2d..c0f5aaf7 100644
--- a/libpager/data-return.c
+++ b/libpager/data-return.c
@@ -19,7 +19,7 @@
#include "memory_object_S.h"
#include <stdio.h>
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
/* Worker function used by _pager_S_memory_object_data_return
and _pager_S_memory_object_data_initialize. All args are
@@ -125,7 +125,7 @@ _pager_do_write_request (struct pager *p,
/* Mark these pages as being paged out. */
if (initializing)
{
- assert (npages <= 32);
+ assert_backtrace (npages <= 32);
for (i = 0; i < npages; i++)
{
if (pm_entries[i] & PM_INIT)
@@ -228,7 +228,7 @@ _pager_do_write_request (struct pager *p,
for (i = 0; i < npages; i++)
{
- assert (notified[i] == 0 || notified[i] == 1);
+ assert_backtrace (notified[i] == 0 || notified[i] == 1);
if (notified[i])
{
short *pm_entry = &pm_entries[i];
diff --git a/libpager/demuxer.c b/libpager/demuxer.c
index 3fd0516a..fcea629d 100644
--- a/libpager/demuxer.c
+++ b/libpager/demuxer.c
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <error.h>
#include <mach/mig_errors.h>
#include <pthread.h>
@@ -315,7 +315,7 @@ pager_start_workers (struct port_bucket *pager_bucket,
pthread_t t;
struct pager_requests *requests;
- assert (out_requests != NULL);
+ assert_backtrace (out_requests != NULL);
requests = malloc (sizeof *requests);
if (requests == NULL)
@@ -376,7 +376,7 @@ pager_inhibit_workers (struct pager_requests *requests)
pthread_mutex_lock (&requests->lock);
/* Check the workers are not already inhibited. */
- assert (requests->queue_out == requests->queue_in);
+ assert_backtrace (requests->queue_out == requests->queue_in);
/* Any new paging requests will go into a new queue. */
struct queue *new_queue = malloc (sizeof *new_queue);
@@ -409,9 +409,9 @@ pager_resume_workers (struct pager_requests *requests)
pthread_mutex_lock (&requests->lock);
/* Check the workers are inhibited. */
- assert (requests->queue_out != requests->queue_in);
- assert (requests->asleep == WORKER_COUNT);
- assert (queue_empty(requests->queue_out));
+ assert_backtrace (requests->queue_out != requests->queue_in);
+ assert_backtrace (requests->asleep == WORKER_COUNT);
+ assert_backtrace (queue_empty(requests->queue_out));
/* The queue has been drained and will no longer be used. */
free (requests->queue_out);
diff --git a/libpager/pager-attr.c b/libpager/pager-attr.c
index cf16d9db..4280e26d 100644
--- a/libpager/pager-attr.c
+++ b/libpager/pager-attr.c
@@ -16,7 +16,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include <assert.h>
+#include <assert-backtrace.h>
/* Change the attributes of the memory object underlying pager P.
Arguments MAY_CACHE and COPY_STRATEGY are as for
diff --git a/libpager/pager-memcpy.c b/libpager/pager-memcpy.c
index f98b0497..12515933 100644
--- a/libpager/pager-memcpy.c
+++ b/libpager/pager-memcpy.c
@@ -20,7 +20,7 @@
#include "pager.h"
#include <sys/mman.h>
#include <hurd/sigpreempt.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
/* Start using vm_copy over memcpy when we have that many page. This is
@@ -50,9 +50,9 @@ pager_memcpy (struct pager *pager, memory_object_t memobj,
error_t do_vm_copy (void)
{
- assert ((offset & (vm_page_size - 1)) == 0);
- assert (((vm_address_t) other & (vm_page_size - 1)) == 0);
- assert (n >= vm_page_size);
+ assert_backtrace ((offset & (vm_page_size - 1)) == 0);
+ assert_backtrace (((vm_address_t) other & (vm_page_size - 1)) == 0);
+ assert_backtrace (n >= vm_page_size);
do
{
@@ -61,8 +61,8 @@ pager_memcpy (struct pager *pager, memory_object_t memobj,
? (n - (n & (vm_page_size - 1)))
: VMCOPY_WINDOW_DEFAULT_SIZE;
- assert (window_size >= VMCOPY_BETTER_THAN_MEMCPY);
- assert ((window_size & (vm_page_size - 1)) == 0);
+ assert_backtrace (window_size >= VMCOPY_BETTER_THAN_MEMCPY);
+ assert_backtrace ((window_size & (vm_page_size - 1)) == 0);
window = 0;
err = vm_map (mach_task_self (), &window, window_size, 0, 1,
@@ -135,8 +135,8 @@ pager_memcpy (struct pager *pager, memory_object_t memobj,
to_copy -= copy_count;
n -= copy_count;
- assert (n >= 0);
- assert (to_copy >= 0);
+ assert_backtrace (n >= 0);
+ assert_backtrace (to_copy >= 0);
}
while (to_copy > 0);
@@ -157,14 +157,14 @@ pager_memcpy (struct pager *pager, memory_object_t memobj,
if (err)
return err;
- assert (n >= VMCOPY_BETTER_THAN_MEMCPY);
+ assert_backtrace (n >= VMCOPY_BETTER_THAN_MEMCPY);
err = do_vm_copy ();
if (err || n == 0)
/* We failed or we finished. */
return err;
- assert (n < VMCOPY_BETTER_THAN_MEMCPY);
+ assert_backtrace (n < VMCOPY_BETTER_THAN_MEMCPY);
}
return do_memcpy (n);
@@ -173,7 +173,7 @@ pager_memcpy (struct pager *pager, memory_object_t memobj,
jmp_buf buf;
void fault (int signo, long int sigcode, struct sigcontext *scp)
{
- assert (scp->sc_error == EKERN_MEMORY_ERROR);
+ assert_backtrace (scp->sc_error == EKERN_MEMORY_ERROR);
err = pager_get_error (pager, sigcode - window + offset);
n -= sigcode - window;
vm_deallocate (mach_task_self (), window, window_size);
@@ -199,7 +199,7 @@ pager_memcpy (struct pager *pager, memory_object_t memobj,
return err;
}
- assert (n < VMCOPY_BETTER_THAN_MEMCPY);
+ assert_backtrace (n < VMCOPY_BETTER_THAN_MEMCPY);
}
/* Need to do it the hard way. */
@@ -213,7 +213,7 @@ pager_memcpy (struct pager *pager, memory_object_t memobj,
&do_copy, (sighandler_t) &fault);
if (! err)
- assert (n == 0);
+ assert_backtrace (n == 0);
*size -= n;
diff --git a/libpipe/pipe.c b/libpipe/pipe.c
index 0b539218..1d4f5cc0 100644
--- a/libpipe/pipe.c
+++ b/libpipe/pipe.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <string.h> /* For memset() */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <stdlib.h>
#include <mach/time_value.h>
@@ -438,7 +438,7 @@ pipe_recv (struct pipe *pipe, int noblock, unsigned *flags, void **source,
packet_read_ports (packet, ports, num_ports);
packet = pq_next (pq, PACKET_TYPE_DATA, NULL);
- assert (packet); /* pipe_write always writes a data packet. */
+ assert_backtrace (packet); /* pipe_write always writes a data packet. */
}
else
/* No control data... */
diff --git a/libports/claim-right.c b/libports/claim-right.c
index 85592ff0..2ead7171 100644
--- a/libports/claim-right.c
+++ b/libports/claim-right.c
@@ -20,7 +20,7 @@
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
#include <errno.h>
#include <hurd/ihash.h>
@@ -39,7 +39,7 @@ ports_claim_right (void *portstruct)
hurd_ihash_locp_remove (&pi->bucket->htable, pi->hentry);
pthread_rwlock_unlock (&_ports_htable_lock);
err = mach_port_move_member (mach_task_self (), ret, MACH_PORT_NULL);
- assert_perror (err);
+ assert_perror_backtrace (err);
pthread_mutex_lock (&_ports_lock);
pi->port_right = MACH_PORT_NULL;
if (pi->flags & PORT_HAS_SENDRIGHTS)
diff --git a/libports/complete-deallocate.c b/libports/complete-deallocate.c
index e3123b26..5c548a37 100644
--- a/libports/complete-deallocate.c
+++ b/libports/complete-deallocate.c
@@ -19,13 +19,13 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/ihash.h>
void
_ports_complete_deallocate (struct port_info *pi)
{
- assert ((pi->flags & PORT_HAS_SENDRIGHTS) == 0);
+ assert_backtrace ((pi->flags & PORT_HAS_SENDRIGHTS) == 0);
if (MACH_PORT_VALID (pi->port_right))
{
@@ -38,7 +38,7 @@ _ports_complete_deallocate (struct port_info *pi)
/* A reference was reacquired through a hash table lookup.
It's fine, we didn't touch anything yet. */
/* XXX: This really shouldn't happen. */
- assert (! "reacquired reference w/o send rights");
+ assert_backtrace (! "reacquired reference w/o send rights");
pthread_rwlock_unlock (&_ports_htable_lock);
return;
}
diff --git a/libports/create-internal.c b/libports/create-internal.c
index d79dc78f..853d541e 100644
--- a/libports/create-internal.c
+++ b/libports/create-internal.c
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/ihash.h>
#include "ports.h"
@@ -49,7 +49,7 @@ _ports_create_port_internal (struct port_class *class,
{
err = mach_port_mod_refs (mach_task_self (), port,
MACH_PORT_RIGHT_RECEIVE, -1);
- assert_perror (err);
+ assert_perror_backtrace (err);
return ENOMEM;
}
@@ -123,7 +123,7 @@ _ports_create_port_internal (struct port_class *class,
error_t e;
e = mach_port_mod_refs (mach_task_self (), port,
MACH_PORT_RIGHT_RECEIVE, -1);
- assert_perror (e);
+ assert_perror_backtrace (e);
free (pi);
return err;
diff --git a/libports/destroy-right.c b/libports/destroy-right.c
index 276255f4..1afa80db 100644
--- a/libports/destroy-right.c
+++ b/libports/destroy-right.c
@@ -20,7 +20,7 @@
#include "ports.h"
#include <hurd/ihash.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pthread.h>
#include <error.h>
@@ -73,7 +73,7 @@ ports_destroy_right (void *portstruct)
{
err = mach_port_mod_refs (mach_task_self (), port_right,
MACH_PORT_RIGHT_RECEIVE, -1);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
if (defer)
diff --git a/libports/get-right.c b/libports/get-right.c
index 8681f465..8b58d722 100644
--- a/libports/get-right.c
+++ b/libports/get-right.c
@@ -20,7 +20,7 @@
#include "ports.h"
#include <mach/notify.h>
-#include <assert.h>
+#include <assert-backtrace.h>
mach_port_t
ports_get_right (void *port)
@@ -49,7 +49,7 @@ ports_get_right (void *port)
pi->port_right,
MACH_MSG_TYPE_MAKE_SEND_ONCE,
&foo);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (foo != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), foo);
}
diff --git a/libports/get-send-right.c b/libports/get-send-right.c
index 3e00276c..524cb8e3 100644
--- a/libports/get-send-right.c
+++ b/libports/get-send-right.c
@@ -18,7 +18,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
mach_port_t
ports_get_send_right (void *port)
@@ -32,7 +32,7 @@ ports_get_send_right (void *port)
err = mach_port_insert_right (mach_task_self (),
right, right, MACH_MSG_TYPE_MAKE_SEND);
- assert_perror (err);
+ assert_perror_backtrace (err);
return right;
}
diff --git a/libports/import-port.c b/libports/import-port.c
index 2c638e18..3a13876b 100644
--- a/libports/import-port.c
+++ b/libports/import-port.c
@@ -21,7 +21,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/ihash.h>
#include <mach/notify.h>
@@ -107,7 +107,7 @@ ports_import_port (struct port_class *class, struct port_bucket *bucket,
stat.mps_mscount,
port, MACH_MSG_TYPE_MAKE_SEND_ONCE,
&foo);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (foo != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), foo);
}
diff --git a/libports/interrupt-on-notify.c b/libports/interrupt-on-notify.c
index b358e840..2feff63f 100644
--- a/libports/interrupt-on-notify.c
+++ b/libports/interrupt-on-notify.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
/* Arrange for hurd_cancel to be called on RPC's thread if OBJECT gets notified
that any of the things in COND have happened to PORT. RPC should be an
@@ -176,7 +176,7 @@ ports_interrupt_self_on_notification (void *object,
break;
pthread_mutex_unlock (&_ports_lock);
- assert (rpc);
+ assert_backtrace (rpc);
/* We don't have to worry about RPC going away after we dropped the lock
because we're that thread, and we're still here. */
diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c
index 576e7670..b3f96877 100644
--- a/libports/manage-multithread.c
+++ b/libports/manage-multithread.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
#include <error.h>
#include <stdio.h>
#include <mach/message.h>
diff --git a/libports/port-deref-deferred.c b/libports/port-deref-deferred.c
index 2580e913..76373ebb 100644
--- a/libports/port-deref-deferred.c
+++ b/libports/port-deref-deferred.c
@@ -19,7 +19,7 @@
You should have received a copy of the GNU General Public License
along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pthread.h>
#include "ports.h"
@@ -40,7 +40,7 @@ valid_color (unsigned int c)
static inline unsigned int
flip_color (unsigned int c)
{
- assert (valid_color (c));
+ assert_backtrace (valid_color (c));
return ! c;
}
@@ -60,7 +60,7 @@ _ports_threadpool_init (struct ports_threadpool *pool)
static inline void
flip_generations (struct ports_threadpool *pool)
{
- assert (pool->old_threads == 0);
+ assert_backtrace (pool->old_threads == 0);
pool->old_threads = pool->young_threads;
pool->old_objects = pool->young_objects;
pool->young_threads = 0;
@@ -91,7 +91,7 @@ _ports_thread_quiescent (struct ports_threadpool *pool,
struct ports_thread *thread)
{
struct pi_list *free_list = NULL, *p;
- assert (valid_color (thread->color));
+ assert_backtrace (valid_color (thread->color));
pthread_spin_lock (&pool->lock);
if (thread->color == pool->color)
@@ -123,7 +123,7 @@ void
_ports_thread_offline (struct ports_threadpool *pool,
struct ports_thread *thread)
{
- assert (valid_color (thread->color));
+ assert_backtrace (valid_color (thread->color));
retry:
pthread_spin_lock (&pool->lock);
@@ -154,7 +154,7 @@ _ports_port_deref_deferred (struct port_info *pi)
pool->young_objects = pl;
if (pool->old_threads == 0)
{
- assert (pool->old_objects == NULL);
+ assert_backtrace (pool->old_objects == NULL);
flip_generations (pool);
}
pthread_spin_unlock (&pool->lock);
diff --git a/libports/port-deref-weak.c b/libports/port-deref-weak.c
index 8432660c..cb3f435a 100644
--- a/libports/port-deref-weak.c
+++ b/libports/port-deref-weak.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
void
ports_port_deref_weak (void *portstruct)
diff --git a/libports/port-deref.c b/libports/port-deref.c
index b97dd13d..34fa6f43 100644
--- a/libports/port-deref.c
+++ b/libports/port-deref.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
void
ports_port_deref (void *portstruct)
diff --git a/libports/port-ref-weak.c b/libports/port-ref-weak.c
index 3f62dfed..de759996 100644
--- a/libports/port-ref-weak.c
+++ b/libports/port-ref-weak.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
void
ports_port_ref_weak (void *portstruct)
diff --git a/libports/port-ref.c b/libports/port-ref.c
index 9a1c71e6..0088f09d 100644
--- a/libports/port-ref.c
+++ b/libports/port-ref.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
void
ports_port_ref (void *portstruct)
diff --git a/libports/reallocate-from-external.c b/libports/reallocate-from-external.c
index d0fae1a9..7392aa8a 100644
--- a/libports/reallocate-from-external.c
+++ b/libports/reallocate-from-external.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/ihash.h>
#include <mach/notify.h>
@@ -33,15 +33,15 @@ ports_reallocate_from_external (void *portstruct, mach_port_t receive)
error_t err;
err = mach_port_get_receive_status (mach_task_self (), receive, &stat);
- assert_perror (err);
+ assert_perror_backtrace (err);
pthread_mutex_lock (&_ports_lock);
- assert (pi->port_right);
+ assert_backtrace (pi->port_right);
err = mach_port_mod_refs (mach_task_self (), pi->port_right,
MACH_PORT_RIGHT_RECEIVE, -1);
- assert_perror (err);
+ assert_perror_backtrace (err);
pthread_rwlock_wrlock (&_ports_htable_lock);
hurd_ihash_locp_remove (&_ports_htable, pi->ports_htable_entry);
@@ -65,11 +65,11 @@ ports_reallocate_from_external (void *portstruct, mach_port_t receive)
pthread_rwlock_wrlock (&_ports_htable_lock);
err = hurd_ihash_add (&_ports_htable, receive, pi);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = hurd_ihash_add (&pi->bucket->htable, receive, pi);
pthread_rwlock_unlock (&_ports_htable_lock);
pthread_mutex_unlock (&_ports_lock);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* This is an optimization. It may fail. */
mach_port_set_protected_payload (mach_task_self (), pi->port_right,
@@ -84,7 +84,7 @@ ports_reallocate_from_external (void *portstruct, mach_port_t receive)
stat.mps_mscount, receive,
MACH_MSG_TYPE_MAKE_SEND_ONCE,
&foo);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (foo != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), foo);
}
diff --git a/libports/reallocate-port.c b/libports/reallocate-port.c
index 4e859a1f..8a9d3601 100644
--- a/libports/reallocate-port.c
+++ b/libports/reallocate-port.c
@@ -20,7 +20,7 @@
#include "ports.h"
#include <hurd/ihash.h>
-#include <assert.h>
+#include <assert-backtrace.h>
void
ports_reallocate_port (void *portstruct)
@@ -30,11 +30,11 @@ ports_reallocate_port (void *portstruct)
int dropref = 0;
pthread_mutex_lock (&_ports_lock);
- assert (pi->port_right);
+ assert_backtrace (pi->port_right);
err = mach_port_mod_refs (mach_task_self (), pi->port_right,
MACH_PORT_RIGHT_RECEIVE, -1);
- assert_perror (err);
+ assert_perror_backtrace (err);
pthread_rwlock_wrlock (&_ports_htable_lock);
hurd_ihash_locp_remove (&_ports_htable, pi->ports_htable_entry);
@@ -43,7 +43,7 @@ ports_reallocate_port (void *portstruct)
err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE,
&pi->port_right);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (pi->flags & PORT_HAS_SENDRIGHTS)
{
pi->flags &= ~PORT_HAS_SENDRIGHTS;
@@ -53,11 +53,11 @@ ports_reallocate_port (void *portstruct)
pi->mscount = 0;
pthread_rwlock_wrlock (&_ports_htable_lock);
err = hurd_ihash_add (&_ports_htable, pi->port_right, pi);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = hurd_ihash_add (&pi->bucket->htable, pi->port_right, pi);
pthread_rwlock_unlock (&_ports_htable_lock);
pthread_mutex_unlock (&_ports_lock);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* This is an optimization. It may fail. */
mach_port_set_protected_payload (mach_task_self (), pi->port_right,
@@ -65,7 +65,7 @@ ports_reallocate_port (void *portstruct)
err = mach_port_move_member (mach_task_self (), pi->port_right,
pi->bucket->portset);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (dropref)
ports_port_deref (pi);
diff --git a/libports/resume-all-rpcs.c b/libports/resume-all-rpcs.c
index e4befffc..0b78c925 100644
--- a/libports/resume-all-rpcs.c
+++ b/libports/resume-all-rpcs.c
@@ -19,13 +19,13 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
void
ports_resume_all_rpcs ()
{
pthread_mutex_lock (&_ports_lock);
- assert (_ports_flags & _PORTS_INHIBITED);
+ assert_backtrace (_ports_flags & _PORTS_INHIBITED);
_ports_flags &= ~_PORTS_INHIBITED;
if (_ports_flags & _PORTS_BLOCKED)
{
diff --git a/libports/resume-bucket-rpcs.c b/libports/resume-bucket-rpcs.c
index cf4db91c..ad129f44 100644
--- a/libports/resume-bucket-rpcs.c
+++ b/libports/resume-bucket-rpcs.c
@@ -19,13 +19,13 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
void
ports_resume_bucket_rpcs (struct port_bucket *bucket)
{
pthread_mutex_lock (&_ports_lock);
- assert (bucket->flags & PORT_BUCKET_INHIBITED);
+ assert_backtrace (bucket->flags & PORT_BUCKET_INHIBITED);
bucket->flags &= ~PORT_BUCKET_INHIBITED;
if (bucket->flags & PORT_BUCKET_BLOCKED)
{
diff --git a/libports/resume-class-rpcs.c b/libports/resume-class-rpcs.c
index 60a2b12e..806108b8 100644
--- a/libports/resume-class-rpcs.c
+++ b/libports/resume-class-rpcs.c
@@ -19,13 +19,13 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
void
ports_resume_class_rpcs (struct port_class *class)
{
pthread_mutex_lock (&_ports_lock);
- assert (class->flags & PORT_CLASS_INHIBITED);
+ assert_backtrace (class->flags & PORT_CLASS_INHIBITED);
class->flags &= ~PORT_CLASS_INHIBITED;
if (class->flags & PORT_CLASS_BLOCKED)
{
diff --git a/libports/resume-port-rpcs.c b/libports/resume-port-rpcs.c
index 6d71ab50..1894bce9 100644
--- a/libports/resume-port-rpcs.c
+++ b/libports/resume-port-rpcs.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
void
ports_resume_port_rpcs (void *portstruct)
@@ -28,7 +28,7 @@ ports_resume_port_rpcs (void *portstruct)
pthread_mutex_lock (&_ports_lock);
- assert (pi->flags & PORT_INHIBITED);
+ assert_backtrace (pi->flags & PORT_INHIBITED);
pi->flags &= ~PORT_INHIBITED;
if (pi->flags & PORT_BLOCKED)
{
diff --git a/libports/transfer-right.c b/libports/transfer-right.c
index 64de7f79..6e05dc65 100644
--- a/libports/transfer-right.c
+++ b/libports/transfer-right.c
@@ -20,7 +20,7 @@
#include "ports.h"
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/ihash.h>
error_t
@@ -63,7 +63,7 @@ ports_transfer_right (void *tostruct,
pthread_rwlock_unlock (&_ports_htable_lock);
err = mach_port_mod_refs (mach_task_self (), topi->port_right,
MACH_PORT_RIGHT_RECEIVE, -1);
- assert_perror (err);
+ assert_perror_backtrace (err);
if ((topi->flags & PORT_HAS_SENDRIGHTS) && !hassendrights)
{
dereftopi = 1;
@@ -87,10 +87,10 @@ ports_transfer_right (void *tostruct,
{
pthread_rwlock_wrlock (&_ports_htable_lock);
err = hurd_ihash_add (&_ports_htable, port, topi);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = hurd_ihash_add (&topi->bucket->htable, port, topi);
pthread_rwlock_unlock (&_ports_htable_lock);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* This is an optimization. It may fail. */
mach_port_set_protected_payload (mach_task_self (), port,
(unsigned long) topi);
@@ -98,7 +98,7 @@ ports_transfer_right (void *tostruct,
{
err = mach_port_move_member (mach_task_self (), port,
topi->bucket->portset);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
}
diff --git a/libps/context.c b/libps/context.c
index 3082d83b..8ed15943 100644
--- a/libps/context.c
+++ b/libps/context.c
@@ -21,7 +21,7 @@
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/term.h>
#include "ps.h"
diff --git a/libps/filters.c b/libps/filters.c
index 6663e61e..1bc5a0e6 100644
--- a/libps/filters.c
+++ b/libps/filters.c
@@ -21,7 +21,7 @@
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pwd.h>
#include <unistd.h>
diff --git a/libps/fmt.c b/libps/fmt.c
index f9142123..cd838852 100644
--- a/libps/fmt.c
+++ b/libps/fmt.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include <ctype.h>
diff --git a/libps/host.c b/libps/host.c
index 9a46e008..120e5c49 100644
--- a/libps/host.c
+++ b/libps/host.c
@@ -21,7 +21,7 @@
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include "ps.h"
#include "common.h"
diff --git a/libps/proclist.c b/libps/proclist.c
index 9a4d6ed5..50aed73a 100644
--- a/libps/proclist.c
+++ b/libps/proclist.c
@@ -21,7 +21,7 @@
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include "ps.h"
diff --git a/libps/procstat.c b/libps/procstat.c
index 9f488cd6..c6c3a44f 100644
--- a/libps/procstat.c
+++ b/libps/procstat.c
@@ -20,7 +20,7 @@
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include "ps.h"
diff --git a/libps/spec.c b/libps/spec.c
index bfee34ea..4a6e226f 100644
--- a/libps/spec.c
+++ b/libps/spec.c
@@ -21,7 +21,8 @@
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
+#define assert assert_backtrace
#include <pwd.h>
#include <hurd/resource.h>
#include <unistd.h>
diff --git a/libps/tty.c b/libps/tty.c
index 3ab72ee8..92f8f3e3 100644
--- a/libps/tty.c
+++ b/libps/tty.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/term.h>
#include "ps.h"
diff --git a/libps/user.c b/libps/user.c
index 0b87ace3..f5b7edc6 100644
--- a/libps/user.c
+++ b/libps/user.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include "ps.h"
#include "common.h"
diff --git a/libshouldbeinlibc/idvec-verify.c b/libshouldbeinlibc/idvec-verify.c
index 4019a04b..a7d95761 100644
--- a/libshouldbeinlibc/idvec-verify.c
+++ b/libshouldbeinlibc/idvec-verify.c
@@ -22,7 +22,7 @@
#include <unistd.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
+#include "assert-backtrace.h"
#include <idvec.h>
#include <grp.h>
#include <pwd.h>
@@ -258,7 +258,7 @@ verify_id (uid_t id, int is_group, int multiple,
char sp_lookup_buf[1024];
/* VERIFY_FN should have been defaulted in idvec_verify if necessary. */
- assert (verify_fn);
+ assert_backtrace (verify_fn);
if (id != (uid_t) -1)
do
diff --git a/libstore/argp.c b/libstore/argp.c
index 73146a8d..a9c7fbd6 100644
--- a/libstore/argp.c
+++ b/libstore/argp.c
@@ -19,7 +19,7 @@
59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd.h>
#include <argp.h>
#include <argz.h>
@@ -217,7 +217,7 @@ store_parsed_open (const struct store_parsed *parsed, int flags,
store_ileave_create (stores, num, parsed->interleave,
flags, store);
else if (parsed->layer)
- assert (! parsed->layer);
+ assert_backtrace (! parsed->layer);
else
err = store_concat_create (stores, num, flags, store);
}
diff --git a/libstore/derive.c b/libstore/derive.c
index a76fbe1c..be615b61 100644
--- a/libstore/derive.c
+++ b/libstore/derive.c
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <sys/types.h>
#include <mach.h>
@@ -78,10 +78,10 @@ _store_derive (struct store *store)
{
while ((1 << store->log2_block_size) < bsize)
store->log2_block_size++;
- assert ((1 << store->log2_block_size) == bsize);
+ assert_backtrace ((1 << store->log2_block_size) == bsize);
while ((bsize << store->log2_blocks_per_page) < vm_page_size)
store->log2_blocks_per_page++;
- assert ((bsize << store->log2_blocks_per_page) == vm_page_size);
+ assert_backtrace ((bsize << store->log2_blocks_per_page) == vm_page_size);
}
}
diff --git a/libstore/device.c b/libstore/device.c
index 3a72df48..b350bc7b 100644
--- a/libstore/device.c
+++ b/libstore/device.c
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -146,7 +146,7 @@ enforced (struct store *store)
if (!err)
{
- assert (sizes_len == DEV_GET_RECORDS_COUNT);
+ assert_backtrace (sizes_len == DEV_GET_RECORDS_COUNT);
if (sizes[DEV_GET_RECORDS_RECORD_SIZE] != store->block_size
|| (store->runs[0].length !=
@@ -165,7 +165,7 @@ enforced (struct store *store)
if (err)
return EINVAL;
- assert (sizes_len == DEV_GET_SIZE_COUNT);
+ assert_backtrace (sizes_len == DEV_GET_SIZE_COUNT);
if (sizes[DEV_GET_SIZE_RECORD_SIZE] != store->block_size
|| (store->runs[0].length !=
diff --git a/libstore/memobj.c b/libstore/memobj.c
index 0849151a..ea2d7b9a 100644
--- a/libstore/memobj.c
+++ b/libstore/memobj.c
@@ -22,7 +22,7 @@
#include <hurd/sigpreempt.h>
#include <sys/mman.h>
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
/* Return a new store in STORE referring to the memory object MEMOBJ.
@@ -101,7 +101,7 @@ memobj_memcpy (memory_object_t memobj,
jmp_buf buf;
void fault (int signo, long int sigcode, struct sigcontext *scp)
{
- assert (scp->sc_error == EKERN_MEMORY_ERROR);
+ assert_backtrace (scp->sc_error == EKERN_MEMORY_ERROR);
err = EIO;
to_copy -= sigcode - window;
siglongjmp (buf, 1);
diff --git a/libstore/part.c b/libstore/part.c
index 0ef2bd4b..349d90f5 100644
--- a/libstore/part.c
+++ b/libstore/part.c
@@ -21,7 +21,7 @@
#include "store.h"
#include <stdlib.h>
#include <errno.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pthread.h>
#include <parted/parted.h>
@@ -99,7 +99,7 @@ store_part_create (struct store *source, int index, int flags,
goto out;
}
- assert (ped_device_open (dev) != 0);
+ assert_backtrace (ped_device_open (dev) != 0);
disk = ped_disk_new (dev);
if (! disk)
@@ -116,7 +116,7 @@ store_part_create (struct store *source, int index, int flags,
&& part->type != 0 /* PED_PARTITION_PRIMARY */)
continue;
- assert (part->num);
+ assert_backtrace (part->num);
if (part->num == index)
break;
}
@@ -155,7 +155,7 @@ store_part_create (struct store *source, int index, int flags,
}
out_with_disk:
- assert (ped_device_close (dev) != 0);
+ assert_backtrace (ped_device_close (dev) != 0);
ped_disk_destroy (disk);
out_with_dev:
ped_device_destroy (dev);
diff --git a/libthreads/cancel-cond.c b/libthreads/cancel-cond.c
index 0cd5f0f1..3aa33f6a 100644
--- a/libthreads/cancel-cond.c
+++ b/libthreads/cancel-cond.c
@@ -20,7 +20,7 @@
#include <hurd/signal.h>
#include <cthreads.h>
#include "cthread_internals.h"
-#include <assert.h>
+#include <assert-backtrace.h>
/* Just like condition_wait, but cancellable. Returns true if cancelled. */
int
@@ -37,7 +37,7 @@ hurd_condition_wait (condition_t c, mutex_t m)
cproc_t p = cproc_self ();
int cancel;
- assert (ss->intr_port == MACH_PORT_NULL); /* Sanity check for signal bugs. */
+ assert_backtrace (ss->intr_port == MACH_PORT_NULL); /* Sanity check for signal bugs. */
p->state = CPROC_CONDWAIT | CPROC_SWITCHING;
diff --git a/libthreads/cprocs.c b/libthreads/cprocs.c
index 5459d7de..5fb138d2 100644
--- a/libthreads/cprocs.c
+++ b/libthreads/cprocs.c
@@ -233,7 +233,7 @@
#include "cthread_internals.h"
#include <mach/message.h>
#include <hurd/threadvar.h> /* GNU */
-#include <assert.h>
+#include <assert-backtrace.h>
/*
* Port_entry's are used by cthread_mach_msg to store information
@@ -343,7 +343,7 @@ cthread_wire(void)
register cproc_t p = cproc_self();
/* In GNU, we wire all threads on creation (in cproc_alloc). */
- assert (p->wired != MACH_PORT_NULL);
+ assert_backtrace (p->wired != MACH_PORT_NULL);
}
/*
diff --git a/libthreads/rwlock.h b/libthreads/rwlock.h
index 44d9a35d..cbe56d7c 100644
--- a/libthreads/rwlock.h
+++ b/libthreads/rwlock.h
@@ -20,7 +20,7 @@
#define _RWLOCK_H 1
#include <cthreads.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <features.h>
#ifdef RWLOCK_DEFINE_EI
@@ -89,7 +89,7 @@ RWLOCK_EI void
rwlock_reader_unlock (struct rwlock *lock)
{
mutex_lock (&lock->master);
- assert (lock->readers);
+ assert_backtrace (lock->readers);
lock->readers--;
if (lock->readers_waiting || lock->writers_waiting)
condition_broadcast (&lock->wakeup);
@@ -101,7 +101,7 @@ RWLOCK_EI void
rwlock_writer_unlock (struct rwlock *lock)
{
mutex_lock (&lock->master);
- assert (lock->readers == -1);
+ assert_backtrace (lock->readers == -1);
lock->readers = 0;
if (lock->readers_waiting || lock->writers_waiting)
condition_broadcast (&lock->wakeup);
diff --git a/libtreefs/dir-lookup.c b/libtreefs/dir-lookup.c
index 80b55388..33fefe69 100644
--- a/libtreefs/dir-lookup.c
+++ b/libtreefs/dir-lookup.c
@@ -73,7 +73,7 @@ _treefs_s_dir_lookup (struct treefs_handle *h,
{
char *nextname;
- assert (!lastcomp);
+ assert_backtrace (!lastcomp);
/* Find the name of the next pathname component */
nextname = index (path, '/');
diff --git a/libtreefs/fsys-startup.c b/libtreefs/fsys-startup.c
index fcee3535..e2d138ba 100644
--- a/libtreefs/fsys-startup.c
+++ b/libtreefs/fsys-startup.c
@@ -28,7 +28,7 @@ treefs_S_fsys_startup (mach_port_t child_boot_port, mach_port_t control_port,
struct port_info *child_boot =
ports_check_port_type (child_boot_port, PT_TRANSBOOT);
- assert (child_boot); /* XXX deal with exec server boot */
+ assert_backtrace (child_boot); /* XXX deal with exec server boot */
err = fshelp_handle_fsys_startup (child_boot, control_port, real, real_type);
ports_done_with_port (child_boot);
diff --git a/libtreefs/treefs.h b/libtreefs/treefs.h
index 0e49ef51..50cf91fe 100644
--- a/libtreefs/treefs.h
+++ b/libtreefs/treefs.h
@@ -25,7 +25,7 @@
#include <errno.h>
#include <pthread.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <features.h>
#include <sys/stat.h>
@@ -281,7 +281,7 @@ treefs_node_release (struct treefs_node *node)
loop:
pthread_spin_lock (&treefs_node_refcnt_lock);
- assert (node->refs);
+ assert_backtrace (node->refs);
node->refs--;
if (node->refs + node->weak_refs == 0)
treefs_node_drop (node);
@@ -328,7 +328,7 @@ treefs_node_unref (struct treefs_node *node)
loop:
pthread_spin_lock (&treefs_node_refcnt_lock);
- assert (node->refs);
+ assert_backtrace (node->refs);
node->refs--;
if (node->refs + node->weak_refs == 0)
{
@@ -374,7 +374,7 @@ TREEFS_EI void
treefs_node_release_weak (struct treefs_node *node)
{
pthread_spin_lock (&treefs_node_refcnt_lock);
- assert (node->weak_refs);
+ assert_backtrace (node->weak_refs);
node->weak_refs--;
if (node->refs + node->weak_refs == 0)
treefs_node_drop (node);
@@ -392,7 +392,7 @@ TREEFS_EI void
treefs_node_unref_weak (struct treefs_node *node)
{
pthread_spin_lock (&treefs_node_refcnt_lock);
- assert (node->weak_refs);
+ assert_backtrace (node->weak_refs);
node->weak_refs--;
if (node->refs + node->weak_refs == 0)
{
diff --git a/libtrivfs/dir-lookup.c b/libtrivfs/dir-lookup.c
index 66afac1d..73aff5c4 100644
--- a/libtrivfs/dir-lookup.c
+++ b/libtrivfs/dir-lookup.c
@@ -16,7 +16,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include <assert.h>
+#include <assert-backtrace.h>
#include <fcntl.h>
#include <string.h>
diff --git a/libtrivfs/file-set-size.c b/libtrivfs/file-set-size.c
index f90ceec6..a2691c85 100644
--- a/libtrivfs/file-set-size.c
+++ b/libtrivfs/file-set-size.c
@@ -17,13 +17,13 @@
#include "priv.h"
#include "trivfs_fs_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
kern_return_t
trivfs_S_file_set_size (struct trivfs_protid *cred,
mach_port_t reply, mach_msg_type_name_t reply_type,
off_t size)
{
- assert (!trivfs_support_write);
+ assert_backtrace (!trivfs_support_write);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/fsys-getroot.c b/libtrivfs/fsys-getroot.c
index c9b8261e..eac13284 100644
--- a/libtrivfs/fsys-getroot.c
+++ b/libtrivfs/fsys-getroot.c
@@ -22,7 +22,7 @@
#include "priv.h"
#include "fsys_reply_U.h"
#include "trivfs_fsys_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
#include <fcntl.h>
#include <string.h>
diff --git a/libtrivfs/io-async-icky.c b/libtrivfs/io-async-icky.c
index d6313d1c..72569423 100644
--- a/libtrivfs/io-async-icky.c
+++ b/libtrivfs/io-async-icky.c
@@ -21,7 +21,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
kern_return_t
trivfs_S_io_get_icky_async_id (struct trivfs_protid *cred,
diff --git a/libtrivfs/io-async.c b/libtrivfs/io-async.c
index 5f609561..01a809cf 100644
--- a/libtrivfs/io-async.c
+++ b/libtrivfs/io-async.c
@@ -21,7 +21,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
kern_return_t
trivfs_S_io_async (struct trivfs_protid *cred,
diff --git a/libtrivfs/io-map.c b/libtrivfs/io-map.c
index 3bf8dabd..958627f6 100644
--- a/libtrivfs/io-map.c
+++ b/libtrivfs/io-map.c
@@ -21,7 +21,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
kern_return_t
trivfs_S_io_map (struct trivfs_protid *cred,
diff --git a/libtrivfs/io-modes-get.c b/libtrivfs/io-modes-get.c
index b70d94bc..c536732c 100644
--- a/libtrivfs/io-modes-get.c
+++ b/libtrivfs/io-modes-get.c
@@ -21,7 +21,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
kern_return_t
trivfs_S_io_get_openmodes (struct trivfs_protid *cred,
diff --git a/libtrivfs/io-modes-off.c b/libtrivfs/io-modes-off.c
index 85d18e75..3717470e 100644
--- a/libtrivfs/io-modes-off.c
+++ b/libtrivfs/io-modes-off.c
@@ -21,7 +21,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
kern_return_t
trivfs_S_io_clear_some_openmodes (struct trivfs_protid *cred,
@@ -29,6 +29,6 @@ trivfs_S_io_clear_some_openmodes (struct trivfs_protid *cred,
mach_msg_type_name_t replytype,
int bits)
{
- assert (!trivfs_support_read && !trivfs_support_write);
+ assert_backtrace (!trivfs_support_read && !trivfs_support_write);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/io-modes-on.c b/libtrivfs/io-modes-on.c
index f1c6ffb9..b71d21b6 100644
--- a/libtrivfs/io-modes-on.c
+++ b/libtrivfs/io-modes-on.c
@@ -21,7 +21,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
kern_return_t
trivfs_S_io_set_some_openmodes (struct trivfs_protid *cred,
@@ -29,6 +29,6 @@ trivfs_S_io_set_some_openmodes (struct trivfs_protid *cred,
mach_msg_type_name_t replytype,
int bits)
{
- assert (!trivfs_support_read && !trivfs_support_write);
+ assert_backtrace (!trivfs_support_read && !trivfs_support_write);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/io-modes-set.c b/libtrivfs/io-modes-set.c
index 1d01b9b5..44846428 100644
--- a/libtrivfs/io-modes-set.c
+++ b/libtrivfs/io-modes-set.c
@@ -21,7 +21,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
error_t
trivfs_S_io_set_all_openmodes (struct trivfs_protid *cred,
@@ -29,6 +29,6 @@ trivfs_S_io_set_all_openmodes (struct trivfs_protid *cred,
mach_msg_type_name_t replytype,
int mode)
{
- assert (!trivfs_support_read && !trivfs_support_write);
+ assert_backtrace (!trivfs_support_read && !trivfs_support_write);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/io-owner-get.c b/libtrivfs/io-owner-get.c
index bd490467..8b4791bb 100644
--- a/libtrivfs/io-owner-get.c
+++ b/libtrivfs/io-owner-get.c
@@ -21,7 +21,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
kern_return_t
trivfs_S_io_get_owner (struct trivfs_protid *cred,
diff --git a/libtrivfs/io-owner-mod.c b/libtrivfs/io-owner-mod.c
index bed9000e..58deb4d7 100644
--- a/libtrivfs/io-owner-mod.c
+++ b/libtrivfs/io-owner-mod.c
@@ -21,7 +21,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
kern_return_t
trivfs_S_io_mod_owner (struct trivfs_protid *cred,
diff --git a/libtrivfs/io-read.c b/libtrivfs/io-read.c
index 7dfdc190..cd8e2d8b 100644
--- a/libtrivfs/io-read.c
+++ b/libtrivfs/io-read.c
@@ -17,7 +17,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
kern_return_t
trivfs_S_io_read (struct trivfs_protid *cred,
@@ -28,6 +28,6 @@ trivfs_S_io_read (struct trivfs_protid *cred,
off_t off,
mach_msg_type_number_t amt)
{
- assert (!trivfs_support_read);
+ assert_backtrace (!trivfs_support_read);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/io-readable.c b/libtrivfs/io-readable.c
index 90e66c77..de4d32b8 100644
--- a/libtrivfs/io-readable.c
+++ b/libtrivfs/io-readable.c
@@ -17,7 +17,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
kern_return_t
trivfs_S_io_readable (struct trivfs_protid *cred,
@@ -25,6 +25,6 @@ trivfs_S_io_readable (struct trivfs_protid *cred,
mach_msg_type_name_t replytype,
mach_msg_type_number_t *amount)
{
- assert (!trivfs_support_read);
+ assert_backtrace (!trivfs_support_read);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/io-reauthenticate.c b/libtrivfs/io-reauthenticate.c
index 72684e35..db8272fb 100644
--- a/libtrivfs/io-reauthenticate.c
+++ b/libtrivfs/io-reauthenticate.c
@@ -21,7 +21,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
kern_return_t
@@ -49,7 +49,7 @@ trivfs_S_io_reauthenticate (struct trivfs_protid *cred,
auth = getauth ();
newright = ports_get_send_right (newcred);
- assert (newright != MACH_PORT_NULL);
+ assert_backtrace (newright != MACH_PORT_NULL);
err = iohelp_reauth (&newcred->user, auth, rendport, newright, 1);
if (!err)
diff --git a/libtrivfs/io-seek.c b/libtrivfs/io-seek.c
index cfb7f53a..b2ec8f4b 100644
--- a/libtrivfs/io-seek.c
+++ b/libtrivfs/io-seek.c
@@ -17,7 +17,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
kern_return_t
trivfs_S_io_seek (struct trivfs_protid *cred,
@@ -27,6 +27,6 @@ trivfs_S_io_seek (struct trivfs_protid *cred,
int whence,
off_t *newp)
{
- assert (!trivfs_support_read && !trivfs_support_write);
+ assert_backtrace (!trivfs_support_read && !trivfs_support_write);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/io-select.c b/libtrivfs/io-select.c
index 0682b2da..668b7a51 100644
--- a/libtrivfs/io-select.c
+++ b/libtrivfs/io-select.c
@@ -21,7 +21,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
kern_return_t
trivfs_S_io_select (struct trivfs_protid *cred,
@@ -32,9 +32,9 @@ trivfs_S_io_select (struct trivfs_protid *cred,
if (!cred)
return EOPNOTSUPP;
if (*seltype & (SELECT_READ|SELECT_URG))
- assert (!trivfs_support_read);
+ assert_backtrace (!trivfs_support_read);
if (*seltype & (SELECT_WRITE|SELECT_URG))
- assert (!trivfs_support_write);
+ assert_backtrace (!trivfs_support_write);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/io-write.c b/libtrivfs/io-write.c
index c479c55b..d5b32524 100644
--- a/libtrivfs/io-write.c
+++ b/libtrivfs/io-write.c
@@ -17,7 +17,7 @@
#include "priv.h"
#include "trivfs_io_S.h"
-#include <assert.h>
+#include <assert-backtrace.h>
#include <fcntl.h>
kern_return_t
@@ -32,6 +32,6 @@ trivfs_S_io_write (struct trivfs_protid *cred,
if (!(trivfs_allow_open & O_WRITE))
return EBADF;
- assert (!trivfs_support_write);
+ assert_backtrace (!trivfs_support_write);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/startup.c b/libtrivfs/startup.c
index 4d76d47c..56ef02c4 100644
--- a/libtrivfs/startup.c
+++ b/libtrivfs/startup.c
@@ -20,7 +20,7 @@
#include <hurd.h>
#include <hurd/fsys.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include "priv.h"
diff --git a/login/utmp.c b/login/utmp.c
index f366d44b..41e244a1 100644
--- a/login/utmp.c
+++ b/login/utmp.c
@@ -32,7 +32,7 @@
#include <hurd/fsys.h>
#include <mach/notify.h>
#include <stdio.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <fcntl.h>
#include <getopt.h>
diff --git a/mach-defpager/Makefile b/mach-defpager/Makefile
index 3b8ce58e..9bf394e7 100644
--- a/mach-defpager/Makefile
+++ b/mach-defpager/Makefile
@@ -29,7 +29,7 @@ OBJS := $(SRCS:.c=.o) \
memory_object default_pager memory_object_default exc) \
default_pager_replyUser.o
-HURDLIBS:= ihash
+HURDLIBS:= ihash shouldbeinlibc
LDLIBS:= -lpthread
include ../Makeconf
diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c
index aafa2cf3..d2220c5a 100644
--- a/mach-defpager/default_pager.c
+++ b/mach-defpager/default_pager.c
@@ -50,7 +50,7 @@
#include "kalloc.h"
#include "default_pager.h"
-#include <assert.h>
+#include <assert-backtrace.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
@@ -1137,7 +1137,7 @@ void pager_release_offset(pager, offset)
pthread_mutex_lock(&pager->lock); /* XXX lock_read */
- assert (pager->map);
+ assert_backtrace (pager->map);
if (INDIRECT_PAGEMAP(pager->size)) {
dp_map_t mapptr;
@@ -2164,7 +2164,7 @@ void pager_port_check_request(ds, pager_request)
mach_port_delta_t delta;
kern_return_t kr;
- assert(ds->pager_request == pager_request);
+ assert_backtrace (ds->pager_request == pager_request);
if (++ds->request_refs > default_pager_max_urefs) {
delta = 1 - ds->request_refs;
@@ -2249,10 +2249,10 @@ seqnos_memory_object_create(old_pager, seqno, new_pager, new_size,
{
default_pager_t ds;
- assert(old_pager == default_pager_default_port);
- assert(MACH_PORT_VALID(new_pager_request));
- assert(MACH_PORT_VALID(new_pager_name));
- assert(new_page_size == vm_page_size);
+ assert_backtrace (old_pager == default_pager_default_port);
+ assert_backtrace (MACH_PORT_VALID(new_pager_request));
+ assert_backtrace (MACH_PORT_VALID(new_pager_name));
+ assert_backtrace (new_page_size == vm_page_size);
ds = pager_port_alloc(new_size);
@@ -2293,9 +2293,9 @@ seqnos_memory_object_init(ds, seqno, pager_request, pager_name,
kern_return_t kr;
static char here[] = "%sinit";
- assert(MACH_PORT_VALID(pager_request));
- assert(MACH_PORT_VALID(pager_name));
- assert(pager_page_size == vm_page_size);
+ assert_backtrace (MACH_PORT_VALID(pager_request));
+ assert_backtrace (MACH_PORT_VALID(pager_name));
+ assert_backtrace (pager_page_size == vm_page_size);
if (ds == DEFAULT_PAGER_NULL)
panic(here, my_name);
@@ -2371,7 +2371,7 @@ ddprintf ("seqnos_memory_object_terminate <%p>: pager_port_lock: <%p>[s:%d,r:%d,
pager_request = ds->pager_request;
ds->pager_request = MACH_PORT_NULL;
ds->request_refs = 0;
- assert(ds->pager_name == pager_name);
+ assert_backtrace (ds->pager_name == pager_name);
ds->pager_name = MACH_PORT_NULL;
ds->name_refs = 0;
ddprintf ("seqnos_memory_object_terminate <%p>: pager_port_unlock: <%p>[s:%d,r:%d,w:%d,l:%d]\n",
@@ -2660,8 +2660,8 @@ seqnos_memory_object_data_return(ds, seqno, pager_request,
vm_size_t limit = ds->dpager.byte_limit;
pager_port_unlock(ds);
if ((limit != round_page(limit)) && (trunc_page(limit) == offset)) {
- assert(trunc_page(limit) == offset);
- assert(data_cnt == vm_page_size);
+ assert_backtrace (trunc_page(limit) == offset);
+ assert_backtrace (data_cnt == vm_page_size);
vm_offset_t tail = addr + limit - trunc_page(limit);
vm_size_t tail_size = round_page(limit) - limit;
@@ -2807,16 +2807,16 @@ boolean_t default_pager_notify_server(in, out)
return FALSE;
}
- assert(ds != DEFAULT_PAGER_NULL);
+ assert_backtrace (ds != DEFAULT_PAGER_NULL);
- assert(n->not_header.msgh_size == sizeof *n);
- assert(n->not_header.msgh_remote_port == MACH_PORT_NULL);
+ assert_backtrace (n->not_header.msgh_size == sizeof *n);
+ assert_backtrace (n->not_header.msgh_remote_port == MACH_PORT_NULL);
- assert(n->not_type.msgt_name == MACH_MSG_TYPE_INTEGER_32);
- assert(n->not_type.msgt_size == 32);
- assert(n->not_type.msgt_number == 1);
- assert(n->not_type.msgt_inline);
- assert(! n->not_type.msgt_longform);
+ assert_backtrace (n->not_type.msgt_name == MACH_MSG_TYPE_INTEGER_32);
+ assert_backtrace (n->not_type.msgt_size == 32);
+ assert_backtrace (n->not_type.msgt_number == 1);
+ assert_backtrace (n->not_type.msgt_inline);
+ assert_backtrace (! n->not_type.msgt_longform);
default_pager_no_senders(ds, n->not_header.msgh_seqno, n->not_count);
diff --git a/mach-defpager/setup.c b/mach-defpager/setup.c
index e4ec8d96..94685c0e 100644
--- a/mach-defpager/setup.c
+++ b/mach-defpager/setup.c
@@ -20,7 +20,7 @@
#include <errno.h>
#include <stddef.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <mach.h>
#include <string.h>
#include <strings.h>
@@ -115,12 +115,12 @@ page_read_file_direct (struct file_direct *fdp,
char *page;
mach_msg_type_number_t nread;
- assert (page_aligned (offset));
- assert (size == vm_page_size);
+ assert_backtrace (page_aligned (offset));
+ assert_backtrace (size == vm_page_size);
offset >>= fdp->bshift;
- assert (offset + (size >> fdp->bshift) <= fdp->fd_size);
+ assert_backtrace (offset + (size >> fdp->bshift) <= fdp->fd_size);
/* Find the run containing the beginning of the page. */
for (r = fdp->runs; offset > r->length; ++r)
@@ -179,12 +179,12 @@ page_write_file_direct(struct file_direct *fdp,
error_t err;
int wrote;
- assert (page_aligned (offset));
- assert (size == vm_page_size);
+ assert_backtrace (page_aligned (offset));
+ assert_backtrace (size == vm_page_size);
offset >>= fdp->bshift;
- assert (offset + (size >> fdp->bshift) <= fdp->fd_size);
+ assert_backtrace (offset + (size >> fdp->bshift) <= fdp->fd_size);
/* Find the run containing the beginning of the page. */
for (r = fdp->runs; offset > r->length; ++r)
@@ -251,7 +251,7 @@ add_paging_file(master_device_port, file_name, linux_signature)
natural_t count;
char *devname = file_name;
- assert (linux_signature == 0);
+ assert_backtrace (linux_signature == 0);
if (!strncmp (file_name, "/dev/", 5))
devname += 5;
diff --git a/nfs/cache.c b/nfs/cache.c
index ecf3b11a..883cb966 100644
--- a/nfs/cache.c
+++ b/nfs/cache.c
@@ -75,7 +75,7 @@ lookup_fhandle (struct fhandle *handle, struct node **npp)
/* Could not find it */
np = netfs_make_node_alloc (sizeof (struct netnode));
- assert (np);
+ assert_backtrace (np);
nn = netfs_node_netnode (np);
nn->handle.size = handle->size;
@@ -127,7 +127,7 @@ netfs_node_norefs (struct node *np)
error_t err;
args = malloc (sizeof (struct fnd));
- assert (args);
+ assert_backtrace (args);
args->dir = np->nn->dead_dir;
args->name = np->nn->dead_name;
diff --git a/nfs/ops.c b/nfs/ops.c
index 33ab38b7..afde0bed 100644
--- a/nfs/ops.c
+++ b/nfs/ops.c
@@ -608,7 +608,7 @@ verify_nonexistent (struct iouser *cred, struct node *dir,
/* Don't use the lookup cache for this; we want a full sync to
get as close to real exclusive create behavior as possible. */
- assert (protocol_version == 2);
+ assert_backtrace (protocol_version == 2);
p = nfs_initialize_rpc (NFSPROC_LOOKUP (protocol_version),
cred, 0, &rpcbuf, dir, -1);
@@ -1134,8 +1134,8 @@ netfs_attempt_mkfile (struct iouser *cred, struct node *dir,
return err;
}
- assert (!(*newnp)->nn->dead_dir);
- assert (!(*newnp)->nn->dead_name);
+ assert_backtrace (!(*newnp)->nn->dead_dir);
+ assert_backtrace (!(*newnp)->nn->dead_name);
netfs_nref (dir);
(*newnp)->nn->dead_dir = dir;
(*newnp)->nn->dead_name = name;
@@ -1668,7 +1668,7 @@ netfs_report_access (struct iouser *cred,
err = netfs_attempt_read (cred, np, 0, &len, &byte);
if (err)
return;
- assert (len == 1 || len == 0);
+ assert_backtrace (len == 1 || len == 0);
*types |= O_READ | O_EXEC;
@@ -1777,7 +1777,7 @@ fetch_directory (struct iouser *cred, struct node *dir,
char *newbuf;
newbuf = realloc (buf, bufmalloced *= 2);
- assert (newbuf);
+ assert_backtrace (newbuf);
if (newbuf != buf)
bp = newbuf + (bp - buf);
buf = newbuf;
diff --git a/nfs/rpc.c b/nfs/rpc.c
index c0d0290e..0d83064a 100644
--- a/nfs/rpc.c
+++ b/nfs/rpc.c
@@ -31,7 +31,7 @@
#undef malloc /* Get rid of the sun block. */
#include <netinet/in.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <errno.h>
#include <error.h>
#include <unistd.h>
@@ -107,7 +107,7 @@ initialize_rpc (int program, int version, int rpc_proc,
*(p++) = htonl (version);
*(p++) = htonl (rpc_proc);
- assert ((uid == -1) == (gid == -1));
+ assert_backtrace ((uid == -1) == (gid == -1));
if (uid == -1)
{
@@ -214,7 +214,7 @@ conduct_rpc (void **rpcbuf, int **pp)
return errno;
}
else
- assert (cc == nc);
+ assert_backtrace (cc == nc);
/* Wait for reply. */
cancel = 0;
@@ -254,7 +254,7 @@ conduct_rpc (void **rpcbuf, int **pp)
/* If the transmition id does not match that in the message,
something strange happened in rpc_receive_thread. */
- assert (*p == xid);
+ assert_backtrace (*p == xid);
p++;
switch (ntohl (*p))
@@ -376,7 +376,7 @@ rpc_receive_thread (void *arg)
/* Allocate a receive buffer. */
buf = malloc (1024 + read_size);
- assert (buf);
+ assert_backtrace (buf);
while (1)
{
@@ -416,7 +416,7 @@ rpc_receive_thread (void *arg)
if (r)
{
buf = malloc (1024 + read_size);
- assert (buf);
+ assert_backtrace (buf);
}
}
}
diff --git a/nfs/storage-info.c b/nfs/storage-info.c
index 7427b3d8..f86f6c0d 100644
--- a/nfs/storage-info.c
+++ b/nfs/storage-info.c
@@ -65,7 +65,7 @@ netfs_file_get_storage_info (struct iouser *cred,
if (*data == MAP_FAILED)
return errno;
*data_len = fmt (name_len) + 1;
- assert (*data_len == name_len);
+ assert_backtrace (*data_len == name_len);
}
/* Now fill in the file handle data in hexadecimal. */
@@ -86,12 +86,12 @@ netfs_file_get_storage_info (struct iouser *cred,
*num_ports = 0;
*ports_type = MACH_MSG_TYPE_COPY_SEND;
- assert (*num_offsets >= 2); /* mig always gives us some */
+ assert_backtrace (*num_offsets >= 2); /* mig always gives us some */
*num_offsets = 2;
(*offsets)[0] = 0;
(*offsets)[1] = np->nn_stat.st_size;
- assert (*num_ints >= 6); /* mig always gives us some */
+ assert_backtrace (*num_ints >= 6); /* mig always gives us some */
*num_ints = 1;
(*ints)[0] = STORAGE_NETWORK;
(*ints)[1] = 0; /* XXX readonly if we supported it */
diff --git a/nfsd/cache.c b/nfsd/cache.c
index 1b2b6ee9..c9d80916 100644
--- a/nfsd/cache.c
+++ b/nfsd/cache.c
@@ -22,7 +22,7 @@
#include <string.h>
#include <sys/mman.h>
#include <hurd/fsys.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include <pthread.h>
#include <hurd/io.h>
@@ -59,7 +59,7 @@ idspec_compare (struct idspec *i, int nuids, int ngids,
|| i->ngids != ngids)
return 0;
- assert (sizeof (int) == sizeof (uid_t));
+ assert_backtrace (sizeof (int) == sizeof (uid_t));
if (bcmp (i->uids, uids, nuids * sizeof (uid_t))
|| bcmp (i->gids, gids, ngids * sizeof (gid_t)))
@@ -103,7 +103,7 @@ idspec_lookup (int nuids, int ngids, int *uids, int *gids)
return i;
}
- assert (sizeof (uid_t) == sizeof (int));
+ assert_backtrace (sizeof (uid_t) == sizeof (int));
i = malloc (sizeof (struct idspec));
i->nuids = nuids;
i->ngids = ngids;
@@ -202,7 +202,7 @@ void
cred_ref (struct idspec *i)
{
pthread_spin_lock (&idhashlock);
- assert (i->references);
+ assert_backtrace (i->references);
i->references++;
pthread_spin_unlock (&idhashlock);
}
diff --git a/pfinet/dummy.c b/pfinet/dummy.c
index b744f0f1..88301493 100644
--- a/pfinet/dummy.c
+++ b/pfinet/dummy.c
@@ -130,5 +130,5 @@ setup_dummy_device (char *name, struct device **device)
initializes its `ifindex' member (which matters!),
and tells the protocol stacks about the device. */
err = - register_netdevice (dev);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
diff --git a/pfinet/ethernet.c b/pfinet/ethernet.c
index e6ae53ce..1b3b5d0f 100644
--- a/pfinet/ethernet.c
+++ b/pfinet/ethernet.c
@@ -197,11 +197,11 @@ ethernet_open (struct device *dev)
device_t master_device;
struct ether_device *edev = (struct ether_device *) dev->priv;
- assert (edev->ether_port == MACH_PORT_NULL);
+ assert_backtrace (edev->ether_port == MACH_PORT_NULL);
err = ports_create_port (etherreadclass, etherport_bucket,
sizeof (struct port_info), &edev->readpt);
- assert_perror (err);
+ assert_perror_backtrace (err);
edev->readptname = ports_get_right (edev->readpt);
mach_port_insert_right (mach_task_self (), edev->readptname, edev->readptname,
MACH_MSG_TYPE_MAKE_SEND);
@@ -291,8 +291,8 @@ ethernet_xmit (struct sk_buff *skb, struct device *dev)
}
else
{
- assert_perror (err);
- assert (count == skb->len);
+ assert_perror_backtrace (err);
+ assert_backtrace (count == skb->len);
}
}
while (err);
@@ -378,12 +378,12 @@ setup_ethernet_device (char *name, struct device **device)
if (err)
error (2, err, "%s: Cannot get device status", name);
dev->mtu = netstat.max_packet_size - dev->hard_header_len;
- assert (netstat.header_format == HDR_ETHERNET);
- assert (netstat.header_size == ETH_HLEN);
- assert (netstat.address_size == ETH_ALEN);
+ assert_backtrace (netstat.header_format == HDR_ETHERNET);
+ assert_backtrace (netstat.header_size == ETH_HLEN);
+ assert_backtrace (netstat.address_size == ETH_ALEN);
count = 2;
- assert (count * sizeof (int) >= ETH_ALEN);
+ assert_backtrace (count * sizeof (int) >= ETH_ALEN);
err = device_get_status (edev->ether_port, NET_ADDRESS, net_address, &count);
if (err)
error (2, err, "%s: Cannot get hardware Ethernet address", name);
@@ -397,5 +397,5 @@ setup_ethernet_device (char *name, struct device **device)
initializes its `ifindex' member (which matters!),
and tells the protocol stacks about the device. */
err = - register_netdevice (dev);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
diff --git a/pfinet/glue-include/linux/interrupt.h b/pfinet/glue-include/linux/interrupt.h
index 22312ba4..49eb23db 100644
--- a/pfinet/glue-include/linux/interrupt.h
+++ b/pfinet/glue-include/linux/interrupt.h
@@ -30,7 +30,7 @@ extern int net_bh_raised;
static inline void
mark_bh (int bh)
{
- assert (bh == NET_BH);
+ assert_backtrace (bh == NET_BH);
net_bh_raised = 1;
pthread_cond_broadcast (&net_bh_wakeup);
}
@@ -39,8 +39,8 @@ void net_bh (void);
static inline void
init_bh (int bh, void (*fn) (void))
{
- assert (bh == NET_BH);
- assert (fn == &net_bh);
+ assert_backtrace (bh == NET_BH);
+ assert_backtrace (fn == &net_bh);
}
#endif
diff --git a/pfinet/glue-include/linux/kernel.h b/pfinet/glue-include/linux/kernel.h
index de5852f6..62ba2ff1 100644
--- a/pfinet/glue-include/linux/kernel.h
+++ b/pfinet/glue-include/linux/kernel.h
@@ -3,7 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
/* These don't actually matter since our locking protocols are different. */
@@ -24,7 +24,7 @@
#define KERN_INFO
#define KERN_DEBUG
-#define panic(str...) (printk (str), assert (!"panic"))
+#define panic(str...) (printk (str), assert_backtrace (!"panic"))
/*
* Display an IP address in readable format.
@@ -63,14 +63,14 @@ putname (char *p)
static inline int
kill_proc (int pid, int signo, int priv)
{
- assert (signo == SIGURG);
+ assert_backtrace (signo == SIGURG);
return 0;
}
static inline int
kill_pg (int pgrp, int signo, int priv)
{
- assert (signo == SIGURG);
+ assert_backtrace (signo == SIGURG);
return 0;
}
diff --git a/pfinet/glue-include/linux/sched.h b/pfinet/glue-include/linux/sched.h
index e39263e5..2446e88c 100644
--- a/pfinet/glue-include/linux/sched.h
+++ b/pfinet/glue-include/linux/sched.h
@@ -6,7 +6,7 @@
#include <mach.h>
#include <hurd/hurd_types.h>
#include <limits.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pthread.h>
#include <errno.h>
@@ -105,7 +105,7 @@ interruptible_sleep_on_timeout (struct wait_queue **p, struct timespec *tsp)
if (c == 0)
{
c = malloc (sizeof **condp);
- assert (c);
+ assert_backtrace (c);
pthread_cond_init (c, NULL);
*condp = c;
}
@@ -134,21 +134,21 @@ wake_up_interruptible (struct wait_queue **p)
static inline void
add_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
{
- assert (current->next_wait == 0);
+ assert_backtrace (current->next_wait == 0);
current->next_wait = p;
}
static inline void
remove_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
{
- assert (current->next_wait == p);
+ assert_backtrace (current->next_wait == p);
current->next_wait = 0;
}
static inline void
schedule (void)
{
- assert (current->next_wait);
+ assert_backtrace (current->next_wait);
interruptible_sleep_on_timeout (current->next_wait, NULL);
}
@@ -201,8 +201,8 @@ schedule_timeout (long timeout)
static inline int
send_sig (u_long signo, struct task_struct *task, int priv)
{
- assert (signo == SIGPIPE);
- assert (task == current);
+ assert_backtrace (signo == SIGPIPE);
+ assert_backtrace (task == current);
return 0;
}
diff --git a/pfinet/glue-include/linux/socket.h b/pfinet/glue-include/linux/socket.h
index 057afbdb..a7475eaf 100644
--- a/pfinet/glue-include/linux/socket.h
+++ b/pfinet/glue-include/linux/socket.h
@@ -111,14 +111,14 @@ extern inline int /* Does not modify IOV. */
memcpy_fromiovecend (unsigned char *kdata, struct iovec *iov,
int offset, int len)
{
- assert (offset + len <= iov->iov_len);
+ assert_backtrace (offset + len <= iov->iov_len);
memcpy (kdata, iov->iov_base + offset, len);
return 0;
}
extern inline int /* Modifies IOV to consume LEN bytes. */
memcpy_fromiovec (unsigned char *kdata, struct iovec *iov, int len)
{
- assert (len <= iov->iov_len);
+ assert_backtrace (len <= iov->iov_len);
memcpy (kdata, iov->iov_base, len);
iov->iov_base += len;
iov->iov_len -= len;
@@ -127,7 +127,7 @@ memcpy_fromiovec (unsigned char *kdata, struct iovec *iov, int len)
extern inline void /* Modifies IOV to consume LEN bytes. */
memcpy_tokerneliovec (struct iovec *iov, unsigned char *kdata, int len)
{
- assert (len <= iov->iov_len);
+ assert_backtrace (len <= iov->iov_len);
memcpy (iov->iov_base, kdata, len);
iov->iov_base += len;
iov->iov_len -= len;
diff --git a/pfinet/glue-include/linux/types.h b/pfinet/glue-include/linux/types.h
index 604b8b14..f348ac25 100644
--- a/pfinet/glue-include/linux/types.h
+++ b/pfinet/glue-include/linux/types.h
@@ -4,7 +4,7 @@
#include <sys/types.h>
#include <sys/uio.h>
#include <stdint.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#define __u8 uint8_t
diff --git a/pfinet/io-ops.c b/pfinet/io-ops.c
index 742d64ff..ddda1110 100644
--- a/pfinet/io-ops.c
+++ b/pfinet/io-ops.c
@@ -269,7 +269,7 @@ io_select_common (struct sock_user *user,
/* In Linux, this means (supposedly) that I/O will never be possible.
That's a lose, so prevent it from happening. */
- assert (user->sock->ops->poll);
+ assert_backtrace (user->sock->ops->poll);
avail = (*user->sock->ops->poll) ((void *) 0xdeadbeef,
user->sock,
@@ -378,7 +378,7 @@ S_io_reauthenticate (struct sock_user *user,
auth = getauth ();
newright = ports_get_send_right (newuser);
- assert (newright != MACH_PORT_NULL);
+ assert_backtrace (newright != MACH_PORT_NULL);
/* Release the global lock while blocking on the auth server and client. */
pthread_mutex_unlock (&global_lock);
do
diff --git a/pfinet/main.c b/pfinet/main.c
index 5e4b7494..6b1b7238 100644
--- a/pfinet/main.c
+++ b/pfinet/main.c
@@ -197,7 +197,7 @@ find_device (char *name, struct device **device)
char *base_name;
/* Skip loopback interface. */
- assert (dev);
+ assert_backtrace (dev);
dev = dev->next;
if (!name)
@@ -252,7 +252,7 @@ enumerate_devices (error_t (*fun) (struct device *dev))
struct device *dev = dev_base;
/* Skip loopback device. */
- assert (dev);
+ assert_backtrace (dev);
dev = dev->next;
for (; dev; dev = dev->next)
diff --git a/pfinet/socket.c b/pfinet/socket.c
index 06ce2c7e..4a12426c 100644
--- a/pfinet/socket.c
+++ b/pfinet/socket.c
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include "pfinet.h"
#include <linux/socket.h>
@@ -32,7 +32,7 @@ struct net_proto_family *net_families[NPROTO];
int
sock_register (struct net_proto_family *fam)
{
- assert (fam->family < NPROTO);
+ assert_backtrace (fam->family < NPROTO);
net_families[fam->family] = fam;
return 0;
}
@@ -72,7 +72,7 @@ make_sock_user (struct socket *sock, int isroot, int noinstall, int consume)
error_t err;
struct sock_user *user;
- assert (sock->refcnt != 0);
+ assert_backtrace (sock->refcnt != 0);
if (noinstall)
err = ports_create_port_noinstall (socketport_class, pfinet_bucket,
diff --git a/pfinet/tunnel.c b/pfinet/tunnel.c
index 02e9ee81..b57f8dbb 100644
--- a/pfinet/tunnel.c
+++ b/pfinet/tunnel.c
@@ -68,7 +68,7 @@ tunnel_get_stats (struct device *dev)
{
struct tunnel_device *tdev = (struct tunnel_device *) dev->priv;
- assert (tdev);
+ assert_backtrace (tdev);
return &tdev->stats;
}
@@ -79,7 +79,7 @@ tunnel_stop (struct device *dev)
struct tunnel_device *tdev = (struct tunnel_device *) dev->priv;
struct sk_buff *skb;
- assert (tdev);
+ assert_backtrace (tdev);
while ((skb = skb_dequeue (&tdev->xq)) != 0)
dev_kfree_skb(skb);
@@ -105,7 +105,7 @@ tunnel_open (struct device *dev)
{
struct tunnel_device *tdev = (struct tunnel_device *) dev->priv;
- assert (tdev);
+ assert_backtrace (tdev);
skb_queue_head_init(&tdev->xq);
@@ -118,7 +118,7 @@ tunnel_xmit (struct sk_buff *skb, struct device *dev)
{
struct tunnel_device *tdev = (struct tunnel_device *) dev->priv;
- assert (tdev);
+ assert_backtrace (tdev);
pthread_mutex_lock (&tdev->lock);
@@ -232,7 +232,7 @@ setup_tunnel_device (char *name, struct device **device)
initializes its `ifindex' member (which matters!),
and tells the protocol stacks about the device. */
err = - register_netdevice (dev);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
/* If a new open with read and/or write permissions is requested,
@@ -327,7 +327,7 @@ trivfs_S_io_read (struct trivfs_protid *cred,
}
skb = skb_dequeue (&tdev->xq);
- assert(skb);
+ assert_backtrace (skb);
if (skb->len < amount)
amount = skb->len;
diff --git a/pflocal/connq.c b/pflocal/connq.c
index d86f9a24..b231da7f 100644
--- a/pflocal/connq.c
+++ b/pflocal/connq.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <pthread.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <stdlib.h>
#include "connq.h"
@@ -66,7 +66,7 @@ connq_request_init (struct connq_request *req, struct sock *sock)
static void
connq_request_enqueue (struct connq *cq, struct connq_request *req)
{
- assert (pthread_mutex_trylock (&cq->lock));
+ assert_backtrace (pthread_mutex_trylock (&cq->lock));
req->next = NULL;
*cq->tail = req;
@@ -82,8 +82,8 @@ connq_request_dequeue (struct connq *cq)
{
struct connq_request *req;
- assert (pthread_mutex_trylock (&cq->lock));
- assert (cq->head);
+ assert_backtrace (pthread_mutex_trylock (&cq->lock));
+ assert_backtrace (cq->head);
req = cq->head;
cq->head = req->next;
@@ -132,8 +132,8 @@ connq_destroy (struct connq *cq)
{
/* Everybody in the queue should hold a reference to the socket
containing the queue. */
- assert (! cq->head);
- assert (cq->count == 0);
+ assert_backtrace (! cq->head);
+ assert_backtrace (cq->count == 0);
free (cq);
}
@@ -171,7 +171,7 @@ connq_listen (struct connq *cq, struct timespec *tsp, struct sock **sock)
if (cq->count == 0)
/* The request queue is empty. */
{
- assert (! cq->head);
+ assert_backtrace (! cq->head);
if (cq->num_connectors > 0)
/* Someone is waiting for an acceptor. Signal that we can
@@ -190,7 +190,7 @@ connq_listen (struct connq *cq, struct timespec *tsp, struct sock **sock)
while (cq->count == 0);
}
- assert (cq->head);
+ assert_backtrace (cq->head);
if (sock)
/* Dequeue the next request, if desired. */
@@ -271,7 +271,7 @@ connq_connect_complete (struct connq *cq, struct sock *sock)
pthread_mutex_lock (&cq->lock);
- assert (cq->num_connectors > 0);
+ assert_backtrace (cq->num_connectors > 0);
cq->num_connectors --;
connq_request_enqueue (cq, req);
@@ -294,7 +294,7 @@ connq_connect_cancel (struct connq *cq)
{
pthread_mutex_lock (&cq->lock);
- assert (cq->num_connectors > 0);
+ assert_backtrace (cq->num_connectors > 0);
cq->num_connectors --;
if (cq->count + cq->num_connectors >= cq->max + cq->num_listeners)
diff --git a/pflocal/io.c b/pflocal/io.c
index c5622746..77e9df6e 100644
--- a/pflocal/io.c
+++ b/pflocal/io.c
@@ -442,7 +442,7 @@ S_io_reauthenticate (struct sock_user *user, mach_port_t rendezvous)
auth_server = getauth ();
err = mach_port_insert_right (mach_task_self (), new_user_port,
new_user_port, MACH_MSG_TYPE_MAKE_SEND);
- assert_perror (err);
+ assert_perror_backtrace (err);
do
err =
auth_server_authenticate (auth_server,
diff --git a/pflocal/sock.c b/pflocal/sock.c
index ef70d2c8..be64a3da 100644
--- a/pflocal/sock.c
+++ b/pflocal/sock.c
@@ -147,7 +147,7 @@ _sock_norefs (struct sock *sock)
{
/* A sock should never have an address when it has 0 refs, as the
address should hold a reference to the sock! */
- assert (sock->addr == NULL);
+ assert_backtrace (sock->addr == NULL);
pthread_mutex_unlock (&sock->lock); /* Unlock so sock_free can do stuff. */
sock_free (sock);
}
@@ -249,7 +249,7 @@ addr_clean (void *vaddr)
/* ADDR should never have a socket bound to it at this point, as it should
have been removed by addr_unbind dropping the socket's weak reference
it. */
- assert (addr->sock == NULL);
+ assert_backtrace (addr->sock == NULL);
}
/* Return a new address, not connected to any socket yet, ADDR. */
@@ -307,7 +307,7 @@ sock_bind (struct sock *sock, struct addr *addr)
zero because whoever's calling us should be holding a ref. */
sock->refs--;
ports_port_deref_weak (old_addr);
- assert (sock->refs > 0); /* But make sure... */
+ assert_backtrace (sock->refs > 0); /* But make sure... */
}
}
@@ -394,7 +394,7 @@ sock_connect (struct sock *sock1, struct sock *sock2)
|| (rd->flags & PFLOCAL_SOCK_SHUTDOWN_READ)))
{
struct pipe *pipe = rd->read_pipe;
- assert (pipe); /* Since PFLOCAL_SOCK_SHUTDOWN_READ isn't set. */
+ assert_backtrace (pipe); /* Since PFLOCAL_SOCK_SHUTDOWN_READ isn't set. */
pipe_add_writer (pipe);
wr->write_pipe = pipe;
}
diff --git a/pflocal/sock.h b/pflocal/sock.h
index 29f0f1f7..011b91a3 100644
--- a/pflocal/sock.h
+++ b/pflocal/sock.h
@@ -21,7 +21,7 @@
#ifndef __SOCK_H__
#define __SOCK_H__
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pthread.h> /* For mutexes */
#include <sys/mman.h>
#include <sys/types.h>
@@ -139,12 +139,12 @@ sock_deref (struct sock *sock)
/* Unbind */
err = sock_bind (sock, NULL);
- assert (!err);
+ assert_backtrace (!err);
/* And release the ref, and thus kill SOCK. */
pthread_mutex_lock (&sock->lock);
sock->refs--;
- assert(sock->refs == 0);
+ assert_backtrace (sock->refs == 0);
_sock_norefs (sock);
}
else
diff --git a/proc/host.c b/proc/host.c
index c68ab8ae..25066888 100644
--- a/proc/host.c
+++ b/proc/host.c
@@ -32,7 +32,7 @@
#include <stdio.h>
#include <hurd/exec.h>
#include <unistd.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <version.h>
#include <sys/mman.h>
@@ -359,7 +359,7 @@ initialize_version_info (void)
err = host_info (mach_host_self (), HOST_BASIC_INFO,
(host_info_t) &info, &n);
- assert (! err);
+ assert_backtrace (! err);
snprintf (uname_info.machine, sizeof uname_info.machine, "%s-%s",
mach_cpu_types[info.cpu_type],
mach_cpu_subtypes[info.cpu_type][info.cpu_subtype]);
@@ -367,11 +367,11 @@ initialize_version_info (void)
/* Notice Mach's and our own version and initialize server version
variables. */
server_versions = malloc (sizeof (struct server_version) * 10);
- assert (server_versions);
+ assert_backtrace (server_versions);
server_versions_nalloc = 10;
err = host_kernel_version (mach_host_self (), kv);
- assert (! err);
+ assert_backtrace (! err);
/* Make sure the result is null-terminated, as the kernel doesn't
guarantee it. */
kv[sizeof (kv) - 1] = '\0';
@@ -382,14 +382,14 @@ initialize_version_info (void)
if (p)
*p = '\0';
kernel_name = strdup (p ? kv : "mach");
- assert (kernel_name);
+ assert_backtrace (kernel_name);
kernel_version = strdup (p ? p + 1 : kv);
- assert (kernel_version);
+ assert_backtrace (kernel_version);
server_versions[0].name = strdup ("proc");
- assert (server_versions[0].name);
+ assert_backtrace (server_versions[0].name);
server_versions[0].version = strdup (HURD_VERSION);
- assert (server_versions[0].version);
+ assert_backtrace (server_versions[0].version);
nserver_versions = 1;
diff --git a/proc/info.c b/proc/info.c
index 79a4c37f..3c1bf6d3 100644
--- a/proc/info.c
+++ b/proc/info.c
@@ -27,7 +27,7 @@
#include <errno.h>
#include <string.h>
#include <sys/resource.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/msg.h>
#include "proc.h"
@@ -71,7 +71,7 @@ S_proc_pid2task (struct proc *callerp,
if (! check_owner (callerp, p))
return EPERM;
- assert (MACH_PORT_VALID (p->p_task));
+ assert_backtrace (MACH_PORT_VALID (p->p_task));
*t = p->p_task;
return 0;
@@ -618,7 +618,7 @@ S_proc_getprocinfo (struct proc *callerp,
pi->pgrp = p->p_pgrp->pg_pgid;
pi->session = p->p_pgrp->pg_session->s_sid;
for (tp = p; !tp->p_loginleader; tp = tp->p_parent)
- assert (tp);
+ assert_backtrace (tp);
pi->logincollection = tp->p_pid;
if (p->p_dead || p->p_stopped)
{
@@ -837,7 +837,7 @@ S_proc_getloginid (struct proc *callerp,
}
for (p = proc; !p->p_loginleader; p = p->p_parent)
- assert (p);
+ assert_backtrace (p);
*leader = p->p_pid;
return 0;
diff --git a/proc/main.c b/proc/main.c
index e615f363..0a6f9916 100644
--- a/proc/main.c
+++ b/proc/main.c
@@ -25,7 +25,7 @@
#include <hurd/paths.h>
#include <hurd/startup.h>
#include <device/device.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <argp.h>
#include <error.h>
#include <version.h>
@@ -165,7 +165,7 @@ main (int argc, char **argv, char **envp)
initialize_version_info ();
err = task_get_bootstrap_port (mach_task_self (), &boot);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (boot == MACH_PORT_NULL)
error (2, 0, "proc server can only be run by startup during boot");
@@ -187,14 +187,14 @@ main (int argc, char **argv, char **envp)
/* Create our own proc object. */
self_proc = allocate_proc (mach_task_self ());
- assert (self_proc);
+ assert_backtrace (self_proc);
complete_proc (self_proc, HURD_PID_PROC);
startup_port = ports_get_send_right (startup_proc);
err = startup_procinit (boot, startup_port, &startup_proc->p_task,
&authserver, &_hurd_host_priv, &_hurd_device_master);
- assert_perror (err);
+ assert_perror_backtrace (err);
mach_port_deallocate (mach_task_self (), startup_port);
/* Get our stderr set up to print on the console, in case we have
@@ -252,7 +252,7 @@ main (int argc, char **argv, char **envp)
startup_fallback = 1;
err = mach_port_deallocate (mach_task_self (), startup);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
else
/* Fall back to abusing the message port lookup. */
diff --git a/proc/mgt.c b/proc/mgt.c
index a9015ccc..750073a0 100644
--- a/proc/mgt.c
+++ b/proc/mgt.c
@@ -33,7 +33,7 @@
#include <mach/mig_errors.h>
#include <sys/resource.h>
#include <hurd/auth.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pids.h>
#include "proc.h"
@@ -189,7 +189,7 @@ S_proc_child (struct proc *parentp,
/* Process hierarchy. Remove from our current location
and place us under our new parent. Sanity check to make sure
parent is currently init. */
- assert (childp->p_parent == init_proc);
+ assert_backtrace (childp->p_parent == init_proc);
if (childp->p_sib)
childp->p_sib->p_prevsib = childp->p_prevsib;
*childp->p_prevsib = childp->p_sib;
@@ -606,7 +606,7 @@ create_init_proc (void)
const char *rootsname = "root";
p = allocate_proc (MACH_PORT_NULL);
- assert (p);
+ assert_backtrace (p);
p->p_pid = HURD_PID_INIT;
@@ -622,11 +622,11 @@ create_init_proc (void)
p->p_noowner = 0;
p->p_id = make_ids (&zero, 1);
- assert (p->p_id);
+ assert_backtrace (p->p_id);
p->p_loginleader = 1;
p->p_login = malloc (sizeof (struct login) + strlen (rootsname) + 1);
- assert (p->p_login);
+ assert_backtrace (p->p_login);
p->p_login->l_refcnt = 1;
strcpy (p->p_login->l_name, rootsname);
@@ -649,7 +649,7 @@ proc_death_notify (struct proc *p)
p->p_pi.port_right,
MACH_MSG_TYPE_MAKE_SEND_ONCE,
&old);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (old != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), old);
@@ -681,7 +681,7 @@ complete_proc (struct proc *p, pid_t pid)
HURD_PID_INIT. */
static const uid_t zero;
p->p_id = make_ids (&zero, 1);
- assert (p->p_id);
+ assert_backtrace (p->p_id);
}
else
{
@@ -930,8 +930,8 @@ process_has_exited (struct proc *p)
void
complete_exit (struct proc *p)
{
- assert (p->p_dead);
- assert (p->p_waited);
+ assert_backtrace (p->p_dead);
+ assert_backtrace (p->p_waited);
remove_proc_from_hash (p);
if (p->p_task != MACH_PORT_NULL)
@@ -1178,7 +1178,7 @@ S_mach_notify_new_task (struct port_info *notify,
proc_child, so we do it on their behalf. */
mach_port_mod_refs (mach_task_self (), task, MACH_PORT_RIGHT_SEND, +1);
err = S_proc_child (parentp, task);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* Relay the notification. This consumes task and parent. */
return mach_notify_new_task (childp->p_task_namespace, task, parent);
diff --git a/proc/msg.c b/proc/msg.c
index 8efc993e..9c326e20 100644
--- a/proc/msg.c
+++ b/proc/msg.c
@@ -19,7 +19,7 @@
#include <hurd.h>
#include "proc.h"
#include <hurd/startup.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <stdlib.h>
#include <stdio.h>
diff --git a/proc/pgrp.c b/proc/pgrp.c
index 9db1dba6..a7876764 100644
--- a/proc/pgrp.c
+++ b/proc/pgrp.c
@@ -25,7 +25,7 @@
#include <sys/errno.h>
#include <stdlib.h>
#include <signal.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include "proc.h"
#include "process_S.h"
@@ -130,7 +130,7 @@ boot_setsid (struct proc *p)
sess = new_session (p);
p->p_pgrp = new_pgrp (p->p_pid, sess);
- assert (p->p_pgrp);
+ assert_backtrace (p->p_pgrp);
join_pgrp (p);
return;
}
diff --git a/proc/stubs.c b/proc/stubs.c
index 096e55ef..e984f234 100644
--- a/proc/stubs.c
+++ b/proc/stubs.c
@@ -20,7 +20,7 @@
#include <hurd/hurd_types.h>
#include <mach/message.h>
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <stdio.h>
#include "proc.h"
@@ -61,7 +61,7 @@ blocking_message_send (void *arg)
case MACH_SEND_INVALID_NOTIFY:
case MACH_SEND_NO_NOTIFY:
case MACH_SEND_NOTIFY_IN_PROGRESS:
- assert_perror (err);
+ assert_perror_backtrace (err);
break;
default: /* Other errors are safe to ignore. */
@@ -169,7 +169,7 @@ send_signal (mach_port_t msgport,
case MACH_SEND_INVALID_NOTIFY:
case MACH_SEND_NO_NOTIFY:
case MACH_SEND_NOTIFY_IN_PROGRESS:
- assert_perror (err);
+ assert_perror_backtrace (err);
break;
default: /* Other errors are safe to ignore. */
diff --git a/proc/wait.c b/proc/wait.c
index 824e6672..e8c379a0 100644
--- a/proc/wait.c
+++ b/proc/wait.c
@@ -29,7 +29,8 @@
#include <sys/wait.h>
#include <errno.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
+#define assert assert_backtrace
#include "process_S.h"
#include <mach/mig_errors.h>
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"
diff --git a/startup/startup.c b/startup/startup.c
index 3c3ead4c..5c46c0f1 100644
--- a/startup/startup.c
+++ b/startup/startup.c
@@ -27,7 +27,7 @@
#include <hurd/fsys.h>
#include <device/device.h>
#include <stdio.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/paths.h>
#include <sys/reboot.h>
#include <sys/file.h>
@@ -379,19 +379,19 @@ run (const char *server, mach_port_t *ports, task_t *task,
char *argz = NULL;
size_t argz_len = 0;
err = argz_create_sep (prog, ' ', &argz, &argz_len);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = task_create (mach_task_self (),
#ifdef KERN_INVALID_LEDGER
NULL, 0, /* OSF Mach */
#endif
0, task);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (insert_ports)
{
err = insert_ports (&argz, &argz_len, *task);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
if (bootstrap_args & RB_KDB)
@@ -712,15 +712,15 @@ main (int argc, char **argv, char **envp)
setbuf (stdout, NULL);
err = argz_create (envp, &startup_envz, &startup_envz_len);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* At this point we can use assert to check for errors. */
err = mach_port_allocate (mach_task_self (),
MACH_PORT_RIGHT_RECEIVE, &startup);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = mach_port_insert_right (mach_task_self (), startup, startup,
MACH_MSG_TYPE_MAKE_SEND);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* Crash if the boot filesystem task dies. */
request_dead_name (fstask);
@@ -765,7 +765,7 @@ main (int argc, char **argv, char **envp)
while (1)
{
err = mach_msg_server (demuxer, 0, startup);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
}
@@ -784,7 +784,7 @@ launch_core_servers (void)
mach_task_self (), authserver,
host_priv, MACH_MSG_TYPE_COPY_SEND,
device_master, MACH_MSG_TYPE_COPY_SEND);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (!fakeboot)
{
mach_port_deallocate (mach_task_self (), device_master);
@@ -796,22 +796,22 @@ launch_core_servers (void)
/* Mark us as important. */
err = proc_mark_important (procserver);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = proc_mark_exec (procserver);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* Declare that the filesystem and auth are our children. */
err = proc_child (procserver, fstask);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = proc_child (procserver, authtask);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = proc_task2proc (procserver, authtask, &authproc);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = proc_mark_important (authproc);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = proc_mark_exec (authproc);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = install_as_translator ();
if (err)
@@ -823,7 +823,7 @@ launch_core_servers (void)
err = startup_authinit_reply (authreply, authreplytype, 0, authproc,
MACH_MSG_TYPE_MOVE_SEND);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (verbose)
fprintf (stderr, "auth launched\n");
@@ -838,13 +838,13 @@ launch_core_servers (void)
err = proc_set_arg_locations (procserver,
(vm_address_t) global_argv,
(vm_address_t) environ);
- assert_perror (err);
+ assert_perror_backtrace (err);
default_ports[INIT_PORT_AUTH] = authserver;
/* Declare that the proc server is our child. */
err = proc_child (procserver, proctask);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = proc_task2proc (procserver, proctask, &procproc);
if (!err)
{
@@ -855,16 +855,16 @@ launch_core_servers (void)
err = proc_register_version (procserver, host_priv,
"init", "", HURD_VERSION);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* Get the bootstrap filesystem's proc server port.
We must do this before calling proc_setmsgport below. */
err = proc_task2proc (procserver, fstask, &fsproc);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = proc_mark_important (fsproc);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = proc_mark_exec (fsproc);
- assert_perror (err);
+ assert_perror_backtrace (err);
fprintf (stderr, ".\n");
@@ -875,7 +875,7 @@ launch_core_servers (void)
calling fsys_init, because fsys_init blocks on exec_init, and
exec_init will block waiting on our message port. */
err = proc_setmsgport (procserver, startup, &old);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (old != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), old);
@@ -1010,10 +1010,10 @@ frob_kernel_process (void)
error (0, err, "cannot mark the kernel as important");
err = record_essential_task ("kernel", task);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = task_get_bootstrap_port (task, &kbs);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (kbs == MACH_PORT_NULL)
{
/* The kernel task has no bootstrap port set, so we are presumably
@@ -1062,16 +1062,16 @@ frob_kernel_process (void)
canonical argv array and argz of those words. */
err = argz_create (&global_argv[1], &argz, &argzlen);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = argz_insert (&argz, &argzlen, argz, "gnumach");
- assert_perror (err);
+ assert_perror_backtrace (err);
argc = argz_count (argz, argzlen);
windowsz = round_page (((argc + 1) * sizeof (char *)) + argzlen);
mine = (vm_address_t) mmap (0, windowsz, PROT_READ|PROT_WRITE,
MAP_ANON, 0, 0);
- assert (mine != -1);
+ assert_backtrace (mine != -1);
err = vm_allocate (task, &his, windowsz, 1);
if (err)
{
@@ -1211,7 +1211,7 @@ start_child (const char *prog, char **progargs)
err = argz_create ((char **) argv, &args, &arglen);
}
}
- assert_perror (err);
+ assert_perror_backtrace (err);
if (verbose)
fprintf (stderr, "Going to execute '%s'\n", args);
@@ -1477,7 +1477,7 @@ do_mach_notify_dead_name (mach_port_t notify,
struct ntfy_task *nt, *pnt;
struct ess_task *et;
- assert (notify == startup);
+ assert_backtrace (notify == startup);
/* Deallocate the extra reference the notification carries. */
mach_port_deallocate (mach_task_self (), name);
diff --git a/storeio/dev.c b/storeio/dev.c
index 614c257f..78e0a177 100644
--- a/storeio/dev.c
+++ b/storeio/dev.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <hurd.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include <hurd/pager.h>
#include <hurd/store.h>
@@ -106,7 +106,7 @@ dev_buf_rw (struct dev *dev, size_t buf_offs, size_t *io_offs, size_t *len,
{
size_t block_size = dev->store->block_size;
- assert (dev_buf_is_active (dev));
+ assert_backtrace (dev_buf_is_active (dev));
if (buf_offs + *len >= block_size)
/* Only part of BUF lies within the buffer (or everything up
@@ -141,7 +141,7 @@ dev_open (struct dev *dev)
const int flags = ((dev->readonly ? STORE_READONLY : 0)
| (dev->no_fileio ? STORE_NO_FILEIO : 0));
- assert (dev->store == 0);
+ assert_backtrace (dev->store == 0);
if (dev->store_name == 0)
{
@@ -188,7 +188,7 @@ dev_open (struct dev *dev)
void
dev_close (struct dev *dev)
{
- assert (dev->store);
+ assert_backtrace (dev->store);
if (!dev->inhibit_cache)
{
diff --git a/storeio/pager.c b/storeio/pager.c
index 54b17142..12387939 100644
--- a/storeio/pager.c
+++ b/storeio/pager.c
@@ -20,7 +20,7 @@
#include <hurd.h>
#include <hurd/pager.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <strings.h>
#include <unistd.h>
#include <errno.h>
@@ -115,7 +115,7 @@ void
pager_notify_evict (struct user_pager_info *pager,
vm_offset_t page)
{
- assert (!"unrequested notification on eviction");
+ assert_backtrace (!"unrequested notification on eviction");
}
/* The user must define this function. It should report back (in
diff --git a/storeio/storeio.c b/storeio/storeio.c
index fcf2f30f..515944ed 100644
--- a/storeio/storeio.c
+++ b/storeio/storeio.c
@@ -19,7 +19,7 @@
#include <stdio.h>
#include <error.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <fcntl.h>
#include <argp.h>
#include <argz.h>
diff --git a/sutils/bless.c b/sutils/bless.c
index 039320ab..4b272adc 100644
--- a/sutils/bless.c
+++ b/sutils/bless.c
@@ -18,7 +18,7 @@
along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */
#include <argp.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <error.h>
#include <hurd.h>
#include <mach.h>
@@ -90,7 +90,7 @@ main (int argc, char **argv)
error (1, err, "Could not mark process as important");
err = mach_port_deallocate (mach_task_self (), proc);
- assert_perror (err);
+ assert_perror_backtrace (err);
return EXIT_SUCCESS;
}
diff --git a/sutils/fsck.c b/sutils/fsck.c
index 1ab9caa5..d864134c 100644
--- a/sutils/fsck.c
+++ b/sutils/fsck.c
@@ -50,7 +50,7 @@
#include <error.h>
#include <argp.h>
#include <argz.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <version.h>
#include "fstab.h"
@@ -137,8 +137,8 @@ fs_start_fsck (struct fs *fs, int flags)
struct fstype *type;
error_t err = fs_type (fs, &type);
- assert_perror (err); /* Should already have been checked for. */
- assert (type->program);
+ assert_perror_backtrace (err); /* Should already have been checked for. */
+ assert_backtrace (type->program);
*argp++ = type->program;
diff --git a/sutils/swapon.c b/sutils/swapon.c
index 40f5a205..78a45908 100644
--- a/sutils/swapon.c
+++ b/sutils/swapon.c
@@ -29,7 +29,7 @@
#include <argp.h>
#include <argz.h>
#include <error.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <sys/mman.h>
#include <hurd/store.h>
#include <hurd/paths.h>
diff --git a/term/devio.c b/term/devio.c
index eedd7b87..60ee2217 100644
--- a/term/devio.c
+++ b/term/devio.c
@@ -43,7 +43,7 @@
#undef EXTA
#undef EXTB
-#include <assert.h>
+#include <assert-backtrace.h>
#include <errno.h>
#include <error.h>
#include <string.h>
@@ -459,15 +459,15 @@ initial_open ()
{
error_t err;
- assert (open_pending != FAKE);
+ assert_backtrace (open_pending != FAKE);
/* Nothing to do */
if (open_pending == INITIAL)
return 0;
- assert (phys_device == MACH_PORT_NULL);
- assert (phys_reply == MACH_PORT_NULL);
- assert (phys_reply_pi == 0);
+ assert_backtrace (phys_device == MACH_PORT_NULL);
+ assert_backtrace (phys_reply == MACH_PORT_NULL);
+ assert_backtrace (phys_reply_pi == 0);
err = ports_create_port (phys_reply_class, term_bucket,
sizeof (struct port_info), &phys_reply_pi);
@@ -516,7 +516,7 @@ devio_assert_dtr ()
/* Schedule a fake open to wait for DTR, unless one is already
happening. */
- assert (open_pending != INITIAL);
+ assert_backtrace (open_pending != INITIAL);
if (open_pending == FAKE)
return 0;
@@ -544,7 +544,7 @@ device_open_reply (mach_port_t replyport,
pthread_mutex_lock (&global_lock);
- assert (open_pending != NOTPENDING);
+ assert_backtrace (open_pending != NOTPENDING);
if (returncode != 0)
{
@@ -564,9 +564,9 @@ device_open_reply (mach_port_t replyport,
{
/* Special handling for the first open */
- assert (phys_device == MACH_PORT_NULL);
- assert (phys_reply_writes == MACH_PORT_NULL);
- assert (phys_reply_writes_pi == 0);
+ assert_backtrace (phys_device == MACH_PORT_NULL);
+ assert_backtrace (phys_reply_writes == MACH_PORT_NULL);
+ assert_backtrace (phys_reply_writes_pi == 0);
phys_device = device;
err = ports_create_port (phys_reply_class, term_bucket,
sizeof (struct port_info),
diff --git a/term/hurdio.c b/term/hurdio.c
index b34854cd..3456ef24 100644
--- a/term/hurdio.c
+++ b/term/hurdio.c
@@ -22,7 +22,7 @@
#include <termios.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <errno.h>
#include <error.h>
#include <string.h>
diff --git a/term/main.c b/term/main.c
index be014e18..2813d528 100644
--- a/term/main.c
+++ b/term/main.c
@@ -232,7 +232,7 @@ parse_opt (int opt, char *arg, struct argp_state *state)
bottom = &hurdio_bottom;
break;
default:
- assert (! "impossible type");
+ assert_backtrace (! "impossible type");
break;
}
free (tty_arg);
diff --git a/term/munge.c b/term/munge.c
index 96b0df39..242dd367 100644
--- a/term/munge.c
+++ b/term/munge.c
@@ -306,7 +306,7 @@ erase_1 (char erase_char)
write_erase_sequence ();
}
if (echo_qsize == 0)
- assert (echo_pstart == output_psize);
+ assert_backtrace (echo_pstart == output_psize);
}
else
reprint_line ();
@@ -712,7 +712,7 @@ create_queue (int size, int lowat, int hiwat)
struct queue *q;
q = malloc (sizeof (struct queue) + size * sizeof (quoted_char));
- assert (q);
+ assert_backtrace (q);
q->susp = 0;
q->lowat = lowat;
@@ -720,7 +720,7 @@ create_queue (int size, int lowat, int hiwat)
q->cs = q->ce = q->array;
q->arraylen = size;
q->wait = malloc (sizeof (pthread_cond_t));
- assert (q->wait);
+ assert_backtrace (q->wait);
pthread_cond_init (q->wait, NULL);
return q;
diff --git a/term/term.h b/term/term.h
index 0a428691..9125e999 100644
--- a/term/term.h
+++ b/term/term.h
@@ -22,7 +22,7 @@
#define __HURD_TERM_H__
#include <pthread.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <errno.h>
#include <hurd/trivfs.h>
#include <sys/types.h>
@@ -246,7 +246,7 @@ dequeue_quote (struct queue *q)
{
int beep = 0;
- assert (qsize (q));
+ assert_backtrace (qsize (q));
if (q->susp && (qsize (q) < q->lowat))
{
q->susp = 0;
@@ -340,7 +340,7 @@ queue_erase (struct queue *q)
short answer;
int beep = 0;
- assert (qsize (q));
+ assert_backtrace (qsize (q));
answer = *--q->ce;
if (q->susp && (qsize (q) < q->lowat))
{
diff --git a/term/users.c b/term/users.c
index 193b3582..4e8368e7 100644
--- a/term/users.c
+++ b/term/users.c
@@ -172,7 +172,7 @@ open_hook (struct trivfs_control *cntl,
}
else
{
- assert (open_count > 0); /* XXX debugging */
+ assert_backtrace (open_count > 0); /* XXX debugging */
if (termflags & EXCL_USE)
{
@@ -254,7 +254,7 @@ pi_destroy_hook (struct trivfs_protid *cred)
pthread_mutex_lock (&global_lock);
if (cred->hook)
{
- assert (((struct protid_hook *)cred->hook)->refcnt > 0);
+ assert_backtrace (((struct protid_hook *)cred->hook)->refcnt > 0);
if (--((struct protid_hook *)cred->hook)->refcnt == 0)
free (cred->hook);
}
@@ -388,7 +388,7 @@ S_termctty_open_terminal (struct port_info *pi,
if (!pi)
return EOPNOTSUPP;
- assert (pi == cttyid);
+ assert_backtrace (pi == cttyid);
err = io_restrict_auth (termctl->underlying, &new_realnode, 0, 0, 0, 0);
diff --git a/tmpfs/dir.c b/tmpfs/dir.c
index 37bb7bff..340a63da 100644
--- a/tmpfs/dir.c
+++ b/tmpfs/dir.c
@@ -44,8 +44,8 @@ diskfs_clear_directory (struct node *dp, struct node *pdp,
{
if (dp->dn->u.dir.entries != 0)
return ENOTEMPTY;
- assert (dp->dn_stat.st_size == 0);
- assert (dp->dn->u.dir.dotdot == pdp->dn);
+ assert_backtrace (dp->dn_stat.st_size == 0);
+ assert_backtrace (dp->dn->u.dir.dotdot == pdp->dn);
/* Decrease hardlink count for parent directory */
pdp->dn_stat.st_nlink--;
@@ -97,7 +97,7 @@ diskfs_get_directs (struct node *dp, int entry, int n,
{
if (dp->dn->u.dir.dotdot == 0)
{
- assert (dp == diskfs_root_node);
+ assert_backtrace (dp == diskfs_root_node);
/* Use something not zero and not an st_ino value for any node in
this filesystem. Since we use pointer values, 2 will never
be a valid number. */
@@ -120,7 +120,7 @@ diskfs_get_directs (struct node *dp, int entry, int n,
if (i < entry)
{
- assert (d == 0);
+ assert_backtrace (d == 0);
*datacnt = 0;
*amt = 0;
return 0;
@@ -177,7 +177,7 @@ diskfs_lookup_hard (struct node *dp,
struct tmpfs_dirent *d, **prevp;
if (type == REMOVE || type == RENAME)
- assert (np);
+ assert_backtrace (np);
if (ds)
ds->dotdot = type & SPEC_DOTDOT;
@@ -196,16 +196,16 @@ diskfs_lookup_hard (struct node *dp,
struct disknode *dddn = dp->dn->u.dir.dotdot;
error_t err;
- assert (np != 0);
+ assert_backtrace (np != 0);
if (dddn == 0) /* root directory */
return EAGAIN;
if (type == (REMOVE|SPEC_DOTDOT) || type == (RENAME|SPEC_DOTDOT))
{
*np = *dddn->hprevp;
- assert (*np);
- assert ((*np)->dn == dddn);
- assert (*dddn->hprevp == *np);
+ assert_backtrace (*np);
+ assert_backtrace ((*np)->dn == dddn);
+ assert_backtrace (*dddn->hprevp == *np);
return 0;
}
else
diff --git a/tmpfs/node.c b/tmpfs/node.c
index 2a4489c2..e93b8794 100644
--- a/tmpfs/node.c
+++ b/tmpfs/node.c
@@ -78,7 +78,7 @@ diskfs_free_node (struct node *np, mode_t mode)
}
break;
case DT_DIR:
- assert (np->dn->u.dir.entries == 0);
+ assert_backtrace (np->dn->u.dir.entries == 0);
break;
case DT_LNK:
free (np->dn->u.lnk);
@@ -122,7 +122,7 @@ diskfs_node_norefs (struct node *np)
switch (np->dn->type)
{
case DT_REG:
- assert (np->allocsize % vm_page_size == 0);
+ assert_backtrace (np->allocsize % vm_page_size == 0);
np->dn->u.reg.allocpages = np->allocsize / vm_page_size;
break;
case DT_CHR:
@@ -170,7 +170,7 @@ diskfs_cached_lookup (ino_t inum, struct node **npp)
struct disknode *dn = (void *) (uintptr_t) inum;
struct node *np;
- assert (npp);
+ assert_backtrace (npp);
pthread_rwlock_rdlock (&all_nodes_lock);
if (dn->hprevp != 0) /* There is already a node. */
@@ -232,8 +232,8 @@ diskfs_cached_lookup (ino_t inum, struct node **npp)
gotit:
np = *dn->hprevp;
- assert (np->dn == dn);
- assert (*dn->hprevp == np);
+ assert_backtrace (np->dn == dn);
+ assert_backtrace (*dn->hprevp == np);
diskfs_nref (np);
pthread_rwlock_unlock (&all_nodes_lock);
pthread_mutex_lock (&np->lock);
@@ -379,7 +379,7 @@ diskfs_set_translator (struct node *np,
static error_t
create_symlink_hook (struct node *np, const char *target)
{
- assert (np->dn->u.lnk == 0);
+ assert_backtrace (np->dn->u.lnk == 0);
np->dn_stat.st_size = strlen (target);
if (np->dn_stat.st_size > 0)
{
@@ -444,7 +444,7 @@ diskfs_truncate (struct node *np, off_t size)
if (np->allocsize <= size)
return 0;
- assert (np->dn->type == DT_REG);
+ assert_backtrace (np->dn->type == DT_REG);
if (default_pager == MACH_PORT_NULL)
return EIO;
@@ -484,7 +484,7 @@ diskfs_truncate (struct node *np, off_t size)
error_t
diskfs_grow (struct node *np, off_t size, struct protid *cred)
{
- assert (np->dn->type == DT_REG);
+ assert_backtrace (np->dn->type == DT_REG);
if (np->allocsize >= size)
return 0;
@@ -548,7 +548,7 @@ diskfs_get_filemap (struct node *np, vm_prot_t prot)
errno = err;
return MACH_PORT_NULL;
}
- assert (np->dn->u.reg.memobj != MACH_PORT_NULL);
+ assert_backtrace (np->dn->u.reg.memobj != MACH_PORT_NULL);
/* XXX we need to keep a reference to the object, or GNU Mach
will terminate it when we release the map. */
@@ -556,7 +556,7 @@ diskfs_get_filemap (struct node *np, vm_prot_t prot)
vm_map (mach_task_self (), &np->dn->u.reg.memref, 4096, 0, 1,
np->dn->u.reg.memobj, 0, 0, VM_PROT_NONE, VM_PROT_NONE,
VM_INHERIT_NONE);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
/* XXX always writable */
@@ -564,7 +564,7 @@ diskfs_get_filemap (struct node *np, vm_prot_t prot)
/* Add a reference for each call, the caller will deallocate it. */
err = mach_port_mod_refs (mach_task_self (), np->dn->u.reg.memobj,
MACH_PORT_RIGHT_SEND, +1);
- assert_perror (err);
+ assert_perror_backtrace (err);
return np->dn->u.reg.memobj;
}
@@ -613,18 +613,18 @@ diskfs_S_file_get_storage_info (struct protid *cred,
if (memobj == MACH_PORT_NULL)
return errno;
- assert (*num_ports >= 1); /* mig always gives us some */
+ assert_backtrace (*num_ports >= 1); /* mig always gives us some */
*num_ports = 1;
*ports_type = MACH_MSG_TYPE_MOVE_SEND;
(*ports)[0]
= (cred->po->openstat & O_RDWR) == O_RDWR ? memobj : MACH_PORT_NULL;
- assert (*num_offsets >= 2); /* mig always gives us some */
+ assert_backtrace (*num_offsets >= 2); /* mig always gives us some */
*num_offsets = 2;
(*offsets)[0] = 0;
(*offsets)[1] = cred->po->np->dn_stat.st_size;
- assert (*num_ints >= 6); /* mig always gives us some */
+ assert_backtrace (*num_ints >= 6); /* mig always gives us some */
*num_ints = 6;
(*ints)[0] = STORAGE_MEMORY;
(*ints)[1] = (cred->po->openstat & O_WRITE) ? 0 : STORE_READONLY;
diff --git a/tmpfs/tmpfs.c b/tmpfs/tmpfs.c
index fd1c9aaf..28151990 100644
--- a/tmpfs/tmpfs.c
+++ b/tmpfs/tmpfs.c
@@ -341,7 +341,7 @@ main (int argc, char **argv)
struct stat st;
err = argp_parse (&startup_argp, argc, argv, ARGP_IN_ORDER, NULL, NULL);
- assert_perror (err);
+ assert_perror_backtrace (err);
task_get_bootstrap_port (mach_task_self (), &bootstrap);
if (bootstrap == MACH_PORT_NULL)
diff --git a/trans/crash.c b/trans/crash.c
index f8e1658d..3fad4992 100644
--- a/trans/crash.c
+++ b/trans/crash.c
@@ -29,7 +29,7 @@
#include <argp.h>
#include <argz.h>
#include <sys/mman.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pthread.h>
#include <version.h>
@@ -152,7 +152,7 @@ template_make_file_name (const char *template,
break;
default:
- assert (!"reached!");
+ assert_backtrace (!"reached!");
}
specifier = 0;
}
@@ -162,7 +162,7 @@ template_make_file_name (const char *template,
fprintf (stream, "%c", *t);
}
- assert (! specifier);
+ assert_backtrace (! specifier);
fprintf (stream, "%c", 0);
fclose (stream);
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index 0571c3e5..df47b00f 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -76,7 +76,7 @@ new_node (file_t file, mach_port_t idport, int locked, int openmodes,
error_t err;
struct netnode *nn;
- assert ((openmodes & ~(O_RDWR|O_EXEC)) == 0);
+ assert_backtrace ((openmodes & ~(O_RDWR|O_EXEC)) == 0);
*np = netfs_make_node_alloc (sizeof *nn);
if (*np == 0)
@@ -97,7 +97,7 @@ new_node (file_t file, mach_port_t idport, int locked, int openmodes,
{
ino_t fileno;
mach_port_t fsidport;
- assert (!locked);
+ assert_backtrace (!locked);
err = io_identity (file, &nn->idport, &fsidport, &fileno);
if (err)
{
@@ -218,7 +218,7 @@ check_openmodes (struct netnode *nn, int newmodes, file_t file)
{
error_t err = 0;
- assert ((newmodes & ~(O_RDWR|O_EXEC)) == 0);
+ assert_backtrace ((newmodes & ~(O_RDWR|O_EXEC)) == 0);
if (newmodes &~ nn->openmodes)
{
@@ -484,7 +484,7 @@ netfs_S_dir_lookup (struct protid *diruser,
if (err)
goto lose;
- assert (retry_name[0] == '\0' && *do_retry == FS_RETRY_NORMAL);
+ assert_backtrace (retry_name[0] == '\0' && *do_retry == FS_RETRY_NORMAL);
flags &= ~(O_CREAT|O_EXCL|O_NOLINK|O_NOTRANS|O_NONBLOCK);
err = iohelp_dup_iouser (&user, diruser->user);
@@ -531,7 +531,7 @@ error_t
netfs_attempt_lookup (struct iouser *user, struct node *dir,
char *name, struct node **np)
{
- assert (! "should not be here");
+ assert_backtrace (! "should not be here");
return EIEIO;
}
@@ -539,7 +539,7 @@ error_t
netfs_attempt_create_file (struct iouser *user, struct node *dir,
char *name, mode_t mode, struct node **np)
{
- assert (! "should not be here");
+ assert_backtrace (! "should not be here");
return EIEIO;
}
@@ -812,7 +812,7 @@ netfs_attempt_readlink (struct iouser *user, struct node *np, char *buf)
err = EINVAL;
else
{
- assert (translen <= sizeof _HURD_SYMLINK + np->nn_stat.st_size + 1);
+ assert_backtrace (translen <= sizeof _HURD_SYMLINK + np->nn_stat.st_size + 1);
memcpy (buf, &trans[sizeof _HURD_SYMLINK],
translen - sizeof _HURD_SYMLINK);
}
@@ -1087,7 +1087,7 @@ netfs_demuxer (mach_msg_header_t *inp,
else
{
error_t err;
- assert (MACH_MSGH_BITS_LOCAL (inp->msgh_bits)
+ assert_backtrace (MACH_MSGH_BITS_LOCAL (inp->msgh_bits)
== MACH_MSG_TYPE_MOVE_SEND
|| MACH_MSGH_BITS_LOCAL (inp->msgh_bits)
== MACH_MSG_TYPE_PROTECTED_PAYLOAD);
diff --git a/trans/magic.c b/trans/magic.c
index a033db9a..e38efcae 100644
--- a/trans/magic.c
+++ b/trans/magic.c
@@ -34,7 +34,7 @@
#include <limits.h>
#include <argp.h>
#include <argz.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include "fsys_S.h"
@@ -167,7 +167,7 @@ magic_getroot (struct trivfs_control *cntl,
*node_type = MACH_MSG_TYPE_COPY_SEND;
err = mach_port_deallocate (mach_task_self (), dotdot);
- assert_perror (err);
+ assert_perror_backtrace (err);
return 0;
}
@@ -313,10 +313,10 @@ trivfs_S_dir_lookup (struct trivfs_protid *cred,
}
err = mach_port_mod_refs (mach_task_self (), dotdot,
MACH_PORT_RIGHT_SEND, +1);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = mach_port_mod_refs (mach_task_self (), cred->realnode,
MACH_PORT_RIGHT_SEND, +1);
- assert_perror (err);
+ assert_perror_backtrace (err);
*retry_type = FS_RETRY_NORMAL;
*retry_name = '\0';
diff --git a/trans/new-fifo.c b/trans/new-fifo.c
index c293b764..efa36c24 100644
--- a/trans/new-fifo.c
+++ b/trans/new-fifo.c
@@ -24,7 +24,7 @@
#include <error.h>
#include <string.h>
#include <fcntl.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pthread.h>
#include <hurd.h>
@@ -536,7 +536,7 @@ trivfs_S_io_read (struct trivfs_protid *cred,
else
{
struct pipe *pipe = cred->po->hook;
- assert (pipe);
+ assert_backtrace (pipe);
pthread_mutex_lock (&pipe->lock);
err = pipe_read (pipe, cred->po->openmodes & O_NONBLOCK, NULL,
data, data_len, amount);
@@ -565,7 +565,7 @@ trivfs_S_io_readable (struct trivfs_protid *cred,
else
{
struct pipe *pipe = cred->po->hook;
- assert (pipe);
+ assert_backtrace (pipe);
pthread_mutex_lock (&pipe->lock);
*amount = pipe_readable (pipe, 1);
pthread_mutex_unlock (&pipe->lock);
@@ -835,7 +835,7 @@ trivfs_S_fsys_forward (mach_port_t server,
return EOPNOTSUPP;
server_trans = cred->po->cntl->hook;
- assert (server_trans->server);
+ assert_backtrace (server_trans->server);
argz_extract (argz, argz_len, argv);
diff --git a/trans/password.c b/trans/password.c
index 9ffcaa0a..b9f9c5bd 100644
--- a/trans/password.c
+++ b/trans/password.c
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <argp.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <errno.h>
#include <error.h>
#include <stdlib.h>
@@ -151,7 +151,7 @@ S_password_check_user (struct trivfs_protid *cred, uid_t user, char *pw,
char *getpass (const char *prompt, uid_t id, int is_group,
void *pwd_or_group, void *hook)
{
- assert (! is_group && id == user);
+ assert_backtrace (! is_group && id == user);
return strdup (pw);
}
@@ -199,7 +199,7 @@ S_password_check_group (struct trivfs_protid *cred, uid_t group, char *pw,
char *getpass (const char *prompt, uid_t id, int is_group,
void *pwd_or_group, void *hook)
{
- assert (is_group && id == group);
+ assert_backtrace (is_group && id == group);
return strdup (pw);
}
diff --git a/trans/random.c b/trans/random.c
index dae2ff4b..f48cea53 100644
--- a/trans/random.c
+++ b/trans/random.c
@@ -17,7 +17,7 @@
#include <argp.h>
#include <argz.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <error.h>
#include <fcntl.h>
#include <gcrypt.h>
@@ -252,7 +252,7 @@ gather_thread (void *args)
+ (float) random () / (float) RAND_MAX)));
}
- assert (! "reached");
+ assert_backtrace (! "reached");
}
error_t
diff --git a/trans/streamio.c b/trans/streamio.c
index 5539c8ea..f276ad6b 100644
--- a/trans/streamio.c
+++ b/trans/streamio.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <stdio.h>
#include <fcntl.h>
#include <argp.h>
@@ -74,11 +74,11 @@ static inline struct buffer *
create_buffer (size_t size)
{
struct buffer *new = malloc (sizeof (struct buffer) + size);
- assert (new);
+ assert_backtrace (new);
new->head = new->tail = new->buf;
new->size = size;
new->wait = malloc (sizeof (pthread_cond_t));
- assert (new->wait);
+ assert_backtrace (new->wait);
pthread_cond_init (new->wait, NULL);
return new;
}
@@ -862,12 +862,12 @@ device_open_reply (mach_port_t reply, int returncode, mach_port_t device)
}
else if (err == 0)
{
- assert (sizes_len == DEV_GET_SIZE_COUNT);
+ assert_backtrace (sizes_len == DEV_GET_SIZE_COUNT);
dev_blksize = sizes[DEV_GET_SIZE_RECORD_SIZE];
dev_size = sizes[DEV_GET_SIZE_DEVICE_SIZE];
- assert (dev_blksize && dev_blksize <= IO_INBAND_MAX);
+ assert_backtrace (dev_blksize && dev_blksize <= IO_INBAND_MAX);
}
else
{
@@ -990,7 +990,7 @@ dev_read (size_t amount, void **buf, size_t *len, int nowait)
vm_allocate (mach_task_self (), (vm_address_t *)buf, max, 1);
*len = buffer_read (input_buffer, *buf, max);
- assert (*len == max);
+ assert_backtrace (*len == max);
err = start_input (nowait);
return err;
@@ -1057,7 +1057,7 @@ start_output (int nowait)
{
int size;
- assert (output_buffer);
+ assert_backtrace (output_buffer);
size = buffer_size (output_buffer);
diff --git a/usermux/leaf.c b/usermux/leaf.c
index 7f41b187..ba7fa270 100644
--- a/usermux/leaf.c
+++ b/usermux/leaf.c
@@ -30,7 +30,7 @@
error_t
netfs_attempt_readlink (struct iouser *user, struct node *node, char *buf)
{
- assert (node->nn->name);
+ assert_backtrace (node->nn->name);
/* For symlink nodes, the translator spec just contains the link target. */
memcpy (buf, node->nn->trans, node->nn->trans_len);
fshelp_touch (&node->nn_stat, TOUCH_ATIME, usermux_maptime);
diff --git a/utils/Makefile b/utils/Makefile
index d2ef9e86..f3f76e9c 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -86,3 +86,5 @@ mount umount: ../sutils/fstab.o ../sutils/clookup.o match-options.o \
../sutils/fstab.o ../sutils/clookup.o: FORCE
$(MAKE) -C $(@D) $(@F)
FORCE:
+
+shd vmallocate: ../libshouldbeinlibc/libshouldbeinlibc.a
diff --git a/utils/fakeauth.c b/utils/fakeauth.c
index 40c898b2..5a349a8e 100644
--- a/utils/fakeauth.c
+++ b/utils/fakeauth.c
@@ -23,7 +23,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <argp.h>
#include <error.h>
#include "auth_S.h"
@@ -359,7 +359,7 @@ believe it has restricted them to different identities or no identity at all.\
/* Create the initial root auth handle. */
err = create_authhandle (&firstauth);
- assert_perror (err);
+ assert_perror_backtrace (err);
idvec_add (&firstauth->euids, 0);
idvec_add (&firstauth->auids, 0);
idvec_add (&firstauth->auids, 0);
@@ -370,7 +370,7 @@ believe it has restricted them to different identities or no identity at all.\
authport = ports_get_right (firstauth);
err = mach_port_insert_right (mach_task_self (), authport, authport,
MACH_MSG_TYPE_MAKE_SEND);
- assert_perror (err);
+ assert_perror_backtrace (err);
ports_port_deref (firstauth);
/* Stash our original auth port for later use. */
diff --git a/utils/login.c b/utils/login.c
index 9ee296aa..1a12c3cd 100644
--- a/utils/login.c
+++ b/utils/login.c
@@ -30,7 +30,7 @@
#include <grp.h>
#include <netdb.h>
#include <time.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <version.h>
#include <sys/mman.h>
@@ -314,7 +314,7 @@ check_login (process_t proc_server, int lid)
if (err == ESRCH)
exit (42); /* Nothing left to watch. */
else
- assert_perror (err);
+ assert_perror_backtrace (err);
if (owned)
exit (0); /* Our task is done. */
@@ -648,7 +648,7 @@ main(int argc, char *argv[])
}
err = proc_getsid (proc_server, pid, &sid);
- assert_perror (err); /* This should never fail. */
+ assert_perror_backtrace (err); /* This should never fail. */
if (!no_login
&& (parent_uids.num != 0
diff --git a/utils/ps.c b/utils/ps.c
index 2abb92aa..f5103239 100644
--- a/utils/ps.c
+++ b/utils/ps.c
@@ -21,7 +21,7 @@
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index e866412a..0aecfc42 100644
--- a/utils/rpctrace.c
+++ b/utils/rpctrace.c
@@ -24,7 +24,7 @@
#include <hurd/ports.h>
#include <hurd/ihash.h>
#include <mach/message.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -321,7 +321,7 @@ destroy_receiver_info (struct receiver_info *info)
while (send_wrapper)
{
struct sender_info *next = send_wrapper->next;
- assert (
+ assert_backtrace (
refcounts_hard_references (&TRACED_INFO (send_wrapper)->pi.refcounts)
== 1);
/* Reset the receive_right of the send wrapper in advance to avoid
@@ -350,7 +350,7 @@ new_send_wrapper (struct receiver_info *receive, task_t task,
/* Create a new wrapper port that forwards to *RIGHT. */
err = ports_create_port (traced_class, traced_bucket,
sizeof *info, &info);
- assert_perror (err);
+ assert_perror_backtrace (err);
TRACED_INFO (info)->name = 0;
asprintf (&TRACED_INFO (info)->name, " %lu<--%lu(pid%d)",
@@ -385,7 +385,7 @@ new_send_once_wrapper (mach_port_t right, mach_port_t *wrapper_right)
/* Create a new wrapper port that forwards to *RIGHT. */
err = ports_create_port (traced_class, traced_bucket,
sizeof *info, &info);
- assert_perror (err);
+ assert_perror_backtrace (err);
TRACED_INFO (info)->name = 0;
}
@@ -422,7 +422,7 @@ unlink_sender_info (void *pi)
prev = &info->receive_right->next;
while (*prev != info && *prev)
prev = &((*prev)->next);
- assert (*prev);
+ assert_backtrace (*prev);
*prev = info->next;
info->next = NULL;
@@ -437,7 +437,7 @@ traced_clean (void *pi)
{
struct sender_info *info = pi;
- assert (TRACED_INFO (info)->type == MACH_MSG_TYPE_MOVE_SEND);
+ assert_backtrace (TRACED_INFO (info)->type == MACH_MSG_TYPE_MOVE_SEND);
free (TRACED_INFO (info)->name);
if (info->receive_right)
@@ -629,7 +629,7 @@ rewrite_right (mach_port_t *right, mach_msg_type_name_t *type,
/* If the send right is moved to the task with the receive right,
* copy the send right in 'forward' of receiver info to the destination.
* Otherwise, copy the send right to the send wrapper. */
- assert (send_wrapper->receive_right);
+ assert_backtrace (send_wrapper->receive_right);
if (dest == send_wrapper->receive_right->task)
{
*right = send_wrapper->receive_right->forward;
@@ -678,7 +678,7 @@ rewrite_right (mach_port_t *right, mach_msg_type_name_t *type,
return receiver_info->name;
else
{
- assert (*right == receiver_info->forward);
+ assert_backtrace (*right == receiver_info->forward);
mach_port_deallocate (mach_task_self (), *right);
send_wrapper = get_send_wrapper (receiver_info, dest, right);
*type = MACH_MSG_TYPE_MAKE_SEND;
@@ -703,7 +703,7 @@ rewrite_right (mach_port_t *right, mach_msg_type_name_t *type,
* We wrap the receive right A in the send wrapper and move the receive
* right B to the destination task. */
{
- assert (req);
+ assert_backtrace (req);
receiver_info = hurd_ihash_find (&traced_names, *right);
if (receiver_info)
{
@@ -740,7 +740,7 @@ rewrite_right (mach_port_t *right, mach_msg_type_name_t *type,
hurd_ihash_locp_remove (&traced_names, receiver_info->locp);
send_wrapper2 = get_send_wrapper (receiver_info, dest, &rr);
- assert (
+ assert_backtrace (
refcounts_hard_references (
&TRACED_INFO (send_wrapper2)->pi.refcounts)
== 1);
@@ -793,7 +793,7 @@ rewrite_right (mach_port_t *right, mach_msg_type_name_t *type,
}
default:
- assert (!"??? bogus port type from kernel!");
+ assert_backtrace (!"??? bogus port type from kernel!");
}
return 0;
}
@@ -860,8 +860,8 @@ print_contents (mach_msg_header_t *inp,
mach_msg_type_name_t newtypes[nelt];
int poly;
- assert (inp->msgh_bits & MACH_MSGH_BITS_COMPLEX);
- assert (eltsize == sizeof (mach_port_t));
+ assert_backtrace (inp->msgh_bits & MACH_MSGH_BITS_COMPLEX);
+ assert_backtrace (eltsize == sizeof (mach_port_t));
poly = 0;
for (i = 0; i < nelt; ++i)
@@ -904,10 +904,10 @@ print_contents (mach_msg_header_t *inp,
portnames[i],
portnames[i],
newtypes[i]);
- assert_perror (err);
+ assert_perror_backtrace (err);
}
else
- assert (newtypes[i] == MACH_MSG_TYPE_MOVE_SEND_ONCE);
+ assert_backtrace (newtypes[i] == MACH_MSG_TYPE_MOVE_SEND_ONCE);
}
else
{
@@ -918,17 +918,17 @@ print_contents (mach_msg_header_t *inp,
err = mach_port_mod_refs (mach_task_self (),
portnames[i],
MACH_PORT_RIGHT_SEND, +1);
- assert_perror (err);
+ assert_perror_backtrace (err);
break;
case MACH_MSG_TYPE_MAKE_SEND:
err = mach_port_insert_right (mach_task_self (),
portnames[i],
portnames[i],
newtypes[i]);
- assert_perror (err);
+ assert_perror_backtrace (err);
break;
default:
- assert (newtypes[i] == MACH_MSG_TYPE_MOVE_SEND);
+ assert_backtrace (newtypes[i] == MACH_MSG_TYPE_MOVE_SEND);
break;
}
@@ -1017,8 +1017,8 @@ wrap_new_thread (mach_msg_header_t *inp, struct req_info *req)
struct sender_info *send_wrapper = ports_lookup_port (traced_bucket,
reply->child_thread, 0);
- assert (send_wrapper);
- assert (send_wrapper->receive_right);
+ assert_backtrace (send_wrapper);
+ assert_backtrace (send_wrapper->receive_right);
thread_port = send_wrapper->receive_right->forward;
err = mach_port_insert_right (mach_task_self (), reply->child_thread,
@@ -1058,8 +1058,8 @@ wrap_new_task (mach_msg_header_t *inp, struct req_info *req)
/* The send wrapper for the new task itself. */
struct sender_info *task_wrapper2;
- assert (task_wrapper1);
- assert (task_wrapper1->receive_right);
+ assert_backtrace (task_wrapper1);
+ assert_backtrace (task_wrapper1->receive_right);
task_port = task_wrapper1->receive_right->forward;
add_task (task_port);
@@ -1138,7 +1138,7 @@ trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp)
else
info = ports_lookup_port (traced_bucket, inp->msgh_local_port, NULL);
- assert (info);
+ assert_backtrace (info);
/* A notification message from the kernel appears to have been sent
with a send-once right, even if there have never really been any. */
@@ -1156,7 +1156,7 @@ trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp)
* If not, we destroy it here. */
if (receiver_info)
{
- assert (n->not_port == receiver_info->forward);
+ assert_backtrace (n->not_port == receiver_info->forward);
destroy_receiver_info (receiver_info);
}
@@ -1190,8 +1190,8 @@ trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp)
}
}
- assert (info != (void *) notify_pi);
- assert (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) == info->type);
+ assert_backtrace (info != (void *) notify_pi);
+ assert_backtrace (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) == info->type);
complex = inp->msgh_bits & MACH_MSGH_BITS_COMPLEX;
@@ -1221,7 +1221,7 @@ trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp)
info = new_send_once_wrapper (inp->msgh_local_port,
&inp->msgh_local_port);
reply_type = MACH_MSG_TYPE_MAKE_SEND_ONCE;
- assert (inp->msgh_local_port);
+ assert_backtrace (inp->msgh_local_port);
if (TRACED_INFO (info)->name == 0)
{
@@ -1245,7 +1245,7 @@ trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp)
inp->msgh_remote_port = SEND_ONCE_INFO (info)->forward;
else
{
- assert (SEND_INFO (info)->receive_right);
+ assert_backtrace (SEND_INFO (info)->receive_right);
inp->msgh_remote_port = SEND_INFO (info)->receive_right->forward;
}
if (this_type == MACH_MSG_TYPE_MOVE_SEND_ONCE)
@@ -1282,7 +1282,7 @@ trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp)
{
struct req_info *req = remove_request (inp->msgh_id - 100,
inp->msgh_remote_port);
- assert (req);
+ assert_backtrace (req);
req->is_req = FALSE;
/* This sure looks like an RPC reply message. */
mig_reply_header_t *rh = (void *) inp;
@@ -1310,10 +1310,10 @@ trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp)
/* It's a notification message. */
if (inp->msgh_id <= 72 && inp->msgh_id >= 64)
{
- assert (info->type == MACH_MSG_TYPE_MOVE_SEND_ONCE);
+ assert_backtrace (info->type == MACH_MSG_TYPE_MOVE_SEND_ONCE);
/* mach_notify_port_destroyed message has a port,
* TODO how do I handle it? */
- assert (inp->msgh_id != 69);
+ assert_backtrace (inp->msgh_id != 69);
}
/* If it's mach_port RPC,
@@ -1364,7 +1364,7 @@ trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp)
mach_msg_destroy (inp);
}
else
- assert_perror (err);
+ assert_perror_backtrace (err);
ports_port_deref (info);
@@ -1502,7 +1502,7 @@ print_data (mach_msg_type_name_t type,
switch (type)
{
case MACH_MSG_TYPE_PORT_NAME:
- assert (eltsize == sizeof (mach_port_t));
+ assert_backtrace (eltsize == sizeof (mach_port_t));
{
mach_msg_type_number_t i;
fprintf (ostream, "pn{");
@@ -1631,7 +1631,7 @@ traced_spawn (char **argv, char **envp)
NULL, 0, /* OSF Mach */
#endif
0, &traced_task);
- assert_perror (err);
+ assert_perror_backtrace (err);
add_task (traced_task);
/* Declare the new task to be our child. This is what a fork does. */
@@ -1654,9 +1654,9 @@ traced_spawn (char **argv, char **envp)
own real task port. */
err = mach_port_insert_right (mach_task_self (), task_wrapper,
task_wrapper, MACH_MSG_TYPE_MAKE_SEND);
- assert_perror (err);
+ assert_perror_backtrace (err);
err = task_set_special_port (traced_task, TASK_KERNEL_PORT, task_wrapper);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* Now actually run the command they told us to trace. We do the exec on
the actual task, so the RPCs to map in the program itself do not get
@@ -1750,7 +1750,7 @@ main (int argc, char **argv, char **envp)
err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_DEAD_NAME,
&unknown_task);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (outfile)
{
@@ -1767,7 +1767,7 @@ main (int argc, char **argv, char **envp)
other_class = ports_create_class (0, 0);
err = ports_create_port (other_class, traced_bucket,
sizeof (*notify_pi), &notify_pi);
- assert_perror (err);
+ assert_perror_backtrace (err);
/* Spawn a single thread that will receive intercepted messages, print
them, and interpose on the ports they carry. The access to the
diff --git a/utils/settrans.c b/utils/settrans.c
index ee7cba53..9c9f087e 100644
--- a/utils/settrans.c
+++ b/utils/settrans.c
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -450,7 +450,7 @@ main(int argc, char *argv[])
if (MACH_PORT_VALID (executable))
{
err = mach_port_deallocate (mach_task_self (), executable);
- assert_perror (err);
+ assert_perror_backtrace (err);
if (prefixed_name)
chroot_command[0] = prefixed_name;
}
diff --git a/utils/shd.c b/utils/shd.c
index feff6135..09a4790e 100644
--- a/utils/shd.c
+++ b/utils/shd.c
@@ -19,7 +19,7 @@
#include <hurd.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <device/device.h>
#include <unistd.h>
#include <errno.h>
@@ -230,7 +230,7 @@ main (int argc, char *argv[])
size_t linebufsize = 0;
proc = getproc ();
- assert (proc);
+ assert_backtrace (proc);
#if 0
{
@@ -238,10 +238,10 @@ main (int argc, char *argv[])
mach_port_t outp;
mach_port_t hostp, masterd;
err = proc_getprivports (proc, &hostp, &masterd);
- assert (!err);
+ assert_backtrace (!err);
err = device_open (masterd, D_WRITE|D_READ, "console", &outp);
- assert (!err);
+ assert_backtrace (!err);
stdin = mach_open_devstream (outp, "r");
stdout = stderr = mach_open_devstream (outp, "w+");
diff --git a/utils/vmallocate.c b/utils/vmallocate.c
index 628cfd12..039b3097 100644
--- a/utils/vmallocate.c
+++ b/utils/vmallocate.c
@@ -18,7 +18,7 @@
along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */
#include <argp.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <error.h>
#include <hurd.h>
#include <inttypes.h>
@@ -161,7 +161,7 @@ main (int argc, char **argv)
process_t proc = getproc ();
/* We must make sure that chunk_size fits into vm_size_t. */
- assert (chunk_size <= 1U << (sizeof (vm_size_t) * 8 - 1));
+ assert_backtrace (chunk_size <= 1U << (sizeof (vm_size_t) * 8 - 1));
/* Parse our arguments. */
argp_parse (&argp, argc, argv, 0, 0, 0);