io/lockf: Include bits/types.h before __OFF_T_MATCHES_OFF64_T check

Message ID 20200826153753.1649367-1-alistair.francis@wdc.com
State Committed
Headers
Series io/lockf: Include bits/types.h before __OFF_T_MATCHES_OFF64_T check |

Commit Message

Alistair Francis Aug. 26, 2020, 3:37 p.m. UTC
  It's possible that although __OFF_T_MATCHES_OFF64_T is defined the
included the relevent header file.  This results in a io/tst-lockf
failure for RV32 by calling the non 64-bit version of lockf.  This
patch fixes the failure by including bits/types.h.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 io/lockf.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Adhemerval Zanella Netto Aug. 26, 2020, 4:21 p.m. UTC | #1
On 26/08/2020 12:37, Alistair Francis via Libc-alpha wrote:
> It's possible that although __OFF_T_MATCHES_OFF64_T is defined the
> included the relevent header file.  This results in a io/tst-lockf
> failure for RV32 by calling the non 64-bit version of lockf.  This
> patch fixes the failure by including bits/types.h.
> 
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

We don't use DCO, but rather Copyright assignment.

LGTM, thanks.

As a side note, I think it would be good to move __OFF_T_MATCHES_OFF64_T to be
*always* defined.  It would get this issue early.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  io/lockf.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/io/lockf.c b/io/lockf.c
> index aa5c673c8d..8ea83e15f0 100644
> --- a/io/lockf.c
> +++ b/io/lockf.c
> @@ -15,6 +15,8 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> +#include <bits/types.h>
> +
>  #ifndef __OFF_T_MATCHES_OFF64_T
>  
>  #include <unistd.h>
>
  

Patch

diff --git a/io/lockf.c b/io/lockf.c
index aa5c673c8d..8ea83e15f0 100644
--- a/io/lockf.c
+++ b/io/lockf.c
@@ -15,6 +15,8 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <bits/types.h>
+
 #ifndef __OFF_T_MATCHES_OFF64_T
 
 #include <unistd.h>