kern_descrip.h
sys/thread.h
sys/sysproto.h
vfs/file.h
src/sys/kernel/gen_calls.c
src/sys/kernel/kern_descrip.c
src/sys/kernel/pipe.c
src/sys/kernel/sched.c
src/sys/vfs/vfs.c
sys/thread.h
ubixos/types.h
sys/_types.h
vfs/file.h
vfs/mount.h
src/sys/include/sys/kern_descrip.h
ubixfs/dirCache.h
sys/sysproto.h
sys/signal.h
src/sys/kernel/pipe.c
src/sys/kernel/sched.c
src/sys/include/sys/kern_descrip.h
src/sys/kernel/kern_descrip.c
src/sys/kernel/gen_calls.c
src/sys/vfs/vfs.c
__timespec
file
stat
F_DUPFD
0
F_GETFD
1
F_GETFL
3
F_GETLK
7
F_GETOWN
5
F_SETFD
2
F_SETFL
4
F_SETLK
8
F_SETLKW
9
F_SETOWN
6
FAPPEND
O_APPEND
FASYNC
O_ASYNC
FCNTLFLAGS
(FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|O_DIRECT)
fcntl
FFLAGS
oflags
((oflags) + 1)
fcntl
FFSYNC
O_FSYNC
FHASLOCK
0x4000
FNDELAY
O_NONBLOCK
FNONBLOCK
O_NONBLOCK
FPOSIXSHM
O_NOFOLLOW
FREAD
0x0001
pipe
FWRITE
0x0002
pipe
O_ACCMODE
0x0003
fcntl
O_APPEND
0x0008
O_ASYNC
0x0040
O_CREAT
0x0200
O_DIRECT
0x00010000
O_EXCL
0x0800
O_EXLOCK
0x0020
O_FSYNC
0x0080
O_NDELAY
O_NONBLOCK
O_NOFOLLOW
0x0100
O_NONBLOCK
0x0004
O_RDONLY
0x0000
O_RDWR
0x0002
O_SHLOCK
0x0010
O_SYNC
0x0080
O_TRUNC
0x0400
O_WRONLY
0x0001
OFLAGS
fflags
((fflags) - 1)
__mode_t typedef __mode_t mode_t mode_t
__nlink_t typedef __nlink_t nlink_t nlink_t
int int close (struct thread *, struct close_args *) close struct thread * struct close_args *
int int falloc (struct thread *, struct file **, int *) falloc struct thread * struct file ** int * kmalloc kprintf thread::o_files pipe sys_open
int int fcntl (struct thread *, struct fcntl_args *) fcntl struct thread * struct fcntl_args *
int int fstat (struct thread *, struct fstat_args *) fstat struct thread * struct fstat_args *
int int getdtablesize (struct thread *, struct getdtablesize_args *) getdtablesize struct thread * struct getdtablesize_args *

return data table size

int int getfd (struct thread *td, struct file **fp, int fd) getfd struct thread * td struct file ** fp int fd

get pointer to file fd in specified thread

returns fp

kprintf
thread::o_files
read
int int ioctl (struct thread *, struct ioctl_args *) ioctl struct thread * td struct ioctl_args * uap

ioctl functionality not implimented yet

NULL for now

    /*****************************************************************************************
    Copyright(c)2002-2004TheUbixOSProject
    Allrightsreserved.

    Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are
    permittedprovidedthatthefollowingconditionsaremet:

    Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof
    conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary
    formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing
    disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided
    withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits
    contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware
    withoutspecificpriorwrittenpermission.

    THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY
    EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF
    MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL
    THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,
    SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT
    OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)
    HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR
    TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS
    SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE.

    $Id: kern__descrip_8h.xml 88 2016-01-12 00:11:29Z reddawg $

    *****************************************************************************************/

    #ifndef_KERN_DESCRIP_H
    #define_KERN_DESCRIP_H

    #include<sys/thread.h>
    #include<sys/sysproto.h>

    #include<vfs/file.h>

    typedef__mode_tmode_t;
    typedef__nlink_tnlink_t;

    /*commandvalues*/
    #defineF_DUPFD0/*duplicatefiledescriptor*/
    #defineF_GETFD1/*getfiledescriptorflags*/
    #defineF_SETFD2/*setfiledescriptorflags*/
    #defineF_GETFL3/*getfilestatusflags*/
    #defineF_SETFL4/*setfilestatusflags*/
    #defineF_GETOWN5/*getSIGIO/SIGURGproc/pgrp*/
    #defineF_SETOWN6/*setSIGIO/SIGURGproc/pgrp*/
    #defineF_GETLK7/*getrecordlockinginformation*/
    #defineF_SETLK8/*setrecordlockinginformation*/
    #defineF_SETLKW9/*F_SETLK;waitifblocked*/

    /*FlagValues*/
    #defineFREAD0x0001
    #defineFWRITE0x0002
    #defineO_NONBLOCK0x0004/*nodelay*/
    #defineO_APPEND0x0008/*setappendmode*/
    #defineO_SHLOCK0x0010/*openwithsharedfilelock*/
    #defineO_EXLOCK0x0020/*openwithexclusivefilelock*/
    #defineO_ASYNC0x0040/*signalpgrpwhendataready*/
    #defineO_FSYNC0x0080/*synchronouswrites*/
    #defineO_SYNC0x0080/*POSIXsynonymforO_FSYNC*/
    #defineO_NOFOLLOW0x0100/*don'tfollowsymlinks*/
    #defineO_CREAT0x0200/*createifnonexistent*/
    #defineO_TRUNC0x0400/*truncatetozerolength*/
    #defineO_EXCL0x0800/*errorifalreadyexists*/
    #defineO_DIRECT0x00010000
    #defineO_RDONLY0x0000/*openforreadingonly*/
    #defineO_WRONLY0x0001/*openforwritingonly*/
    #defineO_RDWR0x0002/*openforreadingandwriting*/
    #defineO_ACCMODE0x0003/*maskforabovemodes*/

    #defineFHASLOCK0x4000/*descriptorholdsadvisorylock*/

    /*FMAPPERS*/
    #defineFAPPENDO_APPEND/*kernel/compat*/
    #defineFASYNCO_ASYNC/*kernel/compat*/
    #defineFFSYNCO_FSYNC/*kernel*/
    #defineFNONBLOCKO_NONBLOCK/*kernel*/
    #defineFNDELAYO_NONBLOCK/*compat*/
    #defineO_NDELAYO_NONBLOCK/*compat*/
    #defineFPOSIXSHMO_NOFOLLOW

    #defineFCNTLFLAGS(FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|O_DIRECT)

    #defineFFLAGS(oflags)((oflags)+1)
    #defineOFLAGS(fflags)((fflags)-1)

    structfile{
    intf_flag;
    charpath[1024];
    fileDescriptor*fd;
    };

    /*TEMP*/
    struct__timespec{
    __time_ttv_sec;/*seconds*/
    longtv_nsec;/*andnanoseconds*/
    };

    structstat{
    __dev_tst_dev;/*inode'sdevice*/
    ino_tst_ino;/*inode'snumber*/
    mode_tst_mode;/*inodeprotectionmode*/
    nlink_tst_nlink;/*numberofhardlinks*/
    uid_tst_uid;/*userIDofthefile'sowner*/
    gid_tst_gid;/*groupIDofthefile'sgroup*/
    __dev_tst_rdev;/*devicetype*/
    #if__BSD_VISIBLE
    structtimespecst_atimespec;/*timeoflastaccess*/
    structtimespecst_mtimespec;/*timeoflastdatamodification*/
    structtimespecst_ctimespec;/*timeoflastfilestatuschange*/
    #else
    time_tst_atime;/*timeoflastaccess*/
    long__st_atimensec;/*nsecoflastaccess*/
    time_tst_mtime;/*timeoflastdatamodification*/
    long__st_mtimensec;/*nsecoflastdatamodification*/
    time_tst_ctime;/*timeoflastfilestatuschange*/
    long__st_ctimensec;/*nsecoflastfilestatuschange*/
    #endif
    off_tst_size;/*filesize,inbytes*/
    blkcnt_tst_blocks;/*blocksallocatedforfile*/
    blksize_tst_blksize;/*optimalblocksizeforI/O*/
    fflags_tst_flags;/*userdefinedflagsforfile*/
    __uint32_tst_gen;/*filegenerationnumber*/
    __int32_tst_lspare;
    #if__BSD_VISIBLE
    structtimespecst_birthtimespec;/*timeoffilecreation*/
    /*
    *Explicitlypadst_birthtimespecto16bytessothatthesizeof
    *structstatisbackwardscompatible.Weusebitfieldsinstead
    *ofanarrayofcharssothatthisdoesn'trequireaC99compiler
    *tocompileifthesizeofthepaddingis0.Weuse2bitfields
    *tocoverupto64bitson32-bitmachines.Weassumethat
    *CHAR_BITis8...
    */
    unsignedint:(8/2)*(16-(int)sizeof(structtimespec));
    unsignedint:(8/2)*(16-(int)sizeof(structtimespec));
    #else
    time_tst_birthtime;/*timeoffilecreation*/
    longst_birthtimensec;/*nsecoffilecreation*/
    unsignedint:(8/2)*(16-(int)sizeof(struct__timespec));
    unsignedint:(8/2)*(16-(int)sizeof(struct__timespec));
    #endif
    };

    intfcntl(structthread*,structfcntl_args*);
    intclose(structthread*,structclose_args*);
    intfalloc(structthread*,structfile**,int*);
    intgetdtablesize(structthread*,structgetdtablesize_args*);
    intfstat(structthread*,structfstat_args*);
    intioctl(structthread*,structioctl_args*);
    intgetfd(structthread*td,structfile**fp,intfd);

    #endif

    /***
    END
    ***/