Changeset 1508


Ignore:
Timestamp:
Sep 15, 2004, 2:34:25 AM (21 years ago)
Author:
bird
Message:

no-unix stuff.

Location:
trunk/src/emx
Files:
3 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/lib/libc.def

    • Property cvs2svn:cvs-rev changed from 1.62 to 1.63
    r1507 r1508  
    11761176    "___libc_OS2ErrorPush" @1196
    11771177    "___libc_OS2ErrorSet" @1197
     1178    "__getdcwd" @1198
  • trunk/src/emx/src/lib/misc/abspath.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1507 r1508  
    88#include <sys/param.h>
    99#include <emx/syscalls.h>
     10#include <InnoTekLIBC/libc.h>
    1011#include <InnoTekLIBC/locale.h>
    1112
     
    1819  char drive, dir[MAXPATHLEN+1], src_drive, *s, *p;
    1920  int i, j, rel, server, trail, mbcl;
     21  char chSlash = !__libc_gfNoUnix ? '/' : '\\';
    2022
    2123  s = alloca (strlen (src) + 1);
     
    3941    }
    4042  else if (__getcwd (dir, drive) == 0)
    41     _fnslashify (dir);
     43    {
     44      if (!__libc_gfNoUnix)
     45        _fnslashify (dir);
     46    }
    4247  else
    4348    {
     
    4550      rel = TRUE;
    4651    }
     52
    4753  while (*s != 0)
    4854    {
    4955      if (s[0] == '.' && (IS_PATH_DELIM (s[1]) || s[1] == 0))
    5056        ++s;
    51       else if (s[0] == '.' && s[1] == '.' && (IS_PATH_DELIM (s[2]) || 
     57      else if (s[0] == '.' && s[1] == '.' && (IS_PATH_DELIM (s[2]) ||
    5258                                              s[2] == 0))
    5359        {
     
    6874          i = strlen (dir);
    6975          if (i < sizeof (dir) - 1)
    70             dir[i++] = '/';
     76            dir[i++] = chSlash;
    7177          while (*s != 0)
    7278            {
     
    105111    }
    106112  if (i < size && server && src_drive == 0)
    107     dst[i++] = '/';
    108   if (i < size && !rel && dir[0] != '/')
    109     dst[i++] = '/';
     113    dst[i++] = chSlash;
     114  if (i < size && !rel && dir[0] != chSlash)
     115    dst[i++] = chSlash;
    110116  j = 0;
    111   if (rel && dir[j] == '/')
     117  if (rel && dir[j] == chSlash)
    112118    ++j;
    113119  while (i < size && dir[j] != 0)
    114120    dst[i++] = dir[j++];
    115   if (trail && i < size && (i == 0 || dst[i-1] != '/'))
    116     dst[i++] = '/';
     121  if (trail && i < size && (i == 0 || dst[i-1] != chSlash))
     122    dst[i++] = chSlash;
    117123  if (i >= size)
    118124    {
  • trunk/src/emx/src/lib/misc/fullpath.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1507 r1508  
    99#include <emx/syscalls.h>
    1010#include <emx/io.h>
     11#include <InnoTekLIBC/libc.h>
    1112
    1213int _fullpath (char *dst, const char *src, int size)
     
    2728  cwd1[0] = cwd2[0] = drive;
    2829  cwd1[1] = cwd2[1] = ':';
    29   cwd1[2] = cwd2[2] = '/';
     30  cwd1[2] = cwd2[2] = !__libc_gfNoUnix ? '/' : '\\';
    3031  if (__getcwd (cwd1+3, drive) != 0)
    3132    goto failure;
     
    6768        }
    6869      if (!_trslash (dst, j, 0))
    69         dst[j++] = '/';
     70        dst[j++] = !__libc_gfNoUnix ? '/' : '\\';
    7071      strcpy (dst+j, temp+k);
    7172    }
    72   _fnslashify (dst);
     73  if (!__libc_gfNoUnix)
     74    _fnslashify (dst);
    7375  return 0;
    7476
  • trunk/src/emx/src/lib/misc/getcwd.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1507 r1508  
    77#include <sys/param.h>
    88#include <emx/syscalls.h>
     9#include <InnoTekLIBC/libc.h>
     10#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC
     11#include <InnoTekLIBC/logstrict.h>
    912
    10 char *_STD(getcwd) (char *buffer, size_t size)
     13char *_STD(getcwd)(char *buffer, size_t size)
    1114{
    12   char tmp[MAXPATHLEN+1];
    13   size_t len;
     15    LIBCLOG_ENTER("buffer=%p size=%d\n", buffer, size);
     16    if (!__libc_gfNoUnix)
     17    {
     18        char tmp[MAXPATHLEN+1];
     19        size_t len;
    1420
    15   if (buffer != NULL && size == 0)
     21        if (buffer != NULL && size == 0)
     22        {
     23            errno = EINVAL;
     24            LIBCLOG_RETURN_P(NULL);
     25        }
     26        if (__getcwd(tmp, 0) < 0)
     27            return NULL;
     28        len = strlen(tmp) + 2;
     29        if (buffer != NULL)
     30        {
     31            if (len > size)
     32            {
     33                errno = ERANGE;
     34                LIBCLOG_RETURN_P(NULL);
     35            }
     36        }
     37        else
     38        {
     39            if (len > size)
     40                size = len;
     41            buffer = malloc(size);
     42            if (buffer == NULL)
     43            {
     44                errno = ENOMEM;
     45                LIBCLOG_RETURN_P(NULL);
     46            }
     47        }
     48        _fnslashify(tmp);
     49        buffer[0] = '/';
     50        memcpy(buffer + 1, tmp, len - 1);
     51        LIBCLOG_RETURN_MSG(buffer, "ret %p:{%s}\n", (void *)buffer, buffer);
     52    }
     53    else
    1654    {
    17       errno = EINVAL;
    18       return NULL;
     55        char *pszRet = _getcwd2(buffer, size);
     56        LIBCLOG_RETURN_P(pszRet);
    1957    }
    20   if (__getcwd (tmp, 0) < 0)
    21     return NULL;
    22   len = strlen (tmp) + 2;
    23   if (buffer != NULL)
    24     {
    25       if (len > size)
    26         {
    27           errno = ERANGE;
    28           return NULL;
    29         }
    30     }
    31   else
    32     {
    33       if (len > size)
    34         size = len;
    35       buffer = malloc (size);
    36       if (buffer == NULL)
    37         {
    38           errno = ENOMEM;
    39           return NULL;
    40         }
    41     }
    42   _fnslashify (tmp);
    43   buffer[0] = '/';
    44   strcpy (buffer+1, tmp);
    45   return buffer;
    4658}
  • trunk/src/emx/src/lib/misc/getcwd1.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1507 r1508  
    44#include <stdlib.h>
    55#include <emx/syscalls.h>
     6#include <InnoTekLIBC/libc.h>
     7#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC
     8#include <InnoTekLIBC/logstrict.h>
    69
    710int _getcwd1 (char *buffer, char drive)
    811{
    9   if (__getcwd (buffer+1, drive) < 0)
    10     return -1;
    11   _fnslashify (buffer+1);
    12   buffer[0] = '/';
    13   return 0;
     12    LIBCLOG_ENTER("buffer=%p drive=%c\n", (void *)buffer, drive);
     13    if (__getcwd (buffer+1, drive) < 0)
     14        LIBCLOG_RETURN_INT(-1);
     15    if (!__libc_gfNoUnix)
     16    {
     17        _fnslashify(buffer+1);
     18        buffer[0] = '/';
     19    }
     20    else
     21        buffer[1] = '\\';
     22    LIBCLOG_RETURN_MSG(0, "ret 0 buffer=:{%s}\n", buffer);
    1423}
  • trunk/src/emx/src/lib/misc/getcwd2.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1507 r1508  
    77#include <sys/param.h>
    88#include <emx/syscalls.h>
     9#include <InnoTekLIBC/libc.h>
     10#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC
     11#include <InnoTekLIBC/logstrict.h>
    912
    1013char *_getcwd2 (char *buffer, int size)
    1114{
    12   char tmp[MAXPATHLEN+1];
    13   int len;
     15    LIBCLOG_ENTER("buffer=%p size=%d\n", (void *)buffer, size);
     16    char tmp[MAXPATHLEN+1];
     17    int len;
    1418
    15   if (buffer != NULL && size <= 0)
     19    if (buffer != NULL && size <= 0)
    1620    {
    17       errno = EINVAL;
    18       return NULL;
     21        errno = EINVAL;
     22        LIBCLOG_RETURN_P(NULL);
    1923    }
    20   if (__getcwd (tmp, 0) < 0)
    21     return NULL;
    22   len = strlen (tmp) + 4;
    23   if (buffer != NULL)
     24    if (__getcwd (tmp, 0) < 0)
     25        return NULL;
     26    len = strlen (tmp) + 4;
     27    if (buffer != NULL)
    2428    {
    25       if (len > size)
     29        if (len > size)
    2630        {
    27           errno = ERANGE;
    28           return NULL;
     31            errno = ERANGE;
     32            LIBCLOG_RETURN_P(NULL);
    2933        }
    3034    }
    31   else
     35    else
    3236    {
    33       if (len > size)
    34         size = len;
    35       buffer = malloc (size);
    36       if (buffer == NULL)
     37        if (len > size)
     38            size = len;
     39        buffer = malloc(size);
     40        if (buffer == NULL)
    3741        {
    38           errno = ENOMEM;
    39           return NULL;
     42            errno = ENOMEM;
     43            LIBCLOG_RETURN_P(NULL);
    4044        }
    4145    }
    42   _fnslashify (tmp);
    43   buffer[0] = _getdrive();
    44   buffer[1] = ':';
    45   buffer[2] = '/';
    46   strcpy (buffer+3, tmp);
    47   return buffer;
     46    if (!__libc_gfNoUnix)
     47    {
     48        _fnslashify(tmp);
     49        buffer[0] = _getdrive();
     50        buffer[1] = ':';
     51        buffer[2] = '/';
     52        memcpy(buffer+3, tmp, len - 3);
     53    }
     54    else
     55    {
     56        buffer[0] = _getdrive();
     57        buffer[1] = ':';
     58        buffer[2] = '\\';
     59        memcpy(buffer+3, tmp, len - 3);
     60    }
     61    LIBCLOG_RETURN_MSG(buffer, "ret %p:{%s}\n", (void *)buffer, buffer);
    4862}
  • trunk/src/emx/src/lib/misc/getwd.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1507 r1508  
    77#include <sys/param.h>
    88#include <emx/syscalls.h>
     9#include <InnoTekLIBC/libc.h>
    910
    1011char *_STD(getwd) (char *buffer)
     
    2021      return NULL;
    2122    }
    22   _fnslashify (buffer+1);
    23   buffer[0] = '/';
     23  if (!__libc_gfNoUnix)
     24    {
     25      _fnslashify (buffer+1);
     26      buffer[0] = '/';
     27    }
     28  else
     29    buffer[0] = '\\';
     30
    2431  return buffer;
    2532}
  • trunk/src/emx/src/lib/startup/386/crt0.s

    • Property cvs2svn:cvs-rev changed from 1.8 to 1.9
    r1507 r1508  
    4646    addl    $8, %esp
    4747#endif
    48 #if defined (HIGHMEM)
    49     pushl    $1     /* vote for high mem for default stack */
     48#if defined(HIGHMEM) && defined(NOUNIX)
     49    pushl    $3     /* vote for high mem for default heap; & less unixness. */
     50#elif defined(HIGHMEM)
     51    pushl    $1     /* vote for high mem for default heap */
     52#elif defined(NOUNIX)
     53    pushl    $2     /* vote against high memory for deault heap; lexx unixness */
    5054#else
    51     pushl    $0     /* veto agains high mem for default stack */
     55    pushl    $0     /* veto against high mem for default heap. */
    5256#endif
    5357    call    ___init_app
  • trunk/src/emx/src/lib/startup/386/dll0.s

    • Property cvs2svn:cvs-rev changed from 1.10 to 1.11
    r1507 r1508  
    6666do_init:
    6767#endif
    68 #if defined (HIGHMEM)
    69     pushl    $1     /* vote for high mem for default stack */
     68#if defined(HIGHMEM) && defined(NOUNIX)
     69    pushl    $3     /* vote for high mem for default heap; & less unixness. */
     70#elif defined(HIGHMEM)
     71    pushl    $1     /* vote for high mem for default heap */
     72#elif defined(NOUNIX)
     73    pushl    $2     /* vote against high memory for deault heap; lexx unixness */
    7074#else
    71     pushl    $0     /* veto against high mem for default stack */
     75    pushl    $0     /* veto against high mem for default heap. */
    7276#endif
    7377    call    ___init_dll
  • trunk/src/emx/src/lib/startup/startup.smak

    • Property cvs2svn:cvs-rev changed from 1.13 to 1.14
    r1507 r1508  
    99include common.smak
    1010
    11 .OBJS += $(addprefix $.$(.TKIND.DIR)src/lib/startup/,mcrt0.o gcrt0.o crt0fork.o dll0fork.o crt0hi.o dll0hi.o crt0hifork.o dll0hifork.o) \
    12   $(addprefix $.omf/src/lib/startup/,mcrt0.obj gcrt0.obj \
    13   $(CPU)/crt0.obj $(CPU)/dll0.obj crt0fork.obj dll0fork.obj crt0hi.obj dll0hi.obj crt0hifork.obj dll0hifork.obj)
     11.OBJS += $(addprefix $.$(.TKIND.DIR)src/lib/startup/,mcrt0.o gcrt0.o) \
     12  $(addprefix $.omf/src/lib/startup/,mcrt0.obj gcrt0.obj $(CPU)/crt0.obj $(CPU)/dll0.obj )
    1413.DIRS := $(sort $(dir $(.OBJS)))
    1514TARGDIRS += $(.DIRS)
     15
     16# define to do 
     17define def_startup
     18$(eval .OBJS += $.aout/src/lib/startup/crt0$(i).o)
     19$$.aout/src/lib/startup/crt0$(i).o: src/lib/startup/386/crt0.s
     20        $$(call DO.COMPILE.s, $(subst noux, -DNOUNIX,$(subst fork, -DFORK,$(subst hi, -DHIGHMEM, $i))))
     21
     22$(eval .OBJS += $.aout/src/lib/startup/dll0$(i).o)
     23$$.aout/src/lib/startup/dll0$(i).o: src/lib/startup/386/dll0.s
     24        $$(call DO.COMPILE.s, $(subst noux, -DNOUNIX,$(subst fork, -DFORK,$(subst hi, -DHIGHMEM, $i))))
     25       
     26$(eval .OBJS += $.omf/src/lib/startup/crt0$(i).obj)
     27$$.omf/src/lib/startup/crt0$(i).obj: $$.aout/src/lib/startup/crt0$(i).o
     28        $$(call DO.EMXOMF,-m__text)
     29       
     30$(eval .OBJS += $.omf/src/lib/startup/dll0$(i).obj)
     31$$.omf/src/lib/startup/dll0$(i).obj: $$.aout/src/lib/startup/dll0$(i).o
     32        $$(call DO.EMXOMF,-l__text)
     33endef
     34
     35# generate
     36$(foreach i,hi hifork hinoux hiforknoux fork forknoux noux,$(eval $(def_startup)))
     37
    1638
    1739libc: emxomf ld $(.DIRS) $(.OBJS)
     
    2143        $(call CP,$^,$(dir $@))
    2244
    23 $.aout/src/lib/startup/crt0fork.o: src/lib/startup/386/crt0.s
    24         $(call DO.COMPILE.s, -DFORK)
    25        
    26 $.aout/src/lib/startup/dll0fork.o: src/lib/startup/386/dll0.s
    27         $(call DO.COMPILE.s, -DFORK)
    28 
    29 $.aout/src/lib/startup/crt0hi.o: src/lib/startup/386/crt0.s
    30         $(call DO.COMPILE.s, -DHIGHMEM)
    31        
    32 $.aout/src/lib/startup/dll0hi.o: src/lib/startup/386/dll0.s
    33         $(call DO.COMPILE.s, -DHIGHMEM)
    34 
    35 $.aout/src/lib/startup/crt0hifork.o: src/lib/startup/386/crt0.s
    36         $(call DO.COMPILE.s, -DHIGHMEM -DFORK)
    37        
    38 $.aout/src/lib/startup/dll0hifork.o: src/lib/startup/386/dll0.s
    39         $(call DO.COMPILE.s, -DHIGHMEM -DFORK)
    40 
    41                                
    4245$.aout/src/lib/startup/mcrt0.o: src/lib/startup/386/crt0.s
    4346        $(call DO.COMPILE.s, -DMCRT0)
     
    5962$.omf/src/lib/startup/gcrt0.obj: $.aout/src/lib/startup/gcrt0.o
    6063        $(call DO.EMXOMF,-m__text)
    61 $.omf/src/lib/startup/dll0fork.obj: $.aout/src/lib/startup/dll0fork.o
    62         $(call DO.EMXOMF,-l__text)
    63 $.omf/src/lib/startup/crt0fork.obj: $.aout/src/lib/startup/crt0fork.o
    64         $(call DO.EMXOMF,-m__text)
    65 $.omf/src/lib/startup/dll0hi.obj: $.aout/src/lib/startup/dll0hi.o
    66         $(call DO.EMXOMF,-l__text)
    67 $.omf/src/lib/startup/crt0hi.obj: $.aout/src/lib/startup/crt0hi.o
    68         $(call DO.EMXOMF,-m__text)
    69 $.omf/src/lib/startup/dll0hifork.obj: $.aout/src/lib/startup/dll0hifork.o
    70         $(call DO.EMXOMF,-l__text)
    71 $.omf/src/lib/startup/crt0hifork.obj: $.aout/src/lib/startup/crt0hifork.o
    72         $(call DO.EMXOMF,-m__text)
    7364$.omf/src/lib/startup/386/dll0.obj: $.aout/src/lib/startup/386/dll0.o
    7465        $(call DO.EMXOMF,-l__text)
  • trunk/src/emx/src/lib/sys/__getcwd.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r1507 r1508  
    1515  if (drive != 0)
    1616    drive -= 'A' - 1;
    17   size =512;
     17  size = CCHMAXPATH;
    1818  FS_SAVE_LOAD();
    1919  rc = DosQueryCurrentDir (drive, buffer, &size);
  • trunk/src/emx/src/lib/sys/__init.c

    • Property cvs2svn:cvs-rev changed from 1.14 to 1.15
    r1507 r1508  
    144144 * Does initialization for thread 1 before main() is called.
    145145 *
    146  * This function doesn't return, but leaves it stack frame on the stack by some
     146 * This function doesn't return, but leaves its stack frame on the stack by some
    147147 * magic done in sys/386/appinit.s. The top of the returned stack have a layout
    148148 * as seen in struct stackframe below - start of struct is main() callframe.
    149  * @param   fDefaultHeapInHighMem   If set the application is open to put the default
    150  *                                  heap in high memory.
    151  *                                  If clear the application veto against putting the
    152  *                                  default heap in high memory.
    153  *                                  Passed on to __init_dll().
     149 *
     150 * @param   fFlags  Bit 0: If set the application is open to put the default heap in high memory.
     151 *                         If clear the application veto against putting the default heap in high memory.
     152 *                  Bit 1: If set some of the unixness of LIBC is disabled.
     153 *                         If clear all unix like features are enabled.
     154 *                  Passed on to __init_dll().
     155 *
    154156 * @ingroup startup
    155157 */
    156 void __init(int fDefaultHeapInHighMem)
     158void __init(int fFlags)
    157159{
    158160    /** top of stack unpon 'return' from this function. */
     
    181183     * Then end the heap voting.
    182184     */
    183     if (__init_dll(fDefaultHeapInHighMem))
     185    if (__init_dll(fFlags))
    184186        goto failure;
    185187
  • trunk/src/emx/src/lib/sys/__initdll.c

    • Property cvs2svn:cvs-rev changed from 1.13 to 1.14
    r1507 r1508  
    3535#include "syscalls.h"
    3636#include <InnoTekLIBC/thread.h>
     37#include <InnoTekLIBC/libc.h>
    3738#define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_INITTERM
    3839#include <InnoTekLIBC/logstrict.h>
     
    6061*   Global Variables                                                           *
    6162*******************************************************************************/
     63int                 __libc_gfNoUnix;
    6264__LIBC_PPTHREAD     __libc_gpTLS;
    6365
     
    7779 * Common init code for crt0 and dll0.
    7880 * This should perhaps be a part of _CRT_init.
    79  */
    80 int __init_dll(int fDefaultHeapInHighMem)
     81 *
     82 * @param   fFlags  Bit 0: If set the application is open to put the default heap in high memory.
     83 *                         If clear the application veto against putting the default heap in high memory.
     84 *                  Bit 1: If set some of the unixness of LIBC is disabled.
     85 *                         If clear all unix like features are enabled.
     86 *                  Passed on to __init_dll().
     87 */
     88int __init_dll(int fFlags)
    8189{
    8290    ULONG               aul[2];
     
    8997
    9098    /*
    91      * Heap voting.
    92      */
    93     __libc_HeapVote(fDefaultHeapInHighMem);
     99     * Process flags.
     100     */
     101    __libc_HeapVote(fFlags & 1);
     102    if (fFlags & 2)
     103        __libc_gfNoUnix = 1;
     104
    94105
    95106    /*
  • trunk/src/emx/src/lib/sys/pathrewrite.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r1507 r1508  
    6060*******************************************************************************/
    6161#include <InnoTekLIBC/pathrewrite.h>
     62#include <InnoTekLIBC/libc.h>
    6263#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO
    6364#include <InnoTekLIBC/logstrict.h>
     
    239240     * Extra unix features.
    240241     */
    241     if (1)
     242    if (!__libc_gfNoUnix)
    242243    {
    243244        /*
  • trunk/src/emx/src/lib/sys/syscalls.h

    • Property cvs2svn:cvs-rev changed from 1.12 to 1.13
    r1507 r1508  
    6464 */
    6565EXTERN unsigned long    _sys_gcbVirtualAddressLimit;
    66 
    6766
    6867/* The top heap object.  This points into _sys_heap_objs[] or is NULL.
     
    161160/** @group Init Functions
    162161 * @{ */
    163 extern void             __init(int fDefaultHeapInHighMem);
    164 extern int              __init_dll(int fDefaultHeapInHighMem);
     162extern void             __init(int fFlags);
     163extern int              __init_dll(int fFlags);
    165164extern void /*volatile*/_sys_init_ret(void *stack) __attribute__((__noreturn__));
    166165extern int              _sys_init_environ(const char *pszEnv);
Note: See TracChangeset for help on using the changeset viewer.