[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
MiNT 1.12 sysupdate patches (again)
Hello,
here are some modifications to make to the sysupdate daemon in MiNT
more robust. First I removed the `setstack' call in update as it is
perfectly unnecessary, as the kernel already presets the stack
pointer with the correct value if the basepage's p_hitpa field is set.
But then secondly I thought having a separate process in the kernel is
a kludge --- and in this case also considerable overkill. Why at all,
then, has the kernel this addroottimeout feature? (Minixfs has moved
in the same direction, btw :-). So I rewrote the update daemon to be
based on addroottimeout. The result is so damned simple that I moved
it into main.c and discard update.c altogether. You can still get the
old behaviour by #define'ing SYSUPDATE_DAEMON in mint.h. However, you
must include update.o into COBJS in makefile again.
As an additional feature (may be you consider it as a bug :-), the
update process won't be started if the UPDATE variable in mint.cnf is
set to 0 or a negative value. Note that atoi will return 0 if the
value is no number at all!
The diffs below are relative to MH-MiNT 1.12h2.
Regards
Wolfgang
----
Wolfgang Lux #include <Standard Disclaimer>
WZH Heidelberg, IBM Germany Internet: lux@heidelbg.ibm.com
+49-6221-59-4546 VNET: LUX at HEIDELBG
+49-6221-59-3200 (fax) EARN: LUX at DHDIBMIP
===================================================================
RCS file: /usr/src/MiNT/main.c,v
retrieving revision 1.4.1.1
diff -u -r1.4.1.1 main.c
--- 1.4.1.1 1994/12/13 07:19:00
+++ main.c 1995/04/14 16:15:08
@@ -28,6 +28,9 @@
static long getmch P_((void));
static void do_line P_((char *));
static void do_file P_((int));
+#ifndef SYSUPDATE_DAEMON
+static void do_sync P_((void));
+#endif
static void shutmedown P_((PROC *));
void shutdown P_((void));
static void doset P_((char *,char *));
@@ -189,7 +192,12 @@
extern Func bios_tab[], dos_tab[];
+/* interval for syncing the filesystems */
+#ifdef SYSUPDATE_DAEMON
extern long sync_time;
+#else
+static long sync_time = 5;
+#endif
/* kernel info that is passed to loaded file systems and device drivers */
@@ -527,6 +535,19 @@
curproc->in_dos = 0;
}
+#ifndef SYSUPDATE_DAEMON
+/*
+ * do_sync: sync all filesystems at regular intervals
+ */
+static void
+do_sync()
+{
+ s_ync();
+ addroottimeout(1000l*sync_time, do_sync, 0);
+}
+#endif
+
+
/*
* shut down processes; this involves waking them all up, and sending
* them SIGTERM to give them a chance to clean up after themselves
@@ -605,7 +626,9 @@
long yn;
FILEPTR *f;
+#ifdef SYSUPDATE_DAEMON
extern void start_sysupdate();
+#endif
#if defined(__GNUC__) || defined(__MINT__)
UNUSED(envp);
@@ -870,7 +893,13 @@
load_config();
/* start system update daemon */
- start_sysupdate();
+ if (sync_time > 0) {
+#ifdef SYSUPDATE_DAEMON
+ start_sysupdate();
+#else
+ addroottimeout(1000l*sync_time, do_sync, 0);
+#endif
+ }
*((long *)0x4c2L) |= PSEUDODRVS;
===================================================================
RCS file: /usr/src/MiNT/makefile,v
retrieving revision 1.4.1.1
diff -u -r1.4.1.1 makefile
--- 1.4.1.1 1994/12/13 07:19:00
+++ makefile 1995/04/14 16:15:30
@@ -67,19 +67,19 @@
filesys.o main.o mem.o proc.o signal.o timeout.o tty.o util.o \
biosfs.o pipefs.o procfs.o tosfs.o debug.o rendez.o cookie.o \
unifs.o shmfs.o fasttext.o welcome.o nalloc2.o memprot.o realloc.o \
- update.o
+# update.o
COBJS030 = bios.o0 xbios.o0 console.o0 dos.o0 dosdir.o0 dosfile.o0 dosmem.o0 dossig.o0 \
filesys.o0 main.o0 mem.o0 proc.o0 signal.o0 timeout.o0 tty.o0 util.o0 \
biosfs.o0 pipefs.o0 procfs.o0 tosfs.o0 debug.o0 rendez.o0 cookie.o0 \
unifs.o0 shmfs.o0 fasttext.o0 welcome.o0 nalloc2.o0 memprot.o realloc.o0 \
- update.o0
+# update.o0
CFILES = bios.c xbios.c console.c dos.c dosdir.c dosfile.c dosmem.c dossig.c \
filesys.c main.c mem.c proc.c signal.c timeout.c tty.c util.c \
biosfs.c pipefs.c procfs.c tosfs.c debug.c rendez.c cookie.c \
unifs.c shmfs.c fasttext.c welcome.c nalloc2.c memprot.c realloc.c \
- update.c
+# update.c
HFILES = assert.h atarierr.h basepage.h cookie.h ctype.h debug.h fasttext.h \
file.h inline.h loadave.h mem.h mint.h proc.h proto.h signal.h sproto.h \
===================================================================
RCS file: /usr/src/MiNT/mint.h,v
retrieving revision 1.4.1.1
diff -u -r1.4.1.1 mint.h
--- 1.4.1.1 1994/12/13 07:19:00
+++ mint.h 1995/04/14 16:15:40
@@ -36,6 +36,10 @@
/* Freate() on pipes should not fail */
#define CREATE_PIPES
+/* define if you want a daemon process for sync'ing (otherwise uses timeout) */
+/* (N.B.: you must include update.o in the executable, then) */
+#undef SYSUPDATE_DAEMON
+
#if 0
/* other options best set in the makefile */
#define MULTITOS /* make a MultiTOS kernel */
===================================================================
RCS file: /usr/src/MiNT/update.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 update.c
--- 1.1.1.1 1994/12/13 07:19:00
+++ update.c 1995/04/14 16:31:16
@@ -8,6 +8,7 @@
* function called.
*/
+#ifdef SYSUPDATE_DAEMON
#include <mintbind.h>
#include "mint.h"
@@ -35,7 +36,9 @@
void
update(long bp)
{
+#ifdef 0
setstack(bp+256+update_stksize);
+#endif
Psignal(SIGALRM, do_sync);
Psignal(SIGTERM, do_sync);
Psignal(SIGQUIT, do_sync);
@@ -75,3 +78,4 @@
b->p_hitpa = (long)b +256+update_stksize;
pid = (short)p_exec(104, "sysupdate", b, 0L);
}
+#endif