kern_descrip.h

Go to the documentation of this file.
00001 /*****************************************************************************************
00002  Copyright (c) 2002-2004 The UbixOS Project
00003  All rights reserved.
00004 
00005  Redistribution and use in source and binary forms, with or without modification, are
00006  permitted provided that the following conditions are met:
00007 
00008  Redistributions of source code must retain the above copyright notice, this list of
00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
00010  form must reproduce the above copyright notice, this list of conditions, the following
00011  disclaimer and the list of authors in the documentation and/or other materials provided
00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
00013  contributors may be used to endorse or promote products derived from this software
00014  without specific prior written permission.
00015 
00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 
00026  $Id$
00027 
00028 *****************************************************************************************/
00029 
00030 #ifndef _KERN_DESCRIP_H
00031 #define _KERN_DESCRIP_H
00032 
00033 #include <sys/thread.h>
00034 #include <sys/sysproto.h>
00035 
00036 typedef  __mode_t        mode_t;
00037 typedef  __nlink_t       nlink_t;
00038 
00039 /* command values */
00040 #define F_DUPFD         0               /* duplicate file descriptor */
00041 #define F_GETFD         1               /* get file descriptor flags */
00042 #define F_SETFD         2               /* set file descriptor flags */
00043 #define F_GETFL         3               /* get file status flags */
00044 #define F_SETFL         4               /* set file status flags */
00045 #define F_GETOWN        5               /* get SIGIO/SIGURG proc/pgrp */
00046 #define F_SETOWN        6               /* set SIGIO/SIGURG proc/pgrp */
00047 #define F_GETLK         7               /* get record locking information */
00048 #define F_SETLK         8               /* set record locking information */
00049 #define F_SETLKW        9               /* F_SETLK; wait if blocked */
00050 
00051 /* Flag Values */
00052 #define FREAD           0x0001
00053 #define FWRITE          0x0002
00054 #define O_NONBLOCK      0x0004          /* no delay */
00055 #define O_APPEND        0x0008          /* set append mode */
00056 #define O_SHLOCK        0x0010          /* open with shared file lock */
00057 #define O_EXLOCK        0x0020          /* open with exclusive file lock */
00058 #define O_ASYNC         0x0040          /* signal pgrp when data ready */
00059 #define O_FSYNC         0x0080          /* synchronous writes */
00060 #define O_SYNC          0x0080          /* POSIX synonym for O_FSYNC */
00061 #define O_NOFOLLOW      0x0100          /* don't follow symlinks */
00062 #define O_CREAT         0x0200          /* create if nonexistent */
00063 #define O_TRUNC         0x0400          /* truncate to zero length */
00064 #define O_EXCL          0x0800          /* error if already exists */
00065 #define O_DIRECT        0x00010000
00066 #define O_RDONLY        0x0000          /* open for reading only */
00067 #define O_WRONLY        0x0001          /* open for writing only */
00068 #define O_RDWR          0x0002          /* open for reading and writing */
00069 #define O_ACCMODE       0x0003          /* mask for above modes */
00070 
00071 
00072 #define FHASLOCK        0x4000          /* descriptor holds advisory lock */
00073 
00074 
00075 /* F MAPPERS */
00076 #define FAPPEND         O_APPEND        /* kernel/compat */
00077 #define FASYNC          O_ASYNC         /* kernel/compat */
00078 #define FFSYNC          O_FSYNC         /* kernel */
00079 #define FNONBLOCK       O_NONBLOCK      /* kernel */
00080 #define FNDELAY         O_NONBLOCK      /* compat */
00081 #define O_NDELAY        O_NONBLOCK      /* compat */
00082 #define FPOSIXSHM       O_NOFOLLOW
00083 
00084 
00085 
00086 #define FCNTLFLAGS      (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|O_DIRECT)
00087 
00088 #define FFLAGS(oflags)  ((oflags) + 1)
00089 #define OFLAGS(fflags)  ((fflags) - 1)
00090 
00091 struct file {
00092   int f_flag;
00093   };
00094 
00095 /* TEMP */
00096 struct __timespec {
00097         __time_t tv_sec;        /* seconds */
00098         long    tv_nsec;        /* and nanoseconds */
00099 };
00100 
00101 struct stat {
00102         __dev_t   st_dev;               /* inode's device */
00103         ino_t     st_ino;               /* inode's number */
00104         mode_t    st_mode;              /* inode protection mode */
00105         nlink_t   st_nlink;             /* number of hard links */
00106         uid_t     st_uid;               /* user ID of the file's owner */
00107         gid_t     st_gid;               /* group ID of the file's group */
00108         __dev_t   st_rdev;              /* device type */
00109 #if __BSD_VISIBLE
00110         struct  timespec st_atimespec;  /* time of last access */
00111         struct  timespec st_mtimespec;  /* time of last data modification */
00112         struct  timespec st_ctimespec;  /* time of last file status change */
00113 #else
00114         time_t    st_atime;             /* time of last access */
00115         long      __st_atimensec;       /* nsec of last access */
00116         time_t    st_mtime;             /* time of last data modification */
00117         long      __st_mtimensec;       /* nsec of last data modification */
00118         time_t    st_ctime;             /* time of last file status change */
00119         long      __st_ctimensec;       /* nsec of last file status change */
00120 #endif
00121         off_t     st_size;              /* file size, in bytes */
00122         blkcnt_t st_blocks;             /* blocks allocated for file */
00123         blksize_t st_blksize;           /* optimal blocksize for I/O */
00124         fflags_t  st_flags;             /* user defined flags for file */
00125         __uint32_t st_gen;              /* file generation number */
00126         __int32_t st_lspare;
00127 #if __BSD_VISIBLE
00128         struct timespec st_birthtimespec; /* time of file creation */
00129         /*
00130          * Explicitly pad st_birthtimespec to 16 bytes so that the size of
00131          * struct stat is backwards compatible.  We use bitfields instead
00132          * of an array of chars so that this doesn't require a C99 compiler
00133          * to compile if the size of the padding is 0.  We use 2 bitfields
00134          * to cover up to 64 bits on 32-bit machines.  We assume that
00135          * CHAR_BIT is 8...
00136          */
00137         unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
00138         unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
00139 #else
00140         time_t    st_birthtime;         /* time of file creation */
00141         long      st_birthtimensec;     /* nsec of file creation */
00142         unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec));
00143         unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec));
00144 #endif
00145 };
00146 
00147 
00148 int fcntl(struct thread *, struct fcntl_args *);
00149 int close(struct thread *,struct close_args *);
00150 int falloc(struct thread *, struct file **, int *);
00151 int getdtablesize(struct thread *, struct getdtablesize_args *);
00152 int fstat(struct thread *, struct fstat_args *);
00153 int ioctl(struct thread *, struct ioctl_args *);
00154 
00155 
00156 #endif
00157 
00158 /***
00159  END
00160  ***/
00161 

Generated on Tue Dec 5 23:34:57 2006 for UbixOS V2 by  doxygen 1.4.7