Here is the regular and strace output on 2.4 kernel, more specifically Linux 2.4.21-4.EL #1 Fri Oct 3 18:13:58 EDT 2003 i686 i686 i386 GNU/Linux.

$ test_threads2
Counter value functionCount1: 1
Counter value functionCount1: 2
Counter value functionCount1: 3
Counter value functionCount2: 4
Counter value functionCount2: 5
Counter value functionCount2: 6
Counter value functionCount2: 7
Counter value functionCount1: 8
Counter value functionCount1: 9
Counter value functionCount1: 10
Final count: 10
$

$ strace test_threads2
execve("/home/jmudd/test_threads2", ["test_threads2"], [/* 26 vars */]) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
set_thread_area({entry_number:-1 -> 6, base_addr:0x804e540, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
set_tid_address(0x804e558)              = 25884
mmap2(NULL, 90112, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb75ea000
mprotect(0xb75eb000, 86016, PROT_READ|PROT_WRITE) = 0
clone(child_stack=0xb75fff30, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|CLONE_DETACHED, parent_tidptr=0xb75fff58, {entry_number:6, base_addr:0xb75fff40, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}, child_tidptr=0xb75fff58) = 25885
mmap2(NULL, 90112, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb75d4000
mprotect(0xb75d5000, 86016, PROT_READ|PROT_WRITE) = 0
clone(child_stack=0xb75e9f30, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|CLONE_DETACHED, parent_tidptr=0xb75e9f58, {entry_number:6, base_addr:0xb75e9f40, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}, child_tidptr=0xb75e9f58) = 25886
futex(0xb75fff58, FUTEX_WAIT, 25885, NULLCounter value functionCount1: 1
Counter value functionCount1: 2
Counter value functionCount1: 3
Counter value functionCount2: 4
Counter value functionCount2: 5
Counter value functionCount2: 6
Counter value functionCount2: 7
Counter value functionCount1: 8
Counter value functionCount1: 9
Counter value functionCount1: 10
) = 0
munmap(0xb75ea000, 90112)               = 0
munmap(0xb75d4000, 90112)               = 0
writev(1, [{"Final count: 10", 15}, {"\n", 1}], 2Final count: 10
) = 16
exit_group(0)                           = ?




On Fri, Mar 21, 2014 at 9:02 AM, John Mudd <johnbmudd@gmail.com> wrote:
Thanks for your reply.

I ran a test using an example thread app. I compiled the cond1.c example from http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html using musl-gcc on Ubuntu 13.04, 2.6 kernel obviously. The executable runs on 2.6 as well as 2.4. I actually expected some kind of failure on 2.4. Did I pick a poor example or am I not understanding still?


On Thu, Mar 20, 2014 at 7:14 PM, Rich Felker <dalias@aerifal.cx> wrote:
On Thu, Mar 20, 2014 at 04:58:49PM -0400, John Mudd wrote:
> Probably a dumb question. Is part of the value of musl that I can build an
> app using musl on linux 2.6 and then run the binary on linux 2.4?

The version of Linux you build on has no bearing on the binary that
comes out, so that's not a problem.

However, Linux 2.4 is not officially supported since it lacks a lot of
functionality needed to provide a modern POSIX conforming environment.
The most notable is that it can't do threads. If you're ok with that,
the other problems might be small enough that you don't mind. I
remember some people in Freenode #musl trying out 2.4 recently and
finding that a few of the busybox applets didn't work right, though,
due to missing statfs64 syscall.

This page has details on which kernel versions added which syscalls:

http://man7.org/linux/man-pages/man2/syscalls.2.html

so it may be helpful in evaluating if there's anything critical you'd
be missing. If a syscall has two versions, one with "64" on the end,
musl needs the one that ends in "64".

This is definitely a topic we could attempt to document better if more
people are interested in trying to use 2.4.

Rich