Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Apr 2020 00:20:31 +0000 (UTC)
From:      "Simon J. Gerraty" <sjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r360481 - stable/12/sys/sys
Message-ID:  <202004300020.03U0KVSA014734@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sjg
Date: Thu Apr 30 00:20:31 2020
New Revision: 360481
URL: https://svnweb.freebsd.org/changeset/base/360481

Log:
  Define enum for so_qstate outside of struct.
  
  LLVM-9.0 clang++ throws an error for enum defined within
  an anonymous struct.
  
  MFC of r360059
  
  Reviewed by:	jtl, rpokala
  Differential Revision: https://reviews.freebsd.org//D24477

Modified:
  stable/12/sys/sys/socketvar.h

Modified: stable/12/sys/sys/socketvar.h
==============================================================================
--- stable/12/sys/sys/socketvar.h	Thu Apr 30 00:14:14 2020	(r360480)
+++ stable/12/sys/sys/socketvar.h	Thu Apr 30 00:20:31 2020	(r360481)
@@ -67,6 +67,12 @@ typedef	void so_dtor_t(struct socket *);
 
 struct socket;
 
+enum socket_qstate {
+	SQ_NONE = 0,
+	SQ_INCOMP = 0x0800,	/* on sol_incomp */
+	SQ_COMP = 0x1000,	/* on sol_comp */
+};
+
 /*-
  * Locking key to struct socket:
  * (a) constant after allocation, no locking required.
@@ -122,12 +128,7 @@ struct socket {
 			/* (e) Our place on accept queue. */
 			TAILQ_ENTRY(socket)	so_list;
 			struct socket		*so_listen;	/* (b) */
-			enum {
-				SQ_NONE = 0,
-				SQ_INCOMP = 0x0800,	/* on sol_incomp */
-				SQ_COMP = 0x1000,	/* on sol_comp */
-			}			so_qstate;	/* (b) */
-
+			enum socket_qstate so_qstate;		/* (b) */
 			/* (b) cached MAC label for peer */
 			struct	label		*so_peerlabel;
 			u_long	so_oobmark;	/* chars to oob mark */
@@ -172,6 +173,10 @@ struct socket {
 			short		sol_sbsnd_flags;
 			sbintime_t	sol_sbrcv_timeo;
 			sbintime_t	sol_sbsnd_timeo;
+
+			/* Information tracking listen queue overflows. */
+			struct timeval	sol_lastover;	/* (e) */
+			int		sol_overcount;	/* (e) */
 		};
 	};
 };
@@ -180,13 +185,13 @@ struct socket {
 /*
  * Socket state bits.
  *
- * Historically, this bits were all kept in the so_state field.  For
- * locking reasons, they are now in multiple fields, as they are
- * locked differently.  so_state maintains basic socket state protected
- * by the socket lock.  so_qstate holds information about the socket
- * accept queues.  Each socket buffer also has a state field holding
- * information relevant to that socket buffer (can't send, rcv).  Many
- * fields will be read without locks to improve performance and avoid
+ * Historically, these bits were all kept in the so_state field.
+ * They are now split into separate, lock-specific fields.
+ * so_state maintains basic socket state protected by the socket lock.
+ * so_qstate holds information about the socket accept queues.
+ * Each socket buffer also has a state field holding information
+ * relevant to that socket buffer (can't send, rcv).
+ * Many fields will be read without locks to improve performance and avoid
  * lock order issues.  However, this approach must be used with caution.
  */
 #define	SS_NOFDREF		0x0001	/* no file table ref any more */
@@ -379,7 +384,8 @@ struct uio;
 /*
  * From uipc_socket and friends
  */
-int	getsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len);
+int	getsockaddr(struct sockaddr **namp, const struct sockaddr *uaddr,
+	    size_t len);
 int	getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
 	    struct file **fpp, u_int *fflagp, struct filecaps *havecaps);
 void	soabort(struct socket *so);



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