Displaying 1 result from an estimated 1 matches for "control_messag".
Did you mean:
control_message
2009 Nov 04
0
PATCH: fast copy of files in local server mode
...ot;
+#include <linux/socket.h>
/** If no timeout is specified then use a 60 second select timeout */
#define SELECT_TIMEOUT 60
@@ -1722,6 +1723,82 @@
writefd(f, str, len);
}
+int send_fd(int socket, int fd_to_send)
+{
+ struct msghdr message;
+ struct iovec iov[1];
+ struct cmsghdr *control_message = NULL;
+ char buffer[CMSG_SPACE(sizeof(int))], data[1];
+ int ret;
+
+ memset(&message, 0, sizeof(struct msghdr));
+ memset(buffer, 0, CMSG_SPACE(sizeof(int)));
+
+ data[0] = 'F';
+ iov[0].iov_base = data;
+ iov[0].iov_len = 1;
+
+ message.msg_iov = iov;
+ message.msg_iovlen = 1;
+
+...