Changeset 3062


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

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

Location:
trunk/libc/src/kNIX/os2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libc/src/kNIX/os2/b_fsNativeFileStat.c

    r2929 r3062  
    44 * kNIX - internal stat.
    55 *
    6  * Copyright (c) 2004-2005 knut st. osmundsen <bird-src-spam@anduin.net>
     6 * Copyright (c) 2004-2007 knut st. osmundsen <bird-src-spam@anduin.net>
    77 *
    88 *
     
    6767     * If potential device, then perform real check.
    6868     */
    69     /** @todo copy device check from the path resolver. */
     69    if (    (pszNativePath[1]== 'd' || pszNativePath[1] == 'D')
     70        &&  (pszNativePath[2] == 'e' || pszNativePath[2] == 'E')
     71        &&  (pszNativePath[3] == 'v' || pszNativePath[3] == 'V')
     72        &&  (pszNativePath[4] == '/' || pszNativePath[4] == '\\')
     73        )
     74    {
     75        ULONG       cb = 64;
     76        PFSQBUFFER2 pfsqb = alloca(cb);
     77        if (!DosQueryFSAttach((PCSZ)pszNativePath, 0, FSAIL_QUERYNAME, pfsqb, &cb))
     78        {
     79            /* fake unix stuff */
     80            /** @todo this doesn't entirely match the open and file handle stat code.
     81             * Fortunately, the user will not see that unless won't have the filename... */
     82            pStat->st_dev = __libc_back_fsPathCalcInodeAndDev(pszNativePath, &pStat->st_ino);
     83            pStat->st_attr = FILE_NORMAL;
     84            pStat->st_mode = S_IFCHR | S_IRWXO | S_IRWXG | S_IRWXU;
     85            pStat->st_uid = 0;
     86            pStat->st_gid = 0;
     87            pStat->st_rdev = 0; /* b_ioFileOpen depends on this being 0 for devices! */
     88            pStat->st_nlink = 1;
     89            pStat->st_size = 0;
     90            pStat->st_blocks = 0;
     91            pStat->st_blksize = 4096 * 12; /* 48kb */
     92            pStat->st_atime = 0;
     93            pStat->st_mtime = 0;
     94            pStat->st_ctime = 0;
     95            pStat->st_birthtime = 0;
     96            LIBCLOG_RETURN_INT(0);
     97        }
     98    }
    7099
    71100    /*
  • trunk/libc/src/kNIX/os2/b_ioFileOpen.c

    r2929 r3062  
    44 * kNIX - open, OS/2.
    55 *
    6  * Copyright (c) 2003-2006 knut st. osmundsen <bird-src-spam@anduin.net>
     6 * Copyright (c) 2003-2007 knut st. osmundsen <bird-src-spam@anduin.net>
    77 * Copyright (c) 1992-1996 by Eberhard Mattes
    88 *
     
    192192            /*
    193193             * Character device or Block device:
    194              *                  Translate the major/minor to an OS/2 device name and open that.
     194             *                  Translate the major/minor to an OS/2 device name and open that,
     195             *                  unless it's a native device of course (see b_fsNativeFileStat.c).
    195196             */
    196197            case S_IFCHR:
    197198            case S_IFBLK:
    198199            {
     200                if (st.st_rdev == 0)
     201                    break;
    199202                /** @todo assign major & minor numbers and do translations. */
    200203                LIBCLOG_ERROR_RETURN_INT(-ENOTSUP);
Note: See TracChangeset for help on using the changeset viewer.