Gentoo Archives: gentoo-embedded

From: Christopher Friedt <cfriedt@××××××××××××××.com>
To: gentoo-embedded@l.g.o
Subject: [gentoo-embedded] (ARM) small patch for linux / headers 2.4.26-r1
Date: Mon, 17 Mar 2008 12:33:55
Message-Id: 47DE6531.8020106@visible-assets.com
1 Hi everyone,
2
3 I'm going to submit a bug for this, but the linux-headers-2.4.26-r1
4 require another small patch. This specifically effects the
5 asm-arm/unistd.h file.
6
7 The syscall for waitpid is not actually defined for the arm, instead it
8 should always be changed to wait4 via the static inline waitpid function.
9
10 When building glibc-2.3.2, however, there is a check made for
11 __NR_waitpid (system call # 7). That should _not_ be defined in the
12 linux-headers. If so, then any glibc-linked (static or dynamic)
13 application will return errno 38 (ENOSYS/Function not implemented) when
14 waitpid is invoked.
15
16 This can be verified if my instructions are followed below for creating
17 a cross-toolchain based on linux-headers-2.4.26-r1 and glibc-2.3.2-r12.
18 That combination will fail for waitpid calls. With the
19 linux-headers-2.4.26-r2 ebuild in my overlay, waitpid works properly.
20
21 http://gentoo-wiki.com/Gentoo_for_the_TS72xx_(Old_Toolchain)
22
23 In my overlay, I've created a separate ebuild for glibc-2.3.2 so it
24 behaves better with the more recent glibc ebuild structure, and also a
25 separate ebuild called linux-headers-2.4.26-r2 which has my very tiny
26 patch as well.
27
28 A simple test program is attached, which can be shown to provide the
29 output below:
30
31 ### Incorrect output
32 ./waitpid_demo; echo $?
33 This is the parent, pid 4106
34
35 waitpid: 38: Function not implemented
36
37
38 This is the child, pid 4107
39 child sleeping
40
41 child sleeping
42
43 child sleeping
44
45 child woke up!
46
47 ### Correct output, with my patch applied to the headers
48 ./waitpid_demo
49
50 This is the child, pid 4179
51
52 child sleeping
53
54 This is the parent, pid 4178
55
56 parent sleeping
57
58 child sleeping
59
60 parent sleeping
61
62 child sleeping
63
64 parent sleeping
65
66 child woke up!
67
68 child 4179 returned
69
70 The patch is also attached.
71
72 This obviously has a massive effect on any program that uses waitpid -
73 and for gnu systems that means _lots_ of libraries and applications
74 would otherwise not work.
75
76 I'll file the bug momentarily.
77
78 Cheers,
79
80 Chris

Attachments

File name MIME type
waitpid_demo.c text/x-csrc
linux-headers-asm-arm-nowaitpid.patch text/x-patch

Replies

Subject Author
Re: [gentoo-embedded] (ARM) small patch for linux / headers 2.4.26-r1 Christopher Friedt <cfriedt@××××××××××××××.com>
Re: [gentoo-embedded] (ARM) small patch for linux / headers 2.4.26-r1 Christopher Friedt <cfriedt@××××××××××××××.com>