linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] recv.2, cmsg.3: Fix type of cmsg_len member of cmsghdr structure
@ 2016-03-11 10:02 Nikola Forró
       [not found] ` <1457690557.5377.2.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Nikola Forró @ 2016-03-11 10:02 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

The type shown for cmsg_len member of cmsghdr structure is socklen_t,
but the actual type used by glibc and the kernel is size_t.

The information was obtained from glibc source code:
http://bit.ly/21m1RMp

Signed-off-by: Nikola Forró <nforro-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 man2/recv.2 | 6 +++---
 man3/cmsg.3 | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/man2/recv.2 b/man2/recv.2
index 33265b8..0491880 100644
--- a/man2/recv.2
+++ b/man2/recv.2
@@ -393,9 +393,9 @@ The messages are of the form:
 .nf
 
 struct cmsghdr {
-    socklen_t     cmsg_len;     /* data byte count, including hdr */
-    int           cmsg_level;   /* originating protocol */
-    int           cmsg_type;    /* protocol-specific type */
+    size_t cmsg_len;    /* data byte count, including hdr */
+    int    cmsg_level;  /* originating protocol */
+    int    cmsg_type;   /* protocol-specific type */
 /* followed by
     unsigned char cmsg_data[]; */
 };
diff --git a/man3/cmsg.3 b/man3/cmsg.3
index f1c4459..f97333f 100644
--- a/man3/cmsg.3
+++ b/man3/cmsg.3
@@ -28,9 +28,9 @@ CMSG_ALIGN, CMSG_SPACE, CMSG_NXTHDR, CMSG_FIRSTHDR \- access ancillary data
 .sp
 .nf
 struct cmsghdr {
-    socklen_t cmsg_len;    /* data byte count, including header */
-    int       cmsg_level;  /* originating protocol */
-    int       cmsg_type;   /* protocol-specific type */
+    size_t cmsg_len;    /* data byte count, including header */
+    int    cmsg_level;  /* originating protocol */
+    int    cmsg_type;   /* protocol-specific type */
     /* followed by unsigned char cmsg_data[]; */
 };
 .fi
-- 
2.4.3


--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] recv.2, cmsg.3: Fix type of cmsg_len member of cmsghdr structure
       [not found] ` <1457690557.5377.2.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2016-03-11 16:33   ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kerrisk (man-pages) @ 2016-03-11 16:33 UTC (permalink / raw)
  To: nforro-H+wXaHxf7aLQT0dZR+AlfA
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w,
	linux-man-u79uwXL29TY76Z2rM5mHXA

Hello Nikola

On 03/11/2016 11:02 AM, Nikola Forró wrote:
> The type shown for cmsg_len member of cmsghdr structure is socklen_t,
> but the actual type used by glibc and the kernel is size_t.
> 
> The information was obtained from glibc source code:
> http://bit.ly/21m1RMp

Thanks for the patch. I've applied it. However, the story is a little
more complex, because according to POSIX the type is 'socklen_t'.
So, I added some words in both pages point this out.

Cheers,

Michael

> Signed-off-by: Nikola Forró <nforro-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  man2/recv.2 | 6 +++---
>  man3/cmsg.3 | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/man2/recv.2 b/man2/recv.2
> index 33265b8..0491880 100644
> --- a/man2/recv.2
> +++ b/man2/recv.2
> @@ -393,9 +393,9 @@ The messages are of the form:
>  .nf
>  
>  struct cmsghdr {
> -    socklen_t     cmsg_len;     /* data byte count, including hdr */
> -    int           cmsg_level;   /* originating protocol */
> -    int           cmsg_type;    /* protocol-specific type */
> +    size_t cmsg_len;    /* data byte count, including hdr */
> +    int    cmsg_level;  /* originating protocol */
> +    int    cmsg_type;   /* protocol-specific type */
>  /* followed by
>      unsigned char cmsg_data[]; */
>  };
> diff --git a/man3/cmsg.3 b/man3/cmsg.3
> index f1c4459..f97333f 100644
> --- a/man3/cmsg.3
> +++ b/man3/cmsg.3
> @@ -28,9 +28,9 @@ CMSG_ALIGN, CMSG_SPACE, CMSG_NXTHDR, CMSG_FIRSTHDR \- access ancillary data
>  .sp
>  .nf
>  struct cmsghdr {
> -    socklen_t cmsg_len;    /* data byte count, including header */
> -    int       cmsg_level;  /* originating protocol */
> -    int       cmsg_type;   /* protocol-specific type */
> +    size_t cmsg_len;    /* data byte count, including header */
> +    int    cmsg_level;  /* originating protocol */
> +    int    cmsg_type;   /* protocol-specific type */
>      /* followed by unsigned char cmsg_data[]; */
>  };
>  .fi
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-11 16:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-11 10:02 [patch] recv.2, cmsg.3: Fix type of cmsg_len member of cmsghdr structure Nikola Forró
     [not found] ` <1457690557.5377.2.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-11 16:33   ` Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).