Subject: b21: running on background bug?
From: [email-masked] (creative1)

7 Dec 1998 07:04:59 -0800
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: [email-masked]

Hi!

Using windows 98...

I must admit that i am not very experience with this topic, but I am
having a problem
with something that works prety well on unix.

Ok, I am trying to compile a program that runs and then stays on the
background,
the partial code that I use is this...

   /* move into background? */
   if (backgrd) {
      xx = fork();
      if (xx == -1)
  fatal("CANNOT FORK PROCESS.", 0);
      if (xx != 0) {
         FILE *fp;
         /* need to attempt to write pid now, not later */
         unlink(pid_file);
         fp = fopen(pid_file, "w");
         if (fp != NULL) {
            fprintf(fp, "%u\n", xx);
            if (fflush(fp)) {
               /* kill bot incase a botchk is run from crond */
               printf("* Warning!  Could not write %s file!\n",
pid_file);
               printf("  Try freeing some disk space\n");
               fclose(fp);
               unlink(pid_file);
               exit(1);
            }
            fclose(fp);
         } else
            printf("* Warning!  Could not write %s file!\n", pid_file);
         printf("Launched into the background  (pid: %d)\n\n", xx);
#if HAVE_SETPGID
  setpgid(xx, xx);
#endif
  exit(0);
     }
   }

It compiles perfect, but at the end, when running, at the last
instruction:
exit(0);

It seems to run, but about 1 second later it crash with this error:

KAOSBOT caused an invalid page fault in
module KERNEL32.DLL at 015f:bff77146.
Registers:
EAX=00000058 CS=015f EIP=bff77146 EFLGS=00010246
EBX=025dec9c SS=0167 ESP=025deadc EBP=025deb20
ECX=00010000 DS=0167 ESI=025deccc FS=0000
EDX=00000000 ES=0167 EDI=00000001 GS=0000
Bytes at CS:EIP:
64 ff 32 64 89 22 8b 4c 24 14 e3 03 83 01 00 64
Stack dump:
bffa18dd 6100dca7 00000058 00000000 00000000 00000000 025dec9c 00000020
025dee34 025dec9c 00000000 00000000 00000003 02687b25 025deb30 6100d95d

I tryed to log after that line, but it seems all the activity stop after
that exit(0);
which would be normal in normal code, but using fork should continue
running on the background...

Any idea how to work around this?
maybe it is my mistake :??

Again, works perfect on unix systems.

Thank You
Joaquin Grech

--
---------------------------------------------------------------
!     C r e a t i v i t y     M u s t    S u r v i v e        !
---------------------------------------------------------------
!  Fido: 2:341/19.67                 Euronet: 25:928/100.67   !
!  Internet: [email-masked]                            !
!  Http://surf.to/creative                  Ya me direis :)   !
---------------------------------------------------------------

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".