Changeset 2298 for trunk/src


Ignore:
Timestamp:
Jan 2, 2000, 11:09:02 PM (26 years ago)
Author:
sandervl
Message:

Fixed Odin zombie processes when there's a trap inside vfprintf during logging.

Location:
trunk/src/kernel32
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/exceptions.cpp

    r1811 r2298  
    1 /* $Id: exceptions.cpp,v 1.30 1999-11-22 20:35:49 sandervl Exp $ */
     1/* $Id: exceptions.cpp,v 1.31 2000-01-02 22:09:01 sandervl Exp $ */
    22
    33/*
     
    932932#define XCPT_CONTINUE_STOP 0x00716668
    933933#endif
     934
     935//in misc.cpp
     936void CheckLogException();
    934937
    935938ULONG APIENTRY OS2ExceptionHandler(PEXCEPTIONREPORTRECORD       pERepRec,
     
    10211024  case XCPT_IN_PAGE_ERROR:
    10221025CrashAndBurn:
     1026        CheckLogException();
    10231027        dprintfException(pERepRec, pERegRec, pCtxRec, p);
    10241028        if(fIsOS2Image == FALSE)  //Only for real win32 apps
  • trunk/src/kernel32/makefile

    r2280 r2298  
    1 # $Id: makefile,v 1.76 1999-12-31 10:47:11 sandervl Exp $
     1# $Id: makefile,v 1.77 2000-01-02 22:09:01 sandervl Exp $
    22
    33#
     
    233233    .\misc.cpp \
    234234    initterm.h \
    235     $(PDWIN32_INCLUDE)\misc.h
     235    $(PDWIN32_INCLUDE)\misc.h \
     236    $(PDWIN32_INCLUDE)\win\thread.h
    236237
    237238win32util.OBJ: \
  • trunk/src/kernel32/misc.cpp

    r2061 r2298  
    1 /* $Id: misc.cpp,v 1.15 1999-12-12 14:32:38 sandervl Exp $ */
     1/* $Id: misc.cpp,v 1.16 2000-01-02 22:09:01 sandervl Exp $ */
    22
    33/*
     
    2929#include "initterm.h"
    3030#include "logging.h"
     31#include <wprocess.h>
    3132
    3233/*****************************************************************************
     
    273274  if(fLogging && flog)
    274275  {
     276    THDB *thdb = GetThreadTHDB();
     277
    275278    va_start(argptr, tekst);
     279    if(thdb) thdb->logfile = (DWORD)flog;
    276280    vfprintf(flog, tekst, argptr);
     281    if(thdb) thdb->logfile = 0;
    277282    va_end(argptr);
    278283
     
    280285      fprintf(flog, "\n");
    281286  }
    282 
     287  fflush(flog);
    283288  SetFS(sel);
    284289  return 1;
     
    293298  if(fLogging && logfile)
    294299  {
     300    THDB *thdb = GetThreadTHDB();
     301
    295302    va_start(argptr, tekst);
     303    if(thdb) thdb->logfile = (DWORD)logfile;
    296304    vfprintf((FILE *)logfile, tekst, argptr);
     305    if(thdb) thdb->logfile = 0;
    297306    va_end(argptr);
    298307
     
    303312  SetFS(sel);
    304313  return 1;
     314}
     315//******************************************************************************
     316//Check if the exception occurred inside a fprintf (logging THDB member set)
     317//If true, decrease the lock count for that file stream
     318//NOTE: HACK: DEPENDS ON COMPILER VERSION!!!!
     319//******************************************************************************
     320void CheckLogException()
     321{
     322  THDB *thdb = GetThreadTHDB();
     323  USHORT *lock;
     324
     325  if(!thdb) return;
     326
     327  if(thdb->logfile) {
     328        //oops, exception in vfprintf; let's clear the lock count
     329#if (__IBMCPP__ == 300) || (__IBMC__ == 300)
     330        lock = (USHORT *)(thdb->logfile+0x1C);
     331#else
     332#error Check the offset of the lock count word in the file stream structure for this compiler revision!!!!!
     333#endif
     334        (*lock)--;
     335  }
    305336}
    306337//******************************************************************************
  • trunk/src/kernel32/wprocess.cpp

    r2280 r2298  
    1 /* $Id: wprocess.cpp,v 1.63 1999-12-31 10:47:12 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.64 2000-01-02 22:09:02 sandervl Exp $ */
    22
    33/*
     
    245245        //And free our own
    246246        OSLibFreeSel(thdb->teb_sel);
     247
     248        *TIBFlatPtr = 0;
    247249   }
    248250   else dprintf(("Already destroyed TIB"));
    249251
    250252   dprintf(("DestroyTIB: FS(%x):[0] = %x", GetFS(), QueryExceptionChain()));
    251    *TIBFlatPtr = 0;
    252253   return;
    253254}
Note: See TracChangeset for help on using the changeset viewer.