]> andersk Git - moira.git/commitdiff
Added support for optional debugging malloc. No code changes if you are
authortytso <tytso>
Fri, 10 Dec 1993 13:49:08 +0000 (13:49 +0000)
committertytso <tytso>
Fri, 10 Dec 1993 13:49:08 +0000 (13:49 +0000)
using the normal malloc in mr_smalloc.c

server/Imakefile
server/mr_glue.c
server/mr_main.c
server/mr_scall.c
server/mr_server.h
server/mr_util.c
server/qfollow.dc
server/qrtn.dc
server/qsupport.dc
server/qvalidate.dc

index 22357c73f4f4121a20748cad643f2b341ddda76b..172fa5c2d019cf0003af825b9b721e1499425671 100644 (file)
@@ -23,13 +23,13 @@ SRCS = startmoira.c mr_main.c mr_sauth.c mr_scall.c \
        qsupport.c qsubs.c queries2.c mr_smalloc.c \
        increment.c cache.c mr_glue.c qvalidate.c \
        mr_server.h query.h qrtn.h qaccess.c qsetup.c \
-       qfollow.c $(XSRC)
+       qfollow.c malloc.h $(XSRC)
 CODE= startmoira.c mr_main.c mr_sauth.c mr_scall.c \
        mr_srvdata.c mr_shutdown.c mr_util.c qrtn.dc \
        qsupport.dc qsubs.c queries2.c mr_smalloc.c \
        increment.dc cache.dc mr_glue.c qvalidate.dc \
        Imakefile mr_server.h query.h qrtn.h qaccess.dc \
-       qsetup.dc qfollow.dc $(XSRC)
+       qsetup.dc qfollow.dc malloc.h $(XSRC)
 SRVOBJ=mr_main.o mr_sauth.o mr_scall.o mr_srvdata.o mr_shutdown.o \
        mr_util.o qrtn.o queries2.o qsupport.o qsubs.o \
        mr_smalloc.o increment.o cache.o qvalidate.o \
index b9f39f6991e5201a0cd1340def35eec4b0154465..8fd1505d99f7201f21ce9a3f235ea3e4c4154c43 100644 (file)
@@ -16,13 +16,13 @@ static char *rcsid_mr_glue_c = "$Header$";
 #endif lint
 
 #include <mit-copyright.h>
-#include "mr_server.h"
 #include <sys/types.h>
 #include <sys/signal.h>
 #include <sys/wait.h>
 #include <krb_et.h>
 #include <pwd.h>
 #include "query.h"
+#include "mr_server.h"
 
 static int already_connected = 0;
 
@@ -30,7 +30,7 @@ static int already_connected = 0;
 
 static client pseudo_client;
 extern int errno;
-extern char *malloc(), *whoami;
+extern char *whoami;
 extern time_t now;
 void reapchild();
 
index f9f539bd36223219484ba47aadf193d5c9408b5a..704a57a7afb73da85acb5dba6d4d2258db26e83e 100644 (file)
@@ -46,8 +46,6 @@ extern char *takedown;
 extern int errno;
 extern FILE *journal;
 
-extern char *malloc();
-extern int free();
 extern char *inet_ntoa();
 extern void mr_com_err();
 extern void do_client();
@@ -59,6 +57,11 @@ void reapchild(), godormant(), gowakeup();
 
 extern time_t now;
 
+#ifdef _DEBUG_MALLOC_INC
+static char *dbg_malloc();
+static int dbg_free();
+#endif
+
 /*
  * Main MOIRA server loop.
  *
@@ -107,8 +110,13 @@ main(argc, argv)
        /* Profiling implies that getting rid of one level of call
         * indirection here wins us maybe 1% on the VAX.
         */
+#ifdef _DEBUG_MALLOC_INC
+       gdb_amv = dbg_malloc;
+       gdb_fmv = dbg_free;
+#else
        gdb_amv = malloc;
-       gdb_fmv = free;
+       gdb_fmv = (int (*)()) free;
+#endif
        
        /*
         * GDB initialization.
@@ -552,3 +560,19 @@ mr_setup_signals()
        exit(1);
     }
 }
+
+#ifdef _DEBUG_MALLOC_INC
+static char *dbg_malloc(size)
+       SIZETYPE        size;
+{
+       return( debug_malloc("somewhere in the gdb code",1,size) );
+}
+
+static int dbg_free(cptr)
+       DATATYPE        *cptr;
+{
+       debug_free((char *)NULL, 0, cptr);
+       return 0;               /* GDB is being stupid */
+}
+#endif
+
index db9e9784dd58c84f067ff9454a16a403b18844c9..eecc2d0df7dbe205d5f305ec54d67a108ecd3358 100644 (file)
@@ -24,7 +24,6 @@ static char *rcsid_sms_scall_c = "$Header$";
 extern char buf1[];
 extern int nclients;
 extern char *whoami;
-extern char *malloc();
 extern int errno;
 
 extern void clist_delete(), do_auth(), do_shutdown();
@@ -247,7 +246,6 @@ list_users(callbk, callarg)
        extern client **clients;
        extern char *inet_ntoa();
        char *cp;
-       char *index();
        char *ctime();
 
        for (i = 0; i < nclients; i++) {
index e13c4c086e638444e4cb3ff6204f97d583ebf74c..2ceddd528dee4c23b9254a1fe47479924fc9b60b 100644 (file)
@@ -14,6 +14,7 @@
 #include "mr_proto.h"
 #include <moira_site.h>
 #include <krb.h>
+#include "malloc.h"
 
 typedef struct returned_tuples {
        struct returned_tuples *next;
index 9926446eb854d43c503a02da2c77089c04d1b95a..47f7cc6cf17fae8e56fa1d80c4b85b23816ce1d0 100644 (file)
@@ -16,7 +16,6 @@ static char *rcsid_mr_util_c = "$Header$";
 #include "mr_server.h"
 
 #include <ctype.h>
-#include <strings.h>
 #include <sys/types.h>
 
 extern char *whoami;
index a0d631b18d5d71e8d93663544c7aaf18c7c70557..7a63bd4d30a69598ab16c9a60a477f267940effe 100644 (file)
@@ -329,7 +329,7 @@ followup_fix_modby(q, sq, v, action, actarg, cl)
     client *cl;
 {
     register int i, j;
-    char **argv, *malloc();
+    char **argv;
     int id, status;
 
     i = q->vcnt - 2;
@@ -368,7 +368,7 @@ followup_guax(q, sq, v, action, actarg, cl)
     client *cl;
 {
     register int i, j;
-    char **argv, *malloc();
+    char **argv;
 #ifdef GDSS
     unsigned char sigbuf[256];
     char *kname;
@@ -638,7 +638,7 @@ followup_gpob(q, sq, v, action, actarg, cl)
     int actarg;
     client *cl;
 {
-    char **argv, *index();
+    char **argv;
     char *ptype, *p;
     int mid, sid, status, i;
 
@@ -700,7 +700,7 @@ followup_gsnt(q, sq, v, action, actarg, cl)
     int actarg;
     client *cl;
 {
-    char **argv, *malloc(), *realloc(), *type;
+    char **argv, *type;
     int id, i, idx, status;
 
     idx = 8;
@@ -765,7 +765,7 @@ followup_ghst(q, sq, v, action, actarg, cl)
     int actarg;
     client *cl;
 {
-    char **argv, *malloc(), *realloc(), *type;
+    char **argv, *type;
     int id, i, idx, status;
 
     while (sq_get_data(sq, &argv)) {
@@ -842,7 +842,7 @@ followup_glin(q, sq, v, action, actarg, cl)
     int actarg;
     client *cl;
 {
-    char **argv, *malloc(), *realloc(), *type;
+    char **argv, *type;
     int id, i, idx, status;
 
     idx = 8;
@@ -916,7 +916,7 @@ followup_gqot(q, sq, v, action, actarg, cl)
     client *cl;
 {
     register int j;
-    char **argv, *malloc();
+    char **argv;
     EXEC SQL BEGIN DECLARE SECTION;
     int id;
     char *name, *label;
@@ -1121,7 +1121,7 @@ followup_gpce(q, sq, v, action, actarg, cl)
     client *cl;
 {
     register int i, j;
-    char **argv, *malloc();
+    char **argv;
     int id, status;
 
     i = q->vcnt - 2;
index f76e8df80a39ed9e499e0617457709d63ba4a51f..154e4007da3376536334514912e91bc7d3edbda4 100644 (file)
@@ -110,7 +110,6 @@ EXEC SQL WHENEVER SQLERROR CALL ingerr;
 int mr_open_database()
 {
     register int i;
-    char *malloc();
     MR_SQLDA_T *mr_alloc_SQLDA();
     static first_open = 1;
 
@@ -437,7 +436,6 @@ build_qual(fmt, argc, argv, qual)
     register char *c;
     register int i;
     char *args[4];
-    char *index();
 
     c = fmt;
     for (i = 0; i < argc; i++) {
@@ -491,6 +489,9 @@ build_sort(v, sort)
     register struct valobj *vo;
     register int n;
     char elem[16];
+#ifdef _DEBUG_MALLOC_INC
+#undef index
+#endif
 
     n = v->objcnt;
     vo = v->valobj;
index 2b413c51971d0e35fe9262e280a2ae5d4e8930fe..80717696b981324e8ddf489986e9a12a182e7988 100644 (file)
@@ -107,7 +107,7 @@ get_list_info(q, aargv, cl, action, actarg)
     register int (*action)();
     int actarg;
 {
-    char *argv[13], *malloc(), *realloc();
+    char *argv[13];
     EXEC SQL BEGIN DECLARE SECTION;
     char *name, acl_type[9], listname[33], active[5], public[5], hidden[5];
     char maillist[5], grouplist[5], gid_str[6], acl_name[256], desc[256];
index c3ac6cb8c45f893ba08a1e0f4f218b2418a247d3..188d4ffb88a36748698e69cb5960b9e71795dcce 100644 (file)
@@ -31,6 +31,12 @@ EXEC SQL END DECLARE SECTION;
 
 EXEC SQL WHENEVER SQLERROR CALL ingerr;
 
+#ifdef _DEBUG_MALLOC_INC
+#undef index
+#define dbg_index(str1,c)             DBindex(__FILE__, __LINE__, str1, c)
+#else
+#define dbg_index index
+#endif
 
 /* Validation Routines */
 
@@ -396,7 +402,6 @@ validate_typedata(q, argv, vo)
     int id;
     EXEC SQL END DECLARE SECTION;
     int status;
-    char *index();
     register char *c;
 
     /* get named object */
@@ -412,11 +417,11 @@ validate_typedata(q, argv, vo)
     if (sqlca.sqlerrd[2] != 1) return(MR_TYPE);
 
     /* now retrieve the record id corresponding to the named object */
-    if (index(data_type, ' '))
-       *index(data_type, ' ') = 0;
+    if (dbg_index(data_type, ' '))
+       *dbg_index(data_type, ' ') = 0;
     if (!strcmp(data_type, "user")) {
        /* USER */
-       if (index(name, '@'))
+       if (dbg_index(name, '@'))
          return(MR_USER);
        status = name_to_id(name, data_type, &id);
        if (status && (status == MR_NO_MATCH || status == MR_NOT_UNIQUE))
This page took 1.691425 seconds and 5 git commands to generate.