You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 1283 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Sorry -- forgot to say that I'm running Ocaml 3.04 on FreeBSD v4.6.
Thanks,
Steve
On Wed, 2002-07-31 at 13:30, Steven Bishop wrote:
Hi,
The following program terminates producing an incorrect result of !SO_KEEPALIVE
but will terminate correctly if the 'if ...' is modified to 'if (getsockopt sd
SO_KEEPALIVE)':
open Unix;;
exception Fatal of string;;
let sd =
try socket PF_INET SOCK_STREAM 6
with Unix_error(e,s1,s2) ->
raise(Fatal("Error:"^(error_message(e))^s1^s2))
in
let opt = setsockopt sd SO_KEEPALIVE true
in
if (getsockopt sd SO_KEEPALIVE) = true
then print_endline("SO_KEEPALIVE")
else print_endline("!SO_KEEPALIVE");;
I believe the problem is due to tha fact that the Unix getsockopt can return
any non-zero integer for true (hence the [8] in the strace output). The
getsockopt implementation calls getsockopt_int and returns a Val_int(..)
though I believe it should return a Val_bool(..) to explictely map numbers > 1
to true.
This probably means implementing getsockopt as:
CAMLprim value unix_getsockopt_bool(value socket, value option) {
return Val_bool(Int_val(getsockopt_int(sockopt_bool, socket, SOL_SOCKET,
option)));
}
Original bug ID: 1283
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Sorry -- forgot to say that I'm running Ocaml 3.04 on FreeBSD v4.6.
Thanks,
Steve
On Wed, 2002-07-31 at 13:30, Steven Bishop wrote:
--
Steve Bishop
President - Cambridge University Caving Club - http://cucc.survex.com/
smb50@cam.ac.uk - http://smb50.quns.cam.ac.uk/ - Mobile 07748 960856
Queens' College, Cambridge. CB3 9ET
The text was updated successfully, but these errors were encountered: