0

Migrating from Sun Solaris to RHEL. But while compiling the C program getting the following errors.

struct msghdr msg;
msg.msg_accrights = (caddr_t)&fd_to_send;
msg.msg_accrightslen = sizeof(int);

error: 'struct msghdr' has no member named 'msg_accrights'

error: 'struct msghdr' has no member named 'msg_accrightslen'

The Linux setup is running kernel 2.6.18-419.el5.

Stephen Kitt
  • 434,908
ray
  • 1

1 Answers1

3

Your Solaris code is using 4.3BSD-style messages; Linux uses 4.4BSD-style messages, with msg_control and msg_controllen and struct cmsg instead of msg_accrights.

You’ll need to modify your code to pass file descriptors using the approach described in How to use sendmsg() to send a file-descriptor via sockets between 2 processes?

Stephen Kitt
  • 434,908