Skip to content

x/sys/unix: mkerrors.sh fails on linux/pidfd.h #48221

@lmb

Description

@lmb

What operating system and processor architecture are you using (go env)?

Linux on amd64

What did you do?

The following diff will make mkerrors.sh error out:

diff --git a/unix/mkerrors.sh b/unix/mkerrors.sh
index 0bcb8c3..e92d8d7 100755
--- a/unix/mkerrors.sh
+++ b/unix/mkerrors.sh
@@ -240,6 +240,7 @@ struct ltchars {
 #include <linux/nfc.h>
 #include <linux/nsfs.h>
 #include <linux/perf_event.h>
+#include <linux/pidfd.h>
 #include <linux/pps.h>
 #include <linux/ptrace.h>
 #include <linux/random.h>

Output:

----- GENERATING: 386 -----
configure: WARNING: minimum kernel version reset to 3.2.0
header files generated
zsysnum file generated
zsyscall file generated
ztypes file generated
In file included from /tmp/include/fcntl.h:35,
                 from /tmp/include/sys/file.h:24,
                 from /build/_const.go:180:
/tmp/include/bits/fcntl.h:35:8: error: redefinition of 'struct flock'
   35 | struct flock
      |        ^~~~~
In file included from /tmp/include/asm/fcntl.h:1,
                 from /tmp/include/linux/fcntl.h:5,
                 from /tmp/include/linux/pidfd.h:7,
                 from /build/_const.go:101:
/tmp/include/asm-generic/fcntl.h:196:8: note: originally defined here
  196 | struct flock {
      |        ^~~~~
In file included from /tmp/include/fcntl.h:35,
                 from /tmp/include/sys/file.h:24,
                 from /build/_const.go:180:
/tmp/include/bits/fcntl.h:50:8: error: redefinition of 'struct flock64'
   50 | struct flock64
      |        ^~~~~~~
In file included from /tmp/include/asm/fcntl.h:1,
                 from /tmp/include/linux/fcntl.h:5,
                 from /tmp/include/linux/pidfd.h:7,
                 from /build/_const.go:101:
/tmp/include/asm-generic/fcntl.h:211:8: note: originally defined here
  211 | struct flock64 {
      |        ^~~~~~~
/tmp/include/asm-generic/fcntl.h:152:21: error: expected identifier before numeric constant
  152 | #define F_OWNER_TID 0
      |                     ^
/tmp/include/bits/fcntl-linux.h:267:5: note: in expansion of macro 'F_OWNER_TID'
  267 |     F_OWNER_TID = 0,  /* Kernel thread.  */
      |     ^~~~~~~~~~~
In file included from /tmp/include/bits/fcntl.h:61,
                 from /tmp/include/fcntl.h:35,
                 from /tmp/include/sys/file.h:24,
                 from /build/_const.go:180:
/tmp/include/bits/fcntl-linux.h:274:8: error: redefinition of 'struct f_owner_ex'
  274 | struct f_owner_ex
      |        ^~~~~~~~~~
In file included from /tmp/include/asm/fcntl.h:1,
                 from /tmp/include/linux/fcntl.h:5,
                 from /tmp/include/linux/pidfd.h:7,
                 from /build/_const.go:101:
/tmp/include/asm-generic/fcntl.h:156:8: note: originally defined here
  156 | struct f_owner_ex {
      |        ^~~~~~~~~~
zerrors file generated
----- SUCCESS:    386 -----

<...>

There is source generated, but the diff is huge and it's not well formed Go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions