Define a new socket option, SO_PRIVSTATE. Getting it returns the state

of the SS_PRIV flag in so_state; setting it always clears same.
This commit is contained in:
Garrett Wollman 1996-02-07 16:19:19 +00:00
parent a8344ffc23
commit b135805469
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13955
2 changed files with 12 additions and 2 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94
* $Id: uipc_socket.c,v 1.12 1995/11/03 18:33:43 wollman Exp $
* $Id: uipc_socket.c,v 1.13 1995/12/14 22:51:01 bde Exp $
*/
#include <sys/param.h>
@ -944,6 +944,11 @@ sosetopt(so, level, optname, m0)
break;
}
case SO_PRIVSTATE:
/* we don't care what the parameter is... */
so->so_state &= ~SS_PRIV;
break;
default:
error = ENOPROTOOPT;
break;
@ -998,6 +1003,10 @@ sogetopt(so, level, optname, mp)
*mtod(m, int *) = so->so_options & optname;
break;
case SO_PRIVSTATE:
*mtod(m, int *) = so->so_state & SS_PRIV;
break;
case SO_TYPE:
*mtod(m, int *) = so->so_type;
break;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)socket.h 8.4 (Berkeley) 2/21/94
* $Id: socket.h,v 1.8 1996/01/05 17:49:30 davidg Exp $
* $Id: socket.h,v 1.9 1996/01/30 23:01:22 mpp Exp $
*/
#ifndef _SYS_SOCKET_H_
@ -75,6 +75,7 @@
#define SO_RCVTIMEO 0x1006 /* receive timeout */
#define SO_ERROR 0x1007 /* get error status and clear */
#define SO_TYPE 0x1008 /* get socket type */
#define SO_PRIVSTATE 0x1009 /* get/deny privileged state */
/*
* Structure used for manipulating linger option.