This file is indexed.

/usr/share/doc/HOWTO/ja-html/RTLinux-HOWTO-4.html is in doc-linux-ja-html 2006.05.25-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.21">
 <TITLE>RTLinux HOWTO: RTLinux $B$N%W%m%0%i%`$r=q$/(B</TITLE>
 <LINK HREF="RTLinux-HOWTO-5.html" REL=next>
 <LINK HREF="RTLinux-HOWTO-3.html" REL=previous>
 <LINK HREF="RTLinux-HOWTO.html#toc4" REL=contents>
</HEAD>
<BODY>
<A HREF="RTLinux-HOWTO-5.html">$B<!$N%Z!<%8(B</A>
<A HREF="RTLinux-HOWTO-3.html">$BA0$N%Z!<%8(B</A>
<A HREF="RTLinux-HOWTO.html#toc4">$BL\<!$X(B</A>
<HR>
<H2><A NAME="s4">4.</A> <A HREF="RTLinux-HOWTO.html#toc4">RTLinux $B$N%W%m%0%i%`$r=q$/(B</A></H2>

<H2><A NAME="ss4.1">4.1</A> <A HREF="RTLinux-HOWTO.html#toc4.1">$B%b%8%e!<%k$N=q$-J}F~Lg(B</A>
</H2>

<P>$B$5$F%b%8%e!<%k$H$O2?$G$7$g$&$+(B? Linux $B$N%b%8%e!<%k$O!"DL>o(B gcc $B$K(B
-c $B%U%i%00z?t$rIU$1$F@8@.$5$l$?%*%V%8%'%/%H%U%!%$%k$K2a$.$^$;$s!#(B
$B%b%8%e!<%k<+BN$O!"(Bmain() $B4X?t$N$J$$IaDL$N(B C $B8@8l%U%!%$%k$r%3%s%Q%$%k(B
$B$9$k$3$H$K$h$j@8@.$5$l$^$9!#(Bmain() $B4X?t$,$J$$Be$o$j$K!"(Binit_module
$B4X?t$H(B cleanup_module $B4X?t$N%Z%"$,4^$^$l$^$9(B:</P>
<P>
<UL>
<LI>init_module() $B$O!"$=$N%b%8%e!<%k$r%+!<%M%k$KAH$_$3$`:]$K%3!<%k$5$l$^$9!#(B
$B@.8y;~$K$O(B 0 $B$rJV$7!"<:GT$7$?$H$-$K$OIi$NCM$rJV$7$^$9!#(B</LI>
<LI>cleanup_module() $B$O!"$=$N%b%8%e!<%k$r:o=|$9$kD>A0$K%3!<%k$5$l$^$9!#(B</LI>
</UL>
</P>
<P>$BDL>o(B init_module() $B$G$O!"%+!<%M%k$K2?$+=hM}$r9T$&%O%s%I%i$rEPO?$9$k$+!"(B
$B%+!<%M%k$N4X?t$N0l$D$rFH<+$N%3!<%I(B($BDL>o$O2?$+9T$$!"(B
$B$=$l$+$i85$N4X?t$r%3!<%k$9$k%3!<%I(B)$B$KCV$-49$($k$+$7$^$9!#(B
cleanup_module() $B4X?t$O!"(Binit_module() $B$,9T$C$?$3$H$9$Y$F$r85$KLa$9(B
$B$3$H$K$J$C$F$$$k$N$G!"%b%8%e!<%k$r0BA4$K30$9$3$H$,2DG=$G$9!#(B</P>
<P>$BNc$($P!"(Bmodule.c $B$H$$$&L>A0$N(B C $B8@8l%U%!%$%k(B(main() $B4X?t$NBe$o$j$K(B
init_module() $B$H(B cleanup_module() $B$,$"$k(B)$B$r=q$$$?$H$7$?$i!"(B
$B0J2<$N$h$&$KF~NO$9$l$P!"$=$N%3!<%I$,%b%8%e!<%k$KJQ49$5$l$^$9(B:</P>
<P>
<PRE>
        $ gcc -c {SOME-FLAGS} my_module.c
</PRE>
</P>
<P>$B$3$N%3%^%s%I$K$h$j(B module.o $B$H$$$&L>A0$N%b%8%e!<%k%U%!%$%k$,@8@.$5$l$^$9!#(B
module.o $B$O(B 'insmod' $B%3%^%s%I$r;HMQ$7$F%+!<%M%k$KAH$_$3$a$^$9(B:</P>
<P>
<PRE>
        $ insmod module.o
</PRE>
</P>
<P>$BF1MM$K%b%8%e!<%k$r:o=|$9$k$K$O(B 'rmmod' $B$r;H$($P$h$$$G$9(B:</P>
<P>
<PRE>
        $ rmmod module
</PRE>
</P>

<H2><A NAME="ss4.2">4.2</A> <A HREF="RTLinux-HOWTO.html#toc4.2">RTLinux $B$K$*$1$k%9%l%C%I$N:n@.(B</A>
</H2>

<P>$BDL>o%j%"%k%?%$%`%"%W%j%1!<%7%g%s$O!"J#?t$N<B9T!V%9%l%C%I!W$G9=@.$5$l$^$9!#(B
$B%9%l%C%I$O!"6&DL$N%"%I%l%96u4V$r6&M-$9$k7ZNL$N%W%m%;%9$G$9!#(BRTLinux $B$G$O!"(B
$B$9$Y$F$N%9%l%C%I$,(B Linux $B%+!<%M%k$N%"%I%l%96u4V$r6&M-$7$^$9!#(B
$B%9%l%C%I$r;H$&$3$H$NMxE@$O!"%3%s%F%-%9%H%9%$%C%A$KHf$Y$F(B
$B%9%l%C%I4V$N@Z$jBX$($,6K$a$F7Z$$$3$H$K$"$j$^$9!#(B
$B0J2<$NNc$G>R2p$9$k3F<o4X?t$rMxMQ$9$l$P!"%9%l%C%I$N<B9T$r40A4$K@)8f$G$-$^$9!#(B</P>

<H2><A NAME="ss4.3">4.3</A> <A HREF="RTLinux-HOWTO.html#toc4.3">$BNc%W%m%0%i%`(B</A>
</H2>

<P>$B%9%l%C%I$NF0:n$rM}2r$9$k$N$K:G$bNI$$$N$O!"%j%"%k%?%$%`%W%m%0%i%`$r(B
$B%H%l!<%9$9$k$3$H$G$9!#Nc$($P!"0J2<$K<($9%W%m%0%i%`$O!"(B1$BIC$K0lEY<B9T$7!"(B
$B$=$NEY$K(B 'Hello World' $B$H=PNO$7$^$9!#(B</P>
<P>$B%W%m%0%i%`%3!<%I(B (file - hello.c) :</P>
<P>
<PRE>
#include &lt;rtl.h&gt;
#include &lt;time.h&gt;
#include &lt;pthread.h&gt;

pthread_t thread;

void * thread_code(void)
{
        pthread_make_periodic_np(pthread_self(), gethrtime(), 1000000000);

        while (1)
        {
                pthread_wait_np ();
                rtl_printf("Hello World\n");
        }

        return 0;
}

int init_module(void) 
{
   return pthread_create(&amp;thread, NULL, thread_code, NULL);
}

void cleanup_module(void) 
{
   pthread_delete_np(thread);
}
</PRE>
</P>
<P>$B$=$l$G$O(B init_module() $B$+$i;O$a$^$7$g$&!#(Binit_module() $B$,(B
pthread_create() $B$r%3!<%k$7$F$$$^$9!#(Bpthread_create() $B$O!"(B
$B%3!<%k$9$k%9%l%C%I$HF1;~$KF0:n$9$k!"?75,$N%9%l%C%I$r:n@.$9$k4X?t$G$9!#(B
<EM>$B$3$N4X?t$O!"(BLinux $B%+!<%M%k%9%l%C%I$+$i$7$+(B
($B$D$^$j!"(Binit_module() $B$rMQ$$$F$7$+(B)$B%3!<%k$7$F$O$$$1$^$;$s!#(B</EM></P>
<P>
<PRE>
        int  pthread_create(pthread_t  * thread,
                            pthread_attr_t * attr,
                            void * (*thread_code)(void *),
                            void * arg);
</PRE>
</P>
<P>$B:n@.$5$l$??75,%9%l%C%I$N7?$O(B pthread_t $B$G!"$3$l$O(B pthread.h
$B%X%C%@%U%!%$%k$GDj5A$5$l$F$$$^$9!#$3$N%9%l%C%I$O!"4X?t(B thread_code()
$B$r<B9T$7!"$=$l$K(B <EM>arg</EM> $B$r0z?t$H$7$FEO$7$^$9!#0z?t(B <EM>attr</EM>
$B$O!"?75,%9%l%C%I$KE,MQ$5$l$k%9%l%C%IB0@-$r;XDj$7$^$9!#$b$7(B <EM>attr</EM>
$B$,(B NULL $B$J$i!"%G%U%)%k%H$NB0@-$,E,MQ$5$l$^$9!#(B</P>
<P>$B$3$3$G$O(B thread_code() $B$O0z?t$J$7$G%3!<%k$5$l$^$9!#(Bthread_code $B$O!"(B
$B=i4|2=!"%i%s%?%$%`!"$=$7$F=*N;$H$$$&;0$D$N9=@.MWAG$+$i@.$j$^$9!#(B</P>
<P>$B=i4|2=%U%'!<%:$G$O!"(Bpthread_make_periodic_np() $B$r%3!<%k$7$^$9!#(B</P>
<P>
<PRE>
        int pthread_make_periodic_np(pthread_t thread, 
                                     hrtime_t start_time, 
                                     hrtime_t period);
</PRE>
</P>
<P>pthread_make_periodic_np $B$O!"<B9T$N=`Hw$,$G$-$?%9%l%C%I(B
<EM>thread</EM> $B$r;XDj$7$^$9!#%9%l%C%I$O(B <EM>start_time</EM>
$B$G;XDj$5$l$?;~4V$K<B9T$r3+;O$7!"%J%NICC10L$G;XDj$5$l$?(B
<EM>period</EM> $B$N4VF0:n$7$^$9!#(B</P>
<P>gethrtime $B$O!"%7%9%F%`$,%V!<%H$7$F$+$i$N;~4V$r%J%NICC10L$GJV$7$^$9!#(B</P>
<P>
<PRE>
       hrtime_t gethrtime(void);
</PRE>
</P>
<P>$B$3$N;~4V$O%j%;%C%H$5$l$k$3$H$b=$@5$5$l$k$3$H$b$"$j$^$;$s!#(Bgethrtime
$B$O>o$K!"C1D4$KA}2C$9$kCM$rJV$7$^$9!#(Bhrtime_t $B$O(B64$B%S%C%H$NId9fIU$-@0?t7?$G$9!#(B</P>
<P>pthread_make_periodic_np() $B4X?t$r%3!<%k$9$k$H!"(B
$B%9%l%C%I$O<+J,$r(B 1Hz $B$NIQEY$GDj4|E*$K<B9T$9$k$h$&!"%9%1%8%e!<%i$K(B
$BL?Na$7$^$9!#$3$l$G%9%l%C%I$N=i4|2=It$O=*$o$j$^$9!#(B</P>
<P>while() $B%k!<%W$O(B pthread_wait_np() $B4X?t$N%3!<%k$G;O$^$j$^$9!#(B
$B$3$N4X?t$O!"<!$N<~4|$,3+;O$9$k$^$G!"8=:_F0:n$7$F$$$k%j%"%k%?%$%`%9%l%C%I(B
$B$N<B9T$rDd;_$7$^$9!#$3$N%9%l%C%I$OA0$K(B pthread_make_periodic_np
$B$K$h$j<B9T;XDj$,$5$l$F$$$^$9!#%9%l%C%I$,:F$S%3!<%k$5$l$k$H!"(B
pthread_wait_np() $B$,$"$i$?$a$F%3!<%k$5$l$k$^$G(B while
$B%k!<%WFb$N;D$j$N=hM}$r<B9T$7$^$9!#(B</P>
<P>$B%k!<%W$rH4$1$k<jCJ$rF~$l$F$$$J$$$N$G!"$3$N%9%l%C%I$O(B 1Hz $B4V3V$G(B
$B1J5W$K<B9T$5$lB3$1$k$3$H$K$J$j$^$9!#%W%m%0%i%`$rDd;_$9$kM#0l$N<jCJ$O!"(B
rmmod $B%3%^%s%I$K$h$j$=$l$r%+!<%M%k$+$i:o=|$9$k$3$H$G$9!#(B
rmmod $B$O(B cleanup_module() $B$r%3!<%k$7$^$9$,!"$3$l$,(B $B%9%l%C%I$rCf;_$7!"(B
$B$=$N%j%=!<%9$r2rJ|$9$k(B pthread_delete_np() $B$r%3!<%k$9$k$N$G$9!#(B</P>

<HR>
<A HREF="RTLinux-HOWTO-5.html">$B<!$N%Z!<%8(B</A>
<A HREF="RTLinux-HOWTO-3.html">$BA0$N%Z!<%8(B</A>
<A HREF="RTLinux-HOWTO.html#toc4">$BL\<!$X(B</A>
</BODY>
</HTML>