Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Feb 2012 13:55:43 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232179 - in head/sys: kern sys
Message-ID:  <201202261355.q1QDth33068041@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sun Feb 26 13:55:43 2012
New Revision: 232179
URL: http://svn.freebsd.org/changeset/base/232179

Log:
  Add SO_PROTOCOL/SO_PROTOTYPE socket SOL_SOCKET-level option to get the
  socket protocol number.  This is useful since the socket type can
  be implemented by different protocols in the same protocol family,
  e.g. SOCK_STREAM may be provided by both TCP and SCTP.
  
  Submitted by:	Jukka A. Ukkonen <jau iki fi>
  PR:	  kern/162352
  Discussed with:	bz
  Reviewed by:	glebius
  MFC after:	2 weeks

Modified:
  head/sys/kern/uipc_socket.c
  head/sys/sys/socket.h

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Sun Feb 26 13:51:05 2012	(r232178)
+++ head/sys/kern/uipc_socket.c	Sun Feb 26 13:55:43 2012	(r232179)
@@ -2733,6 +2733,10 @@ integer:
 			optval = so->so_type;
 			goto integer;
 
+		case SO_PROTOCOL:
+			optval = so->so_proto->pr_protocol;
+			goto integer;
+
 		case SO_ERROR:
 			SOCK_LOCK(so);
 			optval = so->so_error;

Modified: head/sys/sys/socket.h
==============================================================================
--- head/sys/sys/socket.h	Sun Feb 26 13:51:05 2012	(r232178)
+++ head/sys/sys/socket.h	Sun Feb 26 13:55:43 2012	(r232179)
@@ -138,6 +138,8 @@ typedef	__uid_t		uid_t;
 #define	SO_LISTENINCQLEN	0x1013	/* socket's incomplete queue length */
 #define	SO_SETFIB	0x1014		/* use this FIB to route */
 #define	SO_USER_COOKIE	0x1015		/* user cookie (dummynet etc.) */
+#define	SO_PROTOCOL	0x1016		/* get socket protocol (Linux name) */
+#define	SO_PROTOTYPE	SO_PROTOCOL	/* alias for SO_PROTOCOL (SunOS name) */
 #endif
 
 /*



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