Changeset 732 for trunk/src/emx/include


Ignore:
Timestamp:
Sep 26, 2003, 4:41:32 AM (22 years ago)
Author:
bird
Message:

#668: Initial changed related to Large File Support (>2GB).

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

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/386/_limits.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r731 r732  
    9090
    9191/* bird: our off_t is 32 bit signed at the moment. */
    92 #if 0
     92#if 1
    9393#define __OFF_MAX       __LLONG_MAX     /* max value for an off_t */
    9494#define __OFF_MIN       __LLONG_MIN     /* min value for an off_t */
  • trunk/src/emx/include/386/ansi.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r731 r732  
    7575 */
    7676#define _BSD_CT_RUNE_T_ int                     /* arg type for ctype funcs */
    77 #if 0
     77#if 1
    7878#define _BSD_OFF_T_     __int64_t               /* file offset */
    7979#else
  • trunk/src/emx/include/dirent.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r731 r732  
    1 /* dirent.h (emx+gcc) */
     1/*-
     2 * Copyright (c) 1989, 1993
     3 *      The Regents of the University of California.  All rights reserved.
     4 *
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 * 1. Redistributions of source code must retain the above copyright
     9 *    notice, this list of conditions and the following disclaimer.
     10 * 2. Redistributions in binary form must reproduce the above copyright
     11 *    notice, this list of conditions and the following disclaimer in the
     12 *    documentation and/or other materials provided with the distribution.
     13 * 3. All advertising materials mentioning features or use of this software
     14 *    must display the following acknowledgement:
     15 *      This product includes software developed by the University of
     16 *      California, Berkeley and its contributors.
     17 * 4. Neither the name of the University nor the names of its contributors
     18 *    may be used to endorse or promote products derived from this software
     19 *    without specific prior written permission.
     20 *
     21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31 * SUCH DAMAGE.
     32 *
     33 *      @(#)dirent.h    8.2 (Berkeley) 7/28/94
     34 * $FreeBSD: src/include/dirent.h,v 1.13 2002/09/10 18:12:16 mike Exp $
     35 */
    236
    3 #ifndef _DIRENT_H
    4 #define _DIRENT_H
     37/** @file
     38 * FreeBSD 5.1
     39 * @changes bird: Merged in EMX stuff and internal LIBC stuff.
     40 */
    541
    6 #if !defined (_SYS_TYPES_H)
    7 #warning <dirent.h> requires <sys/types.h>
    8 #include <sys/types.h>
     42#ifndef _DIRENT_H_
     43#define _DIRENT_H_
     44
     45/*
     46 * The kernel defines the format of directory entries returned by
     47 * the getdirentries(2) system call.
     48 */
     49#include <sys/cdefs.h>
     50#include <sys/dirent.h>
     51
     52#if __BSD_VISIBLE || __XSI_VISIBLE
     53/*
     54 * XXX this is probably illegal in the __XSI_VISIBLE case, but brings us closer
     55 * to the specification.
     56 */
     57#define d_ino           d_fileno        /* backward and XSI compatibility */
    958#endif
    1059
    11 #include <sys/dirent.h>
     60#if __BSD_VISIBLE
    1261
    13 #if defined (__cplusplus)
    14 extern "C" {
     62/* definitions for library routines operating on directories. */
     63#define DIRBLKSIZ       1024
     64
     65struct _telldir;                /* see telldir.h */
     66
     67/* bird: EMX internal structure. */
     68struct _dircontents
     69{
     70  struct _dircontents * _d_next;
     71  char *                _d_entry;
     72  __off_t               _d_size;
     73  unsigned short        _d_time;
     74  unsigned short        _d_date;
     75  unsigned short        _d_attr;
     76  unsigned char         _d_type;
     77};
     78
     79/* structure describing an open directory. */
     80typedef struct _dirdesc {
     81#if 0
     82        int     dd_fd;          /* file descriptor associated with directory */
     83        long    dd_loc;         /* offset in current buffer */
     84        long    dd_size;        /* amount of data returned by getdirentries */
     85        char    *dd_buf;        /* data buffer */
     86        int     dd_len;         /* size of data buffer */
     87        long    dd_seek;        /* magic cookie returned by getdirentries */
     88        long    dd_rewind;      /* magic cookie for rewinding */
     89        int     dd_flags;       /* flags for readdir */
     90        void    *dd_lock;       /* hack to avoid including <pthread.h> */
     91        struct _telldir *dd_td; /* telldir position recording */
     92#else
     93        int                   dd_id;
     94        long                  dd_loc;
     95        struct _dircontents * dd_contents;
     96        struct _dircontents * dd_cp;
     97        struct dirent         dd_dirent;
     98#endif
     99} DIR;
     100
     101#define dirfd(dirp)     ((dirp)->dd_fd)
     102
     103/* flags for opendir2 */
     104#define DTF_HIDEW       0x0001  /* hide whiteout entries */
     105#define DTF_NODUP       0x0002  /* don't return duplicate names */
     106#define DTF_REWIND      0x0004  /* rewind after reading union stack */
     107#define __DTF_READALL   0x0008  /* everything has been read */
     108
     109#ifndef NULL
     110#define NULL    0
    15111#endif
    16112
    17 struct _dirdesc;
     113#else /* !__BSD_VISIBLE */
    18114
    19 typedef struct _dirdesc DIR;
     115typedef void *  DIR;
    20116
    21 DIR *opendir (__const__ char *);
    22 struct dirent *readdir (DIR *);
    23 int closedir (DIR *);
    24 void rewinddir (DIR *);
     117#endif /* __BSD_VISIBLE */
    25118
    26 #if !defined (_POSIX_SOURCE)
    27 void seekdir (DIR *, long);
    28 long telldir (DIR *);
     119#ifndef _KERNEL
     120
     121__BEGIN_DECLS
     122#if __BSD_VISIBLE
     123/** @todo DIR   *__opendir2(const char *, int); */
     124/** @todo int    alphasort(const void *, const void *); */
     125/** @todo int    getdents(int, char *, int); */
     126/** @todo int    getdirentries(int, char *, int, long *); */
    29127#endif
     128DIR     *opendir(const char *);
     129struct dirent *
     130         readdir(DIR *);
     131#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500
     132int      readdir_r(DIR *, struct dirent *, struct dirent **);
     133#endif
     134void     rewinddir(DIR *);
     135#if __BSD_VISIBLE
     136int      scandir(const char *, struct dirent ***,
     137            int (*)(struct dirent *), int (*)(const void *, const void *));
     138#endif
     139#if __XSI_VISIBLE
     140void     seekdir(DIR *, long);
     141long     telldir(DIR *);
     142#endif
     143int      closedir(DIR *);
    30144
     145
     146/* bird: EMX extra - start */
    31147DIR *_opendir (__const__ char *);
    32148struct dirent *_readdir (DIR *);
     
    35151int _closedir (DIR *);
    36152void _rewinddir (DIR *);
     153/* bird: EMX extra - end */
    37154
    38 #if defined (__cplusplus)
    39 }
    40 #endif
     155__END_DECLS
    41156
    42 #endif /* not _DIRENT_H */
     157#endif /* !_KERNEL */
     158
     159#endif /* !_DIRENT_H_ */
  • trunk/src/emx/include/emx/io.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r731 r732  
    77extern "C" {
    88#endif
     9
     10#include <sys/types.h>
    911
    1012#if !defined (NULL)
     
    1416#define NULL ((void *)0)
    1517#endif
    16 #endif
    17 
    18 #if !defined (_SIZE_T)
    19 #define _SIZE_T
    20 typedef unsigned long size_t;
    2118#endif
    2219
     
    217214void _closestream (struct _FILE *);
    218215int _fflush_nolock (struct _FILE *);
    219 int _fseek_nolock (struct _FILE *, long, int);
    220 long _ftell_nolock (struct _FILE *);
     216int _fseek_nolock (struct _FILE *, off_t, int);
     217off_t _ftell_nolock (struct _FILE *);
    221218size_t _fwrite_nolock (const void *, size_t, size_t, struct _FILE *);
    222219int _input (struct _FILE *, __const__ char *, char *);
  • trunk/src/emx/include/emx/syscalls.h

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r731 r732  
    33#ifndef _EMX_SYSCALLS_H
    44#define _EMX_SYSCALLS_H
     5
     6#include <sys/types.h>
    57
    68#if defined (__cplusplus)
     
    3739typedef unsigned long sigset_t;
    3840#endif
    39 
    40 #if !defined (_SIZE_T)
    41 #define _SIZE_T
    42 typedef unsigned long size_t;
    43 #endif
    44 
    4541
    4642struct hostent;
     
    5450struct timeval;
    5551
     52#pragma pack(1)
    5653struct _find
    5754{
    58   char           reserved[21];
    59   unsigned char  attr;
    60   unsigned short time;
    61   unsigned short date;
    62   unsigned short size_lo;         /* split due to alignment problems */
    63   unsigned short size_hi;
    64   char name[257];                 /* Big buffer for OS/2             */
    65 };
     55    /** Size of file, in number of bytes. */
     56    off_t           cbFile;
     57    /** Last written (OS/2 & DOS time). */
     58    unsigned short  time;
     59    /** Last written (OS/2 & DOS date). */
     60    unsigned short  date;
     61    /** File attributes. */
     62    unsigned char   attr;
     63    /** File name */
     64    char            szName[257];
     65};
     66#pragma pack()
    6667
    6768struct _new_proc
     
    128129int __chmod (__const__ char *name, int flag, int attr);
    129130int __chdrive (char drive);
    130 int __chsize (int handle, long length);
     131int __chsize (int handle, off_t length);
    131132long long __clock (void);
    132133int __close (int handle);
     
    146147int __fsync (int handle);
    147148void __ftime (struct timeb *ptr);
    148 int __ftruncate (int handle, long length);
     149int __ftruncate (int handle, off_t length);
    149150int __getcwd (char *buffer, char drive);
    150151char __getdrive (void);
     
    175176int __kill (int pid, int sig);
    176177int __listen (int handle, int backlog);
    177 int __lseek (int handle, long offset, int origin);
     178off_t __lseek (int handle, off_t offset, int origin);
    178179int __memavail (void);
    179180int __mkdir (__const__ char *name);
    180181int __newthread (int tid);
    181 int __open (__const__ char *name, int flags, unsigned long size);
     182int __open (__const__ char *name, int flags, off_t size);
    182183int __pause (void);
    183184int __pipe (int *two_handles, int pipe_size);
  • trunk/src/emx/include/io.h

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r731 r732  
    4949int access (__const__ char *, int);
    5050int chmod (__const__ char *, int);
    51 int chsize (int, long);
     51int chsize (int, off_t);
    5252int close (int);
    5353int creat (const char *, mode_t);
     
    5555int dup2 (int, int);
    5656int eof (int);
    57 long filelength (int);
     57off_t filelength (int);
    5858int fstat (int, struct stat *);
    5959int fsync (int);
     
    7777int sopen (__const__ char *, int, int, ...);
    7878int stat (__const__ char *, struct stat *);
    79 long tell (int);
     79off_t tell (int);
    8080#ifndef _TRUNCATE_DECLARED
    8181#define _TRUNCATE_DECLARED
     
    9191int _access (__const__ char *, int);
    9292int _chmod (__const__ char *, int);
    93 int _chsize (int, long);
     93int _chsize (int, off_t);
    9494int _close (int);
    9595int _creat (__const__ char *, int);
     
    9898int _dup2 (int, int);
    9999int _eof (int);
    100 long _filelength (int);
     100off_t _filelength (int);
    101101int _fstat (int, struct stat *);
    102102int _fsync (int);
     
    123123int _sopen (__const__ char *, int, int, ...);
    124124int _stat (__const__ char *, struct stat *);
    125 long _tell (int);
    126 int _truncate (char *, long);
     125off_t _tell (int);
     126int _truncate (char *, off_t);
    127127int _umask (int);
    128128int _unlink (__const__ char *);
  • trunk/src/emx/include/os2emx.h

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r731 r732  
    12681268#define FIL_QUERYEASIZEL                12
    12691269#define FIL_QUERYEASFROMLISTL           13
    1270 #define FIL_QUERYFULLNAME               5 /* DosQueryPathInfo */
     1270#define FIL_QUERYFULLNAME               5
    12711271
    12721272#define FILE_BEGIN                      0
     
    15891589typedef FILEFINDBUF4 *PFILEFINDBUF4;
    15901590
     1591typedef struct _FILEFINDBUF3L
     1592{
     1593    ULONG       oNextEntryOffset;
     1594    FDATE       fdateCreation;
     1595    FTIME       ftimeCreation;
     1596    FDATE       fdateLastAccess;
     1597    FTIME       ftimeLastAccess;
     1598    FDATE       fdateLastWrite;
     1599    FTIME       ftimeLastWrite;
     1600    LONGLONG    cbFile;
     1601    LONGLONG    cbFileAlloc;
     1602    ULONG       attrFile;
     1603    UCHAR       cchName;
     1604    CHAR        achName[CCHMAXPATHCOMP];
     1605} FILEFINDBUF3L;
     1606typedef FILEFINDBUF3L *PFILEFINDBUF3L;
     1607
     1608typedef struct _FILEFINDBUF4L
     1609{
     1610    ULONG       oNextEntryOffset;
     1611    FDATE       fdateCreation;
     1612    FTIME       ftimeCreation;
     1613    FDATE       fdateLastAccess;
     1614    FTIME       ftimeLastAccess;
     1615    FDATE       fdateLastWrite;
     1616    FTIME       ftimeLastWrite;
     1617    LONGLONG    cbFile;
     1618    LONGLONG    cbFileAlloc;
     1619    ULONG       attrFile;
     1620    ULONG       cbList;
     1621    UCHAR       cchName;
     1622    CHAR        achName[CCHMAXPATHCOMP];
     1623} FILEFINDBUF4L;
     1624typedef FILEFINDBUF4L  *PFILEFINDBUF4L;
     1625
    15911626typedef struct _FILELOCK
    15921627{
     
    15961631typedef FILELOCK *PFILELOCK;
    15971632
    1598 typedef struct _FILELOCKL     /* flock */
     1633typedef struct _FILELOCKL
    15991634{
    16001635  LONGLONG lOffset;
  • trunk/src/emx/include/stdio.h

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r731 r732  
    1 /* stdio.h (emx+gcc) */
    2 
    3 #ifndef _STDIO_H
    4 #define _STDIO_H
    5 
    6 #if defined (__cplusplus)
    7 extern "C" {
    8 #endif
     1/*-
     2 * Copyright (c) 1990, 1993
     3 *      The Regents of the University of California.  All rights reserved.
     4 *
     5 * This code is derived from software contributed to Berkeley by
     6 * Chris Torek.
     7 *
     8 * Redistribution and use in source and binary forms, with or without
     9 * modification, are permitted provided that the following conditions
     10 * are met:
     11 * 1. Redistributions of source code must retain the above copyright
     12 *    notice, this list of conditions and the following disclaimer.
     13 * 2. Redistributions in binary form must reproduce the above copyright
     14 *    notice, this list of conditions and the following disclaimer in the
     15 *    documentation and/or other materials provided with the distribution.
     16 * 3. All advertising materials mentioning features or use of this software
     17 *    must display the following acknowledgement:
     18 *      This product includes software developed by the University of
     19 *      California, Berkeley and its contributors.
     20 * 4. Neither the name of the University nor the names of its contributors
     21 *    may be used to endorse or promote products derived from this software
     22 *    without specific prior written permission.
     23 *
     24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34 * SUCH DAMAGE.
     35 *
     36 *      @(#)stdio.h     8.5 (Berkeley) 4/29/95
     37 * $FreeBSD: src/include/stdio.h,v 1.51 2003/01/13 08:41:47 tjr Exp $
     38 */
     39
     40/** @file
     41 * FreeBSD 5.1
     42 * @changed bird: EMX isms + LIBC implementation specifics.
     43 * @chagned bird: Made quite a few @todos on function which aren't implemented.
     44 */
     45
     46#ifndef _STDIO_H_
     47#define _STDIO_H_
    948
    1049#include <sys/cdefs.h>
    1150#include <sys/_types.h>
    1251
    13 #if !defined(_VA_LIST_DECLARED) && !defined(_VA_LIST) /* bird: emx */
     52typedef __off_t         fpos_t;
     53
     54#ifndef _SIZE_T_DECLARED
     55typedef __size_t        size_t;
     56#define _SIZE_T_DECLARED
     57#define _SIZE_T                         /* bird: emx */
     58#endif
     59
     60#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
     61#ifndef _VA_LIST_DECLARED
     62typedef __va_list       va_list;
    1463#define _VA_LIST_DECLARED
    1564#define _VA_LIST                        /* bird: emx */
    16 typedef __va_list       va_list;
    17 #endif
    18 
    19 #if !defined (_SIZE_T)
    20 #define _SIZE_T
    21 typedef unsigned long size_t;
    22 #endif
    23 
    24 #if !defined (NULL)
    25 #if defined (__cplusplus)
    26 #define NULL 0
    27 #else
    28 #define NULL ((void *)0)
    29 #endif
    30 #endif
    31 
    32 #if !defined (BUFSIZ)
    33 #define BUFSIZ 5120
    34 #endif
    35 
    36 #if !defined (_FILE_T)
     65#endif
     66#endif
     67
     68#ifndef NULL
     69#define NULL    0
     70#endif
     71
     72#define _FSTDIO                 /* Define for new stdio with functions. */
     73
     74#if 0                                   /* bird: emx */
     75
     76/*
     77 * NB: to fit things in six character monocase externals, the stdio
     78 * code uses the prefix `__s' for stdio objects, typically followed
     79 * by a three-character attempt at a mnemonic.
     80 */
     81
     82/* stdio buffers */
     83struct __sbuf {
     84        unsigned char *_base;
     85        int     _size;
     86};
     87
     88/* hold a buncha junk that would grow the ABI */
     89struct __sFILEX;
     90
     91/*
     92 * stdio state variables.
     93 *
     94 * The following always hold:
     95 *
     96 *      if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
     97 *              _lbfsize is -_bf._size, else _lbfsize is 0
     98 *      if _flags&__SRD, _w is 0
     99 *      if _flags&__SWR, _r is 0
     100 *
     101 * This ensures that the getc and putc macros (or inline functions) never
     102 * try to write or read from a file that is in `read' or `write' mode.
     103 * (Moreover, they can, and do, automatically switch from read mode to
     104 * write mode, and back, on "r+" and "w+" files.)
     105 *
     106 * _lbfsize is used only to make the inline line-buffered output stream
     107 * code as compact as possible.
     108 *
     109 * _ub, _up, and _ur are used when ungetc() pushes back more characters
     110 * than fit in the current _bf, or when ungetc() pushes back a character
     111 * that does not match the previous one in _bf.  When this happens,
     112 * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
     113 * _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
     114 *
     115 * NB: see WARNING above before changing the layout of this structure!
     116 */
     117typedef struct __sFILE {
     118        unsigned char *_p;      /* current position in (some) buffer */
     119        int     _r;             /* read space left for getc() */
     120        int     _w;             /* write space left for putc() */
     121        short   _flags;         /* flags, below; this FILE is free if 0 */
     122        short   _file;          /* fileno, if Unix descriptor, else -1 */
     123        struct  __sbuf _bf;     /* the buffer (at least 1 byte, if !NULL) */
     124        int     _lbfsize;       /* 0 or -_bf._size, for inline putc */
     125
     126        /* operations */
     127        void    *_cookie;       /* cookie passed to io functions */
     128        int     (*_close)(void *);
     129        int     (*_read)(void *, char *, int);
     130        fpos_t  (*_seek)(void *, fpos_t, int);
     131        int     (*_write)(void *, const char *, int);
     132
     133        /* separate buffer for long sequences of ungetc() */
     134        struct  __sbuf _ub;     /* ungetc buffer */
     135        struct __sFILEX *_extra; /* additions to FILE to not break ABI */
     136        int     _ur;            /* saved _r when _r is counting ungetc data */
     137
     138        /* tricks to meet minimum requirements even when malloc() fails */
     139        unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
     140        unsigned char _nbuf[1]; /* guarantee a getc() buffer */
     141
     142        /* separate buffer for fgetln() when line crosses buffer boundary */
     143        struct  __sbuf _lb;     /* buffer for fgetln() */
     144
     145        /* Unix stdio files get aligned to block boundaries on fseek() */
     146        int     _blksize;       /* stat.st_blksize (may be != _bf._size) */
     147        fpos_t  _offset;        /* current lseek offset (see WARNING) */
     148} FILE;
     149
     150__BEGIN_DECLS
     151extern FILE *__stdinp;
     152extern FILE *__stdoutp;
     153extern FILE *__stderrp;
     154__END_DECLS
     155
     156#define __SLBF  0x0001          /* line buffered */
     157#define __SNBF  0x0002          /* unbuffered */
     158#define __SRD   0x0004          /* OK to read */
     159#define __SWR   0x0008          /* OK to write */
     160        /* RD and WR are never simultaneously asserted */
     161#define __SRW   0x0010          /* open for reading & writing */
     162#define __SEOF  0x0020          /* found EOF */
     163#define __SERR  0x0040          /* found error */
     164#define __SMBF  0x0080          /* _buf is from malloc */
     165#define __SAPP  0x0100          /* fdopen()ed in append mode */
     166#define __SSTR  0x0200          /* this is an sprintf/snprintf string */
     167#define __SOPT  0x0400          /* do fseek() optimization */
     168#define __SNPT  0x0800          /* do not do fseek() optimization */
     169#define __SOFF  0x1000          /* set iff _offset is in fact correct */
     170#define __SMOD  0x2000          /* true => fgetln modified _p text */
     171#define __SALC  0x4000          /* allocate string space dynamically */
     172#define __SIGN  0x8000          /* ignore this file in _fwalk */
     173
     174#else  /* bird: EMX specific FILE stuff starts. */
     175
    37176#define _FILE_T
    38177#define _FILE_MEMBERS_HAVE_UNDERSCORE
    39178struct _file2;
    40 struct _FILE
     179typedef struct _FILE
    41180{
    42181  char * _ptr;
     
    54193  int    (*_flush)(struct _FILE *, int);
    55194  struct _file2 *_more;
    56 };
    57 
    58 typedef struct _FILE FILE;
    59 
     195} FILE;
     196
     197__BEGIN_DECLS
    60198extern FILE _streamv[];
    61 
    62 #define stdin  (&_streamv[0])
    63 #define stdout (&_streamv[1])
    64 #define stderr (&_streamv[2])
    65 
    66 #endif
    67 
    68 #if !defined (SEEK_SET)
    69 #define SEEK_SET 0
    70 #define SEEK_CUR 1
    71 #define SEEK_END 2
    72 #endif
    73 
    74 #if !defined (EOF)
    75 #define EOF (-1)
    76 #endif
     199__END_DECLS
     200
     201#define __stdinp    (&_streamv[0])
     202#define __stdoutp   (&_streamv[1])
     203#define __stderrp   (&_streamv[2])
     204
     205#endif /* bird: EMX specific FILE stuff ends. */
     206
     207
     208/*
     209 * The following three definitions are for ANSI C, which took them
     210 * from System V, which brilliantly took internal interface macros and
     211 * made them official arguments to setvbuf(), without renaming them.
     212 * Hence, these ugly _IOxxx names are *supposed* to appear in user code.
     213 *
     214 * Although numbered as their counterparts above, the implementation
     215 * does not rely on this.
     216 */
     217#define _IOFBF  0               /* setvbuf should set fully buffered */
     218#define _IOLBF  0x20 /* bird: emx, was 1 */ /* setvbuf should set line buffered */
     219#define _IONBF  0x40 /* bird: emx, was 2 */ /* setvbuf should set unbuffered */
     220
     221#define BUFSIZ  5120 /* bird: emx, was 1024 */ /* size of buffer used by setbuf */
     222#define EOF     (-1)
     223
     224/*
     225 * FOPEN_MAX is a minimum maximum, and is the number of streams that
     226 * stdio can provide without attempting to allocate further resources
     227 * (which could fail).  Do not use this for anything.
     228 */
     229                                /* must be == _POSIX_STREAM_MAX <limits.h> */
     230#define FOPEN_MAX       14   /* bird: emx, was 20 */ /* must be <= OPEN_MAX <sys/syslimits.h> */
     231#define FILENAME_MAX    260  /* bird: emx, was 1024 */ /* must be <= PATH_MAX <sys/syslimits.h> */
     232
     233/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
     234#if __XSI_VISIBLE
     235#define P_tmpdir        "." /* bird: emx, was "/var/tmp/" */
     236#endif
     237#define L_tmpnam        260  /* bird: emx, was 1024 */ /* XXX must be == PATH_MAX */
     238#define TMP_MAX         1000 /* bird: emx, was 308915776 */
     239
     240#ifndef SEEK_SET
     241#define SEEK_SET        0       /* set file offset to offset */
     242#endif
     243#ifndef SEEK_CUR
     244#define SEEK_CUR        1       /* set file offset to current plus offset */
     245#endif
     246#ifndef SEEK_END
     247#define SEEK_END        2       /* set file offset to EOF plus offset */
     248#endif
     249
     250#define stdin   __stdinp
     251#define stdout  __stdoutp
     252#define stderr  __stderrp
     253
     254__BEGIN_DECLS
     255/*
     256 * Functions defined in ANSI C standard.
     257 */
     258void     clearerr(FILE *);
     259int      fclose(FILE *);
     260int      feof(FILE *);
     261int      ferror(FILE *);
     262int      fflush(FILE *);
     263int      fgetc(FILE *);
     264int      fgetpos(FILE * __restrict, fpos_t * __restrict);
     265char    *fgets(char * __restrict, int, FILE * __restrict);
     266FILE    *fopen(const char * __restrict, const char * __restrict);
     267int      fprintf(FILE * __restrict, const char * __restrict, ...);
     268int      fputc(int, FILE *);
     269int      fputs(const char * __restrict, FILE * __restrict);
     270size_t   fread(void * __restrict, size_t, size_t, FILE * __restrict);
     271FILE    *freopen(const char * __restrict, const char * __restrict, FILE * __restrict);
     272int      fscanf(FILE * __restrict, const char * __restrict, ...);
     273int      fseek(FILE *, long, int);
     274int      fsetpos(FILE *, const fpos_t *);
     275long     ftell(FILE *);
     276size_t   fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
     277#if 0                                   /* bird: emx */
     278int      getc(FILE *);
     279#else                                   /* bird: emx */
     280/** @todo: Check the standard, if this is correct or not. declaration might be required. */
     281#define getc(s)   fgetc(s)              /* bird: emx */
     282#endif                                  /* bird: emx */
     283int      getchar(void);
     284char    *gets(char *);
     285void     perror(const char *);
     286int      printf(const char * __restrict, ...);
     287#if 0                                   /* bird: emx */
     288int      putc(int, FILE *);
     289#else                                   /* bird: emx */
     290/** @todo: Check the standard, if this is correct or not. declaration might be required. */
     291#define putc(c,s) fputc(c,s)            /* bird: emx */
     292#endif                                  /* bird: emx */
     293int      putchar(int);
     294int      puts(const char *);
     295int      remove(const char *);
     296int      rename(const char *, const char *);
     297void     rewind(FILE *);
     298int      scanf(const char * __restrict, ...);
     299void     setbuf(FILE * __restrict, char * __restrict);
     300int      setvbuf(FILE * __restrict, char * __restrict, int, size_t);
     301int      sprintf(char * __restrict, const char * __restrict, ...);
     302int      sscanf(const char * __restrict, const char * __restrict, ...);
     303FILE    *tmpfile(void);
     304char    *tmpnam(char *);
     305int      ungetc(int, FILE *);
     306int      vfprintf(FILE * __restrict, const char * __restrict,
     307            __va_list);
     308int      vprintf(const char * __restrict, __va_list);
     309int      vsprintf(char * __restrict, const char * __restrict,
     310            __va_list);
     311
     312#if __ISO_C_VISIBLE >= 1999
     313int      snprintf(char * __restrict, size_t, const char * __restrict,
     314            ...) __printflike(3, 4);
     315int      vfscanf(FILE * __restrict, const char * __restrict, __va_list)
     316            __scanflike(2, 0);
     317int      vscanf(const char * __restrict, __va_list) __scanflike(1, 0);
     318int      vsnprintf(char * __restrict, size_t, const char * __restrict,
     319            __va_list) __printflike(3, 0);
     320int      vsscanf(const char * __restrict, const char * __restrict, __va_list)
     321            __scanflike(2, 0);
     322#endif
     323
     324/*
     325 * Functions defined in all versions of POSIX 1003.1.
     326 */
     327#if __BSD_VISIBLE || __POSIX_VISIBLE <= 199506
     328/* size for cuserid(3); UT_NAMESIZE + 1, see <utmp.h> */
     329#define L_cuserid       9 /* bird: emx, was 17 */ /* legacy */
     330#endif
     331
     332#if __POSIX_VISIBLE
     333#define L_ctermid       260 /* bird: emx, was 1024 */ /* size for ctermid(3); PATH_MAX */
     334
     335/** @todo char  *ctermid(char *); */
     336FILE    *fdopen(int, const char *);
     337int      fileno(FILE *);
     338#endif /* __POSIX_VISIBLE */
     339
     340#if __POSIX_VISIBLE >= 199209
     341int      pclose(FILE *);
     342FILE    *popen(const char *, const char *);
     343#endif
     344
     345#if __POSIX_VISIBLE >= 199506
     346/** @todo int    ftrylockfile(FILE *); */
     347/** @todo void   flockfile(FILE *); */
     348/** @todo void   funlockfile(FILE *); */
     349
     350/*
     351 * These are normally used through macros as defined below, but POSIX
     352 * requires functions as well.
     353 */
     354/** @todo int    getc_unlocked(FILE *); */
     355/** @todo int    getchar_unlocked(void); */
     356/** @todo int    putc_unlocked(int, FILE *); */
     357/** @todo int    putchar_unlocked(int); */
     358#endif
     359#if __BSD_VISIBLE
     360/** @todo void  clearerr_unlocked(FILE *); */
     361/** @todo int   feof_unlocked(FILE *); */
     362/** @todo int   ferror_unlocked(FILE *); */
     363/** @todo int   fileno_unlocked(FILE *); */
     364#endif
     365
     366#if __POSIX_VISIBLE >= 200112
     367int      fseeko(FILE *, __off_t, int);
     368__off_t  ftello(FILE *);
     369#endif
     370
     371#if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600
     372int      getw(FILE *);
     373int      putw(int, FILE *);
     374#endif /* BSD or X/Open before issue 6 */
     375
     376#if __XSI_VISIBLE
     377char    *tempnam(const char *, const char *);
     378#endif
     379
     380/*
     381 * Routines that are purely local.
     382 */
     383#if __BSD_VISIBLE
     384/** @todo int    asprintf(char **, const char *, ...) __printflike(2, 3); */
     385/** @todo char  *ctermid_r(char *); */
     386/** @todo char  *fgetln(FILE *, size_t *); */
     387#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3
     388#define __ATTR_FORMAT_ARG       __attribute__((__format_arg__(2)))
     389#else
     390#define __ATTR_FORMAT_ARG
     391#endif
     392/** @todo __const char *fmtcheck(const char *, const char *) __ATTR_FORMAT_ARG; */
     393/** @todo int    fpurge(FILE *); */
     394void     setbuffer(FILE *, char *, int);
     395/** @todo int    setlinebuf(FILE *); */
     396/** @todo int    vasprintf(char **, const char *, __va_list)
     397            __printflike(2, 0); */
     398
     399/*
     400 * The system error table contains messages for the first sys_nerr
     401 * positive errno values.  Use strerror() or strerror_r() from <string.h>
     402 * instead.
     403 */
     404extern __const int sys_nerr;
     405extern __const char *__const sys_errlist[];
     406
     407/*
     408 * Stdio function-access interface.
     409 */
     410/** @todo FILE  *funopen(const void *,
     411            int (*)(void *, char *, int),
     412            int (*)(void *, const char *, int),
     413            fpos_t (*)(void *, fpos_t, int),
     414            int (*)(void *)); */
     415/** @todo #define       fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) */
     416/** @todo #define       fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) */
     417
     418/*
     419 * Portability hacks.  See <sys/types.h>.
     420 */
     421#ifndef _FTRUNCATE_DECLARED
     422#define _FTRUNCATE_DECLARED
     423int      ftruncate(int, __off_t);
     424#endif
     425#ifndef _LSEEK_DECLARED
     426#define _LSEEK_DECLARED
     427__off_t  lseek(int, __off_t, int);
     428#endif
     429#ifndef _MMAP_DECLARED
     430#define _MMAP_DECLARED
     431void    *mmap(void *, size_t, int, int, int, __off_t);
     432#endif
     433#ifndef _TRUNCATE_DECLARED
     434#define _TRUNCATE_DECLARED
     435int      truncate(const char *, __off_t);
     436#endif
     437#endif /* __BSD_VISIBLE */
     438
     439#if 0 /* bird: Skip FreeBSD sepcific LIBC stuff. */
     440/*
     441 * Functions internal to the implementation.
     442 */
     443int     __srget(FILE *);
     444int     __swbuf(int, FILE *);
     445
     446/*
     447 * The __sfoo macros are here so that we can
     448 * define function versions in the C library.
     449 */
     450#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
     451#if defined(__GNUC__) && defined(__STDC__)
     452static __inline int __sputc(int _c, FILE *_p) {
     453        if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
     454                return (*_p->_p++ = _c);
     455        else
     456                return (__swbuf(_c, _p));
     457}
     458#else
     459/*
     460 * This has been tuned to generate reasonable code on the vax using pcc.
     461 */
     462#define __sputc(c, p) \
     463        (--(p)->_w < 0 ? \
     464                (p)->_w >= (p)->_lbfsize ? \
     465                        (*(p)->_p = (c)), *(p)->_p != '\n' ? \
     466                                (int)*(p)->_p++ : \
     467                                __swbuf('\n', p) : \
     468                        __swbuf((int)(c), p) : \
     469                (*(p)->_p = (c), (int)*(p)->_p++))
     470#endif
     471
     472#define __sfeof(p)      (((p)->_flags & __SEOF) != 0)
     473#define __sferror(p)    (((p)->_flags & __SERR) != 0)
     474#define __sclearerr(p)  ((void)((p)->_flags &= ~(__SERR|__SEOF)))
     475#define __sfileno(p)    ((p)->_file)
     476
     477#if __BSD_VISIBLE
     478/*
     479 * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
     480 * B.8.2.7 for the rationale behind the *_unlocked() macros.
     481 */
     482#define feof_unlocked(p)        __sfeof(p)
     483#define ferror_unlocked(p)      __sferror(p)
     484#define clearerr_unlocked(p)    __sclearerr(p)
     485#define fileno_unlocked(p)      __sfileno(p)
     486#endif
     487#if __POSIX_VISIBLE >= 199506
     488#define getc_unlocked(fp)       __sgetc(fp)
     489#define putc_unlocked(x, fp)    __sputc(x, fp)
     490
     491#define getchar_unlocked()      getc_unlocked(stdin)
     492#define putchar_unlocked(x)     putc_unlocked(x, stdout)
     493#endif
     494
     495#endif /* bird: Skip FreeBSD sepcific LIBC stuff. */
     496
     497
     498/* bird: start of EMX isms. */
    77499
    78500#if !defined (_IOREAD)
     501/** @todo change to double underscore prefix to prevent confusion with
     502 * setvbuf() constants. See the short rant about it above. */
    79503#define _IOREAD 0x01
    80504#define _IOWRT  0x02
     
    82506#define _IOEOF  0x08
    83507#define _IOERR  0x10
    84 #define _IOFBF  0x00
    85 #define _IOLBF  0x20
    86 #define _IONBF  0x40
    87 #endif
    88 
    89 #if !defined (FOPEN_MAX)
    90 #define FOPEN_MAX       14
    91 #endif
    92 
    93 #if !defined (FILENAME_MAX)
    94 #define FILENAME_MAX    260
    95 #endif
    96 
    97 #if !defined (TMP_MAX)
    98 #define TMP_MAX         1000
    99 #endif
    100 
    101 #if !defined (P_tmpdir)
    102 #define P_tmpdir "."
    103 #define L_tmpnam (sizeof (P_tmpdir) + 13)
    104 #endif
    105 
    106 #if !defined (L_cuserid)
    107 #define L_cuserid       9
    108 #endif
    109 
    110 #if !defined (_FPOS_T)
    111 #define _FPOS_T
    112 typedef struct
    113 {
    114   long _pos;
    115   long _reserved1;
    116   short _mbstate;
    117   short _reserved2;
    118 } fpos_t;
    119 #endif
    120 
    121 
    122 void clearerr (FILE *);
    123 int fclose (FILE *);
    124 int feof (FILE *);
    125 int ferror (FILE *);
    126 int fflush (FILE *);
    127 int fgetc (FILE *);
    128 int fgetpos (FILE *, fpos_t *);
    129 char *fgets (char *, int, FILE *);
    130 FILE *fopen (__const__ char *, __const__ char *);
    131 int fprintf (FILE *, __const__ char *, ...);
    132 int fputc (int, FILE *);
    133 int fputs (__const__ char *, FILE *);
    134 size_t fread (void *, size_t, size_t, FILE *);
    135 FILE *freopen (__const__ char *, __const__ char *, FILE *);
    136 int fscanf (FILE *, __const__ char *, ...);
    137 int fseek (FILE *, long, int);
    138 int fsetpos (FILE *, __const__ fpos_t *);
    139 long ftell (FILE *);
    140 size_t fwrite (__const__ void *, size_t, size_t, FILE *);
    141 int getchar (void);
    142 char *gets (char *);
    143 void perror (__const__ char *);
    144 int printf (__const__ char *, ...);
    145 int putchar (int);
    146 int puts (__const__ char *);
    147 int remove (__const__ char *);
    148 int rename (__const__ char *, __const__ char *);
    149 void rewind (FILE *);
    150 int scanf (__const__ char *, ...);
    151 int setbuf (FILE *, char *);
    152 int setvbuf (FILE *, char *, int, size_t);
    153 int sprintf (char *, __const__ char *, ...);
    154 int sscanf (__const__ char *, __const__ char *, ...);
    155 FILE *tmpfile (void);
    156 char *tmpnam (char *);
    157 int ungetc (int, FILE *);
    158 int vfprintf (FILE *, __const__ char *, va_list);
    159 int vprintf (__const__ char *, va_list);
    160 int vsprintf (char *, __const__ char *, va_list);
     508#endif
    161509
    162510int _fill (FILE *);
     
    174522}
    175523
    176 #define getc(s)   fgetc(s)
    177 #define putc(c,s) fputc(c,s)
    178 
    179524extern __inline__ int getchar (void) { return getc (stdin); }
    180525extern __inline__ int putchar (int _c) { return putc (_c, stdout); }
    181526
    182 
    183 #if !defined (__STRICT_ANSI__)
    184 
    185 /* POSIX.1 */
    186 
    187 /* ctermid() */
    188 FILE *fdopen (int, __const__ char *);
    189 int fileno (FILE *);
    190 
    191 extern __inline__ int fileno (FILE *_s) { return _s->_handle; }
    192 
    193 #endif
    194 
    195 
    196527#if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)
    197528
    198529char *cuserid (char *);
    199 int getw (FILE *);
    200530int fcloseall (void);
    201531int fgetchar (void);
    202532int flushall (void);
    203533int fputchar (int);
    204 int pclose (FILE *);
    205 FILE *popen (__const__ char *, __const__ char *);
    206 int putw (int, FILE *);
    207 int setbuffer (FILE *, char *, size_t);
    208 int snprintf (char *, size_t, __const__ char *, ...);
    209 char *tempnam (__const__ char *, __const__ char *);
    210 int vfscanf (FILE *, __const__ char *, va_list);
    211 int vscanf (__const__ char *, va_list);
    212 int vsnprintf (char *, size_t, __const__ char *, va_list);
    213 int vsscanf (__const__ char *, __const__ char *, va_list);
    214534
    215535#endif
     
    234554FILE *_popen (__const__ char *, __const__ char *);
    235555int _putw (int, FILE *);
    236 int _setbuffer (FILE *, char *, size_t);
     556void _setbuffer (FILE *, char *, int);
    237557int _snprintf (char *, size_t, __const__ char *, ...);
    238558char *_tempnam (__const__ char *, __const__ char *);
     
    240560
    241561#endif
    242 
    243 
    244 #if defined (__cplusplus)
    245 }
    246 #endif
    247 
    248 #endif /* not _STDIO_H */
     562/* bird: end of EMX isms. */
     563
     564__END_DECLS
     565#endif /* !_STDIO_H_ */
     566
  • trunk/src/emx/include/sys/_types.h

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r731 r732  
    5757typedef int             __nl_item;
    5858typedef __uint16_t      __nlink_t;      /* link count */
    59 #if 1 /* bird: emx */
     59#if 0 /* bird: emx */
    6060typedef __int32_t       __off_t;        /* file offset */
    6161#else
  • trunk/src/emx/include/sys/dir.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r731 r732  
    1 /* sys/dir.h (emx+gcc) */
     1/*
     2 * Copyright (c) 1982, 1986, 1989, 1993
     3 *      The Regents of the University of California.  All rights reserved.
     4 *
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 * 1. Redistributions of source code must retain the above copyright
     9 *    notice, this list of conditions and the following disclaimer.
     10 * 2. Redistributions in binary form must reproduce the above copyright
     11 *    notice, this list of conditions and the following disclaimer in the
     12 *    documentation and/or other materials provided with the distribution.
     13 * 3. All advertising materials mentioning features or use of this software
     14 *    must display the following acknowledgement:
     15 *      This product includes software developed by the University of
     16 *      California, Berkeley and its contributors.
     17 * 4. Neither the name of the University nor the names of its contributors
     18 *    may be used to endorse or promote products derived from this software
     19 *    without specific prior written permission.
     20 *
     21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31 * SUCH DAMAGE.
     32 *
     33 *      @(#)dir.h       8.2 (Berkeley) 1/4/94
     34 * $FreeBSD: src/sys/sys/dir.h,v 1.6 1999/08/28 00:51:39 peter Exp $
     35 */
    236
    3 #ifndef _SYS_DIR_H
    4 #define _SYS_DIR_H
     37/** @file
     38 * FreeBSD 5.1
     39 */
    540
    6 #if !defined (_SYS_TYPES_H)
    7 #warning <sys/dir.h> requires <sys/types.h>
    8 #include <sys/types.h>
     41#ifndef _SYS_DIR_H_
     42#define _SYS_DIR_H_
     43
     44#if __GNUC__
     45#warning "The information in this file should be obtained from <dirent.h>"
     46#warning "and is provided solely (and temporarily) for backward compatibility."
    947#endif
    1048
    11 #if defined (__cplusplus)
    12 extern "C" {
    13 #endif
     49#include <dirent.h>
    1450
    15 #if !defined (MAXNAMLEN)
    16 #define MAXNAMLEN  260
    17 #endif
     51/*
     52 * Backwards compatibility.
     53 */
     54#define direct          dirent
     55#define DIRSIZ(dp)      _GENERIC_DIRSIZ(dp)
    1856
    19 #if !defined (MAXPATHLEN)
    20 #define MAXPATHLEN 260
    21 #endif
    22 
    23 #if !defined (A_RONLY)
    24 #define A_RONLY   0x01
    25 #define A_HIDDEN  0x02
    26 #define A_SYSTEM  0x04
    27 #define A_LABEL   0x08
    28 #define A_DIR     0x10
    29 #define A_ARCHIVE 0x20
    30 #endif
    31 
    32 #define _DIRECT_D_MODE_RENAMED_D_ATTR
    33 
    34 struct direct
    35 {
    36   ino_t          d_ino;                 /* Almost not used           */
    37   int            d_reclen;              /* Almost not used           */
    38   int            d_namlen;              /* Length of d_name          */
    39   char           d_name[MAXNAMLEN + 1]; /* File name, 0 terminated   */
    40   long           d_size;                /* File size (bytes)         */
    41   unsigned short d_attr;                /* OS file attributes        */
    42   unsigned short d_time;                /* OS file modification time */
    43   unsigned short d_date;                /* OS file modification date */
    44 };
    45 
    46 struct _dircontents
    47 {
    48   char *                _d_entry;
    49   long                  _d_size;
    50   unsigned short        _d_attr;
    51   unsigned short        _d_time;
    52   unsigned short        _d_date;
    53   struct _dircontents * _d_next;
    54 };
    55 
    56 struct _dirdesc
    57 {
    58   int                   dd_id;
    59   long                  dd_loc;
    60   struct _dircontents * dd_contents;
    61   struct _dircontents * dd_cp;
    62 };
    63 
    64 typedef struct _dirdesc DIR;
    65 
    66 DIR *opendir (__const__ char *name);
    67 struct direct *readdir (DIR *dirp);
    68 void seekdir (DIR *dirp, long off);
    69 long telldir (DIR *dirp);
    70 int closedir (DIR *dirp);
    71 void rewinddir (DIR *dirp);
    72 
    73 #if defined (__cplusplus)
    74 }
    75 #endif
    76 
    77 #endif /* not SYS_DIR_H */
     57#endif /* !_SYS_DIR_H_ */
  • trunk/src/emx/include/sys/dirent.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r731 r732  
    1 /* sys/dirent.h (emx+gcc) */
     1/*-
     2 * Copyright (c) 1989, 1993
     3 *      The Regents of the University of California.  All rights reserved.
     4 *
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 * 1. Redistributions of source code must retain the above copyright
     9 *    notice, this list of conditions and the following disclaimer.
     10 * 2. Redistributions in binary form must reproduce the above copyright
     11 *    notice, this list of conditions and the following disclaimer in the
     12 *    documentation and/or other materials provided with the distribution.
     13 * 3. All advertising materials mentioning features or use of this software
     14 *    must display the following acknowledgement:
     15 *      This product includes software developed by the University of
     16 *      California, Berkeley and its contributors.
     17 * 4. Neither the name of the University nor the names of its contributors
     18 *    may be used to endorse or promote products derived from this software
     19 *    without specific prior written permission.
     20 *
     21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31 * SUCH DAMAGE.
     32 *
     33 *      @(#)dirent.h    8.3 (Berkeley) 8/10/94
     34 * $FreeBSD: src/sys/sys/dirent.h,v 1.13 2002/09/10 18:12:16 mike Exp $
     35 */
    236
    3 #ifndef _SYS_DIRENT_H
    4 #define _SYS_DIRENT_H
     37/** @file
     38 * FreeBSD 5.1
     39 * @changed bird: Merged in all the EMX stuff.
     40 */
    541
    6 #if !defined (_SYS_TYPES_H)
    7 #warning <sys/dirent.h> requires <sys/types.h>
    8 #include <sys/types.h>
     42#ifndef _SYS_DIRENT_H_
     43#define _SYS_DIRENT_H_
     44
     45#include <sys/cdefs.h>
     46#include <sys/_types.h>
     47
     48/*
     49 * The dirent structure defines the format of directory entries returned by
     50 * the getdirentries(2) system call.
     51 *
     52 * A directory entry has a struct dirent at the front of it, containing its
     53 * inode number, the length of the entry, and the length of the name
     54 * contained in the entry.  These are followed by the name padded to a 4
     55 * byte boundary with null bytes.  All names are guaranteed null terminated.
     56 * The maximum length of a name in a directory is MAXNAMLEN.
     57 */
     58
     59struct dirent {
     60        __uint32_t d_fileno;            /* file number of entry */
     61        __uint16_t d_reclen;            /* length of this record */
     62        __uint8_t  d_type;              /* file type, see below */
     63        __uint8_t  d_namlen;            /* length of string in d_name */
     64#if __BSD_VISIBLE
     65#ifndef MAXNAMLEN  /* bird: emx */
     66#define MAXNAMLEN       260 /* bird: changed from 255. */
     67#endif             /* bird: emx */
     68        char    d_name[MAXNAMLEN + 1];  /* name must be no longer than this */
     69#else
     70        char    d_name[260 + 1];        /* bird: changed from 255. */ /* name must be no longer than this */
     71#endif
     72/* bird: Extra EMX fields - start */
     73        __uint8_t  d_attr;              /* OS file attributes        */
     74        __uint16_t d_time;              /* OS file modification time */
     75        __uint16_t d_date;              /* OS file modification date */
     76        __off_t    d_size;              /* File size (bytes)         */
     77/* bird: Extra EMX fields - end */
     78};
     79
     80#if __BSD_VISIBLE
     81/*
     82 * File types
     83 */
     84#define DT_UNKNOWN       0
     85#define DT_FIFO          1
     86#define DT_CHR           2
     87#define DT_DIR           4
     88#define DT_BLK           6
     89#define DT_REG           8
     90#define DT_LNK          10
     91#define DT_SOCK         12
     92#define DT_WHT          14
     93
     94/*
     95 * Convert between stat structure types and directory types.
     96 */
     97#define IFTODT(mode)    (((mode) & 0170000) >> 12)
     98#define DTTOIF(dirtype) ((dirtype) << 12)
     99
     100/*
     101 * The _GENERIC_DIRSIZ macro gives the minimum record length which will hold
     102 * the directory entry.  This requires the amount of space in struct direct
     103 * without the d_name field, plus enough space for the name with a terminating
     104 * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
     105 *
     106 * XXX although this macro is in the implementation namespace, it requires
     107 * a manifest constant that is not.
     108 */
     109#define _GENERIC_DIRSIZ(dp) \
     110    ((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
     111#endif /* __BSD_VISIBLE */
     112
     113#ifdef _KERNEL
     114#define GENERIC_DIRSIZ(dp)      _GENERIC_DIRSIZ(dp)
    9115#endif
    10116
    11 #if !defined (MAXNAMLEN)
    12 #define MAXNAMLEN  260
    13 #endif
     117
     118/* bird: EMX stuff */
     119#define _DIRENT_D_MODE_RENAMED_D_ATTR
    14120
    15121#if !defined (MAXPATHLEN)
     
    26132#endif
    27133
    28 #define _DIRENT_D_MODE_RENAMED_D_ATTR
    29 
    30 struct dirent
    31 {
    32   ino_t          d_ino;                 /* Almost not used           */
    33   int            d_reclen;              /* Almost not used           */
    34   int            d_namlen;              /* Length of d_name          */
    35   char           d_name[MAXNAMLEN + 1]; /* File name, 0 terminated   */
    36   long           d_size;                /* File size (bytes)         */
    37   unsigned short d_attr;                /* OS file attributes        */
    38   unsigned short d_time;                /* OS file modification time */
    39   unsigned short d_date;                /* OS file modification date */
    40 };
    41 
    42134#endif /* not SYS_DIRENT_H */
  • trunk/src/emx/include/sys/dirtree.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r731 r732  
    44#define _SYS_DIRTREE_H
    55
    6 #if defined (__cplusplus)
    7 extern "C" {
     6#include <sys/cdefs.h>
     7#include <sys/_types.h>
     8
     9#if !defined(_TIME_T_DECLARED) && !defined(_TIME_T)
     10typedef __time_t        time_t;
     11#define _TIME_T_DECLARED
     12#define _TIME_T
    813#endif
    914
    10 #if !defined (_TIME_T)
    11 #define _TIME_T
    12 typedef unsigned long time_t;
     15#if !defined(_OFF_T_DECLARED) && !defined(_OFF_T)
     16typedef __off_t         off_t;          /* file offset */
     17#define _OFF_T_DECLARED
     18#define _OFF_T
    1319#endif
    1420
     
    1824  struct _dt_node *sub;    /* Pointer to next level (child) */
    1925  char *name;              /* Name */
    20   long size;               /* File size */
     26  off_t size;              /* File size */
    2127  long user;               /* Available for user */
    2228  time_t mtime;            /* Timestamp for last update */
    2329  unsigned char attr;      /* Attributes */
    2430};
    25 
    2631
    2732struct _dt_tree
     
    3439#define _DT_NOCPDIR  0x8000
    3540
    36 void _dt_free (struct _dt_tree *dt);
     41__BEGIN_DECLS
     42void    _dt_free (struct _dt_tree *dt);
    3743struct _dt_tree *_dt_read (__const__ char *dir, __const__ char *mask,
    3844    unsigned flags);
    39 void _dt_sort (struct _dt_tree *dt, __const__ char *spec);
    40 int _dt_split (__const__ char *src, char *dir, char *mask);
     45void    _dt_sort (struct _dt_tree *dt, __const__ char *spec);
     46int     _dt_split (__const__ char *src, char *dir, char *mask);
     47__END_DECLS
    4148
    42 #if defined (__cplusplus)
    43 }
    44 #endif
    45 
    46 #endif /* not _SYS_DIRTREE_H */
     49#endif /* !_SYS_DIRTREE_H */
Note: See TracChangeset for help on using the changeset viewer.