Changeset 1368


Ignore:
Timestamp:
Apr 15, 2004, 12:54:39 AM (21 years ago)
Author:
bird
Message:

#1023: libc_FHMoreHandles(). Wrote away the _file2 part of streams.

Location:
trunk/src/emx/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/emx/io.h

    • Property cvs2svn:cvs-rev changed from 1.7 to 1.8
    r1367 r1368  
    131131#define _IOWIDE     0x00010000
    132132
     133/** This bit is set for standard streams which should not be closed by _fcloseall(). */
     134#define _IONOCLOSEALL   0x00020000
     135
    133136
    134137#define _FLUSH_FLUSH  (-1)
    135138#define _FLUSH_FILL   (-2)
    136 
    137 struct _FILE;
    138 
    139 struct _file2
    140 {
    141   struct _FILE *owner;
    142 #if defined (_SYS_RMUTEX_H)
    143   _rmutex rsem;
    144 #else
    145   char rsem_ersatz[16];
    146 #endif
    147 };
    148139
    149140#define nbuf(s) (((s)->_flags & _IOBUFMASK) == _IOBUFNONE)
     
    163154struct streamvec
    164155{
    165   struct _FILE *vec;
    166   struct streamvec *next;
    167   int n;
     156    /** Number of free entries in the vector. */
     157    int               cFree;
     158    /** Pointer to the previous node in the list. */
     159    struct streamvec *pPrev;
     160    /** Array of file stream structure. */
     161    struct _FILE     *aFiles;
     162    /** Pointer to the next entry in the list */
     163    struct streamvec *pNext;
     164    /** Number of entries in the vector. */
     165    int               cFiles;
    168166};
    169167
     
    177175
    178176extern struct streamvec    *_streamvec_head;
     177extern struct streamvec    *_streamvec_tail;
    179178extern int                  _io_ninherit;
    180179extern struct fdvec         _fdvec_head;
     
    195194
    196195#define STREAM_LOCK(f) \
    197   (_rmutex_request (&(f)->_more->rsem, _FMR_IGNINT) != 0 \
     196  (_rmutex_request (&(f)->__u.__rsem, _FMR_IGNINT) != 0 \
    198197   ? abort () : (void)0)
    199198
    200199#define STREAM_UNLOCK(f) \
    201   (_rmutex_release (&(f)->_more->rsem) != 0 ? abort () : (void)0)
     200  (_rmutex_release (&(f)->__u.__rsem) != 0 ? abort () : (void)0)
    202201
    203202#define STREAM_LOCK_NOWAIT(f) \
    204   (_rmutex_request (&(f)->_more->rsem, _FMR_NOWAIT) == 0)
    205 
    206 #define STREAM_UNLOCKED(f) _rmutex_available (&(f)->_more->rsem)
     203  (_rmutex_request (&(f)->__u.__rsem, _FMR_NOWAIT) == 0)
     204
     205#define STREAM_UNLOCKED(f) _rmutex_available (&(f)->__u.__rsem)
    207206
    208207#endif /* defined (_SYS_RMUTEX_H) */
     
    330329
    331330int     __libc_FHEnsureHandles(int fh);
     331int     __libc_FHMoreHandles(void);
    332332int     __libc_FHAllocate(int fh, unsigned fFlags, int cb, PLIBCFHOPS pOps, PLIBCFH *ppFH, int *pfh);
    333333int     __libc_FHClose(int fh);
     
    351351struct _FILE *_newstream (void);
    352352int _output (struct _FILE *, __const__ char *, char *);
    353 void _setdummymore (struct _FILE *, struct _file2 *);
    354 int _setmore (struct _FILE *, int);
    355353int _stream_read (int, void *, size_t);
    356354int _stream_write (int, __const__ void *, size_t);
  • trunk/src/emx/include/stdio.h

    • Property cvs2svn:cvs-rev changed from 1.10 to 1.11
    r1367 r1368  
    180180typedef struct _FILE
    181181{
    182   char * _ptr;
    183   char * _buffer;
    184   int    _rcount;
    185   int    _wcount;
    186   int    _handle;
    187   int    _flags;
    188   int    _buf_size;
    189   int    _tmpidx;
    190   int    _pid;
    191   char   _char_buf;
    192   unsigned char _ungetc_count;
    193   short  _mbstate;
    194   int    (*_flush)(struct _FILE *, int);
    195   struct _file2 *_more;
     182    char * _ptr;
     183    char * _buffer;
     184    int    _rcount;
     185    int    _wcount;
     186    int    _handle;
     187    int    _flags;
     188    int    _buf_size;
     189    int    _tmpidx;
     190    int    _pid;
     191    char   _char_buf;
     192    unsigned char _ungetc_count;
     193    short  _mbstate;
     194    int    (*_flush)(struct _FILE *, int);
     195
     196    /** The Mutex Semaphore. */
     197    union
     198    {
     199#if defined (_SYS_RMUTEX_H)
     200        _rmutex   __rsem;
     201#endif
     202        char      __rsem_ersatz[16];
     203    } __u;
     204    /** Pointer to the stream vector which thie FILE belongs to.
     205     * This member is the first which should not be zeroed by _newstream()! */
     206    void    *__pSV;
    196207} FILE;
    197208
     
    538549
    539550int _fcloseall (void);
    540 FILE *_fassign (FILE *, FILE *);
    541551FILE *_fdopen (int, __const__ char *);
    542552int _fgetchar (void);
Note: See TracChangeset for help on using the changeset viewer.