LOCAL_CREDS are broken ?

Yuri yuri at rawbw.com
Thu Aug 29 18:48:48 UTC 2013


The example below breaks with "Protocol not available"
But what is wrong? Isn't this the correct usage?
LOCAL_CREDS are only handled in kern/uipc_usrreq.c for AF_LOCAL, so it 
isn't clear why this doesn't work.

Yuri



--- example.c ---
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/un.h>

main() {
   int sock;
   int error;
   int oval = 1;

   error = socket(AF_LOCAL, SOCK_SEQPACKET, 0);
   if (error == -1) {perror("socket"); exit(-1);}
   sock = error;

   error = setsockopt(sock, SOL_SOCKET, LOCAL_CREDS, &oval, sizeof(oval));
   if (error) {perror("setsockopt"); exit(-1);}
}



More information about the freebsd-net mailing list