1Each strace port relies heavily on port-specific headers:
2	- errnoent.h - map error number to error name like strerror()
3	- ioctlent.h - map ioctl number to symbolic define
4	- signalent.h - map signal number to signal name like strsignal()
5	- syscallent.h - map syscall number to name and function signature
6
7Since generating these headers from scratch (or even just updating them) can be
8a big pain, there are a few scripts to help automate the process.  Since each
9port organizes their kernel sources differently, there may be a specific script
10for your kernel.
11
12We will use the Linux kernel (2.6.20+) as an example below (the Blackfin
13architecture to be specific).  Hopefully, it'll be obvious how to swap out a
14different system or architecture as your circumstances apply.
15
16ksrc=/usr/src/linux
17asrc=$ksrc/arch/blackfin/include/asm
18
19To use the errnoent.sh script, give it all the headers that might contain
20appropriate errno values.  Excessive headers are not a problem.  The resulting
21output should be directly usable without modification.
22	sh ./errnoent.sh \
23		$ksrc/include/linux/*errno*.h \
24		$ksrc/include/asm-generic/*errno*.h \
25		$asrc/*errno*.h \
26		> errnoent.h
27
28To use the ioctlent.sh script, give it all the base include directories.  The
29script will crawl all the headers and try to discover appropriate ioctls.
30Unlike the other scripts, this one creates files for further processing.  This
31is because ioctls tend to have a lot of define indirection, and the ioctlent.h
32header needs to be fully expanded into numeric form and sorted properly.  So
33first we process all of the ioctls with the ioctlent.sh into ioctldefs.h and
34ioctls.h, and then we compile them into ioctlsort.c.  The resulting output,
35while directly usable, only contains definitions that match exactly the current
36kernel version that the script ran against.  That means older/newer ioctl
37defines that might be present in the existing ioctlent.h header will be lost if
38things are copied directly.  A little creative use of `diff` and manual merging
39should be used to produce the final ioctlent.h header.
40	sh ./linux/ioctlent.sh $ksrc/include $asrc
41	gcc -Wall -I. linux/ioctlsort.c -o ioctlsort
42	./ioctlsort > ioctlent.h
43
44To use the signalent.sh script, give it all the headers that might contain
45appropriate signal values.  Excessive headers are not a problem.  The resulting
46output should be directly usable without modification.
47	sh ./signalent.sh \
48		$asrc/signal.h \
49		> signalent.h
50
51To use the syscallent.sh script, give it the header with the list of your
52system call numbers.  The resulting output is useful as a template for creating
53a proper header as it can really only detect the system call number and its
54name.  It has no way of knowing the number of arguments or strace flags for
55decoding them (yet?).
56	sh ./syscallent.sh \
57		$asrc/unistd.h \
58		> syscallent.h
59