[1/2] fix build issue under Android NDK

Submitted by Zhang, Ning A on April 1, 2019, 3:18 a.m.

Details

Message ID 20190401031831.18675-2-ning.a.zhang@intel.com
State New
Series "another fixes for build under Android NDK"
Headers show

Commit Message

Zhang, Ning A April 1, 2019, 3:18 a.m.
From: Zhang Ning <ning.a.zhang@intel.com>

criu/log.c:356:16: error: called object type 'int' is not a function or function pointer
        int __errno = errno;
                      ^~~~~
/root/android-ndk/toolchains/llvm/prebuilt/linux-x86_64//sysroot/usr/include/errno.h:43:24: note: expanded from macro 'errno'
                ~~~~~~~^
criu/log.c:391:2: error: called object type 'int' is not a function or function pointer
        errno =  __errno;
        ^~~~~
/root/android-ndk/toolchains/llvm/prebuilt/linux-x86_64//sysroot/usr/include/errno.h:43:24: note: expanded from macro 'errno'

Cc: Chen Hu <hu1.chen@intel.com>
Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>
---
 criu/log.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/log.c b/criu/log.c
index 060d1ee6..edd2511c 100644
--- a/criu/log.c
+++ b/criu/log.c
@@ -353,7 +353,7 @@  static void early_vprint(const char *format, unsigned int loglevel, va_list para
 void vprint_on_level(unsigned int loglevel, const char *format, va_list params)
 {
 	int fd, size, ret, off = 0;
-	int __errno = errno;
+	int _errno = errno;
 
 	if (unlikely(loglevel == LOG_MSG)) {
 		fd = STDOUT_FILENO;
@@ -388,7 +388,7 @@  void vprint_on_level(unsigned int loglevel, const char *format, va_list params)
 	if (loglevel == LOG_ERROR)
 		log_note_err(buffer + buf_off);
 
-	errno =  __errno;
+	errno =  _errno;
 }
 
 void print_on_level(unsigned int loglevel, const char *format, ...)

Comments

Dmitry Safonov April 1, 2019, 6:30 p.m.
Hi Zhang,

On 4/1/19 4:18 AM, ning.a.zhang@intel.com wrote:
> From: Zhang Ning <ning.a.zhang@intel.com>
> 
> criu/log.c:356:16: error: called object type 'int' is not a function or function pointer
>         int __errno = errno;
>                       ^~~~~
> /root/android-ndk/toolchains/llvm/prebuilt/linux-x86_64//sysroot/usr/include/errno.h:43:24: note: expanded from macro 'errno'
>                 ~~~~~~~^
> criu/log.c:391:2: error: called object type 'int' is not a function or function pointer
>         errno =  __errno;
>         ^~~~~
> /root/android-ndk/toolchains/llvm/prebuilt/linux-x86_64//sysroot/usr/include/errno.h:43:24: note: expanded from macro 'errno'
> 
> Cc: Chen Hu <hu1.chen@intel.com>
> Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>> ---
>  criu/log.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/criu/log.c b/criu/log.c
> index 060d1ee6..edd2511c 100644
> --- a/criu/log.c
> +++ b/criu/log.c
> @@ -353,7 +353,7 @@ static void early_vprint(const char *format, unsigned int loglevel, va_list para
>  void vprint_on_level(unsigned int loglevel, const char *format, va_list params)
>  {
>  	int fd, size, ret, off = 0;
> -	int __errno = errno;
> +	int _errno = errno;
>  
>  	if (unlikely(loglevel == LOG_MSG)) {
>  		fd = STDOUT_FILENO;
> @@ -388,7 +388,7 @@ void vprint_on_level(unsigned int loglevel, const char *format, va_list params)
>  	if (loglevel == LOG_ERROR)
>  		log_note_err(buffer + buf_off);
>  
> -	errno =  __errno;
> +	errno =  _errno;
>  }
>  
>  void print_on_level(unsigned int loglevel, const char *format, ...)
> 

I'm not sure I understand how renaming helps fixing anything here..
Is there a macro named __errno in Android SDK?
Could you add some details in commit message, please?

Thanks,
          Dmitry
Radostin Stoyanov April 1, 2019, 7:32 p.m.
On 01/04/2019 19:30, Dmitry Safonov wrote:
> Hi Zhang,
>
> On 4/1/19 4:18 AM, ning.a.zhang@intel.com wrote:
>> From: Zhang Ning <ning.a.zhang@intel.com>
>>
>> criu/log.c:356:16: error: called object type 'int' is not a function or function pointer
>>         int __errno = errno;
>>                       ^~~~~
>> /root/android-ndk/toolchains/llvm/prebuilt/linux-x86_64//sysroot/usr/include/errno.h:43:24: note: expanded from macro 'errno'
>>                 ~~~~~~~^
>> criu/log.c:391:2: error: called object type 'int' is not a function or function pointer
>>         errno =  __errno;
>>         ^~~~~
>> /root/android-ndk/toolchains/llvm/prebuilt/linux-x86_64//sysroot/usr/include/errno.h:43:24: note: expanded from macro 'errno'
>>
>> Cc: Chen Hu <hu1.chen@intel.com>
>> Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>> ---
>>  criu/log.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/criu/log.c b/criu/log.c
>> index 060d1ee6..edd2511c 100644
>> --- a/criu/log.c
>> +++ b/criu/log.c
>> @@ -353,7 +353,7 @@ static void early_vprint(const char *format, unsigned int loglevel, va_list para
>>  void vprint_on_level(unsigned int loglevel, const char *format, va_list params)
>>  {
>>  	int fd, size, ret, off = 0;
>> -	int __errno = errno;
>> +	int _errno = errno;
>>  
>>  	if (unlikely(loglevel == LOG_MSG)) {
>>  		fd = STDOUT_FILENO;
>> @@ -388,7 +388,7 @@ void vprint_on_level(unsigned int loglevel, const char *format, va_list params)
>>  	if (loglevel == LOG_ERROR)
>>  		log_note_err(buffer + buf_off);
>>  
>> -	errno =  __errno;
>> +	errno =  _errno;
>>  }
>>  
>>  void print_on_level(unsigned int loglevel, const char *format, ...)
>>
> I'm not sure I understand how renaming helps fixing anything here..
> Is there a macro named __errno in Android SDK?
https://android.googlesource.com/platform/development/+/3ccf4f2/ndk/platforms/android-3/include/errno.h#44
> Could you add some details in commit message, please?
>
> Thanks,
>           Dmitry
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
Dmitry Safonov April 1, 2019, 7:35 p.m.
On 4/1/19 8:32 PM, Radostin Stoyanov wrote:
> On 01/04/2019 19:30, Dmitry Safonov wrote:
>> On 4/1/19 4:18 AM, ning.a.zhang@intel.com wrote:
>>> --- a/criu/log.c
>>> +++ b/criu/log.c
>>> @@ -353,7 +353,7 @@ static void early_vprint(const char *format, unsigned int loglevel, va_list para
>>>  void vprint_on_level(unsigned int loglevel, const char *format, va_list params)
>>>  {
>>>  	int fd, size, ret, off = 0;
>>> -	int __errno = errno;
>>> +	int _errno = errno;
>>>  
>>>  	if (unlikely(loglevel == LOG_MSG)) {
>>>  		fd = STDOUT_FILENO;
>>> @@ -388,7 +388,7 @@ void vprint_on_level(unsigned int loglevel, const char *format, va_list params)
>>>  	if (loglevel == LOG_ERROR)
>>>  		log_note_err(buffer + buf_off);
>>>  
>>> -	errno =  __errno;
>>> +	errno =  _errno;
>>>  }
>>>  
>>>  void print_on_level(unsigned int loglevel, const char *format, ...)
>>>
>> I'm not sure I understand how renaming helps fixing anything here..
>> Is there a macro named __errno in Android SDK?
> https://android.googlesource.com/platform/development/+/3ccf4f2/ndk/platforms/android-3/include/errno.h#44

I see, I'm not against, but I prefer changelog to mention that.
Also, probably, worth to fix all places with one patch?

[criu]$ git grep __errno
criu/log.c:     int __errno = errno;
criu/log.c:     errno =  __errno;
test/zdtm/lib/msg.c:    int __errno = errno;
test/zdtm/lib/msg.c:    errno = __errno;

Thanks,
          Dmitry