From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 79B6FBC0A for ; Sat, 5 May 2007 16:56:42 +0200 (CEST) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.226]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l45EuX0A006160 for ; Sat, 5 May 2007 16:56:41 +0200 Received: by wx-out-0506.google.com with SMTP id s16so1026056wxc for ; Sat, 05 May 2007 07:56:41 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=SO75+KN3Q2DSBmvuC/iOO3fLnwJ4YxI79N2l5WkZPbdKZEfkqIJrBBvWEH/uNhuQxyjKQq3gN49+9C+83cRMh8tXkKA1euG/m/WaRBEfJHWe84GqKxAUbdQBhNTB42NhMxOlYnmA40IKI06NH3wpGdwZ8Z8vHOj8A3eK/JHpA1k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=KMMD7Vm6WPLfpFHSfNLgdwCtNoyHRCPswy1eHhZfq1YYzo3AzuZIwAvpj3s5MGrmdtizunih34lJWqoUMEuqCa6DjZvR3hHCBaxJsVupxcYCwhl7UpOn/RT7FojP3s/klFODNEieTJot050Xp8ci6Yrm+8ZS/nv9NigjLnRmxPc= Received: by 10.90.104.14 with SMTP id b14mr3940124agc.1178377001339; Sat, 05 May 2007 07:56:41 -0700 (PDT) Received: by 10.90.31.11 with HTTP; Sat, 5 May 2007 07:56:41 -0700 (PDT) Message-ID: <95513600705050756r49357504v992dd28593159f58@mail.gmail.com> Date: Sat, 5 May 2007 16:56:41 +0200 From: "Olivier Andrieu" Sender: oandrieu@gmail.com To: "Joel Reymont" Subject: Re: [Caml-list] Serious bug in the OCaml FFI? Cc: "OCaml List" In-Reply-To: <307C6D82-55E3-42AD-B0B1-8C1DFC22394A@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <71B2C4B5-3ECB-450F-B015-3C5EAB90855F@gmail.com> <75F71DDF-CACC-4AD9-A3DA-E0049FC9FB2F@gmail.com> <307C6D82-55E3-42AD-B0B1-8C1DFC22394A@gmail.com> X-Google-Sender-Auth: ee7684192dccc9d0 X-Miltered: at discorde with ID 463C9B21.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; andrieu:01 oandrieu:01 bug:01 ocaml:01 ffi:01 osx:01 ocaml:01 topfind:01 getpeername:01 toplevel:01 printf:01 constants:01 unix:01 unix:01 wrote:01 On 5/5/07, Joel Reymont wrote: > I'm using 32-bit Mac OSX 10.4.9 Intel. > > I inserted a print-out into my version of socketpair.c [1] and ran my > OCaml test script > > #use "topfind";; > #require "unix";; > let x, y = Unix.socketpair Unix.PF_UNIX Unix.SOCK_STREAM 0;; > Unix.getpeername y;; > > which resulted in > > unix_socketpair: domain = 1, type = 1, proto = 0 > Exception: Unix.Unix_error (Unix.EAFNOSUPPORT, "", ""). > > Back at the toplevel > > # (Obj.magic Unix.PF_UNIX:int);; > - : int = 0 > > # (Obj.magic Unix.SOCK_STREAM:int);; > - : int = 0 > > Now, how exactly does 0 become 1 here? It doesn't, your printf prints the value of the C constants PF_UNIX and SOCK_STREAM, which apparently is 1. -- Olivier