1 |
1026 |
ivang |
#
|
2 |
|
|
# This shell script generates the starting template for a manager chapter.
|
3 |
|
|
#
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
# Set this based on which chapter you want to generate a template for.
|
7 |
|
|
chapter=$1
|
8 |
|
|
|
9 |
|
|
case ${chapter} in
|
10 |
|
|
process)
|
11 |
|
|
CHAPTER_CAPS="Process Creation and Execution"
|
12 |
|
|
CHAPTER_LOWER="process creation and execution"
|
13 |
|
|
ROUTINES="fork execl execv execle execve execlp execvp pthread_atfork \
|
14 |
|
|
wait waitpid _exit"
|
15 |
|
|
;;
|
16 |
|
|
procenv)
|
17 |
|
|
CHAPTER_CAPS="Process Environment"
|
18 |
|
|
CHAPTER_LOWER="process environment"
|
19 |
|
|
ROUTINES="getpid getppid getuid geteuid getgid getegid setuid setgid \
|
20 |
|
|
getgroups getlogin getlogin_r getpgrp setsid setpgid uname times \
|
21 |
|
|
getenv ctermid ttyname ttyname_r isatty sysconf "
|
22 |
|
|
;;
|
23 |
|
|
files)
|
24 |
|
|
CHAPTER_CAPS="Files and Directories"
|
25 |
|
|
CHAPTER_LOWER="files and directories"
|
26 |
|
|
ROUTINES="opendir readdir readdir_r rewinddir closedir \
|
27 |
|
|
chdir getcwd open creat umask link mkdir mkfifo unlink \
|
28 |
|
|
rmdir rename stat fstat access chmod fchmod chown \
|
29 |
|
|
utime ftrunctate pathconf fpathconf"
|
30 |
|
|
;;
|
31 |
|
|
io)
|
32 |
|
|
CHAPTER_CAPS="Input and Output Primitives"
|
33 |
|
|
CHAPTER_LOWER="input and output primitives"
|
34 |
|
|
ROUTINES="pipe dup dup2 close read write fcntl lseek fsynch fdatasynch \
|
35 |
|
|
aio_read aio_write lio_listio aio_error aio_return aio_cancel \
|
36 |
|
|
aio_suspend aio_fsync"
|
37 |
|
|
;;
|
38 |
|
|
device)
|
39 |
|
|
CHAPTER_CAPS="Device- and Class- Specific Functions"
|
40 |
|
|
CHAPTER_LOWER="device- and class- specific functions"
|
41 |
|
|
ROUTINES="cfgetispeed cfgetospeed cfsetispeed cfsetospeed tcgetattr \
|
42 |
|
|
tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp"
|
43 |
|
|
;;
|
44 |
|
|
cspecific)
|
45 |
|
|
CHAPTER_CAPS="Language-Specific Services for the C Programming Language"
|
46 |
|
|
CHAPTER_LOWER="language-specific services for the C programming language"
|
47 |
|
|
ROUTINES="setlocale fileno fdopen flcokfile ftrylockfile funlockfile \
|
48 |
|
|
getc_unlocked getchar_unlocked putc_unlocked putchar_unlocked \
|
49 |
|
|
setjmp longjmp sigsetjmp siglongjmp tzset strtok_r asctime_r \
|
50 |
|
|
ctime_r gmtime_r localtime_r rand_r"
|
51 |
|
|
;;
|
52 |
|
|
systemdb)
|
53 |
|
|
CHAPTER_CAPS="System Databases"
|
54 |
|
|
CHAPTER_LOWER="system databases"
|
55 |
|
|
ROUTINES="getgrgid getgrgid_r getgrnam getgrnam_r getpwuid getpwuid_r \
|
56 |
|
|
getpwnam getpwnam_r"
|
57 |
|
|
;;
|
58 |
|
|
semaphores)
|
59 |
|
|
CHAPTER_CAPS="Semaphores"
|
60 |
|
|
CHAPTER_LOWER="semaphore"
|
61 |
|
|
ROUTINES="sem_init sem_destroy sem_open sem_close sem_unlink sem_wait \
|
62 |
|
|
sem_trywait sem_post sem_getvalue"
|
63 |
|
|
;;
|
64 |
|
|
memorymgmt)
|
65 |
|
|
CHAPTER_CAPS="Memory Management"
|
66 |
|
|
CHAPTER_LOWER="memory management"
|
67 |
|
|
ROUTINES="mlockall munlockall mlock munlock mmap munmap mprotect \
|
68 |
|
|
msync shm_open shm_unlink"
|
69 |
|
|
;;
|
70 |
|
|
message)
|
71 |
|
|
CHAPTER_CAPS="Message Passing"
|
72 |
|
|
CHAPTER_LOWER="message passing"
|
73 |
|
|
ROUTINES="mq_open mq_close mq_unlink mq_send mq_receive mq_notify \
|
74 |
|
|
mq_setattr mq_getattr"
|
75 |
|
|
;;
|
76 |
|
|
cancel)
|
77 |
|
|
CHAPTER_CAPS="Thread Cancellation"
|
78 |
|
|
CHAPTER_LOWER="thread cancellation"
|
79 |
|
|
ROUTINES="pthread_cancel pthread_setcancelstate pthread_setcanceltype \
|
80 |
|
|
pthread_testcancel pthread_cleanup_push"
|
81 |
|
|
;;
|
82 |
|
|
eventlog)
|
83 |
|
|
CHAPTER_CAPS="Event Logging"
|
84 |
|
|
CHAPTER_LOWER="event logging"
|
85 |
|
|
ROUTINES="log_write log_open log_read log_notify log_close log_seek \
|
86 |
|
|
log_severity_before log_facilityemptyset log_facilityfillset \
|
87 |
|
|
log_facilityaddset log_facilitydelset log_facilityismember"
|
88 |
|
|
;;
|
89 |
|
|
dumpcontrol)
|
90 |
|
|
CHAPTER_CAPS="Process Dump Control"
|
91 |
|
|
CHAPTER_LOWER="process dump control"
|
92 |
|
|
ROUTINES="dump_setpath"
|
93 |
|
|
;;
|
94 |
|
|
confspace)
|
95 |
|
|
CHAPTER_CAPS="Configuration Space"
|
96 |
|
|
CHAPTER_LOWER="configuration space"
|
97 |
|
|
ROUTINES="cfg_mount cfg_unmount cfg_mknod cfg_get cfg_set cfg_link \
|
98 |
|
|
cfg_unlink cfg_open cfg_read cfg_children cfg_mark cfg_close"
|
99 |
|
|
;;
|
100 |
|
|
adminiface)
|
101 |
|
|
CHAPTER_CAPS="Administration Interface"
|
102 |
|
|
CHAPTER_LOWER="administration interface"
|
103 |
|
|
ROUTINES="admin_shutdown"
|
104 |
|
|
;;
|
105 |
|
|
# XXX this is not all of the C Library Stuff
|
106 |
|
|
libc_ctype)
|
107 |
|
|
CHAPTER_CAPS="C Library Character Handling"
|
108 |
|
|
CHAPTER_LOWER="character handling"
|
109 |
|
|
ROUTINES="isalnum isalpha iscntrl isdigit isgraph islower isprint \
|
110 |
|
|
ispunct isspace isupper isxdigit tolower toupper"
|
111 |
|
|
;;
|
112 |
|
|
libc_math)
|
113 |
|
|
CHAPTER_CAPS="C Math Library"
|
114 |
|
|
CHAPTER_LOWER="math library"
|
115 |
|
|
ROUTINES="acos asis atan atan2 cos sin tan cosh sinh tanh exp frexp ldexp
|
116 |
|
|
log log10 modf pow sqrt ceil fabs floor fmod"
|
117 |
|
|
;;
|
118 |
|
|
libc_io)
|
119 |
|
|
CHAPTER_CAPS="C Library IO"
|
120 |
|
|
CHAPTER_LOWER="C Library IO"
|
121 |
|
|
ROUTINES="clearerr fclose feof ferror fflush fgetc fgets fopen fputc \
|
122 |
|
|
fputs fread freopen fseek ftell fwrite getc getchar gets perror \
|
123 |
|
|
printf fprintf sprintf putc putchar puts remove rename rewind \
|
124 |
|
|
scanf fscanf sscanf setbuf tempfile tmpnam ungetc"
|
125 |
|
|
;;
|
126 |
|
|
libc_string)
|
127 |
|
|
CHAPTER_CAPS="C Library String Handling"
|
128 |
|
|
CHAPTER_LOWER="string handling"
|
129 |
|
|
ROUTINES="strcpy strncpy strcat strncat strcmp strncmp strchr strcspn \
|
130 |
|
|
strpbrk strrchr strspn strstr strtok stlen"
|
131 |
|
|
;;
|
132 |
|
|
misc_stackchk)
|
133 |
|
|
CHAPTER_CAPS="Stack Bounds Checker"
|
134 |
|
|
CHAPTER_LOWER="stack bounds checker"
|
135 |
|
|
ROUTINES="Stack_check_Initialize Stack_check_Dump_usage"
|
136 |
|
|
;;
|
137 |
|
|
misc_rtmonuse)
|
138 |
|
|
CHAPTER_CAPS="Rate Monotonic Period Statistics"
|
139 |
|
|
CHAPTER_LOWER="rate monotonic period statistics"
|
140 |
|
|
ROUTINES="Period_usage_Initialize Period_usage_Reset \
|
141 |
|
|
Period_usage_Update Period_usage_Dump"
|
142 |
|
|
;;
|
143 |
|
|
misc_cpuuse)
|
144 |
|
|
CHAPTER_CAPS="CPU Usage Statistics"
|
145 |
|
|
CHAPTER_LOWER="CPU usage statistics"
|
146 |
|
|
ROUTINES="CPU_usage_Dump CPU_usage_Reset"
|
147 |
|
|
;;
|
148 |
|
|
misc_error)
|
149 |
|
|
CHAPTER_CAPS="Error Reporting Support"
|
150 |
|
|
CHAPTER_LOWER="error reporting support"
|
151 |
|
|
ROUTINES="rtems_error rtems_panic"
|
152 |
|
|
;;
|
153 |
|
|
misc_monitor)
|
154 |
|
|
CHAPTER_CAPS="Monitor Task"
|
155 |
|
|
CHAPTER_LOWER="monitor task"
|
156 |
|
|
ROUTINES="rtems_monitor_init rtems_monitor_wakeup"
|
157 |
|
|
;;
|
158 |
|
|
*)
|
159 |
|
|
echo "Unknown chapter name"
|
160 |
|
|
exit 1
|
161 |
|
|
;;
|
162 |
|
|
esac
|
163 |
|
|
|
164 |
|
|
if [ "x${CHAPTER_CAPS}" = "x" -o "x${CHAPTER_LOWER}" = "x" \
|
165 |
|
|
-o "x${ROUTINES}" = "x" ] ; then
|
166 |
|
|
echo "initialization problem"
|
167 |
|
|
exit 1
|
168 |
|
|
fi
|
169 |
|
|
|
170 |
|
|
echo "@c"
|
171 |
|
|
echo "@c COPYRIGHT (c) 1988-2002."
|
172 |
|
|
echo "@c On-Line Applications Research Corporation (OAR)."
|
173 |
|
|
echo "@c All rights reserved. "
|
174 |
|
|
echo "@c"
|
175 |
|
|
echo "@c \$Id\$"
|
176 |
|
|
echo "@c"
|
177 |
|
|
echo ""
|
178 |
|
|
echo "@chapter ${CHAPTER_CAPS}" Manager
|
179 |
|
|
echo ""
|
180 |
|
|
echo "@section Introduction"
|
181 |
|
|
echo ""
|
182 |
|
|
echo "The "
|
183 |
|
|
echo "${CHAPTER_LOWER} manager is ..."
|
184 |
|
|
echo ""
|
185 |
|
|
echo "The directives provided by the ${CHAPTER_LOWER} manager are:"
|
186 |
|
|
echo ""
|
187 |
|
|
echo "@itemize @bullet"
|
188 |
|
|
|
189 |
|
|
for routine in ${ROUTINES}
|
190 |
|
|
do
|
191 |
|
|
echo "@item @code{${routine}} - "
|
192 |
|
|
done
|
193 |
|
|
echo "@end itemize"
|
194 |
|
|
|
195 |
|
|
echo ""
|
196 |
|
|
echo "@section Background"
|
197 |
|
|
echo ""
|
198 |
|
|
echo "@section Operations"
|
199 |
|
|
echo ""
|
200 |
|
|
echo "@section Directives"
|
201 |
|
|
echo ""
|
202 |
|
|
echo "This section details the ${CHAPTER_LOWER} manager's directives."
|
203 |
|
|
echo "A subsection is dedicated to each of this manager's directives"
|
204 |
|
|
echo "and describes the calling sequence, related constants, usage,"
|
205 |
|
|
echo "and status codes."
|
206 |
|
|
echo ""
|
207 |
|
|
|
208 |
|
|
for routine in ${ROUTINES}
|
209 |
|
|
do
|
210 |
|
|
echo "@page"
|
211 |
|
|
echo "@subsection ${routine} - "
|
212 |
|
|
echo ""
|
213 |
|
|
echo "@subheading CALLING SEQUENCE:"
|
214 |
|
|
echo ""
|
215 |
|
|
echo "@ifset is-C"
|
216 |
|
|
echo "@example"
|
217 |
|
|
echo "int ${routine}("
|
218 |
|
|
echo ");"
|
219 |
|
|
echo "@end example"
|
220 |
|
|
echo "@end ifset"
|
221 |
|
|
echo ""
|
222 |
|
|
echo "@ifset is-Ada"
|
223 |
|
|
echo "@end ifset"
|
224 |
|
|
echo ""
|
225 |
|
|
echo "@subheading STATUS CODES:"
|
226 |
|
|
echo ""
|
227 |
|
|
echo "@table @b"
|
228 |
|
|
echo "@item E"
|
229 |
|
|
echo "The"
|
230 |
|
|
echo ""
|
231 |
|
|
echo "@end table"
|
232 |
|
|
echo ""
|
233 |
|
|
echo "@subheading DESCRIPTION:"
|
234 |
|
|
echo ""
|
235 |
|
|
echo "@subheading NOTES:"
|
236 |
|
|
echo ""
|
237 |
|
|
done
|
238 |
|
|
|