<?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="sem_8c" kind="file" language="C++"> <compoundname>sem.c</compoundname> <includes refid="sem_8h" local="no">ubixos/sem.h</includes> <includes refid="include_2sys_2types_8h" local="no">sys/types.h</includes> <includes refid="ubixos_2errno_8h" local="no">ubixos/errno.h</includes> <includes refid="time_8h" local="no">ubixos/time.h</includes> <includes refid="kpanic_8h" local="no">ubixos/kpanic.h</includes> <includes refid="kmalloc_8h" local="no">lib/kmalloc.h</includes> <incdepgraph> <node id="24"> <label>ufs/ufs.h</label> <link refid="ufs_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="25" relation="include"> </childnode> </node> <node id="31"> <label>ubixos/kpanic.h</label> <link refid="kpanic_8h"/> </node> <node id="2"> <label>ubixos/sem.h</label> <link refid="sem_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="10" relation="include"> </childnode> <childnode refid="11" relation="include"> </childnode> </node> <node id="28"> <label>sys/tss.h</label> <link refid="tss_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="30"> <label>sys/io.h</label> <link refid="io_8h"/> </node> <node id="10"> <label>ubixos/errno.h</label> <link refid="ubixos_2errno_8h"/> </node> <node id="27"> <label>ubixos/tty.h</label> <link refid="tty_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="17"> <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="20"> <label>vfs/inode.h</label> <link refid="inode_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="21" relation="include"> </childnode> <childnode refid="22" relation="include"> </childnode> <childnode refid="23" relation="include"> </childnode> <childnode refid="24" relation="include"> </childnode> </node> <node id="11"> <label>ubixos/ubthread.h</label> <link refid="ubthread_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="12" relation="include"> </childnode> <childnode refid="29" 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="32"> <label>lib/kmalloc.h</label> <link refid="kmalloc_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="1"> <label>C:/Dev/git/UbixOS/sys/kernel/sem.c</label> <link refid="sem_8c"/> <childnode refid="2" relation="include"> </childnode> <childnode refid="3" relation="include"> </childnode> <childnode refid="10" relation="include"> </childnode> <childnode refid="29" relation="include"> </childnode> <childnode refid="31" relation="include"> </childnode> <childnode refid="32" relation="include"> </childnode> </node> <node id="26"> <label>vfs/mount.h</label> <link refid="mount_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="19"> <label>sys/resource.h</label> <link refid="resource_8h"/> <childnode refid="4" relation="include"> </childnode> </node> <node id="16"> <label>sys/trap.h</label> <link refid="trap_8h"/> <childnode refid="17" 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="13"> <label>vfs/file.h</label> <link refid="include_2vfs_2file_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="14" relation="include"> </childnode> <childnode refid="15" relation="include"> </childnode> <childnode refid="20" relation="include"> </childnode> <childnode refid="26" relation="include"> </childnode> <childnode refid="24" relation="include"> </childnode> </node> <node id="23"> <label>fs/msdos_fs.h</label> <link refid="msdos__fs_8h"/> </node> <node id="18"> <label>sys/signal.h</label> <link refid="sys_2signal_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="22"> <label>fs/pipe_fs.h</label> <link refid="pipe__fs_8h"/> </node> <node id="21"> <label>ubixos/wait.h</label> <link refid="wait_8h"/> </node> <node id="15"> <label>sys/thread.h</label> <link refid="thread_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="16" relation="include"> </childnode> <childnode refid="18" relation="include"> </childnode> <childnode refid="19" relation="include"> </childnode> </node> <node id="6"> <label>sys/cdefs.h</label> <link refid="cdefs_8h"/> </node> <node id="29"> <label>ubixos/time.h</label> <link refid="time_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="7" relation="include"> </childnode> <childnode refid="30" relation="include"> </childnode> </node> <node id="12"> <label>ubixos/sched.h</label> <link refid="sched_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="13" relation="include"> </childnode> <childnode refid="27" relation="include"> </childnode> <childnode refid="28" relation="include"> </childnode> <childnode refid="15" 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="25"> <label>sys/device.h</label> <link refid="include_2sys_2device_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="14"> <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> </incdepgraph> <sectiondef kind="func"> <memberdef kind="function" id="sem_8c_1a31ab8f6dbb9646ed62f5e836b3639ad1" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sem_close</definition> <argsstring>(semID_t id)</argsstring> <name>sem_close</name> <param> <type><ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref></type> <declname>id</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/sem.c" line="36" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/sem.c" bodystart="36" bodyend="38"/> </memberdef> <memberdef kind="function" id="sem_8c_1aa386df202c6e9b90a1445a61ce694210" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></type> <definition>err_t sem_destroy</definition> <argsstring>(sys_sem_t **sem)</argsstring> <name>sem_destroy</name> <param> <type><ref refid="sem_8h_1a900e36da93bb688c29fc8148f2f44e04" kindref="member">sys_sem_t</ref> **</type> <declname>sem</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/sem.c" line="87" column="7" bodyfile="C:/Dev/git/UbixOS/sys/kernel/sem.c" bodystart="87" bodyend="100"/> <references refid="structsys__sem_1aa758e52262d23c22a40204e410b5f8c4" compoundref="sem_8h" startline="38">sys_sem::cond</references> <references refid="sys_2errno_8h_1a2d1678d5a7cc8ce499643f3b8957def4" compoundref="sys_2errno_8h" startline="55">EINVAL</references> <references refid="ubixos_2errno_8h_1a019daba146137ec289f49606cc1552fc" compoundref="ubixos_2errno_8h" startline="36">ENOERR</references> <references refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" compoundref="kmalloc_8c" startline="342" endline="382">kfree</references> <references refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" compoundref="sem_8h" startline="39">sys_sem::mutex</references> <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references> <references refid="ubthread_8h_1ae914fae69538736dc5e494c15ce93a17" compoundref="ubthread_8c" startline="71" endline="75">ubthread_cond_destroy</references> <references refid="ubthread_8h_1a278f5d5b1e11b6668b75da6a285442e4" compoundref="ubthread_8c" startline="77" endline="81">ubthread_mutex_destroy</references> <referencedby refid="group__sys__sem_1ga4d02e29e5dfa092559efc04dee985822" compoundref="sys__arch_8c" startline="75" endline="86">sys_sem_free</referencedby> </memberdef> <memberdef kind="function" id="sem_8c_1ab80213da2384984db11eeae2c92f8a72" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sem_getvalue</definition> <argsstring>(semID_t id, int *val)</argsstring> <name>sem_getvalue</name> <param> <type><ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref></type> <declname>id</declname> </param> <param> <type>int *</type> <declname>val</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/sem.c" line="83" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/sem.c" bodystart="83" bodyend="85"/> </memberdef> <memberdef kind="function" id="sem_8c_1a19bd6e9be9540104f4ab465624e9a579" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></type> <definition>err_t sem_init</definition> <argsstring>(sys_sem_t **sem, uint8_t count)</argsstring> <name>sem_init</name> <param> <type><ref refid="sem_8h_1a900e36da93bb688c29fc8148f2f44e04" kindref="member">sys_sem_t</ref> **</type> <declname>sem</declname> </param> <param> <type><ref refid="include_2sys_2types_8h_1a2aff71146ab4942b2b38860c749c4074" kindref="member">uint8_t</ref></type> <declname>count</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/sem.c" line="56" column="7" bodyfile="C:/Dev/git/UbixOS/sys/kernel/sem.c" bodystart="56" bodyend="73"/> <references refid="structsys__sem_1aa758e52262d23c22a40204e410b5f8c4" compoundref="sem_8h" startline="38">sys_sem::cond</references> <references refid="ubixos_2errno_8h_1a019daba146137ec289f49606cc1552fc" compoundref="ubixos_2errno_8h" startline="36">ENOERR</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="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" compoundref="sem_8h" startline="39">sys_sem::mutex</references> <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references> <references refid="structsys__sem_1ab9e4ecb1c4448468fb820025b7c773be" compoundref="sem_8h" startline="37">sys_sem::signaled</references> <references refid="ubthread_8h_1acbb7170a68758468ab5b02512a320112">ubthread_cond_init</references> <references refid="ubthread_8h_1ab6bfc2169b55532821582f24b68dc855">ubthread_mutex_init</references> <referencedby refid="group__sys__sem_1gadb68acad14b34550b9891bc11bbf4e63" compoundref="sys__arch_8c" startline="52" endline="72">sys_sem_new</referencedby> </memberdef> <memberdef kind="function" id="sem_8c_1a15c1835612c234029c20431e06a1917d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sem_open</definition> <argsstring>(semID_t *id, const char *name, int oflag, mode_t mode, unsigned int value)</argsstring> <name>sem_open</name> <param> <type><ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref> *</type> <declname>id</declname> </param> <param> <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> char *</type> <declname>name</declname> </param> <param> <type>int</type> <declname>oflag</declname> </param> <param> <type><ref refid="descrip_8h_1ae9f148ba55d84268ecb6f8031ab45076" kindref="member">mode_t</ref></type> <declname>mode</declname> </param> <param> <type>unsigned int</type> <declname>value</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/sem.c" line="75" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/sem.c" bodystart="75" bodyend="77"/> </memberdef> <memberdef kind="function" id="sem_8c_1a81988406ac7a65ee7d6782b97943320e" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sem_post</definition> <argsstring>(semID_t id)</argsstring> <name>sem_post</name> <param> <type><ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref></type> <declname>id</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/sem.c" line="40" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/sem.c" bodystart="40" bodyend="42"/> </memberdef> <memberdef kind="function" id="sem_8c_1a0e52c88f72f178cd67eb289e6f498c26" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sem_timedwait</definition> <argsstring>(semID_t id, const struct timespec *ts)</argsstring> <name>sem_timedwait</name> <param> <type><ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref></type> <declname>id</declname> </param> <param> <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> struct <ref refid="structtimespec" kindref="compound">timespec</ref> *</type> <declname>ts</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/sem.c" line="52" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/sem.c" bodystart="52" bodyend="54"/> </memberdef> <memberdef kind="function" id="sem_8c_1a46c76cc20324278bddf93b50c6f7ae9f" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sem_trywait</definition> <argsstring>(semID_t id)</argsstring> <name>sem_trywait</name> <param> <type><ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref></type> <declname>id</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/sem.c" line="48" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/sem.c" bodystart="48" bodyend="50"/> </memberdef> <memberdef kind="function" id="sem_8c_1a776256d1a473906f8b7490689bfcb75c" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sem_unlink</definition> <argsstring>(const char *name)</argsstring> <name>sem_unlink</name> <param> <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> char *</type> <declname>name</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/sem.c" line="79" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/sem.c" bodystart="79" bodyend="81"/> </memberdef> <memberdef kind="function" id="sem_8c_1ac2e22218e6a5830f6bdfd727d0206798" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> <definition>int sem_wait</definition> <argsstring>(semID_t id)</argsstring> <name>sem_wait</name> <param> <type><ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref></type> <declname>id</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/kernel/sem.c" line="44" column="5" bodyfile="C:/Dev/git/UbixOS/sys/kernel/sem.c" bodystart="44" bodyend="46"/> </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="sem_8h" kindref="compound">ubixos/sem.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="30"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="include_2sys_2types_8h" kindref="compound">sys/types.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="31"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="ubixos_2errno_8h" kindref="compound">ubixos/errno.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="32"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="time_8h" kindref="compound">ubixos/time.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="33"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="kpanic_8h" kindref="compound">ubixos/kpanic.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="34"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="kmalloc_8h" kindref="compound">lib/kmalloc.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="35"><highlight class="normal"></highlight></codeline> <codeline lineno="36" refid="sem_8c_1a31ab8f6dbb9646ed62f5e836b3639ad1" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="sem_8c_1a31ab8f6dbb9646ed62f5e836b3639ad1" kindref="member">sem_close</ref>(<ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref><sp/></highlight><highlight class="keywordtype">id</highlight><highlight class="normal">)<sp/>{</highlight></codeline> <codeline lineno="37"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(0);</highlight></codeline> <codeline lineno="38"><highlight class="normal">}</highlight></codeline> <codeline lineno="39"><highlight class="normal"></highlight></codeline> <codeline lineno="40" refid="sem_8c_1a81988406ac7a65ee7d6782b97943320e" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="sem_8c_1a81988406ac7a65ee7d6782b97943320e" kindref="member">sem_post</ref>(<ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref><sp/></highlight><highlight class="keywordtype">id</highlight><highlight class="normal">)<sp/>{</highlight></codeline> <codeline lineno="41"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(0);</highlight></codeline> <codeline lineno="42"><highlight class="normal">}</highlight></codeline> <codeline lineno="43"><highlight class="normal"></highlight></codeline> <codeline lineno="44" refid="sem_8c_1ac2e22218e6a5830f6bdfd727d0206798" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="sem_8c_1ac2e22218e6a5830f6bdfd727d0206798" kindref="member">sem_wait</ref>(<ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref><sp/></highlight><highlight class="keywordtype">id</highlight><highlight class="normal">)<sp/>{</highlight></codeline> <codeline lineno="45"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(0);</highlight></codeline> <codeline lineno="46"><highlight class="normal">}</highlight></codeline> <codeline lineno="47"><highlight class="normal"></highlight></codeline> <codeline lineno="48" refid="sem_8c_1a46c76cc20324278bddf93b50c6f7ae9f" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="sem_8c_1a46c76cc20324278bddf93b50c6f7ae9f" kindref="member">sem_trywait</ref>(<ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref><sp/></highlight><highlight class="keywordtype">id</highlight><highlight class="normal">)<sp/>{</highlight></codeline> <codeline lineno="49"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(0);</highlight></codeline> <codeline lineno="50"><highlight class="normal">}</highlight></codeline> <codeline lineno="51"><highlight class="normal"></highlight></codeline> <codeline lineno="52" refid="sem_8c_1a0e52c88f72f178cd67eb289e6f498c26" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="sem_8c_1a0e52c88f72f178cd67eb289e6f498c26" kindref="member">sem_timedwait</ref>(<ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref><sp/></highlight><highlight class="keywordtype">id</highlight><highlight class="normal">,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structtimespec" kindref="compound">timespec</ref><sp/>*ts)<sp/>{</highlight></codeline> <codeline lineno="53"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(0);</highlight></codeline> <codeline lineno="54"><highlight class="normal">}</highlight></codeline> <codeline lineno="55"><highlight class="normal"></highlight></codeline> <codeline lineno="56" refid="sem_8c_1a19bd6e9be9540104f4ab465624e9a579" refkind="member"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/><ref refid="sem_8c_1a19bd6e9be9540104f4ab465624e9a579" kindref="member">sem_init</ref>(<ref refid="structsys__sem" kindref="compound">sys_sem_t</ref><sp/>**sem,<sp/><ref refid="include_2sys_2types_8h_1a2aff71146ab4942b2b38860c749c4074" kindref="member">uint8_t</ref><sp/>count)<sp/>{</highlight></codeline> <codeline lineno="57"><highlight class="normal"><sp/><sp/><ref refid="structsys__sem" kindref="compound">sys_sem_t</ref><sp/>*newSem<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="58"><highlight class="normal"></highlight></codeline> <codeline lineno="59"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(*sem<sp/>!=<sp/>0)<sp/>{</highlight></codeline> <codeline lineno="60"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//kpanic("UH<sp/>OH!");</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"UH<sp/>OH!"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="62"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="63"><highlight class="normal"></highlight></codeline> <codeline lineno="64"><highlight class="normal"><sp/><sp/>newSem<sp/>=<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="structsys__sem" kindref="compound">sys_sem</ref>));</highlight></codeline> <codeline lineno="65"><highlight class="normal"><sp/><sp/>newSem-><ref refid="structsys__sem_1ab9e4ecb1c4448468fb820025b7c773be" kindref="member">signaled</ref><sp/>=<sp/>count;</highlight></codeline> <codeline lineno="66"><highlight class="normal"></highlight></codeline> <codeline lineno="67"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1acbb7170a68758468ab5b02512a320112" kindref="member">ubthread_cond_init</ref>(&(newSem-><ref refid="structsys__sem_1aa758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>),<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline> <codeline lineno="68"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1ab6bfc2169b55532821582f24b68dc855" kindref="member">ubthread_mutex_init</ref>(&(newSem-><ref refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>),<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline> <codeline lineno="69"><highlight class="normal"></highlight></codeline> <codeline lineno="70"><highlight class="normal"><sp/><sp/>*sem<sp/>=<sp/>newSem;</highlight></codeline> <codeline lineno="71"><highlight class="normal"></highlight></codeline> <codeline lineno="72"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="ubixos_2errno_8h_1a019daba146137ec289f49606cc1552fc" kindref="member">ENOERR</ref>);</highlight></codeline> <codeline lineno="73"><highlight class="normal">}</highlight></codeline> <codeline lineno="74"><highlight class="normal"></highlight></codeline> <codeline lineno="75" refid="sem_8c_1a15c1835612c234029c20431e06a1917d" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="sem_8c_1a15c1835612c234029c20431e06a1917d" kindref="member">sem_open</ref>(<ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref><sp/>*</highlight><highlight class="keywordtype">id</highlight><highlight class="normal">,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>oflag,<sp/><ref refid="descrip_8h_1ae9f148ba55d84268ecb6f8031ab45076" kindref="member">mode_t</ref><sp/>mode,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>value)<sp/>{</highlight></codeline> <codeline lineno="76"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(0);</highlight></codeline> <codeline lineno="77"><highlight class="normal">}</highlight></codeline> <codeline lineno="78"><highlight class="normal"></highlight></codeline> <codeline lineno="79" refid="sem_8c_1a776256d1a473906f8b7490689bfcb75c" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="sem_8c_1a776256d1a473906f8b7490689bfcb75c" kindref="member">sem_unlink</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>)<sp/>{</highlight></codeline> <codeline lineno="80"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(0);</highlight></codeline> <codeline lineno="81"><highlight class="normal">}</highlight></codeline> <codeline lineno="82"><highlight class="normal"></highlight></codeline> <codeline lineno="83" refid="sem_8c_1ab80213da2384984db11eeae2c92f8a72" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="sem_8c_1ab80213da2384984db11eeae2c92f8a72" kindref="member">sem_getvalue</ref>(<ref refid="sem_8h_1a9f436a6cc8070df1db63f5a75d4d0014" kindref="member">semID_t</ref><sp/></highlight><highlight class="keywordtype">id</highlight><highlight class="normal">,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>*val)<sp/>{</highlight></codeline> <codeline lineno="84"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(0);</highlight></codeline> <codeline lineno="85"><highlight class="normal">}</highlight></codeline> <codeline lineno="86"><highlight class="normal"></highlight></codeline> <codeline lineno="87" refid="sem_8c_1aa386df202c6e9b90a1445a61ce694210" refkind="member"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/><ref refid="sem_8c_1aa386df202c6e9b90a1445a61ce694210" kindref="member">sem_destroy</ref>(<ref refid="structsys__sem" kindref="compound">sys_sem_t</ref><sp/>**sem)<sp/>{</highlight></codeline> <codeline lineno="88"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(*sem<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)</highlight></codeline> <codeline lineno="89"><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="90"><highlight class="normal"></highlight></codeline> <codeline lineno="91"><highlight class="normal"><sp/><sp/><ref refid="structsys__sem" kindref="compound">sys_sem_t</ref><sp/>*d_sem<sp/>=<sp/>*sem;</highlight></codeline> <codeline lineno="92"><highlight class="normal"></highlight></codeline> <codeline lineno="93"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1ae914fae69538736dc5e494c15ce93a17" kindref="member">ubthread_cond_destroy</ref>(&(d_sem-><ref refid="structsys__sem_1aa758e52262d23c22a40204e410b5f8c4" kindref="member">cond</ref>));</highlight></codeline> <codeline lineno="94"><highlight class="normal"><sp/><sp/><ref refid="ubthread_8h_1a278f5d5b1e11b6668b75da6a285442e4" kindref="member">ubthread_mutex_destroy</ref>(&(d_sem-><ref refid="structsys__sem_1a52b664ee7d03d9bc83f26009a5fd27f1" kindref="member">mutex</ref>));</highlight></codeline> <codeline lineno="95"><highlight class="normal"></highlight></codeline> <codeline lineno="96"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(sem);</highlight></codeline> <codeline lineno="97"><highlight class="normal"><sp/><sp/>*sem<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="98"><highlight class="normal"></highlight></codeline> <codeline lineno="99"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="ubixos_2errno_8h_1a019daba146137ec289f49606cc1552fc" kindref="member">ENOERR</ref>);</highlight></codeline> <codeline lineno="100"><highlight class="normal">}</highlight></codeline> <codeline lineno="101"><highlight class="normal"></highlight></codeline> </programlisting> <location file="C:/Dev/git/UbixOS/sys/kernel/sem.c"/> </compounddef> </doxygen>