Permalink
Browse files

Fix compilation on OS X.

  • Loading branch information...
1 parent 8ec6efa commit ca88f5c24a147a04e4f94390ccfced863dfed96c @FooBarWidget FooBarWidget committed May 6, 2008
Showing with 12 additions and 1 deletion.
  1. +2 −0 ext/apache2/MessageChannel.h
  2. +10 −1 ext/passenger/native_support.c
@@ -436,6 +436,8 @@ class MessageChannel {
struct iovec vec;
char dummy[1];
#ifdef __APPLE__
+ // File descriptor passing macros (CMSG_*) seem to be broken
+ // on 64-bit MacOS X. This structure works around the problem.
struct {
struct cmsghdr header;
int fd;
@@ -43,7 +43,14 @@ send_fd(VALUE self, VALUE socket_fd, VALUE fd_to_send) {
struct msghdr msg;
struct iovec vec;
char dummy[1];
- char control_data[CMSG_SPACE(sizeof(int))];
+ #ifdef __APPLE__
+ struct {
+ struct cmsghdr header;
+ int fd;
+ } control_data;
+ #else
+ char control_data[CMSG_SPACE(sizeof(int))];
+ #endif
struct cmsghdr *control_header;
int control_payload;
@@ -97,6 +104,8 @@ recv_fd(VALUE self, VALUE socket_fd) {
struct iovec vec;
char dummy[1];
#ifdef __APPLE__
+ // File descriptor passing macros (CMSG_*) seem to be broken
+ // on 64-bit MacOS X. This structure works around the problem.
struct {
struct cmsghdr header;
int fd;

0 comments on commit ca88f5c

Please sign in to comment.