<?xml version='1.0' encoding='UTF-8' standalone='no'?> <doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.16"> <compounddef id="vfs__calls_8c" kind="file" language="C++"> <compoundname>vfs_calls.c</compoundname> <includes refid="sched_8h" local="no">ubixos/sched.h</includes> <includes refid="thread_8h" local="no">sys/thread.h</includes> <includes refid="sysproto__posix_8h" local="no">sys/sysproto_posix.h</includes> <includes refid="descrip_8h" local="no">sys/descrip.h</includes> <includes refid="video_8h" local="no">sys/video.h</includes> <includes refid="pipe_8h" local="no">sys/pipe.h</includes> <includes refid="sys_2errno_8h" local="no">sys/errno.h</includes> <includes refid="string_8h" local="no">string.h</includes> <includes refid="ufs_8h" local="no">ufs/ufs.h</includes> <incdepgraph> <node id="30"> <label>sys/video.h</label> <link refid="video_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="29"> <label>sys/fcntl.h</label> <link refid="fcntl_8h"/> </node> <node id="21"> <label>ufs/ufs.h</label> <link refid="ufs_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="22" relation="include"> </childnode> </node> <node id="27"> <label>sys/descrip.h</label> <link refid="descrip_8h"/> <childnode refid="12" relation="include"> </childnode> <childnode refid="26" relation="include"> </childnode> <childnode refid="10" relation="include"> </childnode> <childnode refid="28" relation="include"> </childnode> <childnode refid="29" relation="include"> </childnode> </node> <node id="25"> <label>sys/tss.h</label> <link refid="tss_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="31"> <label>sys/pipe.h</label> <link refid="pipe_8h"/> <childnode refid="12" relation="include"> </childnode> <childnode refid="26" relation="include"> </childnode> </node> <node id="24"> <label>ubixos/tty.h</label> <link refid="tty_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="32"> <label>sys/errno.h</label> <link refid="sys_2errno_8h"/> </node> <node id="34"> <label>strings.h</label> <link refid="strings_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="14"> <label>i386/cpu.h</label> <link refid="i386_2cpu_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="5"> <label>sys/select.h</label> <link refid="select_8h"/> <childnode refid="6" relation="include"> </childnode> <childnode refid="4" relation="include"> </childnode> <childnode refid="7" relation="include"> </childnode> <childnode refid="8" relation="include"> </childnode> <childnode refid="9" relation="include"> </childnode> </node> <node id="17"> <label>vfs/inode.h</label> <link refid="inode_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="18" relation="include"> </childnode> <childnode refid="19" relation="include"> </childnode> <childnode refid="20" relation="include"> </childnode> <childnode refid="21" relation="include"> </childnode> </node> <node id="1"> <label>C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c</label> <link refid="vfs__calls_8c"/> <childnode refid="2" relation="include"> </childnode> <childnode refid="12" relation="include"> </childnode> <childnode refid="26" relation="include"> </childnode> <childnode refid="27" relation="include"> </childnode> <childnode refid="30" relation="include"> </childnode> <childnode refid="31" relation="include"> </childnode> <childnode refid="32" relation="include"> </childnode> <childnode refid="33" relation="include"> </childnode> <childnode refid="21" relation="include"> </childnode> </node> <node id="9"> <label>sys/_sigset.h</label> <link refid="__sigset_8h"/> <childnode refid="4" relation="include"> </childnode> </node> <node id="23"> <label>vfs/mount.h</label> <link refid="mount_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="16"> <label>sys/resource.h</label> <link refid="resource_8h"/> <childnode refid="4" relation="include"> </childnode> </node> <node id="13"> <label>sys/trap.h</label> <link refid="trap_8h"/> <childnode refid="14" relation="include"> </childnode> </node> <node id="33"> <label>string.h</label> <link refid="string_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="34" relation="include"> </childnode> </node> <node id="3"> <label>sys/types.h</label> <link refid="include_2sys_2types_8h"/> <childnode refid="4" relation="include"> </childnode> <childnode refid="5" relation="include"> </childnode> </node> <node id="10"> <label>vfs/file.h</label> <link refid="include_2vfs_2file_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="11" relation="include"> </childnode> <childnode refid="12" relation="include"> </childnode> <childnode refid="17" relation="include"> </childnode> <childnode refid="23" relation="include"> </childnode> <childnode refid="21" relation="include"> </childnode> </node> <node id="20"> <label>fs/msdos_fs.h</label> <link refid="msdos__fs_8h"/> </node> <node id="15"> <label>sys/signal.h</label> <link refid="sys_2signal_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="19"> <label>fs/pipe_fs.h</label> <link refid="pipe__fs_8h"/> </node> <node id="18"> <label>ubixos/wait.h</label> <link refid="wait_8h"/> </node> <node id="12"> <label>sys/thread.h</label> <link refid="thread_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="13" relation="include"> </childnode> <childnode refid="15" relation="include"> </childnode> <childnode refid="16" relation="include"> </childnode> </node> <node id="6"> <label>sys/cdefs.h</label> <link refid="cdefs_8h"/> </node> <node id="2"> <label>ubixos/sched.h</label> <link refid="sched_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="10" relation="include"> </childnode> <childnode refid="24" relation="include"> </childnode> <childnode refid="25" relation="include"> </childnode> <childnode refid="12" relation="include"> </childnode> </node> <node id="4"> <label>sys/_types.h</label> <link refid="__types_8h"/> </node> <node id="7"> <label>sys/_timespec.h</label> <link refid="__timespec_8h"/> <childnode refid="4" relation="include"> </childnode> </node> <node id="22"> <label>sys/device.h</label> <link refid="include_2sys_2device_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="26"> <label>sys/sysproto_posix.h</label> <link refid="sysproto__posix_8h"/> <childnode refid="15" relation="include"> </childnode> <childnode refid="12" relation="include"> </childnode> <childnode refid="10" relation="include"> </childnode> </node> <node id="11"> <label>ubixfs/dirCache.h</label> <link refid="dirCache_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="8"> <label>sys/_timeval.h</label> <link refid="__timeval_8h"/> <childnode refid="4" relation="include"> </childnode> </node> <node id="28"> <label>vfs/stat.h</label> <link refid="stat_8h"/> <childnode refid="3" relation="include"> </childnode> </node> </incdepgraph> <sectiondef kind="func"> <memberdef kind="function" id="vfs__calls_8c_1ab35b14c33a5b03f7617b58b4c0667bd4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int kern_openat</definition> <argsstring>(struct thread *thr, int afd, char *path, int flags, int mode)</argsstring> <name>kern_openat</name> <param> <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type> <declname>thr</declname> </param> <param> <type>int</type> <declname>afd</declname> </param> <param> <type>char *</type> <declname>path</declname> </param> <param> <type>int</type> <declname>flags</declname> </param> <param> <type>int</type> <declname>mode</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" line="399" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" bodystart="399" bodyend="448"/> <references refid="sys_2errno_8h_1a2d1678d5a7cc8ce499643f3b8957def4" compoundref="sys_2errno_8h" startline="55">EINVAL</references> <references refid="structfile_1ad549b6a207bd14d3a8a8f8b5c3ee1b9a" compoundref="descrip_8h" startline="68">file::f_flag</references> <references refid="descrip_8h_1a434fb15226182b0ee879a5afe9a8c190" compoundref="descrip_8c" startline="96" endline="123">falloc</references> <references refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" compoundref="descrip_8h" startline="71">file::fd</references> <references refid="descrip_8c_1ae7b881d8f4c6e81d8e10468783ce080f" compoundref="descrip_8c" startline="147" endline="160">fdestroy</references> <references refid="fcntl_8h_1a3c28c97a69c6ce8f87cac54a7c91f9db" compoundref="fcntl_8h" startline="88">FFLAGS</references> <references refid="fcntl_8h_1ab3f8268db3f2e8e22c6f52345799b3fb" compoundref="fcntl_8h" startline="93">FMASK</references> <references refid="file_8c_1a249f3bc0af043dc5ac3c9aa8646986af" compoundref="file_8c" startline="388" endline="518">fopen</references> <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references> <references refid="fcntl_8h_1a4dc4d45e07d2abc899bcaf04b2846a87" compoundref="fcntl_8h" startline="64">O_ACCMODE</references> <references refid="fcntl_8h_1a1cf6b1de1fffedaa1d26b189e9a8d2cc" compoundref="fcntl_8h" startline="57">O_CREAT</references> <references refid="fcntl_8h_1a459542206659fbe295eb4183f8b8f06c" compoundref="fcntl_8h" startline="78">O_EXEC</references> <references refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" compoundref="thread_8h" startline="41">thread::td_retval</references> <referencedby refid="vfs__calls_8c_1a3cd45d74317da8167bac4518cf43f6c0" compoundref="vfs__calls_8c" startline="39" endline="43">sys_open</referencedby> </memberdef> <memberdef kind="function" id="vfs__calls_8c_1a41fe0d27f7d876628b08c74821e180c8" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sys_access</definition> <argsstring>(struct thread *td, struct sys_access_args *args)</argsstring> <name>sys_access</name> <param> <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type> <declname>td</declname> </param> <param> <type>struct <ref refid="structsys__access__args" kindref="compound">sys_access_args</ref> *</type> <declname>args</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" line="366" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" bodystart="366" bodyend="371"/> <references refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" compoundref="thread_8h" startline="41">thread::td_retval</references> </memberdef> <memberdef kind="function" id="vfs__calls_8c_1a3195389ea302c069fc2dbf8a08e4c841" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sys_close</definition> <argsstring>(struct thread *td, struct sys_close_args *args)</argsstring> <name>sys_close</name> <param> <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type> <declname>td</declname> </param> <param> <type>struct <ref refid="structsys__close__args" kindref="compound">sys_close_args</ref> *</type> <declname>args</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" line="99" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" bodystart="99" bodyend="149"/> <references refid="structfile_1adfb0c6311589d1d62b720c9610430ad0" compoundref="descrip_8h" startline="74">file::data</references> <references refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" compoundref="file_8c" startline="526" endline="566">fclose</references> <references refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" compoundref="descrip_8h" startline="71">file::fd</references> <references refid="structsys__close__args_1a0699a7f6afdc76534e0c1de130cd668a" compoundref="sysproto__posix_8h" startline="104">sys_close_args::fd</references> <references refid="structfile_1ac43cc1da8bee1eb339249ad88518f769" compoundref="descrip_8h" startline="72">file::fd_type</references> <references refid="descrip_8c_1ae7b881d8f4c6e81d8e10468783ce080f" compoundref="descrip_8c" startline="147" endline="160">fdestroy</references> <references refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" compoundref="descrip_8c" startline="214" endline="227">getfd</references> <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references> <references refid="structthread_1a68f1e552f18575d52731e9e61ad411fe" compoundref="thread_8h" startline="42">thread::o_files</references> <references refid="structpipeInfo_1a7b8ab29519bbfd2a4f319bb08b13d999" compoundref="pipe_8h" startline="46">pipeInfo::rFD</references> <references refid="structpipeInfo_1ad1f25bacb95bd28fd47a62b648dbd125" compoundref="pipe_8h" startline="47">pipeInfo::rfdCNT</references> <references refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" compoundref="thread_8h" startline="41">thread::td_retval</references> <references refid="structpipeInfo_1ab3c324342452efcb74529c9c830d708b" compoundref="pipe_8h" startline="48">pipeInfo::wFD</references> <references refid="structpipeInfo_1a73534b061097015a340b287279fe52ed" compoundref="pipe_8h" startline="49">pipeInfo::wfdCNT</references> </memberdef> <memberdef kind="function" id="vfs__calls_8c_1aec77dd1139b0a36d6aa7b29d08039bc1" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sys_getdirentries</definition> <argsstring>(struct thread *td, struct sys_getdirentries_args *args)</argsstring> <name>sys_getdirentries</name> <param> <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type> <declname>td</declname> </param> <param> <type>struct <ref refid="structsys__getdirentries__args" kindref="compound">sys_getdirentries_args</ref> *</type> <declname>args</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" line="373" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" bodystart="373" bodyend="387"/> <references refid="structsys__getdirentries__args_1a3d55ee6aac44557c59c772df9cbe4879" compoundref="sysproto__posix_8h" startline="631">sys_getdirentries_args::buf</references> <references refid="structsys__getdirentries__args_1ad4c8ed1d8fe7dcf39d9e7dc2d8ee4db5" compoundref="sysproto__posix_8h" startline="634">sys_getdirentries_args::count</references> <references refid="gpt_8h_1a9c8466b6111a11195a5cd2478c648e32" compoundref="gpt_8h" startline="42">DEV_BSIZE</references> <references refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" compoundref="descrip_8h" startline="71">file::fd</references> <references refid="structsys__getdirentries__args_1afa5ee0d234caa9962f5d4e72c6d23b72" compoundref="sysproto__posix_8h" startline="628">sys_getdirentries_args::fd</references> <references refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" compoundref="file_8c" startline="291" endline="309">fread</references> <references refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" compoundref="descrip_8c" startline="214" endline="227">getfd</references> <references refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" compoundref="thread_8h" startline="41">thread::td_retval</references> </memberdef> <memberdef kind="function" id="vfs__calls_8c_1a3cd45d74317da8167bac4518cf43f6c0" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sys_open</definition> <argsstring>(struct thread *td, struct sys_open_args *args)</argsstring> <name>sys_open</name> <param> <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type> <declname>td</declname> </param> <param> <type>struct <ref refid="structsys__open__args" kindref="compound">sys_open_args</ref> *</type> <declname>args</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" line="39" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" bodystart="39" bodyend="43"/> <references refid="fcntl_8h_1a301749b9aa4b9416c329bb8b19345216" compoundref="fcntl_8h" startline="32">AT_FDCWD</references> <references refid="structsys__open__args_1a7cc431a46588fa9c1b1cf3d9f7fcd786" compoundref="sysproto__posix_8h" startline="94">sys_open_args::flags</references> <references refid="vfs__calls_8c_1ab35b14c33a5b03f7617b58b4c0667bd4" compoundref="vfs__calls_8c" startline="399" endline="448">kern_openat</references> <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references> <references refid="structsys__open__args_1ab63689873a9bf3f848ab32ff7724258e" compoundref="sysproto__posix_8h" startline="98">sys_open_args::mode</references> <references refid="structsys__open__args_1a664e124de651f96aa0bc40a6dced040d" compoundref="sysproto__posix_8h" startline="90">sys_open_args::path</references> </memberdef> <memberdef kind="function" id="vfs__calls_8c_1a61bacda2680307d7f33cd2efe52ba2b5" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sys_openat</definition> <argsstring>(struct thread *td, struct sys_openat_args *args)</argsstring> <name>sys_openat</name> <param> <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type> <declname>td</declname> </param> <param> <type>struct <ref refid="structsys__openat__args" kindref="compound">sys_openat_args</ref> *</type> <declname>args</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" line="45" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" bodystart="45" bodyend="97"/> <references refid="descrip_8h_1a434fb15226182b0ee879a5afe9a8c190" compoundref="descrip_8c" startline="96" endline="123">falloc</references> <references refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" compoundref="descrip_8h" startline="71">file::fd</references> <references refid="descrip_8c_1ae7b881d8f4c6e81d8e10468783ce080f" compoundref="descrip_8c" startline="147" endline="160">fdestroy</references> <references refid="structsys__openat__args_1aa3c9aaa2a71dbef7573d986a426cd037" compoundref="sysproto__posix_8h" startline="507">sys_openat_args::flag</references> <references refid="file_8c_1a249f3bc0af043dc5ac3c9aa8646986af" compoundref="file_8c" startline="388" endline="518">fopen</references> <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references> <references refid="fcntl_8h_1abb0586253488ee61072b73557eeb873b" compoundref="fcntl_8h" startline="63">O_RDWR</references> <references refid="fcntl_8h_1a11b644a8526139c4cc1850dac1271ced" compoundref="fcntl_8h" startline="62">O_WRONLY</references> <references refid="structsys__openat__args_1a4667d2a2d5a72278accc6c5fa03c584e" compoundref="sysproto__posix_8h" startline="504">sys_openat_args::path</references> <references refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" compoundref="thread_8h" startline="41">thread::td_retval</references> </memberdef> <memberdef kind="function" id="vfs__calls_8c_1a883455624440fedf2b1af73d313e0ade" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sys_pread</definition> <argsstring>(struct thread *td, struct sys_pread_args *args)</argsstring> <name>sys_pread</name> <param> <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type> <declname>td</declname> </param> <param> <type>struct <ref refid="structsys__pread__args" kindref="compound">sys_pread_args</ref> *</type> <declname>args</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" line="239" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" bodystart="239" bodyend="291"/> <references refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" compoundref="armv6_2sched_8c" startline="50">_current</references> <references refid="structsys__pread__args_1acbb492abfd48a374f07bbd00cdf46464" compoundref="sysproto__posix_8h" startline="733">sys_pread_args::buf</references> <references refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" compoundref="descrip_8h" startline="71">file::fd</references> <references refid="structsys__pread__args_1a58ed22347b5642bc16f57888bf4f19a4" compoundref="sysproto__posix_8h" startline="730">sys_pread_args::fd</references> <references refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" compoundref="file_8c" startline="291" endline="309">fread</references> <references refid="include_2vfs_2file_8h_1ac45fdeab51c3197c1e7c4ec7beabaca9" compoundref="atkbd_8c" startline="346" endline="393">getchar</references> <references refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" compoundref="descrip_8c" startline="214" endline="227">getfd</references> <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references> <references refid="structsys__pread__args_1a3da203fe77c7e92a0850db3da81c540a" compoundref="sysproto__posix_8h" startline="736">sys_pread_args::nbyte</references> <references refid="structfileDescriptor_1a09c5cd0d4979a70b8d7098319cd00b7c" compoundref="include_2vfs_2file_8h" startline="69">fileDescriptor::offset</references> <references refid="structsys__pread__args_1a7637975c89393f51333047c84fa82750" compoundref="sysproto__posix_8h" startline="739">sys_pread_args::offset</references> <references refid="armv6_2sched_8c_1a08933fe6d593a1c78b9080359f15a0b7" compoundref="armv6_2sched_8c" startline="244" endline="246">sched_yield</references> <references refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" compoundref="thread_8h" startline="41">thread::td_retval</references> <references refid="structtaskStruct_1a4563a310626d4f4ea885f4532356abb3" compoundref="sched_8h" startline="77">taskStruct::term</references> <references refid="tty_8h_1aafbb5679104334c34d7691b2de7d7a86" compoundref="tty_8c" startline="38">tty_foreground</references> </memberdef> <memberdef kind="function" id="vfs__calls_8c_1a7678726e58a6393050f3b26e0b9b3152" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sys_read</definition> <argsstring>(struct thread *td, struct sys_read_args *args)</argsstring> <name>sys_read</name> <param> <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type> <declname>td</declname> </param> <param> <type>struct <ref refid="structsys__read__args" kindref="compound">sys_read_args</ref> *</type> <declname>args</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" line="151" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" bodystart="151" bodyend="237"/> <references refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" compoundref="armv6_2sched_8c" startline="50">_current</references> <references refid="structpipeInfo_1a1af79350f10c92db334eb798c2e073e1" compoundref="pipe_8h" startline="50">pipeInfo::bCNT</references> <references refid="structsys__read__args_1ab8c33f0c1b932b48cb5c55a9cd0c95b7" compoundref="sysproto__posix_8h" startline="67">sys_read_args::buf</references> <references refid="structpipeBuf_1aa910cff72b25f70395e2cc68ecc9a18d" compoundref="pipe_8h" startline="39">pipeBuf::buffer</references> <references refid="structfile_1adfb0c6311589d1d62b720c9610430ad0" compoundref="descrip_8h" startline="74">file::data</references> <references refid="structsys__read__args_1a024d936329e4045013cda3e3c872cc1e" compoundref="sysproto__posix_8h" startline="64">sys_read_args::fd</references> <references refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" compoundref="descrip_8h" startline="71">file::fd</references> <references refid="structfile_1ac43cc1da8bee1eb339249ad88518f769" compoundref="descrip_8h" startline="72">file::fd_type</references> <references refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" compoundref="file_8c" startline="291" endline="309">fread</references> <references refid="include_2vfs_2file_8h_1ac45fdeab51c3197c1e7c4ec7beabaca9" compoundref="atkbd_8c" startline="346" endline="393">getchar</references> <references refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" compoundref="descrip_8c" startline="214" endline="227">getfd</references> <references refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" compoundref="pipe_8h" startline="51">pipeInfo::headPB</references> <references refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" compoundref="kmalloc_8c" startline="342" endline="382">kfree</references> <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references> <references refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c">memcpy</references> <references refid="structsys__read__args_1ac062bed8f21a0fd19f35ceaf95533a4e" compoundref="sysproto__posix_8h" startline="70">sys_read_args::nbyte</references> <references refid="structpipeBuf_1aeec091b287e397899ae81495cd80f464" compoundref="pipe_8h" startline="40">pipeBuf::nbytes</references> <references refid="structpipeBuf_1ad9a3f124f1d677ea353fcc8cfc76a46d" compoundref="pipe_8h" startline="38">pipeBuf::next</references> <references refid="structpipeBuf_1a117747ee40ba0c3fbb36e1b81d01bd61" compoundref="pipe_8h" startline="41">pipeBuf::offset</references> <references refid="armv6_2sched_8c_1a08933fe6d593a1c78b9080359f15a0b7" compoundref="armv6_2sched_8c" startline="244" endline="246">sched_yield</references> <references refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" compoundref="thread_8h" startline="41">thread::td_retval</references> <references refid="structtaskStruct_1a4563a310626d4f4ea885f4532356abb3" compoundref="sched_8h" startline="77">taskStruct::term</references> <references refid="tty_8h_1aafbb5679104334c34d7691b2de7d7a86" compoundref="tty_8c" startline="38">tty_foreground</references> </memberdef> <memberdef kind="function" id="vfs__calls_8c_1a35d9649c48f61f1511e9d5de290e4991" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sys_readlink</definition> <argsstring>(struct thread *thr, struct sys_readlink_args *args)</argsstring> <name>sys_readlink</name> <param> <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type> <declname>thr</declname> </param> <param> <type>struct <ref refid="structsys__readlink__args" kindref="compound">sys_readlink_args</ref> *</type> <declname>args</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" line="389" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" bodystart="389" bodyend="397"/> <references refid="structsys__readlink__args_1ae4b18f6982f02caf736ac80e6a8563d5" compoundref="sysproto__posix_8h" startline="751">sys_readlink_args::count</references> <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references> <references refid="structsys__readlink__args_1a1fe89dd18120f3820ef9f8b746f73b6c" compoundref="sysproto__posix_8h" startline="745">sys_readlink_args::path</references> <references refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" compoundref="thread_8h" startline="41">thread::td_retval</references> </memberdef> <memberdef kind="function" id="vfs__calls_8c_1a159495d16f0ec154193733ad4fb1fc71" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sys_write</definition> <argsstring>(struct thread *td, struct sys_write_args *uap)</argsstring> <name>sys_write</name> <param> <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type> <declname>td</declname> </param> <param> <type>struct <ref refid="structsys__write__args" kindref="compound">sys_write_args</ref> *</type> <declname>uap</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" line="293" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c" bodystart="293" bodyend="364"/> <references refid="structpipeInfo_1a1af79350f10c92db334eb798c2e073e1" compoundref="pipe_8h" startline="50">pipeInfo::bCNT</references> <references refid="structsys__write__args_1a0d548a06729e6674b8310634e345f07f" compoundref="sysproto__posix_8h" startline="80">sys_write_args::buf</references> <references refid="structpipeBuf_1aa910cff72b25f70395e2cc68ecc9a18d" compoundref="pipe_8h" startline="39">pipeBuf::buffer</references> <references refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" compoundref="shell_8c" startline="47">buffer</references> <references refid="structfile_1adfb0c6311589d1d62b720c9610430ad0" compoundref="descrip_8h" startline="74">file::data</references> <references refid="video_8h_1a2984c3db0ad3a4a571a8ee0b4d2fe90b" compoundref="video_8h" startline="34">defaultColor</references> <references refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" compoundref="descrip_8h" startline="71">file::fd</references> <references refid="structsys__write__args_1a45cd1139d4d410f71c8cec212e6ff3ec" compoundref="sysproto__posix_8h" startline="76">sys_write_args::fd</references> <references refid="structfile_1ac43cc1da8bee1eb339249ad88518f769" compoundref="descrip_8h" startline="72">file::fd_type</references> <references refid="file_8c_1a803ecb7dac37bee57ef3fe11c7899d36" compoundref="file_8c" startline="311" endline="324">fwrite</references> <references refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" compoundref="descrip_8c" startline="214" endline="227">getfd</references> <references refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" compoundref="pipe_8h" startline="51">pipeInfo::headPB</references> <references refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" compoundref="kmalloc_8c" startline="342" endline="382">kfree</references> <references refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" compoundref="kmalloc_8c" startline="241" endline="331">kmalloc</references> <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references> <references refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c">memcpy</references> <references refid="structsys__write__args_1ac441511caeedf53cf8c315f482bb9863" compoundref="sysproto__posix_8h" startline="84">sys_write_args::nbyte</references> <references refid="structpipeBuf_1aeec091b287e397899ae81495cd80f464" compoundref="pipe_8h" startline="40">pipeBuf::nbytes</references> <references refid="structpipeBuf_1ad9a3f124f1d677ea353fcc8cfc76a46d" compoundref="pipe_8h" startline="38">pipeBuf::next</references> <references refid="structthread_1a68f1e552f18575d52731e9e61ad411fe" compoundref="thread_8h" startline="42">thread::o_files</references> <references refid="video_8h_1aa6d08b2dd961295607e6a5d52f1d471e" compoundref="video_8c" startline="35">printColor</references> <references refid="structfileDescriptor_1acf8de2682bb1eaedd14cc477895982d5" compoundref="include_2vfs_2file_8h" startline="82">fileDescriptor::res</references> <references refid="structpipeInfo_1a3bd26f08a5757a3e89049a8f1d7c0831" compoundref="pipe_8h" startline="52">pipeInfo::tailPB</references> <references refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" compoundref="thread_8h" startline="41">thread::td_retval</references> </memberdef> </sectiondef> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <programlisting> <codeline lineno="1"><highlight class="comment">/*-</highlight></codeline> <codeline lineno="2"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2002-2018<sp/>The<sp/>UbixOS<sp/>Project.</highlight></codeline> <codeline lineno="3"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline> <codeline lineno="4"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="5"><highlight class="comment"><sp/>*<sp/>This<sp/>was<sp/>developed<sp/>by<sp/>Christopher<sp/>W.<sp/>Olsen<sp/>for<sp/>the<sp/>UbixOS<sp/>Project.</highlight></codeline> <codeline lineno="6"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="7"><highlight class="comment"><sp/>*<sp/>Redistribution<sp/>and<sp/>use<sp/>in<sp/>source<sp/>and<sp/>binary<sp/>forms,<sp/>with<sp/>or<sp/>without<sp/>modification,<sp/>are<sp/>permitted</highlight></codeline> <codeline lineno="8"><highlight class="comment"><sp/>*<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions<sp/>are<sp/>met:</highlight></codeline> <codeline lineno="9"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="10"><highlight class="comment"><sp/>*<sp/>1)<sp/>Redistributions<sp/>of<sp/>source<sp/>code<sp/>must<sp/>retain<sp/>the<sp/>above<sp/>copyright<sp/>notice,<sp/>this<sp/>list<sp/>of</highlight></codeline> <codeline lineno="11"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>conditions,<sp/>the<sp/>following<sp/>disclaimer<sp/>and<sp/>the<sp/>list<sp/>of<sp/>authors.</highlight></codeline> <codeline lineno="12"><highlight class="comment"><sp/>*<sp/>2)<sp/>Redistributions<sp/>in<sp/>binary<sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright<sp/>notice,<sp/>this<sp/>list<sp/>of</highlight></codeline> <codeline lineno="13"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>conditions,<sp/>the<sp/>following<sp/>disclaimer<sp/>and<sp/>the<sp/>list<sp/>of<sp/>authors<sp/>in<sp/>the<sp/>documentation<sp/>and/or</highlight></codeline> <codeline lineno="14"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.</highlight></codeline> <codeline lineno="15"><highlight class="comment"><sp/>*<sp/>3)<sp/>Neither<sp/>the<sp/>name<sp/>of<sp/>the<sp/>UbixOS<sp/>Project<sp/>nor<sp/>the<sp/>names<sp/>of<sp/>its<sp/>contributors<sp/>may<sp/>be<sp/>used<sp/>to</highlight></codeline> <codeline lineno="16"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>endorse<sp/>or<sp/>promote<sp/>products<sp/>derived<sp/>from<sp/>this<sp/>software<sp/>without<sp/>specific<sp/>prior<sp/>written</highlight></codeline> <codeline lineno="17"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>permission.</highlight></codeline> <codeline lineno="18"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="19"><highlight class="comment"><sp/>*<sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>THE<sp/>AUTHOR<sp/>AND<sp/>CONTRIBUTORS<sp/>"AS<sp/>IS"<sp/>AND<sp/>ANY<sp/>EXPRESS<sp/>OR<sp/>IMPLIED</highlight></codeline> <codeline lineno="20"><highlight class="comment"><sp/>*<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS</highlight></codeline> <codeline lineno="21"><highlight class="comment"><sp/>*<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/>ARE<sp/>DISCLAIMED.<sp/>IN<sp/>NO<sp/>EVENT<sp/>SHALL<sp/>THE<sp/>COPYRIGHT<sp/>OWNER<sp/>OR<sp/>CONTRIBUTORS</highlight></codeline> <codeline lineno="22"><highlight class="comment"><sp/>*<sp/>BE<sp/>LIABLE<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL<sp/>DAMAGES</highlight></codeline> <codeline lineno="23"><highlight class="comment"><sp/>*<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT<sp/>OF<sp/>SUBSTITUTE<sp/>GOODS<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,</highlight></codeline> <codeline lineno="24"><highlight class="comment"><sp/>*<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS<sp/>INTERRUPTION)<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN</highlight></codeline> <codeline lineno="25"><highlight class="comment"><sp/>*<sp/>CONTRACT,<sp/>STRICT<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING<sp/>IN<sp/>ANY<sp/>WAY<sp/>OUT</highlight></codeline> <codeline lineno="26"><highlight class="comment"><sp/>*<sp/>OF<sp/>THE<sp/>USE<sp/>OF<sp/>THIS<sp/>SOFTWARE,<sp/>EVEN<sp/>IF<sp/>ADVISED<sp/>OF<sp/>THE<sp/>POSSIBILITY<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline> <codeline lineno="27"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="28"><highlight class="normal"></highlight></codeline> <codeline lineno="29"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="sched_8h" kindref="compound">ubixos/sched.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="30"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="thread_8h" kindref="compound">sys/thread.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="31"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="sysproto__posix_8h" kindref="compound">sys/sysproto_posix.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="32"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="descrip_8h" kindref="compound">sys/descrip.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="33"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="video_8h" kindref="compound">sys/video.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="34"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="pipe_8h" kindref="compound">sys/pipe.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="35"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="sys_2errno_8h" kindref="compound">sys/errno.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="36"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="string_8h" kindref="compound">string.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="37"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="ufs_8h" kindref="compound">ufs/ufs.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="38"><highlight class="normal"></highlight></codeline> <codeline lineno="39" refid="vfs__calls_8c_1a3cd45d74317da8167bac4518cf43f6c0" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vfs__calls_8c_1a3cd45d74317da8167bac4518cf43f6c0" kindref="member">sys_open</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*td,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__open__args" kindref="compound">sys_open_args</ref><sp/>*args)<sp/>{</highlight></codeline> <codeline lineno="40"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"sys_open?"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="41"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="vfs__calls_8c_1ab35b14c33a5b03f7617b58b4c0667bd4" kindref="member">kern_openat</ref>(td,<sp/><ref refid="fcntl_8h_1a301749b9aa4b9416c329bb8b19345216" kindref="member">AT_FDCWD</ref>,<sp/>args-><ref refid="structsys__open__args_1a664e124de651f96aa0bc40a6dced040d" kindref="member">path</ref>,<sp/>args-><ref refid="structsys__open__args_1a7cc431a46588fa9c1b1cf3d9f7fcd786" kindref="member">flags</ref>,<sp/>args-><ref refid="structsys__open__args_1ab63689873a9bf3f848ab32ff7724258e" kindref="member">mode</ref>));</highlight></codeline> <codeline lineno="42"><highlight class="normal"></highlight></codeline> <codeline lineno="43"><highlight class="normal">}</highlight></codeline> <codeline lineno="44"><highlight class="normal"></highlight></codeline> <codeline lineno="45" refid="vfs__calls_8c_1a61bacda2680307d7f33cd2efe52ba2b5" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vfs__calls_8c_1a61bacda2680307d7f33cd2efe52ba2b5" kindref="member">sys_openat</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*td,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__openat__args" kindref="compound">sys_openat_args</ref><sp/>*args)<sp/>{</highlight></codeline> <codeline lineno="46"><highlight class="normal"></highlight></codeline> <codeline lineno="47"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>error<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="48"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>fd<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="49"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfile" kindref="compound">file</ref><sp/>*nfp<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="50"><highlight class="normal"></highlight></codeline> <codeline lineno="51"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>DEBUG_OPENAT</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="52"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"openat"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="53"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="54"><highlight class="normal"></highlight></codeline> <codeline lineno="55"><highlight class="normal"><sp/><sp/>error<sp/>=<sp/><ref refid="descrip_8h_1a434fb15226182b0ee879a5afe9a8c190" kindref="member">falloc</ref>(td,<sp/>&nfp,<sp/>&<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="56"><highlight class="normal"></highlight></codeline> <codeline lineno="57"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(error)</highlight></codeline> <codeline lineno="58"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(error);</highlight></codeline> <codeline lineno="59"><highlight class="normal"></highlight></codeline> <codeline lineno="60"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((args-><ref refid="structsys__openat__args_1aa3c9aaa2a71dbef7573d986a426cd037" kindref="member">flag</ref><sp/>&<sp/><ref refid="fcntl_8h_1a11b644a8526139c4cc1850dac1271ced" kindref="member">O_WRONLY</ref>)<sp/>==<sp/><ref refid="fcntl_8h_1a11b644a8526139c4cc1850dac1271ced" kindref="member">O_WRONLY</ref>)</highlight></codeline> <codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/>nfp-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>=<sp/><ref refid="file_8c_1a249f3bc0af043dc5ac3c9aa8646986af" kindref="member">fopen</ref>(args-><ref refid="structsys__openat__args_1a4667d2a2d5a72278accc6c5fa03c584e" kindref="member">path</ref>,<sp/></highlight><highlight class="stringliteral">"w"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="62"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((args-><ref refid="structsys__openat__args_1aa3c9aaa2a71dbef7573d986a426cd037" kindref="member">flag</ref><sp/>&<sp/><ref refid="fcntl_8h_1abb0586253488ee61072b73557eeb873b" kindref="member">O_RDWR</ref>)<sp/>==<sp/><ref refid="fcntl_8h_1abb0586253488ee61072b73557eeb873b" kindref="member">O_RDWR</ref>)</highlight></codeline> <codeline lineno="63"><highlight class="normal"><sp/><sp/><sp/><sp/>nfp-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>=<sp/><ref refid="file_8c_1a249f3bc0af043dc5ac3c9aa8646986af" kindref="member">fopen</ref>(args-><ref refid="structsys__openat__args_1a4667d2a2d5a72278accc6c5fa03c584e" kindref="member">path</ref>,<sp/></highlight><highlight class="stringliteral">"a"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="64"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/>nfp-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>=<sp/><ref refid="file_8c_1a249f3bc0af043dc5ac3c9aa8646986af" kindref="member">fopen</ref>(args-><ref refid="structsys__openat__args_1a4667d2a2d5a72278accc6c5fa03c584e" kindref="member">path</ref>,<sp/></highlight><highlight class="stringliteral">"r"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="66"><highlight class="normal"></highlight></codeline> <codeline lineno="67"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(nfp-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>==<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="68"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="descrip_8c_1ae7b881d8f4c6e81d8e10468783ce080f" kindref="member">fdestroy</ref>(td,<sp/>nfp,<sp/><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="69"><highlight class="normal"></highlight></codeline> <codeline lineno="70"><highlight class="normal"><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>-1;</highlight></codeline> <codeline lineno="71"><highlight class="normal"><sp/><sp/><sp/><sp/>error<sp/>=<sp/>-1;</highlight></codeline> <codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="73"><highlight class="comment"></highlight></codeline> <codeline lineno="74"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>kprintf("[sOA:<sp/>0x%X:%s:%s:]",<sp/>args->flag,<sp/>args->mode,<sp/>args->path,<sp/>td->td_retval[0]);</highlight></codeline> <codeline lineno="75"><highlight class="comment"></highlight></codeline> <codeline lineno="76"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>if<sp/>((args->flag<sp/>&<sp/>O_RDONLY)<sp/>==<sp/>O_RDONLY)</highlight></codeline> <codeline lineno="77"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>kprintf("O_RDONLY");</highlight></codeline> <codeline lineno="78"><highlight class="comment"></highlight></codeline> <codeline lineno="79"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>if<sp/>((args->flag<sp/>&<sp/>O_WRONLY)<sp/>==<sp/>O_WRONLY)</highlight></codeline> <codeline lineno="80"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>kprintf("O_WRONLY");</highlight></codeline> <codeline lineno="81"><highlight class="comment"></highlight></codeline> <codeline lineno="82"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>if<sp/>((args->flag<sp/>&<sp/>O_RDWR)<sp/>==<sp/>O_RDWR)</highlight></codeline> <codeline lineno="83"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>kprintf("O_RDWR");</highlight></codeline> <codeline lineno="84"><highlight class="comment"></highlight></codeline> <codeline lineno="85"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>if<sp/>((args->flag<sp/>&<sp/>O_ACCMODE)<sp/>==<sp/>O_ACCMODE)</highlight></codeline> <codeline lineno="86"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>kprintf("O_ACCMODE");</highlight></codeline> <codeline lineno="87"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="88"><highlight class="normal"></highlight></codeline> <codeline lineno="89"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="90"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>;</highlight></codeline> <codeline lineno="92"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="93"><highlight class="normal"></highlight></codeline> <codeline lineno="94"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//kprintf("[sOA:<sp/>0x%X:%s:%s:]",<sp/>args->flag,<sp/>args->mode,<sp/>args->path,<sp/>td->td_retval[0]);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="95"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"sys_openat:<sp/>%i,<sp/>0x%X,<sp/>0x%X"</highlight><highlight class="normal">,<sp/><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>,<sp/>nfp,<sp/>nfp-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="96"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(error);</highlight></codeline> <codeline lineno="97"><highlight class="normal">}</highlight></codeline> <codeline lineno="98"><highlight class="normal"></highlight></codeline> <codeline lineno="99" refid="vfs__calls_8c_1a3195389ea302c069fc2dbf8a08e4c841" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vfs__calls_8c_1a3195389ea302c069fc2dbf8a08e4c841" kindref="member">sys_close</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*td,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__close__args" kindref="compound">sys_close_args</ref><sp/>*args)<sp/>{</highlight></codeline> <codeline lineno="100"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfile" kindref="compound">file</ref><sp/>*<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="101"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpipeInfo" kindref="compound">pipeInfo</ref><sp/>*pFD<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="102"><highlight class="normal"></highlight></codeline> <codeline lineno="103"><highlight class="normal"><sp/><sp/><ref refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" kindref="member">getfd</ref>(td,<sp/>&fd,<sp/>args-><ref refid="structsys__close__args_1a0699a7f6afdc76534e0c1de130cd668a" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="104"><highlight class="normal"></highlight></codeline> <codeline lineno="105"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"[sC:%i:0x%X:0x%X]"</highlight><highlight class="normal">,<sp/>args-><ref refid="structsys__close__args_1a0699a7f6afdc76534e0c1de130cd668a" kindref="member">fd</ref>,<sp/>fd,<sp/>fd-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="106"><highlight class="normal"></highlight></codeline> <codeline lineno="107"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>DEBUG_VFS_CALLS</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="108"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"[sC::0x%X:0x%X]"</highlight><highlight class="normal">,<sp/>args-><ref refid="structsys__close__args_1a0699a7f6afdc76534e0c1de130cd668a" kindref="member">fd</ref>,<sp/>fd,<sp/>fd-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="109"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="110"><highlight class="normal"></highlight></codeline> <codeline lineno="111"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(fd<sp/>==<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="112"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"COULDN'T<sp/>FIND<sp/>FD:<sp/>"</highlight><highlight class="normal">,<sp/>args-><ref refid="structsys__close__args_1a0699a7f6afdc76534e0c1de130cd668a" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="113"><highlight class="normal"><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>-1;</highlight></codeline> <codeline lineno="114"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="115"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(fd-><ref refid="structfile_1ac43cc1da8bee1eb339249ad88518f769" kindref="member">fd_type</ref>)<sp/>{</highlight></codeline> <codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>3:</highlight></codeline> <codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pFD<sp/>=<sp/>fd-><ref refid="structfile_1adfb0c6311589d1d62b720c9610430ad0" kindref="member">data</ref>;</highlight></codeline> <codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(args-><ref refid="structsys__close__args_1a0699a7f6afdc76534e0c1de130cd668a" kindref="member">fd</ref><sp/>==<sp/>pFD-><ref refid="structpipeInfo_1a7b8ab29519bbfd2a4f319bb08b13d999" kindref="member">rFD</ref>)<sp/>{</highlight></codeline> <codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pFD-><ref refid="structpipeInfo_1ad1f25bacb95bd28fd47a62b648dbd125" kindref="member">rfdCNT</ref><sp/><<sp/>2)</highlight></codeline> <codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="descrip_8c_1ae7b881d8f4c6e81d8e10468783ce080f" kindref="member">fdestroy</ref>(td,<sp/>fd,<sp/>args-><ref refid="structsys__close__args_1a0699a7f6afdc76534e0c1de130cd668a" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pFD-><ref refid="structpipeInfo_1ad1f25bacb95bd28fd47a62b648dbd125" kindref="member">rfdCNT</ref>--;</highlight></codeline> <codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="124"><highlight class="normal"></highlight></codeline> <codeline lineno="125"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(args-><ref refid="structsys__close__args_1a0699a7f6afdc76534e0c1de130cd668a" kindref="member">fd</ref><sp/>==<sp/>pFD-><ref refid="structpipeInfo_1ab3c324342452efcb74529c9c830d708b" kindref="member">wFD</ref>)<sp/>{</highlight></codeline> <codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pFD-><ref refid="structpipeInfo_1a73534b061097015a340b287279fe52ed" kindref="member">wfdCNT</ref><sp/><<sp/>2)</highlight></codeline> <codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="descrip_8c_1ae7b881d8f4c6e81d8e10468783ce080f" kindref="member">fdestroy</ref>(td,<sp/>fd,<sp/>args-><ref refid="structsys__close__args_1a0699a7f6afdc76534e0c1de130cd668a" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="128"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pFD-><ref refid="structpipeInfo_1a73534b061097015a340b287279fe52ed" kindref="member">wfdCNT</ref>--;</highlight></codeline> <codeline lineno="129"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="130"><highlight class="normal"></highlight></codeline> <codeline lineno="131"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="132"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline> <codeline lineno="133"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(args-><ref refid="structsys__close__args_1a0699a7f6afdc76534e0c1de130cd668a" kindref="member">fd</ref><sp/><<sp/>3)</highlight></codeline> <codeline lineno="134"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>0;</highlight></codeline> <codeline lineno="135"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="136"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(fd-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>))</highlight></codeline> <codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>-1;</highlight></codeline> <codeline lineno="138"><highlight class="normal"></highlight></codeline> <codeline lineno="139"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"DESTROY:<sp/>%i!"</highlight><highlight class="normal">,<sp/>args-><ref refid="structsys__close__args_1a0699a7f6afdc76534e0c1de130cd668a" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="140"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="descrip_8c_1ae7b881d8f4c6e81d8e10468783ce080f" kindref="member">fdestroy</ref>(td,<sp/>fd,<sp/>args-><ref refid="structsys__close__args_1a0699a7f6afdc76534e0c1de130cd668a" kindref="member">fd</ref>))</highlight></codeline> <codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"[%s:%i]<sp/>fdestroy(0x%X,<sp/>0x%X)<sp/>failed\n"</highlight><highlight class="normal">,<sp/>__FILE__,<sp/>__LINE__,<sp/>fd,<sp/>td-><ref refid="structthread_1a68f1e552f18575d52731e9e61ad411fe" kindref="member">o_files</ref>[args-><ref refid="structsys__close__args_1a0699a7f6afdc76534e0c1de130cd668a" kindref="member">fd</ref>]);</highlight></codeline> <codeline lineno="142"><highlight class="normal"></highlight></codeline> <codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>0;</highlight></codeline> <codeline lineno="144"><highlight class="normal"></highlight></codeline> <codeline lineno="145"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="147"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="148"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline> <codeline lineno="149"><highlight class="normal">}</highlight></codeline> <codeline lineno="150"><highlight class="normal"></highlight></codeline> <codeline lineno="151" refid="vfs__calls_8c_1a7678726e58a6393050f3b26e0b9b3152" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vfs__calls_8c_1a7678726e58a6393050f3b26e0b9b3152" kindref="member">sys_read</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*td,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__read__args" kindref="compound">sys_read_args</ref><sp/>*args)<sp/>{</highlight></codeline> <codeline lineno="152"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0;</highlight></codeline> <codeline lineno="153"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>c<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="154"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>bf[2];</highlight></codeline> <codeline lineno="155"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">volatile</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="structbuf" kindref="compound">buf</ref><sp/>=<sp/>args-><ref refid="structsys__read__args_1ab8c33f0c1b932b48cb5c55a9cd0c95b7" kindref="member">buf</ref>;</highlight></codeline> <codeline lineno="156"><highlight class="normal"></highlight></codeline> <codeline lineno="157"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfile" kindref="compound">file</ref><sp/>*<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="158"><highlight class="normal"></highlight></codeline> <codeline lineno="159"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpipeInfo" kindref="compound">pipeInfo</ref><sp/>*pFD<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="160"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpipeInfo" kindref="compound">pipeInfo</ref><sp/>*rpFD<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="161"><highlight class="normal"></highlight></codeline> <codeline lineno="162"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>nbytes;</highlight></codeline> <codeline lineno="163"><highlight class="normal"></highlight></codeline> <codeline lineno="164"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>rpCNT<sp/>=<sp/>0;</highlight></codeline> <codeline lineno="165"><highlight class="normal"></highlight></codeline> <codeline lineno="166"><highlight class="normal"><sp/><sp/><ref refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" kindref="member">getfd</ref>(td,<sp/>&fd,<sp/>args-><ref refid="structsys__read__args_1a024d936329e4045013cda3e3c872cc1e" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="167"><highlight class="normal"></highlight></codeline> <codeline lineno="168"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(args-><ref refid="structsys__read__args_1a024d936329e4045013cda3e3c872cc1e" kindref="member">fd</ref><sp/>><sp/>3)<sp/>{</highlight></codeline> <codeline lineno="169"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(fd-><ref refid="structfile_1ac43cc1da8bee1eb339249ad88518f769" kindref="member">fd_type</ref>)<sp/>{</highlight></codeline> <codeline lineno="170"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>3:<sp/></highlight><highlight class="comment">/*<sp/>XXX<sp/>-<sp/>Pipe2<sp/>Handling<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="171"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pFD<sp/>=<sp/>fd-><ref refid="structfile_1adfb0c6311589d1d62b720c9610430ad0" kindref="member">data</ref>;</highlight></codeline> <codeline lineno="172"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(pFD-><ref refid="structpipeInfo_1a1af79350f10c92db334eb798c2e073e1" kindref="member">bCNT</ref><sp/>==<sp/>0<sp/>&&<sp/>rpCNT<sp/><<sp/>100)<sp/>{</highlight></codeline> <codeline lineno="173"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a08933fe6d593a1c78b9080359f15a0b7" kindref="member">sched_yield</ref>();</highlight></codeline> <codeline lineno="174"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>rpCNT++;</highlight></codeline> <codeline lineno="175"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="176"><highlight class="normal"></highlight></codeline> <codeline lineno="177"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(rpCNT<sp/>>=<sp/>100<sp/>&&<sp/>pFD-><ref refid="structpipeInfo_1a1af79350f10c92db334eb798c2e073e1" kindref="member">bCNT</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline> <codeline lineno="178"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>0;</highlight></codeline> <codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="181"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nbytes<sp/>=<sp/>(args-><ref refid="structsys__read__args_1ac062bed8f21a0fd19f35ceaf95533a4e" kindref="member">nbyte</ref><sp/>-<sp/>(pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref>-><ref refid="structpipeBuf_1aeec091b287e397899ae81495cd80f464" kindref="member">nbytes</ref><sp/>-<sp/>pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref>-><ref refid="structpipeBuf_1a117747ee40ba0c3fbb36e1b81d01bd61" kindref="member">offset</ref>)<sp/><=<sp/>0)<sp/>?<sp/>args-><ref refid="structsys__read__args_1ac062bed8f21a0fd19f35ceaf95533a4e" kindref="member">nbyte</ref><sp/>:<sp/>(pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref>-><ref refid="structpipeBuf_1aeec091b287e397899ae81495cd80f464" kindref="member">nbytes</ref><sp/>-<sp/>pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref>-><ref refid="structpipeBuf_1a117747ee40ba0c3fbb36e1b81d01bd61" kindref="member">offset</ref>);</highlight></codeline> <codeline lineno="182"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//kprintf("[unb:<sp/>,<sp/>nbs:<sp/>%i,<sp/>bf:<sp/>0x%X]",<sp/>args->nbyte,<sp/>nbytes,<sp/>fd->fd->buffer);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="183"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//kprintf("PR:<sp/>[]",<sp/>nbytes);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="184"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c" kindref="member">memcpy</ref>(args-><ref refid="structsys__read__args_1ab8c33f0c1b932b48cb5c55a9cd0c95b7" kindref="member">buf</ref>,<sp/>pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref>-><ref refid="structpipeBuf_1aa910cff72b25f70395e2cc68ecc9a18d" kindref="member">buffer</ref><sp/>+<sp/>pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref>-><ref refid="structpipeBuf_1a117747ee40ba0c3fbb36e1b81d01bd61" kindref="member">offset</ref>,<sp/>nbytes);</highlight></codeline> <codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref>-><ref refid="structpipeBuf_1a117747ee40ba0c3fbb36e1b81d01bd61" kindref="member">offset</ref><sp/>+=<sp/>nbytes;</highlight></codeline> <codeline lineno="186"><highlight class="normal"></highlight></codeline> <codeline lineno="187"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref>-><ref refid="structpipeBuf_1a117747ee40ba0c3fbb36e1b81d01bd61" kindref="member">offset</ref><sp/>>=<sp/>pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref>-><ref refid="structpipeBuf_1aeec091b287e397899ae81495cd80f464" kindref="member">nbytes</ref>)<sp/>{</highlight></codeline> <codeline lineno="188"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>rpFD<sp/>=<sp/>pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref>;</highlight></codeline> <codeline lineno="189"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref><sp/>=<sp/>pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref>-><ref refid="structpipeBuf_1ad9a3f124f1d677ea353fcc8cfc76a46d" kindref="member">next</ref>;</highlight></codeline> <codeline lineno="190"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(rpFD);</highlight></codeline> <codeline lineno="191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pFD-><ref refid="structpipeInfo_1a1af79350f10c92db334eb798c2e073e1" kindref="member">bCNT</ref>--;</highlight></codeline> <codeline lineno="192"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="193"><highlight class="normal"></highlight></codeline> <codeline lineno="194"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>nbytes;</highlight></codeline> <codeline lineno="195"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="196"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="197"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline> <codeline lineno="198"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//kprintf("[r:0x%X::%i:%s]",fd->fd,<sp/>args->fd,<sp/>fd->fd_type,<sp/>fd->fd->fileName);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="199"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/><ref refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" kindref="member">fread</ref>(args-><ref refid="structsys__read__args_1ab8c33f0c1b932b48cb5c55a9cd0c95b7" kindref="member">buf</ref>,<sp/>args-><ref refid="structsys__read__args_1ac062bed8f21a0fd19f35ceaf95533a4e" kindref="member">nbyte</ref>,<sp/>1,<sp/>fd-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="200"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="201"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="202"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="203"><highlight class="normal"><sp/><sp/><sp/><sp/>bf[1]<sp/>=<sp/></highlight><highlight class="charliteral">'\0'</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="204"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4563a310626d4f4ea885f4532356abb3" kindref="member">term</ref><sp/>==<sp/><ref refid="tty_8h_1aafbb5679104334c34d7691b2de7d7a86" kindref="member">tty_foreground</ref>)</highlight></codeline> <codeline lineno="205"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>c<sp/>=<sp/><ref refid="include_2vfs_2file_8h_1ac45fdeab51c3197c1e7c4ec7beabaca9" kindref="member">getchar</ref>();</highlight></codeline> <codeline lineno="206"><highlight class="normal"></highlight></codeline> <codeline lineno="207"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(x<sp/>=<sp/>0;<sp/>x<sp/><<sp/>args-><ref refid="structsys__read__args_1ac062bed8f21a0fd19f35ceaf95533a4e" kindref="member">nbyte</ref><sp/>&&<sp/>c<sp/>!=<sp/></highlight><highlight class="charliteral">'\n'</highlight><highlight class="normal">;)<sp/>{</highlight></codeline> <codeline lineno="208"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4563a310626d4f4ea885f4532356abb3" kindref="member">term</ref><sp/>==<sp/><ref refid="tty_8h_1aafbb5679104334c34d7691b2de7d7a86" kindref="member">tty_foreground</ref>)<sp/>{</highlight></codeline> <codeline lineno="209"><highlight class="normal"></highlight></codeline> <codeline lineno="210"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>!=<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="211"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>[x++]<sp/>=<sp/>c;</highlight></codeline> <codeline lineno="212"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>bf[0]<sp/>=<sp/>c;</highlight></codeline> <codeline lineno="213"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(bf);</highlight></codeline> <codeline lineno="214"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="215"><highlight class="normal"></highlight></codeline> <codeline lineno="216"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>==<sp/></highlight><highlight class="charliteral">'\n'</highlight><highlight class="normal">)<sp/>{</highlight></codeline> <codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>[x++]<sp/>=<sp/>c;</highlight></codeline> <codeline lineno="218"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="220"><highlight class="normal"></highlight></codeline> <codeline lineno="221"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a08933fe6d593a1c78b9080359f15a0b7" kindref="member">sched_yield</ref>();</highlight></codeline> <codeline lineno="222"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>c<sp/>=<sp/><ref refid="include_2vfs_2file_8h_1ac45fdeab51c3197c1e7c4ec7beabaca9" kindref="member">getchar</ref>();</highlight></codeline> <codeline lineno="223"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="225"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a08933fe6d593a1c78b9080359f15a0b7" kindref="member">sched_yield</ref>();</highlight></codeline> <codeline lineno="226"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="227"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="228"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>==<sp/></highlight><highlight class="charliteral">'\n'</highlight><highlight class="normal">)</highlight></codeline> <codeline lineno="229"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>[x++]<sp/>=<sp/></highlight><highlight class="charliteral">'\n'</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="230"><highlight class="normal"></highlight></codeline> <codeline lineno="231"><highlight class="normal"><sp/><sp/><sp/><sp/>bf[0]<sp/>=<sp/></highlight><highlight class="charliteral">'\n'</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="232"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(bf);</highlight></codeline> <codeline lineno="233"><highlight class="normal"></highlight></codeline> <codeline lineno="234"><highlight class="normal"><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>x;</highlight></codeline> <codeline lineno="235"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="236"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline> <codeline lineno="237"><highlight class="normal">}</highlight></codeline> <codeline lineno="238"><highlight class="normal"></highlight></codeline> <codeline lineno="239" refid="vfs__calls_8c_1a883455624440fedf2b1af73d313e0ade" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vfs__calls_8c_1a883455624440fedf2b1af73d313e0ade" kindref="member">sys_pread</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*td,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__pread__args" kindref="compound">sys_pread_args</ref><sp/>*args)<sp/>{</highlight></codeline> <codeline lineno="240"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>offset<sp/>=<sp/>0;</highlight></codeline> <codeline lineno="241"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0;</highlight></codeline> <codeline lineno="242"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>c<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="243"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>bf[2];</highlight></codeline> <codeline lineno="244"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">volatile</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="structbuf" kindref="compound">buf</ref><sp/>=<sp/>args-><ref refid="structsys__pread__args_1acbb492abfd48a374f07bbd00cdf46464" kindref="member">buf</ref>;</highlight></codeline> <codeline lineno="245"><highlight class="normal"></highlight></codeline> <codeline lineno="246"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfile" kindref="compound">file</ref><sp/>*<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="247"><highlight class="normal"></highlight></codeline> <codeline lineno="248"><highlight class="normal"><sp/><sp/><ref refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" kindref="member">getfd</ref>(td,<sp/>&<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>,<sp/>args-><ref refid="structsys__pread__args_1a58ed22347b5642bc16f57888bf4f19a4" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="249"><highlight class="normal"></highlight></codeline> <codeline lineno="250"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(args-><ref refid="structsys__pread__args_1a58ed22347b5642bc16f57888bf4f19a4" kindref="member">fd</ref><sp/>><sp/>3)<sp/>{</highlight></codeline> <codeline lineno="251"><highlight class="normal"><sp/><sp/><sp/><sp/>offset<sp/>=<sp/><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>->fd-><ref refid="structfileDescriptor_1a09c5cd0d4979a70b8d7098319cd00b7c" kindref="member">offset</ref>;</highlight></codeline> <codeline lineno="252"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>->fd-><ref refid="structfileDescriptor_1a09c5cd0d4979a70b8d7098319cd00b7c" kindref="member">offset</ref><sp/>=<sp/>args-><ref refid="structsys__pread__args_1a7637975c89393f51333047c84fa82750" kindref="member">offset</ref>;</highlight></codeline> <codeline lineno="253"><highlight class="normal"><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/><ref refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" kindref="member">fread</ref>(args-><ref refid="structsys__pread__args_1acbb492abfd48a374f07bbd00cdf46464" kindref="member">buf</ref>,<sp/>args-><ref refid="structsys__pread__args_1a3da203fe77c7e92a0850db3da81c540a" kindref="member">nbyte</ref>,<sp/>1,<sp/><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>->fd);</highlight></codeline> <codeline lineno="254"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>->fd-><ref refid="structfileDescriptor_1a09c5cd0d4979a70b8d7098319cd00b7c" kindref="member">offset</ref><sp/>=<sp/>offset;</highlight></codeline> <codeline lineno="255"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="256"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="257"><highlight class="normal"><sp/><sp/><sp/><sp/>bf[1]<sp/>=<sp/></highlight><highlight class="charliteral">'\0'</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="258"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4563a310626d4f4ea885f4532356abb3" kindref="member">term</ref><sp/>==<sp/><ref refid="tty_8h_1aafbb5679104334c34d7691b2de7d7a86" kindref="member">tty_foreground</ref>)</highlight></codeline> <codeline lineno="259"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>c<sp/>=<sp/><ref refid="include_2vfs_2file_8h_1ac45fdeab51c3197c1e7c4ec7beabaca9" kindref="member">getchar</ref>();</highlight></codeline> <codeline lineno="260"><highlight class="normal"></highlight></codeline> <codeline lineno="261"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(x<sp/>=<sp/>0;<sp/>x<sp/><<sp/>args-><ref refid="structsys__pread__args_1a3da203fe77c7e92a0850db3da81c540a" kindref="member">nbyte</ref><sp/>&&<sp/>c<sp/>!=<sp/></highlight><highlight class="charliteral">'\n'</highlight><highlight class="normal">;)<sp/>{</highlight></codeline> <codeline lineno="262"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4563a310626d4f4ea885f4532356abb3" kindref="member">term</ref><sp/>==<sp/><ref refid="tty_8h_1aafbb5679104334c34d7691b2de7d7a86" kindref="member">tty_foreground</ref>)<sp/>{</highlight></codeline> <codeline lineno="263"><highlight class="normal"></highlight></codeline> <codeline lineno="264"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>!=<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="265"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>[x++]<sp/>=<sp/>c;</highlight></codeline> <codeline lineno="266"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>bf[0]<sp/>=<sp/>c;</highlight></codeline> <codeline lineno="267"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(bf);</highlight></codeline> <codeline lineno="268"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="269"><highlight class="normal"></highlight></codeline> <codeline lineno="270"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>==<sp/></highlight><highlight class="charliteral">'\n'</highlight><highlight class="normal">)<sp/>{</highlight></codeline> <codeline lineno="271"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>[x++]<sp/>=<sp/>c;</highlight></codeline> <codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="273"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="274"><highlight class="normal"></highlight></codeline> <codeline lineno="275"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a08933fe6d593a1c78b9080359f15a0b7" kindref="member">sched_yield</ref>();</highlight></codeline> <codeline lineno="276"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>c<sp/>=<sp/><ref refid="include_2vfs_2file_8h_1ac45fdeab51c3197c1e7c4ec7beabaca9" kindref="member">getchar</ref>();</highlight></codeline> <codeline lineno="277"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="278"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="279"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a08933fe6d593a1c78b9080359f15a0b7" kindref="member">sched_yield</ref>();</highlight></codeline> <codeline lineno="280"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="282"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>==<sp/></highlight><highlight class="charliteral">'\n'</highlight><highlight class="normal">)</highlight></codeline> <codeline lineno="283"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>[x++]<sp/>=<sp/></highlight><highlight class="charliteral">'\n'</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="284"><highlight class="normal"></highlight></codeline> <codeline lineno="285"><highlight class="normal"><sp/><sp/><sp/><sp/>bf[0]<sp/>=<sp/></highlight><highlight class="charliteral">'\n'</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="286"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(bf);</highlight></codeline> <codeline lineno="287"><highlight class="normal"></highlight></codeline> <codeline lineno="288"><highlight class="normal"><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>x;</highlight></codeline> <codeline lineno="289"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="290"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline> <codeline lineno="291"><highlight class="normal">}</highlight></codeline> <codeline lineno="292"><highlight class="normal"></highlight></codeline> <codeline lineno="293" refid="vfs__calls_8c_1a159495d16f0ec154193733ad4fb1fc71" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vfs__calls_8c_1a159495d16f0ec154193733ad4fb1fc71" kindref="member">sys_write</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*td,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__write__args" kindref="compound">sys_write_args</ref><sp/>*uap)<sp/>{</highlight></codeline> <codeline lineno="294"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="295"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfile" kindref="compound">file</ref><sp/>*<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="296"><highlight class="normal"></highlight></codeline> <codeline lineno="297"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpipeInfo" kindref="compound">pipeInfo</ref><sp/>*pFD<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="298"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpipeBuf" kindref="compound">pipeBuf</ref><sp/>*pBuf<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="299"><highlight class="normal"></highlight></codeline> <codeline lineno="300"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/><ref refid="structpipeBuf_1aeec091b287e397899ae81495cd80f464" kindref="member">nbytes</ref>;</highlight></codeline> <codeline lineno="301"><highlight class="normal"></highlight></codeline> <codeline lineno="302"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(uap-><ref refid="structsys__write__args_1a45cd1139d4d410f71c8cec212e6ff3ec" kindref="member">fd</ref><sp/>==<sp/>2)<sp/>{</highlight></codeline> <codeline lineno="303"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref><sp/>=<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(1024);</highlight></codeline> <codeline lineno="304"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c" kindref="member">memcpy</ref>(<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>,<sp/>uap-><ref refid="structsys__write__args_1a0d548a06729e6674b8310634e345f07f" kindref="member">buf</ref>,<sp/>uap-><ref refid="structsys__write__args_1ac441511caeedf53cf8c315f482bb9863" kindref="member">nbyte</ref>);</highlight></codeline> <codeline lineno="305"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="video_8h_1aa6d08b2dd961295607e6a5d52f1d471e" kindref="member">printColor</ref><sp/>+=<sp/>1;</highlight></codeline> <codeline lineno="306"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>);</highlight></codeline> <codeline lineno="307"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="video_8h_1aa6d08b2dd961295607e6a5d52f1d471e" kindref="member">printColor</ref><sp/>=<sp/><ref refid="video_8h_1a2984c3db0ad3a4a571a8ee0b4d2fe90b" kindref="member">defaultColor</ref>;</highlight></codeline> <codeline lineno="308"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>);</highlight></codeline> <codeline lineno="309"><highlight class="normal"><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>uap-><ref refid="structsys__write__args_1ac441511caeedf53cf8c315f482bb9863" kindref="member">nbyte</ref>;</highlight></codeline> <codeline lineno="310"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="311"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(uap-><ref refid="structsys__write__args_1a45cd1139d4d410f71c8cec212e6ff3ec" kindref="member">fd</ref><sp/>==<sp/>1<sp/>&&<sp/>((</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfile" kindref="compound">file</ref>*)<sp/>td-><ref refid="structthread_1a68f1e552f18575d52731e9e61ad411fe" kindref="member">o_files</ref>[1])->fd<sp/>==<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref><sp/>=<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(1024);</highlight></codeline> <codeline lineno="313"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c" kindref="member">memcpy</ref>(<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>,<sp/>uap-><ref refid="structsys__write__args_1a0d548a06729e6674b8310634e345f07f" kindref="member">buf</ref>,<sp/>uap-><ref refid="structsys__write__args_1ac441511caeedf53cf8c315f482bb9863" kindref="member">nbyte</ref>);</highlight></codeline> <codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>);</highlight></codeline> <codeline lineno="315"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>);</highlight></codeline> <codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>uap-><ref refid="structsys__write__args_1ac441511caeedf53cf8c315f482bb9863" kindref="member">nbyte</ref>;</highlight></codeline> <codeline lineno="317"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="318"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" kindref="member">getfd</ref>(td,<sp/>&fd,<sp/>uap-><ref refid="structsys__write__args_1a45cd1139d4d410f71c8cec212e6ff3ec" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="320"><highlight class="normal"></highlight></codeline> <codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//kprintf("[fd:<sp/>%i:0x%X,<sp/>fd_type:<sp/>%i]",<sp/>uap->fd,<sp/>fd,<sp/>fd->fd_type);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="322"><highlight class="normal"></highlight></codeline> <codeline lineno="323"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(fd-><ref refid="structfile_1ac43cc1da8bee1eb339249ad88518f769" kindref="member">fd_type</ref>)<sp/>{</highlight></codeline> <codeline lineno="324"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>3:<sp/></highlight><highlight class="comment">/*<sp/>XXX<sp/>-<sp/>Temp<sp/>Pipe<sp/>Stuff<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="325"><highlight class="normal"></highlight></codeline> <codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pFD<sp/>=<sp/>fd-><ref refid="structfile_1adfb0c6311589d1d62b720c9610430ad0" kindref="member">data</ref>;</highlight></codeline> <codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pBuf<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpipeBuf" kindref="compound">pipeBuf</ref>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpipeBuf" kindref="compound">pipeBuf</ref>));</highlight></codeline> <codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pBuf-><ref refid="structpipeBuf_1aa910cff72b25f70395e2cc68ecc9a18d" kindref="member">buffer</ref><sp/>=<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(uap-><ref refid="structsys__write__args_1ac441511caeedf53cf8c315f482bb9863" kindref="member">nbyte</ref>);</highlight></codeline> <codeline lineno="329"><highlight class="normal"></highlight></codeline> <codeline lineno="330"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c" kindref="member">memcpy</ref>(pBuf-><ref refid="structpipeBuf_1aa910cff72b25f70395e2cc68ecc9a18d" kindref="member">buffer</ref>,<sp/>uap-><ref refid="structsys__write__args_1a0d548a06729e6674b8310634e345f07f" kindref="member">buf</ref>,<sp/>uap-><ref refid="structsys__write__args_1ac441511caeedf53cf8c315f482bb9863" kindref="member">nbyte</ref>);</highlight></codeline> <codeline lineno="331"><highlight class="normal"></highlight></codeline> <codeline lineno="332"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pBuf-><ref refid="structpipeBuf_1aeec091b287e397899ae81495cd80f464" kindref="member">nbytes</ref><sp/>=<sp/>uap-><ref refid="structsys__write__args_1ac441511caeedf53cf8c315f482bb9863" kindref="member">nbyte</ref>;</highlight></codeline> <codeline lineno="333"><highlight class="normal"></highlight></codeline> <codeline lineno="334"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pFD-><ref refid="structpipeInfo_1a3bd26f08a5757a3e89049a8f1d7c0831" kindref="member">tailPB</ref>)</highlight></codeline> <codeline lineno="335"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pFD-><ref refid="structpipeInfo_1a3bd26f08a5757a3e89049a8f1d7c0831" kindref="member">tailPB</ref>-><ref refid="structpipeBuf_1ad9a3f124f1d677ea353fcc8cfc76a46d" kindref="member">next</ref><sp/>=<sp/>pBuf;</highlight></codeline> <codeline lineno="336"><highlight class="normal"></highlight></codeline> <codeline lineno="337"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pFD-><ref refid="structpipeInfo_1a3bd26f08a5757a3e89049a8f1d7c0831" kindref="member">tailPB</ref><sp/>=<sp/>pBuf;</highlight></codeline> <codeline lineno="338"><highlight class="normal"></highlight></codeline> <codeline lineno="339"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref>)</highlight></codeline> <codeline lineno="340"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pFD-><ref refid="structpipeInfo_1a17d5f665e9b347438e7062904ece1cfa" kindref="member">headPB</ref><sp/>=<sp/>pBuf;</highlight></codeline> <codeline lineno="341"><highlight class="normal"></highlight></codeline> <codeline lineno="342"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pFD-><ref refid="structpipeInfo_1a1af79350f10c92db334eb798c2e073e1" kindref="member">bCNT</ref>++;</highlight></codeline> <codeline lineno="343"><highlight class="normal"></highlight></codeline> <codeline lineno="344"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/><ref refid="structpipeBuf_1aeec091b287e397899ae81495cd80f464" kindref="member">nbytes</ref>;</highlight></codeline> <codeline lineno="345"><highlight class="normal"></highlight></codeline> <codeline lineno="346"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="347"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline> <codeline lineno="348"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(fd-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>)<sp/>{</highlight></codeline> <codeline lineno="349"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"[0x%X]"</highlight><highlight class="normal">,<sp/>fd-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>-><ref refid="structfileDescriptor_1acf8de2682bb1eaedd14cc477895982d5" kindref="member">res</ref>);</highlight></codeline> <codeline lineno="350"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/><ref refid="file_8c_1a803ecb7dac37bee57ef3fe11c7899d36" kindref="member">fwrite</ref>(uap-><ref refid="structsys__write__args_1a0d548a06729e6674b8310634e345f07f" kindref="member">buf</ref>,<sp/>uap-><ref refid="structsys__write__args_1ac441511caeedf53cf8c315f482bb9863" kindref="member">nbyte</ref>,<sp/>1,<sp/>fd-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="351"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="352"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="353"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"[%i]"</highlight><highlight class="normal">,<sp/>uap-><ref refid="structsys__write__args_1ac441511caeedf53cf8c315f482bb9863" kindref="member">nbyte</ref>);</highlight></codeline> <codeline lineno="354"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref><sp/>=<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(uap-><ref refid="structsys__write__args_1ac441511caeedf53cf8c315f482bb9863" kindref="member">nbyte</ref>);</highlight></codeline> <codeline lineno="355"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c" kindref="member">memcpy</ref>(<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>,<sp/>uap-><ref refid="structsys__write__args_1a0d548a06729e6674b8310634e345f07f" kindref="member">buf</ref>,<sp/>uap-><ref refid="structsys__write__args_1ac441511caeedf53cf8c315f482bb9863" kindref="member">nbyte</ref>);</highlight></codeline> <codeline lineno="356"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"(%i)<sp/>%s"</highlight><highlight class="normal">,<sp/>uap-><ref refid="structsys__write__args_1a45cd1139d4d410f71c8cec212e6ff3ec" kindref="member">fd</ref>,<sp/>uap-><ref refid="structsys__write__args_1a0d548a06729e6674b8310634e345f07f" kindref="member">buf</ref>);</highlight></codeline> <codeline lineno="357"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>);</highlight></codeline> <codeline lineno="358"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>uap-><ref refid="structsys__write__args_1ac441511caeedf53cf8c315f482bb9863" kindref="member">nbyte</ref>;</highlight></codeline> <codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="361"><highlight class="normal"></highlight></codeline> <codeline lineno="362"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="363"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0x0);</highlight></codeline> <codeline lineno="364"><highlight class="normal">}</highlight></codeline> <codeline lineno="365"><highlight class="normal"></highlight></codeline> <codeline lineno="366" refid="vfs__calls_8c_1a41fe0d27f7d876628b08c74821e180c8" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vfs__calls_8c_1a41fe0d27f7d876628b08c74821e180c8" kindref="member">sys_access</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*td,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__access__args" kindref="compound">sys_access_args</ref><sp/>*args)<sp/>{</highlight></codeline> <codeline lineno="367"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>XXX<sp/>-<sp/>This<sp/>is<sp/>a<sp/>temporary<sp/>as<sp/>it<sp/>always<sp/>returns<sp/>true<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="368"><highlight class="normal"></highlight></codeline> <codeline lineno="369"><highlight class="normal"><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>0;</highlight></codeline> <codeline lineno="370"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline> <codeline lineno="371"><highlight class="normal">}</highlight></codeline> <codeline lineno="372"><highlight class="normal"></highlight></codeline> <codeline lineno="373" refid="vfs__calls_8c_1aec77dd1139b0a36d6aa7b29d08039bc1" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vfs__calls_8c_1aec77dd1139b0a36d6aa7b29d08039bc1" kindref="member">sys_getdirentries</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*td,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__getdirentries__args" kindref="compound">sys_getdirentries_args</ref><sp/>*args)<sp/>{</highlight></codeline> <codeline lineno="374"><highlight class="normal"></highlight></codeline> <codeline lineno="375"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfile" kindref="compound">file</ref><sp/>*<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="376"><highlight class="normal"></highlight></codeline> <codeline lineno="377"><highlight class="normal"><sp/><sp/><ref refid="descrip_8h_1a14e228d6e5391a882d3b20ff2466b2ac" kindref="member">getfd</ref>(td,<sp/>&<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>,<sp/>args-><ref refid="structsys__getdirentries__args_1afa5ee0d234caa9962f5d4e72c6d23b72" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="378"><highlight class="normal"></highlight></codeline> <codeline lineno="379"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/><ref refid="structbuf" kindref="compound">buf</ref>[<ref refid="gpt_8h_1a9c8466b6111a11195a5cd2478c648e32" kindref="member">DEV_BSIZE</ref>];</highlight></codeline> <codeline lineno="380"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structdirent" kindref="compound">dirent</ref><sp/>*d;</highlight></codeline> <codeline lineno="381"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*s;</highlight></codeline> <codeline lineno="382"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a87bd983bf349d8b86901f3200d559e8e" kindref="member">ssize_t</ref><sp/>n;</highlight></codeline> <codeline lineno="383"><highlight class="normal"></highlight></codeline> <codeline lineno="384"><highlight class="normal"><sp/><sp/>td-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/><ref refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" kindref="member">fread</ref>(args-><ref refid="structsys__getdirentries__args_1a3d55ee6aac44557c59c772df9cbe4879" kindref="member">buf</ref>,<sp/>args-><ref refid="structsys__getdirentries__args_1ad4c8ed1d8fe7dcf39d9e7dc2d8ee4db5" kindref="member">count</ref>,<sp/>1,<sp/>fd-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="385"><highlight class="normal"></highlight></codeline> <codeline lineno="386"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline> <codeline lineno="387"><highlight class="normal">}</highlight></codeline> <codeline lineno="388"><highlight class="normal"></highlight></codeline> <codeline lineno="389" refid="vfs__calls_8c_1a35d9649c48f61f1511e9d5de290e4991" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vfs__calls_8c_1a35d9649c48f61f1511e9d5de290e4991" kindref="member">sys_readlink</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*thr,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structsys__readlink__args" kindref="compound">sys_readlink_args</ref><sp/>*args)<sp/>{</highlight></codeline> <codeline lineno="390"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>XXX<sp/>-<sp/>Need<sp/>to<sp/>implement<sp/>readlink<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="391"><highlight class="normal"></highlight></codeline> <codeline lineno="392"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"RL:<sp/>%s:\n"</highlight><highlight class="normal">,<sp/>args-><ref refid="structsys__readlink__args_1a1fe89dd18120f3820ef9f8b746f73b6c" kindref="member">path</ref>,<sp/>args-><ref refid="structsys__readlink__args_1ae4b18f6982f02caf736ac80e6a8563d5" kindref="member">count</ref>);</highlight></codeline> <codeline lineno="393"><highlight class="normal"></highlight></codeline> <codeline lineno="394"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//Return<sp/>Error</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="395"><highlight class="normal"><sp/><sp/>thr-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>2;</highlight></codeline> <codeline lineno="396"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(-1);</highlight></codeline> <codeline lineno="397"><highlight class="normal">}</highlight></codeline> <codeline lineno="398"><highlight class="normal"></highlight></codeline> <codeline lineno="399" refid="vfs__calls_8c_1ab35b14c33a5b03f7617b58b4c0667bd4" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vfs__calls_8c_1ab35b14c33a5b03f7617b58b4c0667bd4" kindref="member">kern_openat</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*thr,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>afd,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*path,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>flags,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>mode)<sp/>{</highlight></codeline> <codeline lineno="400"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>error<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="401"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>fd<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="402"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfile" kindref="compound">file</ref><sp/>*nfp<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="403"><highlight class="normal"></highlight></codeline> <codeline lineno="404"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="405"><highlight class="comment"><sp/><sp/><sp/>*<sp/>Only<sp/>one<sp/>of<sp/>the<sp/>O_EXEC,<sp/>O_RDONLY,<sp/>O_WRONLY<sp/>and<sp/>O_RDWR<sp/>flags</highlight></codeline> <codeline lineno="406"><highlight class="comment"><sp/><sp/><sp/>*<sp/>may<sp/>be<sp/>specified.</highlight></codeline> <codeline lineno="407"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="408"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>&<sp/><ref refid="fcntl_8h_1a459542206659fbe295eb4183f8b8f06c" kindref="member">O_EXEC</ref>)<sp/>{</highlight></codeline> <codeline lineno="409"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>&<sp/><ref refid="fcntl_8h_1a4dc4d45e07d2abc899bcaf04b2846a87" kindref="member">O_ACCMODE</ref>)</highlight></codeline> <codeline lineno="410"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="sys_2errno_8h_1a2d1678d5a7cc8ce499643f3b8957def4" kindref="member">EINVAL</ref>);</highlight></codeline> <codeline lineno="411"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="412"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((flags<sp/>&<sp/><ref refid="fcntl_8h_1a4dc4d45e07d2abc899bcaf04b2846a87" kindref="member">O_ACCMODE</ref>)<sp/>==<sp/><ref refid="fcntl_8h_1a4dc4d45e07d2abc899bcaf04b2846a87" kindref="member">O_ACCMODE</ref>)<sp/>{</highlight></codeline> <codeline lineno="413"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="sys_2errno_8h_1a2d1678d5a7cc8ce499643f3b8957def4" kindref="member">EINVAL</ref>);</highlight></codeline> <codeline lineno="414"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="415"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="416"><highlight class="normal"><sp/><sp/><sp/><sp/>flags<sp/>=<sp/><ref refid="fcntl_8h_1a3c28c97a69c6ce8f87cac54a7c91f9db" kindref="member">FFLAGS</ref>(flags);</highlight></codeline> <codeline lineno="417"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="418"><highlight class="normal"></highlight></codeline> <codeline lineno="419"><highlight class="normal"><sp/><sp/>error<sp/>=<sp/><ref refid="descrip_8h_1a434fb15226182b0ee879a5afe9a8c190" kindref="member">falloc</ref>(thr,<sp/>&nfp,<sp/>&<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="420"><highlight class="normal"></highlight></codeline> <codeline lineno="421"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(error)<sp/>{</highlight></codeline> <codeline lineno="422"><highlight class="normal"><sp/><sp/><sp/><sp/>thr-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>-1;</highlight></codeline> <codeline lineno="423"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(error);</highlight></codeline> <codeline lineno="424"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="425"><highlight class="normal"></highlight></codeline> <codeline lineno="426"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>|<sp/><ref refid="fcntl_8h_1a1cf6b1de1fffedaa1d26b189e9a8d2cc" kindref="member">O_CREAT</ref>)</highlight></codeline> <codeline lineno="427"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"O_CREAT\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="428"><highlight class="normal"></highlight></codeline> <codeline lineno="429"><highlight class="normal"><sp/><sp/>nfp-><ref refid="structfile_1ad549b6a207bd14d3a8a8f8b5c3ee1b9a" kindref="member">f_flag</ref><sp/>=<sp/>flags<sp/>&<sp/><ref refid="fcntl_8h_1ab3f8268db3f2e8e22c6f52345799b3fb" kindref="member">FMASK</ref>;</highlight></codeline> <codeline lineno="430"><highlight class="normal"></highlight></codeline> <codeline lineno="431"><highlight class="normal"><sp/><sp/>nfp-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>=<sp/><ref refid="file_8c_1a249f3bc0af043dc5ac3c9aa8646986af" kindref="member">fopen</ref>(path,<sp/></highlight><highlight class="stringliteral">"rwb"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="432"><highlight class="normal"></highlight></codeline> <codeline lineno="433"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(nfp-><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>==<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="descrip_8c_1ae7b881d8f4c6e81d8e10468783ce080f" kindref="member">fdestroy</ref>(thr,<sp/>nfp,<sp/><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>);</highlight></codeline> <codeline lineno="435"><highlight class="normal"></highlight></codeline> <codeline lineno="436"><highlight class="normal"><sp/><sp/><sp/><sp/>thr-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>-1;</highlight></codeline> <codeline lineno="437"><highlight class="normal"></highlight></codeline> <codeline lineno="438"><highlight class="normal"><sp/><sp/><sp/><sp/>error<sp/>=<sp/>-1;</highlight></codeline> <codeline lineno="439"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="440"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="441"><highlight class="normal"><sp/><sp/><sp/><sp/>thr-><ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/><ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref>;</highlight></codeline> <codeline lineno="442"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="443"><highlight class="normal"></highlight></codeline> <codeline lineno="444"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//kprintf("sO:<sp/>0x%X:%s:",<sp/>args->mode,<sp/>args->path,<sp/>td->td_retval[0]);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="445"><highlight class="normal"></highlight></codeline> <codeline lineno="446"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(error);</highlight></codeline> <codeline lineno="447"><highlight class="normal"></highlight></codeline> <codeline lineno="448"><highlight class="normal">}</highlight></codeline> </programlisting> <location file="C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c"/> </compounddef> </doxygen>