guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hello! I'm guile newbie. getsockopt problem on OSX.


From: tomas
Subject: Re: Hello! I'm guile newbie. getsockopt problem on OSX.
Date: Thu, 12 Nov 2015 10:46:51 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Nov 12, 2015 at 03:17:32AM +0900, Park SungMin wrote:
> 
> I used guile 2.0.11 on Mac OSX.
> but, I find this problem..
> 
> 
> (use-modules (system foreign)
>            (rnrs bytevectors))
> 
> (define sock (socket AF_INET SOCK_DGRAM 0))
> 
> (getsockopt sock SOL_SOCKET SO_SNDBUF) ;;=> 140733193397248 ???
> 
> 
> so…I use C function directly…
> 
> ;;; 
> (define foreign-getsockopt
>   (pointer->procedure int (dynamic-func "getsockopt" (dynamic-link))
>                     (list int int int '* '*)))
> 
> (define ret-value (sint-list->bytevector '(0) (native-endianness) 4))
> (define size-value (sint-list->bytevector '(4) (native-endianness) 4))
> 
> (foreign-getsockopt (port->fdes sock) SOL_SOCKET SO_SNDBUF 
> (bytevector->pointer ret-value)
>                   (bytevector->pointer size-value))
> 
> (bytevector->sint-list  ret-value (native-endianness) 4) ;;=> 9216. It's 
> right!
> 
> 
> is it bug of getsockopt??

FWIW, on Linux (some Debian oldstable with stains of stable & testing, and a 
3.2.0-3,
64 bit), I'm getting 229376, wich is the expected value (it corresponds exactly 
with
the value in /proc/sys/net/core/wmem_default).

Guile 2.0.11 here, too.

So perhaps it's something specific to the OSX port?

regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlZEYAsACgkQBcgs9XrR2kbtlwCfaCRlWG4D0rBCGZwf7XPywZez
GJ0An3/9pkzRY2vmiSlLcqFQxBp6aJXc
=YBbm
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]