Date: Sat, 7 Apr 2018 21:00:21 +0000 (UTC) From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332244 - stable/11/lib/libsysdecode Message-ID: <201804072100.w37L0LfE004293@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tuexen Date: Sat Apr 7 21:00:21 2018 New Revision: 332244 URL: https://svnweb.freebsd.org/changeset/base/332244 Log: MFC r327966: Add a function is decode the sinfo_flags of struct sctp_sndrcvinfo. Added: stable/11/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3 - copied unchanged from r327966, head/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3 Modified: stable/11/lib/libsysdecode/Makefile stable/11/lib/libsysdecode/flags.c stable/11/lib/libsysdecode/sysdecode.3 stable/11/lib/libsysdecode/sysdecode.h stable/11/lib/libsysdecode/sysdecode_enum.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/Makefile ============================================================================== --- stable/11/lib/libsysdecode/Makefile Sat Apr 7 20:57:27 2018 (r332243) +++ stable/11/lib/libsysdecode/Makefile Sat Apr 7 21:00:21 2018 (r332244) @@ -21,6 +21,7 @@ MAN= sysdecode.3 \ sysdecode_ioctlname.3 \ sysdecode_mask.3 \ sysdecode_quotactl_cmd.3 \ + sysdecode_sctp_sinfo_flags.3 \ sysdecode_sigcode.3 \ sysdecode_sockopt_name.3 \ sysdecode_socket_protocol.3 \ Modified: stable/11/lib/libsysdecode/flags.c ============================================================================== --- stable/11/lib/libsysdecode/flags.c Sat Apr 7 20:57:27 2018 (r332243) +++ stable/11/lib/libsysdecode/flags.c Sat Apr 7 21:00:21 2018 (r332244) @@ -1163,3 +1163,31 @@ sysdecode_sctp_pr_policy(int policy) return (lookup_value(sctpprpolicy, policy)); } + +static struct name_table sctpsinfoflags[] = { + X(SCTP_EOF) X(SCTP_ABORT) X(SCTP_UNORDERED) X(SCTP_ADDR_OVER) + X(SCTP_SENDALL) X(SCTP_EOR) X(SCTP_SACK_IMMEDIATELY) XEND +}; + +void +sysdecode_sctp_sinfo_flags(FILE *fp, int sinfo_flags) +{ + const char *temp; + int rem; + bool printed; + + printed = print_mask_0(fp, sctpsinfoflags, sinfo_flags, &rem); + if (rem & ~SCTP_PR_SCTP_ALL) { + fprintf(fp, "%s%#x", printed ? "|" : "", rem & ~SCTP_PR_SCTP_ALL); + printed = true; + rem &= ~SCTP_PR_SCTP_ALL; + } + if (rem != 0) { + temp = sysdecode_sctp_pr_policy(rem); + if (temp != NULL) { + fprintf(fp, "%s%s", printed ? "|" : "", temp); + } else { + fprintf(fp, "%s%#x", printed ? "|" : "", rem); + } + } +} Modified: stable/11/lib/libsysdecode/sysdecode.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.3 Sat Apr 7 20:57:27 2018 (r332243) +++ stable/11/lib/libsysdecode/sysdecode.3 Sat Apr 7 21:00:21 2018 (r332244) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 2017 +.Dd January 14, 2018 .Dt SYSDECODE 3 .Os .Sh NAME @@ -76,6 +76,7 @@ A placeholder for use when the ABI is not known. .Xr sysdecode_kevent 3 , .Xr sysdecode_mask 3 , .Xr sysdecode_quotactl_cmd 3 , +.Xr sysdecode_sctp_sinfo_flags 3 , .Xr sysdecode_sigcode 3 , .Xr sysdecode_socket_protocol 3 , .Xr sysdecode_sockopt_name 3 , Modified: stable/11/lib/libsysdecode/sysdecode.h ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.h Sat Apr 7 20:57:27 2018 (r332243) +++ stable/11/lib/libsysdecode/sysdecode.h Sat Apr 7 21:00:21 2018 (r332244) @@ -90,6 +90,7 @@ const char *sysdecode_rlimit(int _resource); const char *sysdecode_rtprio_function(int _function); const char *sysdecode_scheduler_policy(int _policy); const char *sysdecode_sctp_pr_policy(int _policy); +void sysdecode_sctp_sinfo_flags(FILE *_fp, int _sinfo_flags); const char *sysdecode_semctl_cmd(int _cmd); bool sysdecode_semget_flags(FILE *_fp, int _flag, int *_rem); bool sysdecode_sendfile_flags(FILE *_fp, int _flags, int *_rem); Modified: stable/11/lib/libsysdecode/sysdecode_enum.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_enum.3 Sat Apr 7 20:57:27 2018 (r332243) +++ stable/11/lib/libsysdecode/sysdecode_enum.3 Sat Apr 7 21:00:21 2018 (r332244) @@ -54,6 +54,7 @@ .Nm sysdecode_rtprio_function , .Nm sysdecode_scheduler_policy , .Nm sysdecode_sctp_pr_policy , +.Nm sysdecode_sctp_sinfo_flags , .Nm sysdecode_semctl_cmd , .Nm sysdecode_shmctl_cmd , .Nm sysdecode_shutdown_how , Copied: stable/11/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3 (from r327966, head/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3 Sat Apr 7 21:00:21 2018 (r332244, copy of r327966, head/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3) @@ -0,0 +1,55 @@ +.\" +.\" Copyright (c) 2018 Michael Tuexen <tuexen@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 14, 2018 +.Dt sysdecode_sctp_sinfo_flags 3 +.Os +.Sh NAME +.Nm sysdecode_sctp_sinfo_flags +.Nd output textual description of the sinfo_flags field of struct sctp_sndrcvinfo +.Sh LIBRARY +.Lb libsysdecode +.Sh SYNOPSIS +.In sys/types.h +.In stdbool.h +.In stdio.h +.In sysdecode.h +.Ft void +.Fn sysdecode_sctp_sinfo_flags "FILE *fp" "int sinfo_flags" +.Sh DESCRIPTION +The +.Fn sysdecode_sctp_sinfo_flags +function outputs a textual description of the +.Fa sinfo_flags +member of a +.Vt struct sctp_sndrcvinfo +to the stream +.Fa fp . +In particular, the embedded PR-SCTP policies are handled. +.Sh SEE ALSO +.Xr sysdecode 3 +.Xr sysdecode_sctp_pr_policy 3
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804072100.w37L0LfE004293>