We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Use the same CMSG_* fix on Solaris 9 as on OS X.

The previous fix didn't work at runtime.
ato (author)
Tue Jul 08 18:29:46 -0700 2008
commit  f97d825704bed3cae095248c950c1b506bb30a52
tree    12e70f973b3c6bf0df24d4ee8b8f48147c0e2670
parent  383ee5248371e394756016f54e9d61c98902756c
...
38
39
40
41
42
43
44
45
46
47
48
49
50
...
292
293
294
295
 
296
297
298
...
320
321
322
323
 
324
325
326
...
468
469
470
471
 
472
473
474
...
507
508
509
510
 
511
512
513
...
38
39
40
 
 
 
 
 
 
 
41
42
43
...
285
286
287
 
288
289
290
291
...
313
314
315
 
316
317
318
319
...
461
462
463
 
464
465
466
467
...
500
501
502
 
503
504
505
506
0
@@ -38,13 +38,6 @@
0
   // always included by unistd.h and sys/types.h.
0
   #include <sys/uio.h>
0
 #endif
0
-#ifdef __SOLARIS9__
0
- // These macros are missing from sys/socket.h on Solaris 9.
0
- #define CMSG_SPACE(l) \
0
- ((unsigned int)_CMSG_HDR_ALIGN(sizeof (struct cmsghdr) + (l)))
0
- #define CMSG_LEN(l) \
0
- ((unsigned int)_CMSG_DATA_ALIGN(sizeof (struct cmsghdr)) + (l))
0
-#endif
0
 
0
 #include "Exceptions.h"
0
 #include "Utils.h"
0
@@ -292,7 +285,7 @@ public:
0
     struct msghdr msg;
0
     struct iovec vec;
0
     char dummy[1];
0
- #ifdef __APPLE__
0
+ #if defined(__APPLE__) || defined(__SOLARIS9__)
0
       struct {
0
         struct cmsghdr header;
0
         int fd;
0
@@ -320,7 +313,7 @@ public:
0
     control_header = CMSG_FIRSTHDR(&msg);
0
     control_header->cmsg_level = SOL_SOCKET;
0
     control_header->cmsg_type = SCM_RIGHTS;
0
- #ifdef __APPLE__
0
+ #if defined(__APPLE__) || defined(__SOLARIS9__)
0
       control_header->cmsg_len = sizeof(control_data);
0
       control_data.fd = fileDescriptor;
0
     #else
0
@@ -468,7 +461,7 @@ public:
0
     struct msghdr msg;
0
     struct iovec vec;
0
     char dummy[1];
0
- #ifdef __APPLE__
0
+ #if defined(__APPLE__) || defined(__SOLARIS9__)
0
       // File descriptor passing macros (CMSG_*) seem to be broken
0
       // on 64-bit MacOS X. This structure works around the problem.
0
       struct {
0
@@ -507,7 +500,7 @@ public:
0
      || control_header->cmsg_type != SCM_RIGHTS) {
0
       throw IOException("No valid file descriptor received.");
0
     }
0
- #ifdef __APPLE__
0
+ #if defined(__APPLE__) || defined(__SOLARIS9__)
0
       return control_data.fd;
0
     #else
0
       return *((int *) CMSG_DATA(control_header));
...
21
22
23
 
 
 
24
25
26
27
28
29
 
...
21
22
23
24
25
26
27
28
29
30
 
31
32
0
@@ -21,8 +21,11 @@ $LIBS=""
0
 if RUBY_PLATFORM =~ /solaris/
0
   have_library('xnet')
0
   $CFLAGS << " -D_XPG4_2"
0
+ if RUBY_PLATFORM =~ /solaris2.9/
0
+ $CFLAGS << " -D__SOLARIS9__"
0
+ end
0
 end
0
 
0
 with_cflags($CFLAGS) do
0
   create_makefile('native_support')
0
-end
0
\ No newline at end of file
0
+end
...
29
30
31
32
33
34
35
36
37
38
39
40
41
...
57
58
59
60
 
61
62
63
...
86
87
88
89
 
90
91
92
...
117
118
119
120
 
121
122
123
...
156
157
158
159
 
160
161
162
...
29
30
31
 
 
 
 
 
 
 
32
33
34
...
50
51
52
 
53
54
55
56
...
79
80
81
 
82
83
84
85
...
110
111
112
 
113
114
115
116
...
149
150
151
 
152
153
154
155
0
@@ -29,13 +29,6 @@
0
   // always included by unistd.h and sys/types.h.
0
   #include <sys/uio.h>
0
 #endif
0
-#ifdef __SOLARIS9__
0
- // These macros are missing from sys/socket.h on Solaris 9.
0
- #define CMSG_SPACE(l) \
0
- ((unsigned int)_CMSG_HDR_ALIGN(sizeof (struct cmsghdr) + (l)))
0
- #define CMSG_LEN(l) \
0
- ((unsigned int)_CMSG_DATA_ALIGN(sizeof (struct cmsghdr)) + (l))
0
-#endif
0
 
0
 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
0
 
0
@@ -57,7 +50,7 @@ send_fd(VALUE self, VALUE socket_fd, VALUE fd_to_send) {
0
   struct msghdr msg;
0
   struct iovec vec;
0
   char dummy[1];
0
- #ifdef __APPLE__
0
+ #if defined(__APPLE__) || defined(__SOLARIS9__)
0
     struct {
0
       struct cmsghdr header;
0
       int fd;
0
@@ -86,7 +79,7 @@ send_fd(VALUE self, VALUE socket_fd, VALUE fd_to_send) {
0
   control_header->cmsg_level = SOL_SOCKET;
0
   control_header->cmsg_type = SCM_RIGHTS;
0
   control_payload = NUM2INT(fd_to_send);
0
- #ifdef __APPLE__
0
+ #if defined(__APPLE__) || defined(__SOLARIS9__)
0
     control_header->cmsg_len = sizeof(control_data);
0
     control_data.fd = control_payload;
0
   #else
0
@@ -117,7 +110,7 @@ recv_fd(VALUE self, VALUE socket_fd) {
0
   struct msghdr msg;
0
   struct iovec vec;
0
   char dummy[1];
0
- #ifdef __APPLE__
0
+ #if defined(__APPLE__) || defined(__SOLARIS9__)
0
     // File descriptor passing macros (CMSG_*) seem to be broken
0
     // on 64-bit MacOS X. This structure works around the problem.
0
     struct {
0
@@ -156,7 +149,7 @@ recv_fd(VALUE self, VALUE socket_fd) {
0
     rb_sys_fail("No valid file descriptor received.");
0
     return Qnil;
0
   }
0
- #ifdef __APPLE__
0
+ #if defined(__APPLE__) || defined(__SOLARIS9__)
0
     return INT2NUM(control_data.fd);
0
   #else
0
     return INT2NUM(*((int *) CMSG_DATA(control_header)));

Comments

    No one has commented yet.