(one day I'll learn to open a defect) duphi.patch.patch
The socket descriptor shouldn't be moved in 64-bit mode (patch should check build environment) since the 256-fd limit for stdio is not an issue for 64-bit apps. Low descriptors will be chewed up by other apr functions (file open, pipe open, accept) as well as non-apr code. I guess it helps some apps in some configurations (e.g., httpd has a big bunch of listening sockets and some plugin module or support library uses fopen(). If this patch is important for 32-bit apps, it would seem even more important to do the same thing for file descriptors created by apr_file_open(). Fishing for other thoughts: Maybe some of the other solutions at http://developers.sun.com/solaris/articles/stdio_256.html are more appropriate to the 32-bit case.