* [PATCH v2] Remove several implicit function declarations
@ 2023-02-08 14:34 Arjun Shankar
2023-02-08 16:34 ` Darrick J. Wong
0 siblings, 1 reply; 3+ messages in thread
From: Arjun Shankar @ 2023-02-08 14:34 UTC (permalink / raw)
To: linux-xfs; +Cc: Arjun Shankar
During configure, several ioctl checks omit the corresponding include
and a pwritev2 check uses the wrong feature test macro.
This commit fixes the same.
Signed-off-by: Arjun Shankar <arjun@redhat.com>
---
We ran into these when trying to port Fedora to modern C:
https://fedoraproject.org/wiki/Changes/PortingToModernC
https://fedoraproject.org/wiki/Toolchain/PortingToModernC
v2 notes: Removed the changes to unicrash.c;
it was already fixed by 5ead2de386d879
---
m4/package_libcdev.m4 | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index bb1ab49c..f987aa4a 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -117,6 +117,7 @@ AC_DEFUN([AC_HAVE_FIEMAP],
#define _GNU_SOURCE
#include <linux/fs.h>
#include <linux/fiemap.h>
+#include <sys/ioctl.h>
]], [[
struct fiemap *fiemap;
ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
@@ -153,7 +154,7 @@ AC_DEFUN([AC_HAVE_PWRITEV2],
[ AC_MSG_CHECKING([for pwritev2])
AC_LINK_IFELSE(
[ AC_LANG_PROGRAM([[
-#define _BSD_SOURCE
+#define _GNU_SOURCE
#include <sys/uio.h>
]], [[
pwritev2(0, 0, 0, 0, 0);
@@ -454,6 +455,7 @@ AC_DEFUN([AC_HAVE_SG_IO],
AC_COMPILE_IFELSE(
[ AC_LANG_PROGRAM([[
#include <scsi/sg.h>
+#include <sys/ioctl.h>
]], [[
struct sg_io_hdr hdr;
ioctl(0, SG_IO, &hdr);
@@ -471,7 +473,8 @@ AC_DEFUN([AC_HAVE_HDIO_GETGEO],
[ AC_MSG_CHECKING([for struct hd_geometry ])
AC_COMPILE_IFELSE(
[ AC_LANG_PROGRAM([[
-#include <linux/hdreg.h>,
+#include <linux/hdreg.h>
+#include <sys/ioctl.h>
]], [[
struct hd_geometry hdr;
ioctl(0, HDIO_GETGEO, &hdr);
--
2.38.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] Remove several implicit function declarations
2023-02-08 14:34 [PATCH v2] Remove several implicit function declarations Arjun Shankar
@ 2023-02-08 16:34 ` Darrick J. Wong
2023-02-10 14:31 ` Arjun Shankar
0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2023-02-08 16:34 UTC (permalink / raw)
To: Arjun Shankar; +Cc: linux-xfs
On Wed, Feb 08, 2023 at 03:34:16PM +0100, Arjun Shankar wrote:
> During configure, several ioctl checks omit the corresponding include
> and a pwritev2 check uses the wrong feature test macro.
> This commit fixes the same.
>
> Signed-off-by: Arjun Shankar <arjun@redhat.com>
> ---
> We ran into these when trying to port Fedora to modern C:
>
> https://fedoraproject.org/wiki/Changes/PortingToModernC
> https://fedoraproject.org/wiki/Toolchain/PortingToModernC
>
> v2 notes: Removed the changes to unicrash.c;
> it was already fixed by 5ead2de386d879
> ---
> m4/package_libcdev.m4 | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
> index bb1ab49c..f987aa4a 100644
> --- a/m4/package_libcdev.m4
> +++ b/m4/package_libcdev.m4
> @@ -117,6 +117,7 @@ AC_DEFUN([AC_HAVE_FIEMAP],
> #define _GNU_SOURCE
> #include <linux/fs.h>
> #include <linux/fiemap.h>
> +#include <sys/ioctl.h>
> ]], [[
> struct fiemap *fiemap;
> ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
> @@ -153,7 +154,7 @@ AC_DEFUN([AC_HAVE_PWRITEV2],
> [ AC_MSG_CHECKING([for pwritev2])
> AC_LINK_IFELSE(
> [ AC_LANG_PROGRAM([[
> -#define _BSD_SOURCE
> +#define _GNU_SOURCE
Could you update the pwritev2 manpage to document that _GNU_SOURCE is
the feature test macro for pwritev2?
> #include <sys/uio.h>
> ]], [[
> pwritev2(0, 0, 0, 0, 0);
> @@ -454,6 +455,7 @@ AC_DEFUN([AC_HAVE_SG_IO],
> AC_COMPILE_IFELSE(
> [ AC_LANG_PROGRAM([[
> #include <scsi/sg.h>
> +#include <sys/ioctl.h>
> ]], [[
> struct sg_io_hdr hdr;
> ioctl(0, SG_IO, &hdr);
> @@ -471,7 +473,8 @@ AC_DEFUN([AC_HAVE_HDIO_GETGEO],
> [ AC_MSG_CHECKING([for struct hd_geometry ])
> AC_COMPILE_IFELSE(
> [ AC_LANG_PROGRAM([[
> -#include <linux/hdreg.h>,
Gosh, how did that ever work with the trailing comma??
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> +#include <linux/hdreg.h>
> +#include <sys/ioctl.h>
> ]], [[
> struct hd_geometry hdr;
> ioctl(0, HDIO_GETGEO, &hdr);
> --
> 2.38.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] Remove several implicit function declarations
2023-02-08 16:34 ` Darrick J. Wong
@ 2023-02-10 14:31 ` Arjun Shankar
0 siblings, 0 replies; 3+ messages in thread
From: Arjun Shankar @ 2023-02-10 14:31 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs
On Wed, Feb 8, 2023 at 5:43 PM Darrick J. Wong <djwong@kernel.org> wrote:
>
> On Wed, Feb 08, 2023 at 03:34:16PM +0100, Arjun Shankar wrote:
> > During configure, several ioctl checks omit the corresponding include
> > and a pwritev2 check uses the wrong feature test macro.
> > This commit fixes the same.
> >
> > Signed-off-by: Arjun Shankar <arjun@redhat.com>
> > ---
> > We ran into these when trying to port Fedora to modern C:
> >
> > https://fedoraproject.org/wiki/Changes/PortingToModernC
> > https://fedoraproject.org/wiki/Toolchain/PortingToModernC
> >
> > v2 notes: Removed the changes to unicrash.c;
> > it was already fixed by 5ead2de386d879
> > ---
> > m4/package_libcdev.m4 | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
> > index bb1ab49c..f987aa4a 100644
> > --- a/m4/package_libcdev.m4
> > +++ b/m4/package_libcdev.m4
> > @@ -117,6 +117,7 @@ AC_DEFUN([AC_HAVE_FIEMAP],
> > #define _GNU_SOURCE
> > #include <linux/fs.h>
> > #include <linux/fiemap.h>
> > +#include <sys/ioctl.h>
> > ]], [[
> > struct fiemap *fiemap;
> > ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
> > @@ -153,7 +154,7 @@ AC_DEFUN([AC_HAVE_PWRITEV2],
> > [ AC_MSG_CHECKING([for pwritev2])
> > AC_LINK_IFELSE(
> > [ AC_LANG_PROGRAM([[
> > -#define _BSD_SOURCE
> > +#define _GNU_SOURCE
>
> Could you update the pwritev2 manpage to document that _GNU_SOURCE is
> the feature test macro for pwritev2?
Thanks for pointing this out. I'm making a note to get this done. In
addition, there's a chance that pwritev2 might be made available under
_DEFAULT_SOURCE in future versions of glibc. Either way, current
versions of glibc do make this function available under _GNU_SOURCE
and that needs to be documented.
> > #include <sys/uio.h>
> > ]], [[
> > pwritev2(0, 0, 0, 0, 0);
> > @@ -454,6 +455,7 @@ AC_DEFUN([AC_HAVE_SG_IO],
> > AC_COMPILE_IFELSE(
> > [ AC_LANG_PROGRAM([[
> > #include <scsi/sg.h>
> > +#include <sys/ioctl.h>
> > ]], [[
> > struct sg_io_hdr hdr;
> > ioctl(0, SG_IO, &hdr);
> > @@ -471,7 +473,8 @@ AC_DEFUN([AC_HAVE_HDIO_GETGEO],
> > [ AC_MSG_CHECKING([for struct hd_geometry ])
> > AC_COMPILE_IFELSE(
> > [ AC_LANG_PROGRAM([[
> > -#include <linux/hdreg.h>,
>
> Gosh, how did that ever work with the trailing comma??
That surprised me as well. cpp seems to complain about it but is fine
with it for some reason.
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Thanks for the review!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-10 14:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-08 14:34 [PATCH v2] Remove several implicit function declarations Arjun Shankar
2023-02-08 16:34 ` Darrick J. Wong
2023-02-10 14:31 ` Arjun Shankar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox