From: Adam Dickmeiss Date: Mon, 27 Mar 1995 12:51:04 +0000 (+0000) Subject: New log level in use: GW_LOG_ERRNO. X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=c3d25c24fb405af98c6879fa7f5f619ccc895151;p=egate.git New log level in use: GW_LOG_ERRNO. --- diff --git a/kernel/Makefile b/kernel/Makefile index 3d46052..0be3750 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -2,7 +2,10 @@ # Europagate, 1995 # # $Log: Makefile,v $ -# Revision 1.12 1995/03/27 08:23:57 adam +# Revision 1.13 1995/03/27 12:51:04 adam +# New log level in use: GW_LOG_ERRNO. +# +# Revision 1.12 1995/03/27 08:23:57 adam # First use of gip interface and gw-db. # First work on eti program. # @@ -49,7 +52,7 @@ ZINC=-I$(ZPRE) ZLIB=$(ZPRE)/libz3950.a INCLUDE=-I../include -CFLAGS=-g -Wall +#CFLAGS=-g -Wall CPP=$(CC) -E DEFS=$(INCLUDE) -DUSE_FML=1 USELIBS1=../lib/ccl.a ../lib/fml.a ../lib/libzass.a ../lib/libres+log.a \ diff --git a/kernel/eti.c b/kernel/eti.c index f901a10..183f0e3 100644 --- a/kernel/eti.c +++ b/kernel/eti.c @@ -2,7 +2,10 @@ * Europagate, 1995 * * $Log: eti.c,v $ - * Revision 1.1 1995/03/27 08:24:00 adam + * Revision 1.2 1995/03/27 12:51:05 adam + * New log level in use: GW_LOG_ERRNO. + * + * Revision 1.1 1995/03/27 08:24:00 adam * First use of gip interface and gw-db. * First work on eti program. * @@ -124,7 +127,7 @@ int main (int argc, char **argv) argv_p = malloc (sizeof(*argv_p)*(argc+2)); if (!argv_p) { - gw_log (GW_LOG_FATAL, module, "Malloc fail"); + gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, module, "Malloc fail"); exit (1); } argv_p[0] = "kernel"; @@ -138,13 +141,13 @@ int main (int argc, char **argv) pid = fork (); if (pid == -1) { - gw_log (GW_LOG_FATAL, module, "fork"); + gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, module, "fork"); exit (1); } if (!pid) { execvp ("kernel", argv_p); - gw_log (GW_LOG_FATAL, module, "execvp"); + gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, module, "execvp"); exit (1); } gipc_open (gip, fifo_server_name, 1); diff --git a/kernel/main.c b/kernel/main.c index 1fa110e..10dc733 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -2,7 +2,10 @@ * Europagate, 1995 * * $Log: main.c,v $ - * Revision 1.11 1995/03/27 08:24:02 adam + * Revision 1.12 1995/03/27 12:51:05 adam + * New log level in use: GW_LOG_ERRNO. + * + * Revision 1.11 1995/03/27 08:24:02 adam * First use of gip interface and gw-db. * First work on eti program. * @@ -70,7 +73,7 @@ static void mk_active (int userid) fd = open (active_name, O_WRONLY|O_CREAT, 0666); if (fd == -1) { - gw_log (GW_LOG_FATAL, "Cannot create %s", active_name); + gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, "Cannot create %s", active_name); exit (1); } sprintf (pid_buf, "%ld", (long) getpid()); @@ -115,7 +118,7 @@ static void kernel_events (int userid) r = select (gip_fd+1, &set_r, NULL, NULL, &tv); if (r == -1) { - gw_log (GW_LOG_FATAL, KERNEL_LOG, "select fail"); + gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, KERNEL_LOG, "select"); exit (1); } if (r == 0) @@ -180,6 +183,20 @@ int main (int argc, char **argv) { switch (argv[0][1]) { + case 'H': + fprintf (stderr, "kernel [option..] [resource]\n"); + fprintf (stderr, "If no resource file is given"); + fprintf (stderr, " default.res is used\n"); + fprintf (stderr, "Options:\n"); + fprintf (stderr, " -d Enable debugging log\n"); + fprintf (stderr, " -t target Open target immediately\n"); + fprintf (stderr, " -l lang Set language\n"); + fprintf (stderr, " -o resource Override with resource\n"); + fprintf (stderr, " -h host Override host\n"); + fprintf (stderr, " -p port Override port\n"); + fprintf (stderr, " -g log Set Log file\n"); + fprintf (stderr, " -i id Set IPC userid\n"); + exit (1); case 'd': gw_log_level (GW_LOG_ALL); break; @@ -221,7 +238,7 @@ int main (int argc, char **argv) } else { - gw_log (GW_LOG_FATAL, KERNEL_LOG, "missing language name"); + gw_log (GW_LOG_FATAL, KERNEL_LOG, "missing override name"); exit (1); } break; diff --git a/kernel/urp.c b/kernel/urp.c index f3d61bc..9f3b37e 100644 --- a/kernel/urp.c +++ b/kernel/urp.c @@ -2,7 +2,10 @@ * Europagate, 1995 * * $Log: urp.c,v $ - * Revision 1.21 1995/03/27 08:24:04 adam + * Revision 1.22 1995/03/27 12:51:05 adam + * New log level in use: GW_LOG_ERRNO. + * + * Revision 1.21 1995/03/27 08:24:04 adam * First use of gip interface and gw-db. * First work on eti program. * @@ -102,7 +105,7 @@ int lgets (char *buf, int max, int fd) if ((r=read (fd, buf+no, 1)) != 1) { if (r == -1) - gw_log (GW_LOG_WARN, KERNEL_LOG, "read fail"); + gw_log (GW_LOG_WARN|GW_LOG_ERRNO, KERNEL_LOG, "read fail"); buf[no] = '\0'; return 0; } @@ -168,6 +171,7 @@ static struct command_word { { "status", "status" }, { "cancel", "cancel" }, { "target", "target" }, +{ "stop", "stop" }, { NULL, NULL } }; @@ -445,7 +449,7 @@ static void present (const char *set, int offset, int number, record_log_name ); record_log_fd = open (path, O_WRONLY|O_CREAT|O_APPEND, 0666); if (record_log_fd == -1) - gw_log (GW_LOG_WARN, "Cannot open %s", path); + gw_log (GW_LOG_WARN|GW_LOG_ERRNO, "Cannot open %s", path); } fprintf (reply_fd, gw_res_get (info.kernel_res, "gw.msg.records", @@ -745,7 +749,7 @@ int urp (int fd) reply_fd = fopen (reply_fname, "w"); if (!reply_fd) { - gw_log (GW_LOG_FATAL, KERNEL_LOG, "Cannot create %s", + gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, KERNEL_LOG, "Cannot create %s", reply_fname); return -1; } @@ -813,8 +817,8 @@ int urp (int fd) mta_code = system (cmd); if (mta_code) - gw_log (GW_LOG_FATAL, KERNEL_LOG, "Reply '%s' got exit code %d", - cmd, mta_code); + gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, KERNEL_LOG, + "Reply '%s' got exit code %d", cmd, mta_code); unlink (reply_fname); gw_log (GW_LOG_ACCT, KERNEL_LOG, "User end %s", from_str); } diff --git a/res+log/Makefile b/res+log/Makefile index 77598b1..f47da3d 100644 --- a/res+log/Makefile +++ b/res+log/Makefile @@ -2,7 +2,10 @@ # Europagate, 1994-1995. # # $Log: Makefile,v $ -# Revision 1.4 1995/02/23 08:32:20 adam +# Revision 1.5 1995/03/27 12:51:10 adam +# New log level in use: GW_LOG_ERRNO. +# +# Revision 1.4 1995/02/23 08:32:20 adam # Changed header. # # Revision 1.2 1995/02/22 08:51:44 adam @@ -13,7 +16,7 @@ # SHELL=/bin/sh INCLUDE=-I../include -CFLAGS=-Wall -pedantic -ansi +#CFLAGS=-Wall -pedantic -ansi CPP=$(CC) -E TPROG1=gw-log-test TPROG2=gw-res-test diff --git a/res+log/gw-log.c b/res+log/gw-log.c index 088c230..87e3aaf 100644 --- a/res+log/gw-log.c +++ b/res+log/gw-log.c @@ -4,7 +4,10 @@ * Europagate, 1994-1995. * * $Log: gw-log.c,v $ - * Revision 1.4 1995/02/23 08:32:22 adam + * Revision 1.5 1995/03/27 12:51:10 adam + * New log level in use: GW_LOG_ERRNO. + * + * Revision 1.4 1995/02/23 08:32:22 adam * Changed header. * * Revision 1.2 1995/02/17 17:06:56 adam @@ -23,6 +26,7 @@ #include #include #include +#include #include @@ -147,6 +151,11 @@ int gw_log (unsigned level_a, const char *event_type, const char *format, ...) *cp = ' '; count = strlen (emit_str); vsprintf (emit_str+count, format, ap); + if (e_level & GW_LOG_ERRNO) + { + strcat (emit_str, ": "); + strcat (emit_str, strerror (errno)); + } strcat (emit_str, "\n"); count = strlen (emit_str);