Changeset 3063 for branches


Ignore:
Timestamp:
Apr 8, 2007, 10:24:07 PM (18 years ago)
Author:
bird
Message:

Fake something half ok when a device is being stat()'ed. Fixes #149.

Location:
branches/libc-0.6/src/emx/src/lib/sys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/src/lib/sys/b_fsNativeFileStat.c

    r2579 r3063  
    44 * LIBC SYS Backend - internal stat.
    55 *
    6  * Copyright (c) 2004-2005 knut st. osmundsen <bird@innotek.de>
     6 * Copyright (c) 2004-2007 knut st. osmundsen <bird-src-spam@innotek.de>
    77 *
    88 *
     
    8585     * If potential device, then perform real check.
    8686     */
    87     /** @todo copy device check from the path resolver. */
     87    if (    (pszNativePath[1]== 'd' || pszNativePath[1] == 'D')
     88        &&  (pszNativePath[2] == 'e' || pszNativePath[2] == 'E')
     89        &&  (pszNativePath[3] == 'v' || pszNativePath[3] == 'V')
     90        &&  (pszNativePath[4] == '/' || pszNativePath[4] == '\\')
     91        )
     92    {
     93        ULONG       cb = 64;
     94        PFSQBUFFER2 pfsqb = alloca(cb);
     95        if (!DosQueryFSAttach((PCSZ)pszNativePath, 0, FSAIL_QUERYNAME, pfsqb, &cb))
     96        {
     97            /* fake unix stuff */
     98            /** @todo this doesn't entirely match the open and file handle stat code.
     99             * Fortunately, the user will not see that unless won't have the filename... */
     100            pStat->st_dev = __libc_back_fsPathCalcInodeAndDev(pszNativePath, &pStat->st_ino);
     101            pStat->st_attr = FILE_NORMAL;
     102            pStat->st_mode = S_IFCHR | S_IRWXO | S_IRWXG | S_IRWXU;
     103            pStat->st_uid = 0;
     104            pStat->st_gid = 0;
     105            pStat->st_rdev = 0; /* b_ioFileOpen depends on this being 0 for devices! */
     106            pStat->st_nlink = 1;
     107            pStat->st_size = 0;
     108            pStat->st_blocks = 0;
     109            pStat->st_blksize = 4096 * 12; /* 48kb */
     110            pStat->st_atime = 0;
     111            pStat->st_mtime = 0;
     112            pStat->st_ctime = 0;
     113            pStat->st_birthtime = 0;
     114            LIBCLOG_RETURN_INT(0);
     115        }
     116    }
    88117
    89118    /*
  • branches/libc-0.6/src/emx/src/lib/sys/b_ioFileOpen.c

    r2811 r3063  
    44 * LIBC SYS Backend - open.
    55 *
    6  * Copyright (c) 2003-2005 knut st. osmundsen <bird@innotek.de>
     6 * Copyright (c) 2003-2007 knut st. osmundsen <bird-src-spam@innotek.de>
    77 * Copyright (c) 1992-1996 by Eberhard Mattes
    88 *
     
    217217                /*
    218218                 * Character device or Block device:
    219                  *                  Translate the major/minor to an OS/2 device name and open that.
     219                 *                  Translate the major/minor to an OS/2 device name and open that,
     220                 *                  unless it's a native device of course (see b_fsNativeFileStat.c).
    220221                 */
    221222                case S_IFCHR:
    222223                case S_IFBLK:
    223224                {
     225                    if (st.st_rdev == 0)
     226                        break;
    224227                    /** @todo assign major & minor numbers and do translations. */
    225228                    LIBCLOG_ERROR_RETURN_INT(-ENOTSUP);
Note: See TracChangeset for help on using the changeset viewer.