gonzui


Format: Advanced Search

t2ex/t2ex_source/lib/libc/src/stdio/stdio_fs.cbare sourcepermlink (0.02 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T2EX Software Package
    4:  *
    5:  *    Copyright 2012 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2012/12/12.
   10:  *    Modified by T-Engine Forum at 2014/07/08.
   11:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/04.
   12:  *
   13:  *----------------------------------------------------------------------
   14:  */
   15: /*
   16:  * This software package is available for use, modification, 
   17:  * and redistribution in accordance with the terms of the attached 
   18:  * T-License 2.x.
   19:  * If you want to redistribute the source code, you need to attach 
   20:  * the T-License 2.x document.
   21:  * There's no obligation to publish the content, and no obligation 
   22:  * to disclose it to the TRON Forum if you have modified the 
   23:  * software package.
   24:  * You can also distribute the modified source code. In this case, 
   25:  * please register the modification to T-Kernel traceability service.
   26:  * People can know the history of modifications by the service, 
   27:  * and can be sure that the version you have inherited some 
   28:  * modification of a particular version or not.
   29:  *
   30:  *    http://trace.tron.org/tk/?lang=en
   31:  *    http://trace.tron.org/tk/?lang=ja
   32:  *
   33:  * As per the provisions of the T-License 2.x, TRON Forum ensures that 
   34:  * the portion of the software that is copyrighted by Ken Sakamura or 
   35:  * the TRON Forum does not infringe the copyrights of a third party.
   36:  * However, it does not make any warranty other than this.
   37:  * DISCLAIMER: TRON Forum and Ken Sakamura shall not be held
   38:  * responsible for any consequences or damages caused directly or
   39:  * indirectly by the use of this software package.
   40:  *
   41:  * The source codes in bsd_source.tar.gz in this software package are 
   42:  * derived from NetBSD or OpenBSD and not covered under T-License 2.x.
   43:  * They need to be changed or redistributed according to the 
   44:  * representation of each source header.
   45:  */
   46: 
   47: /*
   48:  *      @(#)stdio_fs.c
   49:  *
   50:  */
   51: 
   52: #include <basic.h>
   53: #include <t2ex/fs.h>
   54: 
   55: struct __libc_stat {
   56:         unsigned int   st_mode;
   57:         unsigned int   st_blksize;
   58:         off64_t        st_size;
   59: };
   60: 
   61: #ifndef _T2EX
   62: EXPORT  int      __libc_open( const char *path, int oflags, mode_t mode )
   63: {
   64:         return fs_open( path, oflags, mode );
   65: }
   66: #endif
   67: 
   68: EXPORT  int      __libc_close( int fd )
   69: {
   70:         return fs_close( fd );
   71: }
   72: 
   73: EXPORT  int      __libc_read( int fd, void *buf, size_t count )
   74: {
   75:         return fs_read( fd, buf, count );
   76: }
   77: 
   78: EXPORT  int      __libc_write( int fd, const void *buf, size_t count )
   79: {
   80:         return fs_write( fd, buf, count );
   81: }
   82: 
   83: EXPORT  off64_t  __libc_lseek( int fd, off64_t offset64, int whence )
   84: {
   85:         return fs_lseek64( fd, offset64, whence );
   86: }
   87: 
   88: #ifndef _T2EX
   89: EXPORT  ER       __libc_fcntl(int fd, int cmd, int arg)
   90: {
   91:         return fs_fcntl( fd, cmd, arg );
   92: }
   93: #endif
   94: 
   95: EXPORT  int      __libc_fstat( int fd, struct __libc_stat *buf  )
   96: {
   97:         int    r;
   98:         struct stat64  s;
   99: 
  100:         r = fs_fstat64( fd, &s );
  101:         if (r < 0) return -1;
  102: 
  103:         buf->st_mode = s.st_mode;
  104:         buf->st_size = s.st_size;
  105:         buf->st_blksize = s.st_blksize;
  106: 
  107:         return 0;
  108: }
  109: