Changeset 1519 for trunk/src/emx/include


Ignore:
Timestamp:
Sep 27, 2004, 4:15:07 AM (21 years ago)
Author:
bird
Message:

Big path handling change. Fixed wrong file headers. A new api or two. A bit of restructuring. And hopefully no new bug :-)

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

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/InnoTekLIBC/backend.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r1518 r1519  
    3030#include <sys/cdefs.h>
    3131#include <sys/types.h>
     32#include <emx/io.h>
    3233
    3334__BEGIN_DECLS
     
    3839#endif
    3940struct statfs;
     41struct stat;
    4042
    4143
     
    8284
    8385
    84 /** @defgroup __libc_Back_fh   LIBC Backend - File Handles.
    85  * @{ */
     86/** @defgroup __libc_Back_fs   LIBC Backend - File System
     87 * @{ */
     88
     89/**
     90 * Get the statistics for the filesystem which pszPath is located on.
     91 *
     92 * @returns 0 on success.
     93 * @returns Negative error code (errno.h) on failure.
     94 * @param   pszPath     The path to somewhere in the filesystem.
     95 * @param   pStatFs     Where to store the obtained information.
     96 */
     97int __libc_Back_fsStat(const char *pszPath, struct statfs *pStatFs);
     98
     99/**
     100 * Get file system statistics
     101 *
     102 * @returns 0 on success.
     103 * @returns Negative error code (errno.h) on failure.
     104 * @param   fh          The filehandle of any file within the mounted file system.
     105 * @param   pStatFs     Where to store the statistics.
     106 */
     107int __libc_Back_fsStatFH(int fh, struct statfs *pStatFs);
     108
     109/**
     110 * Get the statistics for all the mounted filesystems.
     111 *
     112 * @returns Number of returned statfs structs on success.
     113 * @returns Number of mounted filesystems on success if paStatFS is NULL
     114 * @returns Negative error code (errno.h) on failure.
     115 * @param   paStatFs    Where to to store the statistics.
     116 * @param   cStatFS     Number of structures the array pointed to by paStatFs can hold.
     117 * @param   fFlags      Flags, currently ignored.
     118 */
     119int __libc_Back_fsStats(struct statfs *paStatFs, unsigned cStatFs, unsigned fFlags);
     120
     121/**
     122 * Schedules all file system buffers for writing.
     123 *
     124 * See sync() for OS/2 limitations.
     125 */
     126void __libc_Back_fsSync(void);
     127
     128/**
     129 * Resolves the path into an canonicalized absolute path.
     130 *
     131 * @returns 0 on success.
     132 * @returns Negative error code (errno.h) on failure.
     133 * @param   pszPath     The path to resolve.
     134 * @param   pszBuf      Where to store the resolved path.
     135 * @param   cchBuf      Size of the buffer.
     136 * @param   fFlags      At the moment 0. Which means the entire path must exist.
     137 */
     138int __libc_Back_fsPathResolve(const char *pszPath, char *pszBuf, size_t cchBuf, unsigned fFlags);
     139
     140/**
     141 * Changes the default drive of the process.
     142 *
     143 * @returns 0 on success.
     144 * @returns Negative error code (errno.h) on failure.
     145 * @param   chDrive     New default drive.
     146 */
     147int __libc_Back_fsDriveDefaultSet(char chDrive);
     148
     149/**
     150 * Gets the default drive of the process.
     151 *
     152 * @returns 0 on success.
     153 * @returns Negative error code (errno.h) on failure.
     154 * @param   pchDrive    Where to store the default drive.
     155 */
     156int __libc_Back_fsDriveDefaultGet(char *pchDrive);
     157
     158/**
     159 * Sets or change the unixroot of the current process.
     160 *
     161 * @returns 0 on success.
     162 * @returns Negative error code (errno.h) on failure.
     163 * @param   pszNewRoot  The new root.
     164 */
     165int __libc_Back_fsDirChangeRoot(const char *pszNewRoot);
     166
     167/**
     168 * Gets the current directory of the process on a
     169 * specific drive or on the current one.
     170 *
     171 * @returns 0 on success.
     172 * @returns Negative error code (errno.h) on failure.
     173 * @param   pszPath     Where to store the path to the current directory.
     174 *                      This will be prefixed with a drive letter if we're
     175 *                      not in the unix tree.
     176 * @param   cchPath     The size of the path buffer.
     177 * @param   chDrive     The drive letter of the drive to get it for.
     178 *                      If '\0' the current dir for the current drive is returned.
     179 * @param   fFlags      Flags for skipping drive letter and slash.
     180 */
     181int __libc_Back_fsDirCurrentGet(char *pszPath, size_t cchPath, char chDrive, int fFlags);
     182
     183/** Flags for __libc_Back_fsDirCurrentGet().
     184 * @{ */
     185#define __LIBC_BACK_FSCWD_NO_DRIVE          1
     186#define __LIBC_BACK_FSCWD_NO_ROOT_SLASH     2
     187/** @} */
     188
     189/**
     190 * Changes the current directory of the process.
     191 *
     192 * @returns 0 on success.
     193 * @returns Negative error code (errno.h) on failure.
     194 * @param   pszPath     Path to the new current directory of the process.
     195 */
     196int __libc_Back_fsDirCurrentSet(const char *pszPath);
     197
     198/**
     199 * Creates a new directory.
     200 *
     201 * @returns 0 on success.
     202 * @returns Negative error code (errno.h) on failure.
     203 * @param   pszPath     Path of the new directory.
     204 * @param   Mode        Permissions on the created directory.
     205 */
     206int __libc_Back_fsDirCreate(const char *pszPath, mode_t Mode);
     207
     208/**
     209 * Removes a new directory.
     210 *
     211 * @returns 0 on success.
     212 * @returns Negative error code (errno.h) on failure.
     213 * @param   pszPath     Path to the directory which is to be removed.
     214 */
     215int __libc_Back_fsDirRemove(const char *pszPath);
     216
     217/**
     218 * Creates a symbolic link.
     219 *
     220 * @returns 0 on success.
     221 * @returns Negative error code (errno.h) on failure.
     222 * @param   pszTarget   The target of the symlink link.
     223 * @param   pszSymlink  The path to the symbolic link to create.
     224 */
     225int __libc_Back_fsSymlinkCreate(const char *pszTarget, const char *pszSymlink);
     226
     227/**
     228 * Reads the content of a symbolic link.
     229 *
     230 * This is weird interface as it will return a truncated result if not
     231 * enough buffer space. It is also weird in that there is no string
     232 * terminator.
     233 *
     234 * @returns Number of bytes returned in pachBuf.
     235 * @returns Negative error code (errno.h) on failure.
     236 * @param   pszPath     The path to the symlink directory.
     237 * @param   pachBuf     Where to store the symlink value.
     238 * @param   cchBuf      Size of buffer.
     239 */
     240int __libc_Back_fsSymlinkRead(const char *pszPath, char *pachBuf, size_t cchBuf);
     241
     242/**
     243 * Stats a symbolic link.
     244 *
     245 * @returns 0 on success.
     246 * @returns Negative error code (errno.h) on failure.
     247 * @param   pszPath     Path to the file to stat. If this is a symbolic link
     248 *                      the link it self will be stat'ed.
     249 * @param   pStat       Where to store the file stats.
     250 */
     251int __libc_Back_fsSymlinkStat(const char *pszPath, struct stat *pStat);
     252
     253/**
     254 * Stats a file.
     255 *
     256 * @returns 0 on success.
     257 * @returns Negative error code (errno.h) on failure.
     258 * @param   pszPath     Path to the file to stat.
     259 * @param   pStat       Where to store the file stats.
     260 */
     261int __libc_Back_fsFileStat(const char *pszPath, struct stat *pStat);
     262
     263/**
     264 * Gets the file stats for a file by filehandle.
     265 *
     266 * @returns 0 on success.
     267 * @returns Negative error code (errno.h) on failure. The content
     268 *          of *pStat is undefined.
     269 * @param   fh      Handle to file.
     270 * @param   pStat   Where to store the stats.
     271 */
     272int __libc_Back_fsFileStatFH(int fh, struct stat *pStat);
     273
     274
     275/** @defgroup __libc_Back_io   LIBC Backend - I/O and File Management.
     276 * @{ */
     277
     278/**
     279 * Opens a file.
     280 *
     281 * @returns Filehandle to the opened file on success.
     282 * @returns Negative error code (errno.h) on failure.
     283 * @param   pszFile     Path to the file.
     284 * @param   fFlags      Open flags.
     285 * @param   cbInitial   Initial filesize.
     286 * @param   Mode        The specified permission mask.
     287 * @param   fLibc       LIBC filehandle flags.
     288 * @param   ppFH        Where to store the LIBC filehandle structure which was created
     289 *                      for the opened file.
     290 */
     291int __libc_Back_ioFileOpen(const char *pszFile, int fFlags, off_t cbInitial, mode_t Mode, unsigned fLibc, PLIBCFH *ppFH);
     292
     293/**
     294 * Change the current position of a file stream and get the new position.
     295 *
     296 * @returns new file offset on success.
     297 * @returns Negative error code (errno) on failure.
     298 * @param   hFile       File handle to preform seek operation on.
     299 * @param   off         Offset to seek to.
     300 * @param   iMethod     The seek method. SEEK_CUR, SEEK_SET or SEEK_END.
     301 */
     302off_t __libc_Back_ioSeek(int hFile, off_t off, int iMethod);
     303
     304/**
     305 * Sets the size of an open file.
     306 *
     307 * When expanding a file the contents of the allocated
     308 * space is undefined.
     309 *
     310 * @returns 0 on success.
     311 * @returns Negative error code (errno.h) on failure.
     312 * @param   fh      Handle to the file which size should be changed.
     313 * @param   cbFile  The new filesize.
     314 * @param   fZero   If set any new allocated file space will be
     315 *                  initialized to zero.
     316 */
     317int __libc_Back_ioFileSizeSet(int fh, __off_t cbFile, int fZero);
    86318
    87319/**
     
    89321 *
    90322 * @returns 0 on success.
    91  * @returns -1 and errno on failure.
     323 * @returns Negative error code (errno.h) on failure.
    92324 * @param   fh          The file handle.
    93325 * @param   pszPath     Where to store the path.
    94326 * @param   cchPath     The size of he buffer pointed to by pszPath.
    95327 */
    96 int __libc_Back_fhToPath(int fh, char *pszPath, size_t cchPath);
    97 
    98 /** @} */
    99 
    100 
    101 /** @defgroup __libc_Back_fs   LIBC Backend - File System
    102  * @{ */
    103 
    104 /**
    105  * Get the statistics for the filesystem which pszPath is located on.
    106  *
    107  * @returns 0 on success.
    108  * @returns -1 and errno on failure.
    109  * @param   pszPath     The path to somewhere in the filesystem.
    110  * @param   pStatFs     Where to store the obtained information.
    111  */
    112 int __libc_Back_fsStat(const char *pszPath, struct statfs *pStatFs);
    113 
    114 /**
    115  * Get file system statistics
    116  *
    117  * @returns 0 on success.
    118  * @returns -1 and errno on failure.
    119  * @param   fh          The filehandle of any file within the mounted file system.
    120  * @param   pStatFs     Where to store the statistics.
    121  */
    122 int __libc_Back_fsStatFH(int fh, struct statfs *pStatFs);
    123 
    124 /**
    125  * Get the statistics for all the mounted filesystems.
    126  *
    127  * @returns Number of returned statfs structs on success.
    128  * @returns Number of mounted filesystems on success if paStatFS is NULL
    129  * @returns -1 and errno on failure.
    130  * @param   paStatFs    Where to to store the statistics.
    131  * @param   cStatFS     Number of structures the array pointed to by paStatFs can hold.
    132  * @param   fFlags      Flags, currently ignored.
    133  */
    134 int __libc_Back_fsStats(struct statfs *paStatFs, unsigned cStatFs, unsigned fFlags);
    135 
    136 /**
    137  * Schedules all file system buffers for writing.
    138  *
    139  * See sync() for OS/2 limitations.
    140  */
    141 void __libc_Back_fsSync(void);
    142 
    143 /**
    144  * Sets or change the unixroot of the current process.
    145  *
    146  * @returns 0 on success.
    147  * @returns -1 and errno on failure.
    148  * @param   pszNewRoot  The new root.
    149  */
    150 int __libc_Back_fsChRoot(const char *pszNewRoot);
     328int __libc_Back_ioFHToPath(int fh, char *pszPath, size_t cchPath);
     329
     330/** @} */
    151331
    152332/** @} */
     
    163343 *
    164344 * @returns 0 on success.
    165  * @returns -1 and errno on failure.
     345 * @returns Negative error code (errno.h) on failure.
    166346 * @param   pardAvgs    Where to store the samples.
    167347 * @param   cAvgs       Number of samples to get. Max is 3.
  • trunk/src/emx/include/InnoTekLIBC/logstrict.h

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r1518 r1519  
    182182#define __LIBC_LOG_GRP_ENV          15
    183183
     184/** Backend FS APIs. */
     185#define __LIBC_LOG_GRP_BACK_FS      23
    184186/** Shared Process Database and LIBC Shared Memory APIs. */
    185187#define __LIBC_LOG_GRP_SPM          24
  • trunk/src/emx/include/InnoTekLIBC/sharedpm.h

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r1518 r1519  
    178178typedef __LIBC_SPMINHFHBSOCK *__LIBC_PSPMINHFHBSOCK;
    179179
     180/**
     181 * SPM fs inherit data.
     182 */
     183typedef struct __libc_SPMInhFS
     184{
     185    /** In Unix Tree global. */
     186    int         fInUnixTree;
     187    /** Size of the unix root. Only set if there's an official root. */
     188    size_t      cchUnixRoot;
     189    /** The current unix root if cchUnixRoot is non-zero. */
     190    char        szUnixRoot[1];
     191} __LIBC_SPMINHFS;
     192/** Pointer to FS inherit data. */
     193typedef __LIBC_SPMINHFS *__LIBC_PSPMINHFS;
     194
     195
    180196
    181197/**
     
    191207     * This is a succession of bundles terminating with a _END one. */
    192208    __LIBC_PSPMINHFHBHDR    pFHBundles;
     209    /** Pointer to the file system part. If NULL default values are assumed. */
     210    __LIBC_PSPMINHFS        pFS;
    193211
    194212    /** @todo Add signals and the other properties which are inherited. */
     
    559577 *
    560578 * @returns 0 on success.
    561  * @returns -1 and errno on failure.
     579 * @returns Negative error code (errno.h) on failure.
    562580 * @param   pLoadAvg    Where to store the load average samples.
    563581 * @param   puTimestamp Where to store the current timestamp.
     
    569587 *
    570588 * @returns 0 on success.
    571  * @returns -1 and errno on failure.
     589 * @returns Negative error code (errno.h) on failure.
    572590 * @param   pLoadAvg    Where to store the load average samples.
    573591 */
  • trunk/src/emx/include/direct.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1518 r1519  
    5959char _getdrive(void);
    6060
     61/* Special LIBC addition. */
     62#ifdef __BSD_VISIBLE
     63char *_getcwdux(char *, size_t);
     64#endif
     65
    6166__END_DECLS
    6267
  • trunk/src/emx/include/emx/io.h

    • Property cvs2svn:cvs-rev changed from 1.10 to 1.11
    r1518 r1519  
    384384int     __libc_FHClose(int fh);
    385385PLIBCFH __libc_FH(int fh);
     386int     __libc_FHEx(int fh, __LIBC_PFH *ppFH);
    386387
    387388
  • trunk/src/emx/include/emx/syscalls.h

    • Property cvs2svn:cvs-rev changed from 1.10 to 1.11
    r1518 r1519  
    120120
    121121
    122 int __accept (int handle, struct sockaddr *addr, int *paddrlen);
     122//dead int __accept (int handle, struct sockaddr *addr, int *paddrlen);
    123123unsigned __alarm (unsigned sec);
    124 int __bind (int handle, __const__ struct sockaddr *addr, int addrlen);
     124//dead int __bind (int handle, __const__ struct sockaddr *addr, int addrlen);
    125125void *__brk (void *addr);
    126126void __cgets (char *buffer);
    127 int __chdir (__const__ char *name);
     127//dead int __chdir (__const__ char *name);
    128128int __chmod (__const__ char *name, int flag, int attr);
    129129int __chdrive (char drive);
    130 int __chsize (int handle, off_t length);
     130//dead int __chsize (int handle, off_t length);
    131131long long __clock (void);
    132132int __close (int handle);
    133 int __connect (int handle, __const__ struct sockaddr *addr, int addrlen);
     133//dead int __connect (int handle, __const__ struct sockaddr *addr, int addrlen);
    134134int __core (int handle);
    135135int __dup (int handle);
     
    142142int __findfirst (__const__ char *name, int attr, struct _find *fp);
    143143int __findnext (struct _find *fp);
    144 int __fork (void);
    145 int __fstat (int handle, struct stat *buffer);
     144//dead int __fork (void);
     145//dead int __fstat (int handle, struct stat *buffer);
    146146int __fsync (int handle);
    147147void __ftime (struct timeb *ptr);
    148 int __ftruncate (int handle, off_t length);
    149 int __getcwd (char *buffer, char drive);
     148//dead int __ftruncate (int handle, off_t length);
     149//dead int __getcwd (char *buffer, char drive);
    150150char __getdrive (void);
    151 int __gethostbyaddr (__const__ char *addr, int len, int type,
    152     struct hostent **dst);
    153 int __gethostbyname (__const__ char *name, struct hostent **dst);
    154 int __gethostid (int *dst);
    155 int __gethostname (char *name, int len);
    156 int __getnetbyname (__const__ char *name, struct netent **dst);
    157 int __getnetbyaddr (long net, struct netent **dst);
    158 int __getpeername (int handle, struct sockaddr *name, int *pnamelen);
     151//dead int __gethostbyaddr (__const__ char *addr, int len, int type,
     152//dead     struct hostent **dst);
     153//dead int __gethostbyname (__const__ char *name, struct hostent **dst);
     154//dead int __gethostid (int *dst);
     155//dead int __gethostname (char *name, int len);
     156//dead int __getnetbyname (__const__ char *name, struct netent **dst);
     157//dead int __getnetbyaddr (long net, struct netent **dst);
     158//dead int __getpeername (int handle, struct sockaddr *name, int *pnamelen);
    159159int __getpid (void);
    160160int __getppid (void);
    161 int __getprotobyname (__const__ char *name, struct protoent **dst);
    162 int __getprotobynumber (int prot, struct protoent **dst);
    163 int __getservbyname (__const__ char *name, __const__ char *proto,
    164     struct servent **dst);
    165 int __getservbyport (int port, __const__ char *proto, struct servent **dst);
    166 int __getsockhandle (int handle);
    167 int __getsockname (int handle, struct sockaddr *name, int *pnamelen);
    168 int __getsockopt (int handle, int level, int optname, void *optval,
    169     int *poptlen);
    170 int __imphandle (int handle);
    171 int __impsockhandle (int handle, int flags);
     161//dead int __getprotobyname (__const__ char *name, struct protoent **dst);
     162//dead int __getprotobynumber (int prot, struct protoent **dst);
     163//dead int __getservbyname (__const__ char *name, __const__ char *proto,
     164//dead     struct servent **dst);
     165//dead int __getservbyport (int port, __const__ char *proto, struct servent **dst);
     166//dead int __getsockhandle (int handle);
     167//dead int __getsockname (int handle, struct sockaddr *name, int *pnamelen);
     168//dead int __getsockopt (int handle, int level, int optname, void *optval,
     169//dead     int *poptlen);
     170//dead int __imphandle (int handle);
     171//dead int __impsockhandle (int handle, int flags);
    172172int __ioctl1 (int handle, int code);
    173173int __ioctl2 (int handle, unsigned long request, int arg);
    174174int __kill (int pid, int sig);
    175175int __listen (int handle, int backlog);
    176 off_t __lseek (int handle, off_t offset, int origin);
     176//dead off_t __lseek (int handle, off_t offset, int origin);
    177177int __memavail (void);
    178 int __mkdir (__const__ char *name);
     178//dead int __mkdir (__const__ char *name);
    179179int __newthread (int tid);
    180180struct __libc_FileHandle;
    181 int __open (__const__ char *name, int flags, off_t size, unsigned fLibc, struct __libc_FileHandle **pFH);
     181//dead int __open (__const__ char *name, int flags, off_t size, mode_t cmode, unsigned fLibc, struct __libc_FileHandle **pFH);
    182182int __pause (void);
    183183int __pipe(int *two_handles, int pipe_size, struct __libc_FileHandle **ppFHRead, struct __libc_FileHandle **ppFHWrite);
     
    191191int __remove (__const__ char *name);
    192192int __rename (__const__ char *old_name, __const__ char *new_name);
    193 int __rmdir (__const__ char *name);
     193//dead int __rmdir (__const__ char *name);
    194194void *__sbrk (int incr);
    195195void __scrsize (int *dst);
    196 int __select(int nfds, struct fd_set *readfds, struct fd_set *writefds,
    197              struct fd_set *exceptfds, struct timeval *tv);
    198 int __send (int handle, __const__ void *buf, int len, unsigned flags);
    199 int __sendto (__const__ struct _sendto *args);
    200 int __setsockopt (int handle, int level, int optname, __const__ void *optval,
    201     int optlen);
     196//dead int __select(int nfds, struct fd_set *readfds, struct fd_set *writefds,
     197//dead              struct fd_set *exceptfds, struct timeval *tv);
     198//dead int __send (int handle, __const__ void *buf, int len, unsigned flags);
     199//dead int __sendto (__const__ struct _sendto *args);
     200//dead int __setsockopt (int handle, int level, int optname, __const__ void *optval,
     201//dead     int optlen);
    202202int __settime (const struct timeval *tp);
    203 int __shutdown (int handle, int how);
     203//dead int __shutdown (int handle, int how);
    204204int __sigaction (int _sig, __const__ struct sigaction *_iact,
    205205    struct sigaction *_oact);
     
    210210unsigned __sleep (unsigned sec);
    211211unsigned __sleep2 (unsigned millisec);
    212 int __socket (int domain, int type, int protocol);
     212//dead int __socket (int domain, int type, int protocol);
    213213int __spawnve (struct _new_proc *np);
    214 int __stat (__const__ char *name, struct stat *buffer);
     214//dead int __stat (__const__ char *name, struct stat *buffer);
    215215int __swchar (int flag, int new_char);
    216216int __uflags (int mask, int new_flags);
    217217long __ulimit (int cmd, long new_limit);
    218 int __umask (int pmode);
     218//dead int __umask (int pmode);
    219219void __unwind2 (void *xcpt_reg_ptr);
    220220int __utimes (__const__ char *name, __const__ struct timeval *tvp);
  • trunk/src/emx/include/io.h

    • Property cvs2svn:cvs-rev changed from 1.10 to 1.11
    r1518 r1519  
    8585int      truncate(const char *, off_t);
    8686#endif
    87 int umask (int);
     87mode_t  umask(mode_t);
    8888int unlink (__const__ char *);
    8989int write (int, __const__ void *, size_t);
  • trunk/src/emx/include/stdlib.h

    • Property cvs2svn:cvs-rev changed from 1.24 to 1.25
    r1518 r1519  
    287287#endif /* __BSD_VISIBLE */
    288288
     289
     290
     291/* bird: LIBC stuff - start  */
     292#ifdef __BSD_VISIBLE
     293char    *_getcwdux(char *, size_t);
     294#endif
     295#ifdef  __USE_GNU
     296char    *canonicalize_file_name(const char *);
     297#endif
     298/* bird: LIBC stuff - end  */
    289299
    290300
  • trunk/src/emx/include/unistd.h

    • Property cvs2svn:cvs-rev changed from 1.19 to 1.20
    r1518 r1519  
    408408
    409409
    410 #if !defined(_POSIX_SOURCE)
    411 
    412 
    413 #endif
    414 
    415 
     410/*
     411 * LIBC additions.
     412 */
     413#ifdef __BSD_VISIBLE
     414char    *_getcwdux(char *, size_t);
     415#endif
     416
     417
     418/*
     419 * EMX stuff.
     420 */
    416421#if !defined(_POSIX_SOURCE) || defined(_WITH_UNDERSCORE)
    417422/** @todo update this section to match the one without underscores as far as needed! */
Note: See TracChangeset for help on using the changeset viewer.