Your message dated Thu, 1 May 2025 16:48:31 +0200
with message-id <[email protected]>
and subject line Re: Bug#1010458: linux/sysctl.h: unknown type name 'size_t'
has caused the Debian Bug report #1010458,
regarding linux/sysctl.h: unknown type name 'size_t'
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1010458: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1010458
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: linux-libc-dev
Version: 5.17.3-1
Severity: normal
Tags: upstream
X-Debbugs-Cc: [email protected]


I was cleaning up the example programs in the man-pages by using
iwyu(1), when I found that <linux/sysctl.h> is using 'size_t'
without including any definition for it.

See the following example program:

        $ cat tmp/src/man2/sysctl.2.d/sysctl.c

        #define _GNU_SOURCE
        #include <linux/sysctl.h>
        #include <stdio.h>
        #include <stdlib.h>
        #include <string.h>
        #include <sys/syscall.h>
        #include <unistd.h>

        int _sysctl(struct __sysctl_args *args );

        #define OSNAMESZ 100

        int
        main(void)
        {
            struct __sysctl_args args;
            char osname[OSNAMESZ];
            size_t osnamelth;
            int name[] = { CTL_KERN, KERN_OSTYPE };

            memset(&args, 0, sizeof(args));
            args.name = name;
            args.nlen = sizeof(name)/sizeof(name[0]);
            args.oldval = osname;
            args.oldlenp = &osnamelth;

            osnamelth = sizeof(osname);

            if (syscall(SYS__sysctl, &args) == -1) {
                perror("_sysctl");
                exit(EXIT_FAILURE);
            }
            printf("This machine is running %*s\n", (int) osnamelth, osname);
            exit(EXIT_SUCCESS);
        }

for which I get the following errors:

        $ cc -c -std=gnu17 -Wall -Wextra -Werror -Wno-error=unused-parameter \
             -Wno-error=sign-compare -Wno-error=format \
             -o tmp/src/man2/sysctl.2.d/sysctl.o \
             tmp/src/man2/sysctl.2.d/sysctl.c;
        In file included from tmp/src/man2/sysctl.2.d/sysctl.c:3:
        /usr/include/linux/sysctl.h:39:9: error: unknown type name 'size_t'
           39 |         size_t *oldlenp;
              |         ^~~~~~
        /usr/include/linux/sysctl.h:41:9: error: unknown type name 'size_t'
           41 |         size_t newlen;
              |         ^~~~~~
        tmp/src/man2/sysctl.2.d/sysctl.c: In function 'main':
        tmp/src/man2/sysctl.2.d/sysctl.c:26:18: error: assignment to 'int *' 
from incompatible pointer type 'size_t *' {aka 'long unsigned int *'} 
[-Werror=incompatible-pointer-types]
           26 |     args.oldlenp = &osnamelth;
              |                  ^
        cc1: all warnings being treated as errors


It seems that it's supposed to know some types, but for some reason
'size_t' is not defined by the included headers:

        $ grep include </usr/include/linux/sysctl.h 
        #include <linux/const.h>
        #include <linux/types.h>


Cheers,

Alex



-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.16.0-5-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

-- no debconf information

--- End Message ---
--- Begin Message ---
On Mon, May 02, 2022 at 01:23:05AM +0200, Alejandro Colomar wrote:
> Package: linux-libc-dev
> Version: 5.17.3-1
> Severity: normal
> Tags: upstream
> X-Debbugs-Cc: [email protected]
> 
> 
> I was cleaning up the example programs in the man-pages by using
> iwyu(1), when I found that <linux/sysctl.h> is using 'size_t'
> without including any definition for it.
> 
> See the following example program:
> 
>       $ cat tmp/src/man2/sysctl.2.d/sysctl.c
> 
>       #define _GNU_SOURCE
>       #include <linux/sysctl.h>
>       #include <stdio.h>
>       #include <stdlib.h>
>       #include <string.h>
>       #include <sys/syscall.h>
>       #include <unistd.h>
> 
>       int _sysctl(struct __sysctl_args *args );
> 
>       #define OSNAMESZ 100
> 
>       int
>       main(void)
>       {
>           struct __sysctl_args args;
>           char osname[OSNAMESZ];
>           size_t osnamelth;
>           int name[] = { CTL_KERN, KERN_OSTYPE };
> 
>           memset(&args, 0, sizeof(args));
>           args.name = name;
>           args.nlen = sizeof(name)/sizeof(name[0]);
>           args.oldval = osname;
>           args.oldlenp = &osnamelth;
> 
>           osnamelth = sizeof(osname);
> 
>           if (syscall(SYS__sysctl, &args) == -1) {
>               perror("_sysctl");
>               exit(EXIT_FAILURE);
>           }
>           printf("This machine is running %*s\n", (int) osnamelth, osname);
>           exit(EXIT_SUCCESS);
>       }
> 
> for which I get the following errors:
> 
>       $ cc -c -std=gnu17 -Wall -Wextra -Werror -Wno-error=unused-parameter \
>            -Wno-error=sign-compare -Wno-error=format \
>            -o tmp/src/man2/sysctl.2.d/sysctl.o \
>            tmp/src/man2/sysctl.2.d/sysctl.c;
>       In file included from tmp/src/man2/sysctl.2.d/sysctl.c:3:
>       /usr/include/linux/sysctl.h:39:9: error: unknown type name 'size_t'
>          39 |         size_t *oldlenp;
>             |         ^~~~~~
>       /usr/include/linux/sysctl.h:41:9: error: unknown type name 'size_t'
>          41 |         size_t newlen;
>             |         ^~~~~~
>       tmp/src/man2/sysctl.2.d/sysctl.c: In function 'main':
>       tmp/src/man2/sysctl.2.d/sysctl.c:26:18: error: assignment to 'int *' 
> from incompatible pointer type 'size_t *' {aka 'long unsigned int *'} 
> [-Werror=incompatible-pointer-types]
>          26 |     args.oldlenp = &osnamelth;
>             |                  ^
>       cc1: all warnings being treated as errors
> 
> 
> It seems that it's supposed to know some types, but for some reason
> 'size_t' is not defined by the included headers:
> 
>       $ grep include </usr/include/linux/sysctl.h 
>       #include <linux/const.h>
>       #include <linux/types.h>

If I understand the report
https://lore.kernel.org/all/[email protected]/
upstream correctly there is not really much change that it will be
changed upstream. I'm closing this old bug as I do not see that we
will do something different from upstream.

Regards,
Salvatore

--- End Message ---

Reply via email to