io: include typesizes.h before using macro __OFF_T_MATCHES_OFF64_T

Message ID 1561650029-32363-1-git-send-email-vincentc@andestech.com
State New
Headers show
Series
  • io: include typesizes.h before using macro __OFF_T_MATCHES_OFF64_T
Related show

Commit Message

Vincent Chen June 27, 2019, 3:40 p.m.
The macro __OFF_T_MATCHES_OFF64_T is defined in typesizes.h if the
data type of off_t is the same as off64_t. Hence the condition
"#ifndef __OFF_T_MATCHES_OFF64_T" will be valid when the header file
typesizes.h is included.
---
 ChangeLog  | 5 +++++
 io/lockf.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

-- 
2.7.4

Comments

Adhemerval Zanella June 27, 2019, 8:05 p.m. | #1
On 27/06/2019 12:40, Vincent Chen wrote:
> The macro __OFF_T_MATCHES_OFF64_T is defined in typesizes.h if the

> data type of off_t is the same as off64_t. Hence the condition

> "#ifndef __OFF_T_MATCHES_OFF64_T" will be valid when the header file

> typesizes.h is included.


LGTM, thanks.

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


PS: it is usual to indicate how you actually tested the change,
something line 'check on x86_64' or 'check on aarch64-linux-gnu'.

> ---

>  ChangeLog  | 5 +++++

>  io/lockf.c | 4 ++--

>  2 files changed, 7 insertions(+), 2 deletions(-)

> 

> diff --git a/ChangeLog b/ChangeLog

> index c10f372..57e87cc 100644

> --- a/ChangeLog

> +++ b/ChangeLog

> @@ -1,3 +1,8 @@

> +2019-06-27  Vincentc Chen  <vincentc@andestech.com>

> +

> +	* io/lockf.c: include typesizes.h before using macro

> +	__OFF_T_MATCHES_OFF64_T.

> + 

>  2019-06-26  H.J. Lu  <hongjiu.lu@intel.com>

>  

>  	* sysdeps/i386/dl-lookupcfg.h: Moved to ...

> diff --git a/io/lockf.c b/io/lockf.c

> index d40aa88..a8a8530 100644

> --- a/io/lockf.c

> +++ b/io/lockf.c

> @@ -15,12 +15,12 @@

>     License along with the GNU C Library; if not, see

>     <http://www.gnu.org/licenses/>.  */

>  

> -#ifndef __OFF_T_MATCHES_OFF64_T

> -

>  #include <unistd.h>

>  #include <fcntl.h>

>  #include <errno.h>

>  

> +#ifndef __OFF_T_MATCHES_OFF64_T

> +

>  /* lockf is a simplified interface to fcntl's locking facilities.  */

>  int

>  lockf (int fd, int cmd, off_t len)

>

Patch

diff --git a/ChangeLog b/ChangeLog
index c10f372..57e87cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@ 
+2019-06-27  Vincentc Chen  <vincentc@andestech.com>
+
+	* io/lockf.c: include typesizes.h before using macro
+	__OFF_T_MATCHES_OFF64_T.
+ 
 2019-06-26  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/i386/dl-lookupcfg.h: Moved to ...
diff --git a/io/lockf.c b/io/lockf.c
index d40aa88..a8a8530 100644
--- a/io/lockf.c
+++ b/io/lockf.c
@@ -15,12 +15,12 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef __OFF_T_MATCHES_OFF64_T
-
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
 
+#ifndef __OFF_T_MATCHES_OFF64_T
+
 /* lockf is a simplified interface to fcntl's locking facilities.  */
 int
 lockf (int fd, int cmd, off_t len)