From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18631 invoked by alias); 2 Dec 2013 19:35:12 -0000 Mailing-List: contact cygwin-talk-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-talk-owner@cygwin.com Reply-To: The Vulgar and Unprofessional Cygwin-Talk List Mail-Followup-To: cygwin-talk@cygwin.com Received: (qmail 18597 invoked by uid 89); 2 Dec 2013 19:35:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: etr-usa.com Received: from Unknown (HELO etr-usa.com) (130.94.180.135) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 02 Dec 2013 19:35:10 +0000 Received: (qmail 96270 invoked by uid 13447); 2 Dec 2013 19:35:03 -0000 Received: from unknown (HELO [172.20.0.42]) ([107.4.26.51]) (envelope-sender ) by 130.94.180.135 (qmail-ldap-1.03) with SMTP for ; 2 Dec 2013 19:35:03 -0000 Message-ID: <529CE0E4.4080804@etr-usa.com> Date: Mon, 02 Dec 2013 19:35:00 -0000 From: Warren Young User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: The Vulgar and Unprofessional Cygwin-Talk List Subject: Re: Design mixed 32 and 64 bit systems. References: <6CF2FC1279D0844C9357664DC5A08BA21D7054@MLBXV06.nih.gov> In-Reply-To: <6CF2FC1279D0844C9357664DC5A08BA21D7054@MLBXV06.nih.gov> Content-Type: multipart/mixed; boundary="------------060603070702030604030702" X-IsSubscribed: yes X-SW-Source: 2013-q4/txt/msg00012.txt.bz2 This is a multi-part message in MIME format. --------------060603070702030604030702 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1878 On 11/27/2013 13:11, Buchbinder, Barry (NIH/NIAID) [E] wrote: > > My question is why 64 bit wasn't named cygwin2.dll? While I agree that there is justification for that on "different ABI" grounds, it doesn't solve the core problem. That being, the Cygwin DLL maintains a bunch of shared data structures to provide the POSIX emulation that Cygwin programs require. Different DLLs mean different memory spaces, which means two *independent* sets of these data structures. Consider a simple case: parent PID. A 64-bit Cygwin program launches a 32-bit Cygwin program. What goes getppid(2) return in the child? Take a second and think about it. Got your guess? Okay, now put the two attached C++ files into a directory that both Cygwins can see (/cygdrive/c for example) and build them. The easiest way to do that is to say "make child32" from Cygwin 32 and "make parent64" from Cygwin 64. Now from Cygwin 64, run parent64. Does the output match your guess? I bet you'll find it surprising! ------- BEGIN SPOILER -------- This happens because POSIX PIDs are in a table that lives in cygwin1.dll's memory space, and because there are two DLLs, there are two different PID tables. -------- END SPOILER --------- You don't run into this problem on "real" 32/64-bit OSes because there is only one kernel, and the 32 vs 64 bit differences are abstracted away by the syscall layer, so that everything becomes 64-bit within kernel space. There is no single central entity in Cygwin, since Cygwin runs entirely in user space. Perhaps one could build a special 32-bit cygwin1.dll that worked like Wow64[*]. It may not be possible without kernel level support, from a driver at least. On the other hand, it can't be any more tricky than building something like VirtualBox. The question then is whether it's worth the effort. [*] http://goo.gl/oYbLwg --------------060603070702030604030702 Content-Type: text/x-c++src; name="child32.cpp" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="child32.cpp" Content-length: 159 #include #include int main() { std::cout << "My PID is " << getpid() << "; my parent's PID is " << getppid() << '.' << std::endl; } --------------060603070702030604030702 Content-Type: text/x-c++src; name="parent64.cpp" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="parent64.cpp" Content-length: 460 #include #include #include #include int main() { std::cout << "My PID is " << getpid() << "; " << std::flush; switch (int pid = fork()) { case -1: // error std::cout << "ERROR: " << strerror(errno) << std::endl; break; case 0: { // child const char* cmd = "./child32"; execl(cmd, cmd, 0); break; } default: // parent std::cout << "created child PID " << pid << std::endl; } } --------------060603070702030604030702--