Home | History | Annotate | Download | only in tests
      1 #include <netlink/netlink.h>
      2 #include <errno.h>
      3 
      4 int main(int argc, char *argv[])
      5 {
      6 	struct nl_sock *h[1025];
      7 	int i;
      8 
      9 	h[0] = nl_socket_alloc();
     10 	printf("Created handle with port 0x%x\n",
     11 			nl_socket_get_local_port(h[0]));
     12 	nl_socket_free(h[0]);
     13 	h[0] = nl_socket_alloc();
     14 	printf("Created handle with port 0x%x\n",
     15 			nl_socket_get_local_port(h[0]));
     16 	nl_socket_free(h[0]);
     17 
     18 	for (i = 0; i < 1025; i++) {
     19 		h[i] = nl_socket_alloc();
     20 		if (h[i] == NULL)
     21 			nl_perror(ENOMEM, "Unable to allocate socket");
     22 		else
     23 			printf("Created handle with port 0x%x\n",
     24 				nl_socket_get_local_port(h[i]));
     25 	}
     26 
     27 	return 0;
     28 }
     29