Check-in [f1282eed3e]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fixed sockaddr_in.sin_zero size, thanks to gwatt
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f1282eed3e71eb08974e779dbd8e008a6661e11a
User & Date: aldo 2016-12-12 22:48:14
Context
2016-12-12
23:11
clearer way to get sizeof sockaddr_in.sin_zero check-in: b43586041b user: aldo tags: trunk
22:48
fixed sockaddr_in.sin_zero size, thanks to gwatt check-in: f1282eed3e user: aldo tags: trunk
16:01
added better errno support check-in: e0957430e1 user: aldo tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to socket.sls.

55
56
57
58
59
60
61

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
	      (sun_data (array 108 char))))
    
    (define-ftype in_addr_t unsigned-32)
    (define-ftype in_addr
      (struct (s_addr in_addr_t)))
    
    ;; WARNING- here the size of sin_zero should be calculated on your machine as:

    #;(import (c-eval))
    #;(parameterize ([c-eval-includes '("stdio.h" "sys/socket.h" "netinet/in.h")])
    (c-eval-printf "%d" "sizeof(struct sockaddr_in) - (sizeof (sa_family_t) - sizeof(in_port_t) - sizeof(in_addr_t))"))
    ;; in my case  (a6le) -> 20
    
    (define-ftype sockaddr_in
      (struct
       (sin_family sa_family_t)
       (sin_port in_port_t)
       (sin_addr in_addr)
       (sin_zero (array 20 unsigned-8))))
  
    (define INADDR_ANY 0)
    ]
   [else
    (error 'socket.sls "unsupported machine-type ~a" (machine-type))])

  (define (socket domain type type-flags protocol)  







>


|
|






|







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
	      (sun_data (array 108 char))))
    
    (define-ftype in_addr_t unsigned-32)
    (define-ftype in_addr
      (struct (s_addr in_addr_t)))
    
    ;; WARNING- here the size of sin_zero should be calculated on your machine as:
    
    #;(import (c-eval))
    #;(parameterize ([c-eval-includes '("stdio.h" "sys/socket.h" "netinet/in.h")])
    (c-eval-printf "%d" "sizeof(struct sockaddr_in) - sizeof (sa_family_t) - sizeof(in_port_t) - sizeof(in_addr_t)"))
    ;; in my case  (a6le) -> 8
    
    (define-ftype sockaddr_in
      (struct
       (sin_family sa_family_t)
       (sin_port in_port_t)
       (sin_addr in_addr)
       (sin_zero (array 8 unsigned-8))))
  
    (define INADDR_ANY 0)
    ]
   [else
    (error 'socket.sls "unsupported machine-type ~a" (machine-type))])

  (define (socket domain type type-flags protocol)