From owner-svn-src-all@freebsd.org Thu Apr 30 00:20:32 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 320152C7778; Thu, 30 Apr 2020 00:20:32 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CGHh0Zc4z41LS; Thu, 30 Apr 2020 00:20:32 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D3C7E172; Thu, 30 Apr 2020 00:20:32 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03U0KVts014735; Thu, 30 Apr 2020 00:20:31 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03U0KVSA014734; Thu, 30 Apr 2020 00:20:31 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <202004300020.03U0KVSA014734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 30 Apr 2020 00:20:31 +0000 (UTC) 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 X-SVN-Group: stable-12 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: stable/12/sys/sys X-SVN-Commit-Revision: 360481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 00:20:32 -0000 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);