50 lines
14 KiB
HTML
50 lines
14 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - Classes And Methods - The Kernel Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
|
||
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
|
||
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheKernelKit.html" title="The Kernel Kit" /><link rel="prev" href="TheKernelKit_SystemInfo.html" title="System Information" /><link rel="next" href="TheMailKit.html" title="The Mail Kit" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="TheKernelKit_SystemInfo.html" title="System Information"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheKernelKit.html" title="The Kernel Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="TheMailKit.html" title="The Mail Kit"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - Classes And Methods - The Kernel Kit</div></div><div id="headerB">Prev: <a href="TheKernelKit_SystemInfo.html">System Information</a> Up: <a href="TheKernelKit.html">The Kernel Kit</a> Next: <a href="TheMailKit.html">The Mail Kit</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="TheKernelKit_Miscellaneous"></a>Miscellaneous Functions And Constants</h2></div></div></div><div class="informaltable"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Declared in:</td><td><code class="filename">kernel/OS.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libroot.so</code></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="Miscellaneous_Functions"></a>Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="clear_caches"></a>clear_caches()</h4></div></div></div><a id="id1114057" class="indexterm"></a><code class="methodsynopsis c"><span class="type">void </span><span class="methodname">clear_caches</span>(<span class="methodparam"><span class="type">void* </span><span class="parameter">addr</span></span>,<br /> <span class="methodparam"><span class="type">size_t </span><span class="parameter">len</span></span>,<br /> <span class="methodparam"><span class="type">uint32 </span><span class="parameter">flags</span></span>);</code><p>Declared in: <code class="filename">kernel/image.h</code></p><p>This function clears or invalidates the instruction and data caches. You
|
||
should only need this function if you're generating code on the fly, or
|
||
if you're performing a timing loop and you want to start with fresh
|
||
caches (to get a "worst case" estimate).</p><p>The parameters are:</p><table class="variablelist parameters"><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="parameter">addr</code></span></p></td><td><p>Is the starting address of a section of memory that corresponds
|
||
to a section of one of the caches.</p></td></tr><tr><td><p><span class="term"><code class="parameter">len</code></span></p></td><td><p>Is the length, in bytes, of the instruction or data segment that
|
||
you want to clear or invalidate.</p></td></tr><tr><td><p><span class="term"><code class="parameter">flags</code></span></p></td><td><p>Is one or both of <code class="constant">B_INVALIDATE_ICACHE</code>
|
||
and <code class="constant">B_FLUSH_DCACHE</code>.</p></td></tr></tbody></table><p>By invalidating a section of the instruction cache, you cause the
|
||
instructions in that section to be reloaded next time they're needed.
|
||
Flushing the data cache causes the in-memory copy of the data to be
|
||
written out to the cache.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="debugger"></a>debugger()</h4></div></div></div><a id="id1114207" class="indexterm"></a><code class="methodsynopsis c"><span class="type">void </span><span class="methodname">debugger</span>(<span class="methodparam"><span class="type">const char* </span><span class="parameter">string</span></span>);</code><p>Throws the calling thread into the debugger. The <code class="parameter">string</code> argument becomes
|
||
the debugger's first utterance.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="disable_debugger"></a>disable_debugger()</h4></div></div></div><a id="id1114255" class="indexterm"></a><code class="methodsynopsis c"><span class="type">int </span><span class="methodname">disable_debugger</span>(<span class="methodparam"><span class="type">int </span><span class="parameter">state</span></span>);</code><p>Instructs the kernel to send a signal for all exceptions, even those that
|
||
don't normally trigger the debugger. If the application doesn't have a
|
||
handler installed for the exception, the team dies without triggering the
|
||
debugger. <code class="parameter">state</code> should be nonzero to turn on this functionality or 0 to
|
||
turn it off.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="set_alarm"></a>set_alarm()</h4></div></div></div><a id="id1114306" class="indexterm"></a><code class="methodsynopsis c"><span class="type">bigtime_t </span><span class="methodname">set_alarm</span>(<span class="methodparam"><span class="type">bigtime_t </span><span class="parameter">time</span></span>,<br /> <span class="methodparam"><span class="type">uint32 </span><span class="parameter">mode</span></span>);</code><p>Tells the kernel to send the <span class="signal">SIGALRM</span>
|
||
signal at some point in the future,
|
||
as defined by the arguments:</p><ul class="itemizedlist"><li><p>If <code class="parameter">mode</code> is <code class="constant">B_PERIODIC_ALARM</code>,
|
||
the signal is sent every <code class="parameter">time</code> microseconds,
|
||
starting as soon as <code class="function">set_alarm()</code> function returns.</p></li><li><p>If <code class="parameter">mode</code> is <code class="constant">B_ONE_SHOT_ABOLUTE_ALARM</code>, the signal is sent once (only)
|
||
after <code class="parameter">time</code> microseconds have elapsed measured from the time the system
|
||
was booted. If that point has already passed, the signal is sent
|
||
immediately.</p></li><li><p>If <code class="parameter">mode</code> is <code class="constant">B_ONE_SHOT_RELATIVE_ALARM</code>,
|
||
the signal is sent once (only) after <code class="parameter">time</code> microseconds
|
||
have elapsed from the time <code class="function">set_alarm()</code> returns.</p></li></ul><p>When the signal is sent, the <span class="signal">SIGALRM</span>
|
||
handler is called (you set the
|
||
handler through the normal means, by calling the Posix <code class="function">signal()</code>
|
||
function). The handler runs in the thread that set the alarm.</p><div class="admonition warning"><div class="title">Warning</div><div class="graphic"><img class="icon" alt="Warning" width="32" src="./images/admonitions/Stop_32.png" /><div class="text"><p>From within the SIGALRM handler, you mustn't call anything that would
|
||
cause the kernel scheduler to run. Just about the only safe call you can
|
||
make from your signal handler is
|
||
<a class="link" href="TheKernelKit_Semaphores.html#release_sem" title="release_sem(), release_sem_etc()"><code class="function">release_sem()</code></a>.</p></div></div></div><p>The most recent alarm requested cancels any previous request. For
|
||
example, in this sequence…</p><pre class="programlisting example c"><span class="comment">/* Ask for an alarm ten seconds from now. */</span>
|
||
<code class="function">set_alarm</code>(10e6, <code class="constant">B_ONE_SHOT_RELATIVE_ALARM</code>);
|
||
|
||
<span class="comment">/* Ask for an alarm one second from now. */</span>
|
||
<code class="function">set_alarm</code>(10e5, <code class="constant">B_ONE_SHOT_RELATIVE_ALARM</code>);</pre><p>…only the second alarm request will be fulfilled the first
|
||
requested is cancelled when the second <code class="function">set_alarm()</code> call is made. This
|
||
applies to all alarm types; for example, a one-shot alarm request will
|
||
cancel an active periodic alarm.</p><p>To explicitly cancel the previous alarm request without installing a new
|
||
alarm, do this:</p><pre class="programlisting example c"><code class="function">set_alarm</code>(<code class="constant">B_INFINITE_TIMEOUT</code>, <code class="constant">B_PERIODIC_ALARM</code>);</pre><p>This cancels the previous alarm request regardless of the type of alarm.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="set_signal_stack"></a>set_signal_stack()</h4></div></div></div><a id="id1114550" class="indexterm"></a><code class="methodsynopsis c"><span class="type">void </span><span class="methodname">set_signal_stack</span>(<span class="methodparam"><span class="type">void* </span><span class="parameter">ptr</span></span>,<br /> <span class="methodparam"><span class="type">size_t </span><span class="parameter">size</span></span>);</code><p>Declared in: <code class="filename">posix/signal.be.h</code></p><p>Sets the location and size of the stack that's used by the thread's
|
||
signal handlers.</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="Miscellaneous_Constants"></a>Constants</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="B_INFINITE_TIMEOUT"></a>B_INFINITE_TIMEOUT</h4></div></div></div><a id="id1114623" class="indexterm"></a><pre class="programlisting c"><code class="constant">B_INFINITE_TIMEOUT</code></pre><p>The inifinite timeout value can be used to specify, to timeout-accepting
|
||
functions, that you're willing to wait forever.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="B_OS_NAME_LENGTH"></a>B_OS_NAME_LENGTH</h4></div></div></div><a id="id1114656" class="indexterm"></a><pre class="programlisting c"><code class="constant">B_OS_NAME_LENGTH</code></pre><p>This constant gives the maximum length of the name of a thread,
|
||
semaphore, port, area, or other operating system bauble.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="B_PAGE_SIZE"></a>B_PAGE_SIZE</h4></div></div></div><a id="id1114688" class="indexterm"></a><pre class="programlisting c"><code class="constant">B_PAGE_SIZE</code></pre><p>The <code class="constant">B_PAGE_SIZE</code> constant gives the size,
|
||
in bytes, of a page of RAM.</p></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="TheKernelKit_SystemInfo.html">System Information</a> Up: <a href="TheKernelKit.html">The Kernel Kit</a> Next: <a href="TheMailKit.html">The Mail Kit</a> </div><div id="footerB"><div id="footerBL"><a href="TheKernelKit_SystemInfo.html" title="System Information"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheKernelKit.html" title="The Kernel Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="TheMailKit.html" title="The Mail Kit"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
|
||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
|
||
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>
|