Logo Search packages:      
Sourcecode: libnl2 version File versions  Download package

int nl_socket_drop_memberships ( struct nl_sock *  sk,
int  group,
  ... 
)

Leave groups

  • sk Netlink socket
  • group Group identifier
Leaves the specified groups using the modern socket option which is available since kernel version 2.6.14. The list of groups has to terminated by 0 (NFNLGRP_NONE).

See also:
nl_socket_add_membership
Returns:
0 on success or a negative error code.

Definition at line 336 of file socket.c.

{
      int err;
      va_list ap;

      if (sk->s_fd == -1)
            return -NLE_BAD_SOCK;

      va_start(ap, group);

      while (group != 0) {
            if (group < 0)
                  return -NLE_INVAL;

            err = setsockopt(sk->s_fd, SOL_NETLINK, NETLINK_DROP_MEMBERSHIP,
                                     &group, sizeof(group));
            if (err < 0)
                  return -nl_syserr2nlerr(errno);

            group = va_arg(ap, int);
      }

      va_end(ap);

      return 0;
}


Generated by  Doxygen 1.6.0   Back to index