Changeset 2538


Ignore:
Timestamp:
Feb 6, 2006, 11:12:16 PM (20 years ago)
Author:
bird
Message:

#50: Inherit umask.

Location:
branches/libc-0.6/src/emx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/include/InnoTekLIBC/sharedpm.h

    r2323 r2538  
    278278
    279279/**
    280  * SPM fs inherit data.
     280 * The SPM fs inherit data, part 1.
     281 * The FS data is stored in two sections for legacy reasons.
    281282 */
    282283typedef struct __libc_SPMInhFS
     
    291292/** Pointer to FS inherit data. */
    292293typedef __LIBC_SPMINHFS *__LIBC_PSPMINHFS;
     294
     295/**
     296 * SPM fs inherit data, part two.
     297 */
     298typedef struct __libc_SPMInhFS2
     299{
     300    /** The size of this structure. */
     301    unsigned    cb;
     302    /** The umask value. */
     303    unsigned    fUMask;
     304} __LIBC_SPMINHFS2;
     305/** Pointer to FS inherit data, part two. */
     306typedef __LIBC_SPMINHFS2 *__LIBC_PSPMINHFS2;
    293307
    294308/**
     
    326340     * All the strings are NULL terminated and referenced by offset. */
    327341    char                   *pszStrings;
     342    /** More file system stuff. */
     343    __LIBC_PSPMINHFS2       pFS2;
    328344} __LIBC_SPMINHERIT;
    329345/** Pointer to inherit data. */
  • branches/libc-0.6/src/emx/src/lib/sys/__spawnve.c

    r2323 r2538  
    5858        size_t              cbFS;
    5959        __LIBC_PSPMINHFS    pFS;
    60         if (!__libc_back_fsInheritPack(&pFS, &cbFS))
     60        size_t              cbFS2;
     61        __LIBC_PSPMINHFS2   pFS2;
     62        if (!__libc_back_fsInheritPack(&pFS, &cbFS, &pFS2, &cbFS2))
    6163        {
    6264            /*
     
    9597                        pRet->pFS = NULL;
    9698
     99                    /* fs2 */
     100                    if (pFS2)
     101                    {
     102                        pRet->pFS2 = (__LIBC_PSPMINHFS)p;
     103                        p += ALIGNIT(cbFS2);
     104                        memcpy(pRet->pFS2, pFS2, cbFS2);
     105                        free(pFS2);
     106                    }
     107                    else
     108                        pRet->pFS2 = NULL;
     109
    97110                    /* sig */
    98111                    if (pSig)
     
    123136            }
    124137            free(pFS);
     138            free(pFS2);
    125139        }
    126140
  • branches/libc-0.6/src/emx/src/lib/sys/b_fs.h

    r2525 r2538  
    242242 * @returns 0 on success.
    243243 * @returns -1 on failure.
    244  * @param   ppFS    Where to store the pointer to the inherit data.
    245  * @param   pcbFS   Where to store the size of the inherit data.
    246  */
    247 int __libc_back_fsInheritPack(__LIBC_PSPMINHFS *ppFS, size_t *pcbFS);
     244 * @param   ppFS    Where to store the pointer to the inherit data, part 1.
     245 * @param   pcbFS   Where to store the size of the inherit data, part 1.
     246 * @param   ppFS2   Where to store the pointer to the inherit data, part 2.
     247 * @param   pcbFS2  Where to store the size of the inherit data, part 2.
     248 */
     249int __libc_back_fsInheritPack(__LIBC_PSPMINHFS *ppFS, size_t *pcbFS, __LIBC_PSPMINHFS2 *ppFS2, size_t *pcbFS2);
    248250
    249251/**
  • branches/libc-0.6/src/emx/src/lib/sys/fs.c

    r2530 r2538  
    250250     */
    251251    __LIBC_PSPMINHERIT  pInherit = __libc_spmInheritRequest();
     252
     253    /* part 2, the umask. */
     254    __LIBC_PSPMINHFS2   pFS2;
     255    if (    pInherit
     256        &&  pInherit->cb > offsetof(__LIBC_SPMINHERIT, pFS2)
     257        &&  (pFS2 = pInherit->pFS2) != NULL
     258        &&  !(pFS2->fUMask & ~0777))
     259    {
     260        LIBCLOG_MSG("Inherited fUMask=%04o\n", pFS2->fUMask);
     261        __libc_gfsUMask = pFS2->fUMask & 0777;
     262    }
     263
     264    /* part 1, the unixroot. */
    252265    __LIBC_PSPMINHFS    pFS;
    253266    if (    pInherit
     
    339352 * @returns 0 on success.
    340353 * @returns -1 on failure.
    341  * @param   ppFS    Where to store the pointer to the inherit data.
    342  * @param   pcbFS   Where to store the size of the inherit data.
    343  */
    344 int __libc_back_fsInheritPack(__LIBC_PSPMINHFS *ppFS, size_t *pcbFS)
    345 {
    346     LIBCLOG_ENTER("ppFS=%p pcbFS=%p\n", (void *)ppFS, (void *)pcbFS);
     354 * @param   ppFS    Where to store the pointer to the inherit data, part 1.
     355 * @param   pcbFS   Where to store the size of the inherit data, part 1.
     356 * @param   ppFS2   Where to store the pointer to the inherit data, part 2.
     357 * @param   pcbFS2  Where to store the size of the inherit data, part 2.
     358 */
     359int __libc_back_fsInheritPack(__LIBC_PSPMINHFS *ppFS, size_t *pcbFS, __LIBC_PSPMINHFS2 *ppFS2, size_t *pcbFS2)
     360{
     361    LIBCLOG_ENTER("ppFS=%p pcbFS=%p ppFS2=%p pcbFS2=%p\n", (void *)ppFS, (void *)pcbFS, (void *)ppFS2, (void *)pcbFS2);
    347362
    348363    *ppFS = NULL;
    349364    *pcbFS = 0;
     365    *ppFS2 = NULL;
     366    *pcbFS2 = 0;
    350367
    351368    if (__libc_back_fsMutexRequest())
     
    366383            *pcbFS = cb;
    367384            *ppFS = pFS;
     385        }
     386        else
     387            rc = -1;
     388    }
     389
     390    if (!rc)
     391    {
     392        __LIBC_PSPMINHFS2 pFS2 = (__LIBC_PSPMINHFS2)malloc(sizeof(*pFS2));
     393        if (pFS2)
     394        {
     395            pFS2->cb = sizeof(*pFS2);
     396            pFS2->fUMask = __libc_gfsUMask;
     397            LIBCLOG_MSG("fUMask=%04o\n", pFS2->fUMask);
     398
     399            *pcbFS2 = sizeof(*pFS2);
     400            *ppFS2 = pFS2;
    368401        }
    369402        else
Note: See TracChangeset for help on using the changeset viewer.