Changeset 21837 for branches/gcc-kmk/src


Ignore:
Timestamp:
Nov 30, 2011, 2:58:20 PM (14 years ago)
Author:
dmik
Message:

Use pid instead of the ordinal number in log file names.

This in particular fixes the problem when WGSS50 writes to the log
before the ordinal is correctly initialized by KERNEL32 which resulted
into two processes writing to the same log file.

This also guarantees that a subsequent re-run will not vanish the
previous log file which is also useful sometimes.

Location:
branches/gcc-kmk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/gcc-kmk/src/kernel32/_ras.cpp

    r21787 r21837  
    77#include <_ras.h>
    88#include <umalloc.h>
     9#include <process.h>
    910
    1011#include <custombuild.h>
     
    786787
    787788    snprintf (uniqueLogFileName, sizeof(uniqueLogFileName),
    788               "%s.%d", filename, loadNr);
     789              "%s.%d", filename, getpid());
    789790
    790791    if (rasdata.rlc.hlogfile == -1)
  • branches/gcc-kmk/src/kernel32/dbglog.cpp

    r21790 r21837  
    2626#include <string.h>
    2727#include <stdarg.h>
     28#include <process.h>
    2829#include <win32type.h>
    2930#include <win32api.h>
     
    332333#ifdef WIN32_IP_LOGGING
    333334        char *logserver = getenv("WIN32LOG_IPSERVER");
    334         if(logserver && loadNr == 0) {
     335        if(logserver) {
    335336             sock_init();
    336337
     
    348349            pszLogBase = "odin32_";
    349350
    350         sprintf(szLogFile, "%s%d.log", pszLogBase, loadNr);
     351        sprintf(szLogFile, "%s%d.log", pszLogBase, getpid());
    351352        flog = fopen(szLogFile, "w");
    352353        if(flog == NULL)
    353354        {//probably running exe on readonly device
    354             sprintf(szLogFile, "%sodin32_%d.log", kernel32Path, loadNr);
     355            sprintf(szLogFile, "%sodin32_%d.log", kernel32Path, getpid());
    355356            flog = fopen(szLogFile, "w");
    356357        }
     
    576577        char logname[CCHMAXPATH];
    577578
    578         sprintf(logname, "odin32_%d.log", loadNr);
     579        sprintf(logname, "odin32_%d.log", getpid());
    579580        flog = fopen(logname, "w");
    580581        if(flog == NULL) {//probably running exe on readonly device
    581             sprintf(logname, "%sodin32_%d.log", kernel32Path, loadNr);
     582            sprintf(logname, "%sodin32_%d.log", kernel32Path, getpid());
    582583            flog = fopen(logname, "w");
    583584        }
  • branches/gcc-kmk/src/kernel32/globaldata.asm

    r21801 r21837  
    1111
    1212_GLOBALDATA     SEGMENT DWORD PUBLIC USE32 'DATA'
    13 
    14 ;
    15 ; initterm.cpp:
    16 ;
    17                 PUBLIC _globLoadNr
    18 
    19 ; extern int globLoadNr; // = 0
    20 _globLoadNr     DD 0
    2113
    2214;
  • branches/gcc-kmk/src/kernel32/initterm.cpp

    r21829 r21837  
    6060extern PFN pfnImSetMsgQueueProperty;
    6161
    62 //
    63 // Global DLL Data (keep it in sync with globaldata.asm!)
    64 //
    65 extern int globLoadNr; // = 0
    66 
    6762BOOL    fVersionWarp3 = FALSE;
    6863BOOL    fCustomBuild  = FALSE;
     
    7065ULONG   flAllocMem = 0;    /* flag to optimize DosAllocMem to use all the memory on SMP machines */
    7166ULONG   ulMaxAddr = 0x20000000; /* end of user address space. */
    72 int     loadNr = 0;
    7367char    kernel32Path[CCHMAXPATH] = "";
    7468BOOL    fInit     = FALSE;
     
    359353{
    360354    HMODULE hModule;
    361 
    362     if (!fInit)
    363         loadNr = globLoadNr++;
    364355
    365356    BOOL WGSS_OK = FALSE;
  • branches/gcc-kmk/src/kernel32/initterm.h

    r9878 r21837  
    2828void CloseLogFile(); //misc.cpp
    2929
    30 extern int globLoadNr; //global data
    31 extern int loadNr;
    3230extern BOOL fVersionWarp3;
    3331extern BOOL fInit;
  • branches/gcc-kmk/src/kernel32/perfview.cpp

    r7413 r21837  
    2828#else
    2929
     30#include <process.h>
     31
    3032#include <ccollection.h>
    3133#include <winbase.h>
    3234
    3335// imported from the kernel loader (initterm)
    34 extern int loadNr;
    3536extern char  kernel32Path[];
    3637
     
    348349  char szFilename[260];
    349350
    350   sprintf(szFilename, "perf_%d.log", loadNr);
     351  sprintf(szFilename, "perf_%d.log", getpid());
    351352  _privateLogFile = fopen(szFilename, "w");
    352353 
    353354  if(_privateLogFile == NULL)
    354355  {
    355     sprintf(szFilename, "%sperf_%d.log", kernel32Path, loadNr);
     356    sprintf(szFilename, "%sperf_%d.log", kernel32Path, getpid());
    356357    _privateLogFile = fopen(szFilename, "w");
    357358  }
  • branches/gcc-kmk/src/kernel32/winimagepeldr.cpp

    r21824 r21837  
    4141
    4242#ifdef DEBUG
     43#include <process.h>
    4344//use a different logfile
    4445#define PRIVATE_LOGGING
     
    8687 char logname[CCHMAXPATH];
    8788
    88     sprintf(logname, "pe_%d.log", loadNr);
     89    sprintf(logname, "pe_%d.log", getpid());
    8990        _privateLogFile = fopen(logname, "w");
    9091    if(_privateLogFile == NULL) {
    91         sprintf(logname, "%spe_%d.log", kernel32Path, loadNr);
     92        sprintf(logname, "%spe_%d.log", kernel32Path, getpid());
    9293            _privateLogFile = fopen(logname, "w");
    9394    }
  • branches/gcc-kmk/src/oleaut32/old/typelib.cpp

    r21754 r21837  
    2020#define DEBUG2
    2121
     22#ifdef DEBUG
     23#include <process.h>
     24#endif
     25
    2226#include "oleaut32.h"
    2327#include "olectl.h"
     
    3943    char logname[1024];
    4044
    41     sprintf(logname, "tlib_%d.log", loadNr);
     45    sprintf(logname, "tlib_%d.log", getpid());
    4246    _privateLogFile = fopen(logname, "w");
    4347    if(_privateLogFile == NULL)
    4448    {
    45         sprintf(logname, "%stlib_%d.log", oleaut32Path, loadNr);
     49        sprintf(logname, "%stlib_%d.log", oleaut32Path, getpid());
    4650        _privateLogFile = fopen(logname, "w");
    4751    }
Note: See TracChangeset for help on using the changeset viewer.