Changeset 1676 for trunk/src


Ignore:
Timestamp:
Dec 2, 2004, 2:42:51 AM (21 years ago)
Author:
bird
Message:

Fixed fork() problem by adding DosLoadModuleEx and DosFreeModuleEx. (also fixed heap problem)

Location:
trunk/src/emx
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/emx/startup.h

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1675 r1676  
    88#endif
    99
    10 extern int  _CRT_init (void);
    11 extern void _CRT_term (void);
    12 extern void __ctordtorInit (void);
    13 extern void __ctordtorTerm (void);
     10extern int  _CRT_init(void);
     11extern void _CRT_term(void);
     12extern void __ctordtorInit(void);
     13extern void __ctordtorTerm(void);
     14
     15extern void __ctordtorInit1(int *);
     16extern void __ctordtorTerm1(int *);
     17
     18/** init and term vectors.
     19 * @{
     20 */
     21/** Array of CRT init functions. */
     22extern int __crtinit1__;
     23/** Array of CRT exit functions. */
     24extern int __crtexit1__;
     25/** Array of exception handlers something. */
     26extern int __eh_init__;
     27/** Array of exception handlers something. */
     28extern int __eh_term__;
     29/** Array of constructors. */
     30extern int __CTOR_LIST__;
     31/** Array of destructors. */
     32extern int __DTOR_LIST__;
     33/** @} */
     34
    1435
    1536/* argv[i][-1] contains some flag bits: */
  • trunk/src/emx/include/os2emx.h

    • Property cvs2svn:cvs-rev changed from 1.25 to 1.26
    r1675 r1676  
    1352913529APIRET APIENTRY DosCloseEventSemEx(HEV hev);
    1353013530
     13531
     13532
     13533
     13534
     13535
     13536
     13537
     13538
     13539
     13540
     13541
     13542
    1353113543#ifdef INCL_EXAPIS_MAPPINGS
    1353213544
     
    1354213554#define DosCloseEventSem(a)        DosCloseEventSemEx((a))
    1354313555
     13556
     13557
     13558
    1354413559#endif /* INCL_EXAPIS_MAPPINGS */
    1354513560
  • trunk/src/emx/include/sys/fmutex.h

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1675 r1676  
    100100}
    101101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
    102113
    103114unsigned _fmutex_create (_fmutex *, unsigned);
  • trunk/src/emx/src/lib/libc.def

    • Property cvs2svn:cvs-rev changed from 1.82 to 1.83
    r1675 r1676  
    12731273    "_warnc" @1291
    12741274    ; new stuff
     1275
     1276
  • trunk/src/emx/src/lib/malloc/initr.c

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1675 r1676  
    167167        LIBCLOG_MSG("Unlocking the heaps.\n");
    168168        if (_um_tiled_heap)
    169             _um_heap_unlock(_um_tiled_heap);
     169            _);
    170170        if (_um_high_heap)
    171             _um_heap_unlock(_um_high_heap);
     171            _);
    172172        if (_um_low_heap)
    173             _um_heap_unlock(_um_low_heap);
     173            _);
    174174        gfForkCleanupDone = 1;
    175175    }
  • trunk/src/emx/src/lib/startup/cleanup.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r1675 r1676  
    22
    33#include <stdio.h>
    4 #include <emx\startup.h>
    5 
    6 extern int __crtexit1__;
    7 extern void __ctordtorTerm1 (int *ptr);
     4#include <emx/startup.h>
    85
    96void _CRT_term (void)
  • trunk/src/emx/src/lib/startup/ctor1.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1675 r1676  
    22
    33#include <stdlib.h>
     4
    45
    5 void __ctordtorInit1 (int *ptr);
    66void __ctordtorInit1 (int *ptr)
    77{
  • trunk/src/emx/src/lib/startup/startup.c

    • Property cvs2svn:cvs-rev changed from 1.12 to 1.13
    r1675 r1676  
    1111#define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_INITTERM
    1212#include <InnoTekLIBC/logstrict.h>
    13 
    14 extern int __crtinit1__;
    15 extern void __ctordtorInit1 (int *ptr);
    1613
    1714
  • trunk/src/emx/src/lib/sys/DosEx.c

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r1675 r1676  
    158158static int  dosexForkPreEventCreate(PDOSEX pEntry);
    159159static int  dosexForkPreEventOpen(PDOSEX pEntry);
     160
    160161static int  dosexForkChild(__LIBC_PFORKHANDLE pForkHandle, __LIBC_FORKOP enmOperation);
    161162static void dosexForkCleanup(void *pvArg, int rc, __LIBC_FORKCTX enmCtx);
     
    192193 * @returns OS/2 error code on failure.
    193194 */
    194 int  dosexRequestMutex(void)
     195int  dosexRequestMutex(void)
    195196{
    196197    LIBCLOG_ENTER("\n");
     
    227228 * Release mutex succesfully obtained by dosexRequestMutex().
    228229 */
    229 void dosexReleaseMutex(void)
     230void dosexReleaseMutex(void)
    230231{
    231232    LIBCLOG_ENTER("\n");
     
    255256 * @remark  Caller owns mutex.
    256257 */
    257 int dosexAllocPool(void)
     258int dosexAllocPool(void)
    258259{
    259260    LIBCLOG_ENTER("\n");
     
    495496 *
    496497 */
    497 int dosexFreeEntry(DOSEXTYPE enmType, PDOSEX pCur, PDOSEX pPrev, PDOSEXHDR pPool)
     498int dosexFreeEntry(DOSEXTYPE enmType, PDOSEX pCur, PDOSEX pPrev, PDOSEXHDR pPool)
    498499{
    499500    int         rc;
     
    550551            break;
    551552
     553
     554
     555
     556
     557
     558
     559
     560
     561
     562
     563
     564
    552565        default:
    553566            rc = ERROR_INVALID_PARAMETER;
     
    714727 * @param   pForkHandle     Pointer to the fork handle.
    715728 */
    716 int     dosexForkOpExecParent(__LIBC_PFORKHANDLE pForkHandle)
     729int     dosexForkOpExecParent(__LIBC_PFORKHANDLE pForkHandle)
    717730{
    718731    LIBCLOG_ENTER("pForkHandle=%p\n", (void *)pForkHandle);
     
    833846 * @param   pForkHandle     Pointer to the fork handle.
    834847 */
    835 int  dosexForkOpForkParent(__LIBC_PFORKHANDLE pForkHandle)
     848int  dosexForkOpForkParent(__LIBC_PFORKHANDLE pForkHandle)
    836849{
    837850    LIBCLOG_ENTER("pForkHandle=%p\n", (void *)pForkHandle);
     
    885898 * @param   cbArg           sizeof(DOSEXFORKCHILDALLOC).
    886899 */
    887 int dosexForkChildAlloc(__LIBC_PFORKHANDLE pForkHandle, void *pvArg, size_t cbArg)
     900int dosexForkChildAlloc(__LIBC_PFORKHANDLE pForkHandle, void *pvArg, size_t cbArg)
    888901{
    889902    LIBCLOG_ENTER("pForkHandle=%p pvArg=%p cbArg=%d\n", (void *)pForkHandle, pvArg, cbArg);
     
    912925 * @param   cbArg           sizeof(PDOSEXHDR).
    913926 */
    914 int dosexForkChildProcess(__LIBC_PFORKHANDLE pForkHandle, void *pvArg, size_t cbArg)
     927int dosexForkChildProcess(__LIBC_PFORKHANDLE pForkHandle, void *pvArg, size_t cbArg)
    915928{
    916929    LIBCLOG_ENTER("pForkHandle=%p pvArg=%p:{%p} cbArg=%d\n", (void *)pForkHandle, pvArg, *(void **)pvArg, cbArg);
     
    961974        if (rc)
    962975            break;
     976
     977
     978
     979
     980
     981
    963982    }
    964983
     
    967986
    968987/**
    969  * Allocates the memory described in the entry.
     988 * Allocates the memory described in the entry.
    970989 *
    971990 * @returns 0 on success.
     
    973992 * @param   pEntry  Entry containing a memory allocation.
    974993 */
    975 int dosexForkPreMemAlloc(PDOSEX pEntry)
     994int dosexForkPreMemAlloc(PDOSEX pEntry)
    976995{
    977996    int rc;
     
    9861005
    9871006/**
    988  * Allocates the memory described in the entry.
     1007 * Allocates the memory described in the entry.
    9891008 *
    9901009 * @returns 0 on success.
     
    9921011 * @param   pEntry  Entry containing a memory allocation.
    9931012 */
    994 int dosexForkPreMemOpen(PDOSEX pEntry)
     1013int dosexForkPreMemOpen(PDOSEX pEntry)
    9951014{
    9961015    unsigned    cOpens = pEntry->u.MemOpen.cOpens;
     
    10071026
    10081027/**
    1009  * Allocates the memory described in the entry.
     1028 * described in the entry.
    10101029 *
    10111030 * @returns 0 on success.
     
    10131032 * @param   pEntry  Entry containing a memory allocation.
    10141033 */
    1015 int dosexForkPreMutexCreate(PDOSEX pEntry)
     1034int dosexForkPreMutexCreate(PDOSEX pEntry)
    10161035{
    10171036    int                 i;
     
    10841103
    10851104/**
    1086  * Allocates the memory described in the entry.
     1105 * described in the entry.
    10871106 *
    10881107 * @returns 0 on success.
     
    10901109 * @param   pEntry  Entry containing a memory allocation.
    10911110 */
    1092 int dosexForkPreMutexOpen(PDOSEX pEntry)
     1111int dosexForkPreMutexOpen(PDOSEX pEntry)
    10931112{
    10941113    int cOpens = pEntry->u.MutexOpen.cOpens;
     
    11051124
    11061125/**
    1107  * Allocates the memory described in the entry.
     1126 * described in the entry.
    11081127 *
    11091128 * @returns 0 on success.
     
    11111130 * @param   pEntry  Entry containing a memory allocation.
    11121131 */
    1113 int dosexForkPreEventCreate(PDOSEX pEntry)
     1132int dosexForkPreEventCreate(PDOSEX pEntry)
    11141133{
    11151134    int                 i;
     
    11821201
    11831202/**
    1184  * Allocates the memory described in the entry.
     1203 * described in the entry.
    11851204 *
    11861205 * @returns 0 on success.
     
    11881207 * @param   pEntry  Entry containing a memory allocation.
    11891208 */
    1190 int dosexForkPreEventOpen(PDOSEX pEntry)
     1209int dosexForkPreEventOpen(PDOSEX pEntry)
    11911210{
    11921211    int cOpens = pEntry->u.EventOpen.cOpens;
     
    11951214        int rc = DosOpenEventSem(NULL, &pEntry->u.EventOpen.hev);
    11961215        LIBC_ASSERTM(!rc, "DosOpenEventSem(,%#lx) -> rc=%d\n", pEntry->u.EventOpen.hev, rc);
     1216
     1217
     1218
     1219
     1220
     1221
     1222
     1223
     1224
     1225
     1226
     1227
     1228
     1229
     1230
     1231
     1232
     1233
     1234
     1235
     1236
     1237
     1238
     1239
     1240
     1241
     1242
     1243
     1244
     1245
     1246
     1247
     1248
     1249
     1250
     1251
     1252
     1253
    11971254        if (rc)
    11981255            return -__libc_native2errno(rc);
     
    12641321}
    12651322
    1266 
  • trunk/src/emx/src/lib/sys/DosEx.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1675 r1676  
    4949    /** Event open. */
    5050    DOSEX_TYPE_EVENT_OPEN,
     51
     52
    5153    /** Max type (exclusive). */
    5254    DOSEX_TYPE_MAX
     
    6971    {
    7072        /** Search key.
    71          * We assume that sizeof(unsigned) == sizeof(PVOID) == sizeof(HMTX) == sizeof(HEV).
     73         * We assume that sizeof(unsigned) == sizeof(PVOID) == sizeof(HMTX) == sizeof(HEV).
    7274         */
    7375        unsigned        uKey;
     
    151153            unsigned    cOpens;
    152154        }   EventOpen;
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
    153166    }       u;
    154167} DOSEX;
  • trunk/src/emx/src/lib/sys/b_ldrClose.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1675 r1676  
    3131#include "libc-alias.h"
    3232#define INCL_BASE
     33
    3334#define INCL_FSMACROS
    3435#include <os2emx.h>
     
    5051    FS_VAR();
    5152    FS_SAVE_LOAD();
    52     int rc = DosFreeModule((HMODULE)pvModule);
     53    int rc = DosFreeModule((HMODULE)pvModule);
    5354    FS_RESTORE();
    5455    LIBCLOG_RETURN_INT(rc);
  • trunk/src/emx/src/lib/sys/b_ldrOpen.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1675 r1676  
    3232#define INCL_BASE
    3333#define INCL_FSMACROS
     34
    3435#include <os2emx.h>
    3536#include <InnoTekLIBC/backend.h>
     
    5556    FS_VAR();
    5657    FS_SAVE_LOAD();
    57     int rc = DosLoadModule((PSZ)pszError, cchError, (PCSZ)pszLibrary, &hmod);
     58    int rc = DosLoadModule((PSZ)pszError, cchError, (PCSZ)pszLibrary, &hmod);
    5859    FS_RESTORE();
    5960    if (!rc)
Note: See TracChangeset for help on using the changeset viewer.