[PATCH 3/4] makedumpfile: add -D_GNU_SOURCE to CFLAGS

Wang Nan wangnan0 at huawei.com
Sat May 3 18:28:15 PDT 2014


On 2014/4/30 19:55, HATAYAMA Daisuke wrote:
> From: Wang Nan <wangnan0 at huawei.com>
> Subject: [PATCH 3/4] makedumpfile: add -D_GNU_SOURCE to CFLAGS
> Date: Sat, 26 Apr 2014 12:07:08 +0800
> 
>> This patch is preparation for introduce pread/pwrite.
>>
> 
> Do you explain more about _GNU_SOURCE? Did you need to define this on
> your environment to build makedumpfile with pread/pwrite?
> 
> I tried to build a very simple test program using pread like
> 
> int main(void)
> {
>    printf("%p\n", pread);
> }
> 
> on RHEL5.4, RHEL6.5 and fc20, and all were done successfully without
> _GNU_SOURCE. They are all on x86_64.
> 
> I checked man pread and man pwrite on each environments for
> _GNU_SOURCE but I didn't find it. What I found was _XOPEN_SOURCE
> description only. For example this is man pread on RHEL6.5.
> 
> $ LANG=C man pread
> PREAD(2)                   Linux Programmer's Manual                  PREAD(2)
> 
> NAME
>        pread, pwrite - read from or write to a file descriptor at a given offset
> 
> SYNOPSIS
>        #define _XOPEN_SOURCE 500

I define _GNU_SOURCE because it introduces _XOPEN_SOURCE. It also introduces others which
I thought may help further improvements.

Do you mean use only _XOPEN_SOURCE for pread/pwrite?

> 
>        #include <unistd.h>
> 
>        ssize_t pread(int fd, void *buf, size_t count, off_t offset);
> 
>        ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
> 
> Note that just as I said the above, building was successfully done on
> this environment.
> 
> --
> Thanks.
> HATAYAMA, Daisuke
> 





More information about the kexec mailing list