Changeset 3747 for branches


Ignore:
Timestamp:
Mar 4, 2012, 7:45:55 PM (13 years ago)
Author:
bird
Message:

socketpair: support osfd (return sockets descriptors) pointing to high memory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/src/libsocket/socketpair.c

    r2434 r3747  
    125125    int             fh1;
    126126    int             fh2;
     127    int             aNativeFDs[2] = {-1, -1};
    127128    PLIBCSOCKETFH   pFH1;
    128129
    129     rc = __libsocket_socketpair(af, type, flags, osfd);
     130    /* Make sure we crash here if parameter is invalid. */
     131    osfd[0] = -1;
     132    osfd[1] = -1;
     133
     134    /* Call the native API. */
     135    rc = __libsocket_socketpair(af, type, flags, aNativeFDs);
    130136    if (rc < 0)
    131137    {
     
    137143     * Allocate LIBC sockets.
    138144     */
    139     pFH1 = TCPNAMEG(AllocFH)(osfd[0], &fh1);
     145    pFH1 = TCPNAMEG(AllocFH)(aNativeFDs[0], &fh1);
    140146    if (pFH1)
    141147    {
    142         PLIBCSOCKETFH   pFH2 = TCPNAMEG(AllocFH)(osfd[1], &fh2);
     148        PLIBCSOCKETFH   pFH2 = TCPNAMEG(AllocFH)(aNativeFDs[1], &fh2);
    143149        if (pFH2)
    144150        {
     
    148154            LIBCLOG_RETURN_MSG(0, "ret 0 osfd[0]=%d osfd[1]=%d\n", osfd[0], osfd[1]);
    149155        }
    150         __libsocket_soclose(osfd[1]);
     156         
     157        __libsocket_soclose(aNativeFDs[1]);
    151158        __libc_FHClose(fh1);
    152159    }
    153160    else
    154161    {
    155         __libsocket_soclose(osfd[1]);
    156         __libsocket_soclose(osfd[0]);
     162        __libsocket_soclose(aNativeFDs[1]);
     163        __libsocket_soclose(aNativeFDs[0]);
    157164    }
    158165
Note: See TracChangeset for help on using the changeset viewer.