Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Aug 2013 11:48:41 -0700
From:      Yuri <yuri@rawbw.com>
To:        freebsd-net@freebsd.org
Subject:   LOCAL_CREDS are broken ?
Message-ID:  <521F9789.5000903@rawbw.com>

next in thread | raw e-mail | index | archive | help
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);}
}




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?521F9789.5000903>