[Crash-utility] gcc 2.96 diskdump.c compile failure

Dave Anderson anderson at redhat.com
Wed Nov 9 22:17:57 UTC 2005


Dave Anderson wrote:

> Dave Anderson wrote:
>
>> cc -c -g -DX86 -D_FILE_OFFSET_BITS=64 diskdump.c
>> In file included from diskdump.c:24:
>> diskdump.h:49: array size missing in `tasks'
>> make[3]: *** [diskdump.o] Error 1
>>
>> because of the tasks member at the end of this struct:
>>
>> struct disk_dump_header {
>>         char                    signature[SIG_LEN];     /* = "DISKDUMP" */
>>         int                     header_version; /* Dump header version */
>>         struct new_utsname      utsname;        /* copy of system_utsname */
>>         struct timeval          timestamp;      /* Time stamp */
>>         unsigned int            status;         /* Above flags */
>>         int                     block_size;     /* Size of a block in byte */
>>         int                     sub_hdr_size;   /* Size of arch dependent
>>                                                    header in blocks */
>>         unsigned int            bitmap_blocks;  /* Size of Memory bitmap in
>>                                                    block */
>>         unsigned int            max_mapnr;      /* = max_mapnr */
>>         unsigned int            total_ram_blocks;/* Number of blocks should be
>>                                                    written */
>>         unsigned int            device_blocks;  /* Number of total blocks in
>>                                                  * the dump device */
>>         unsigned int            written_blocks; /* Number of written blocks */
>>         unsigned int            current_cpu;    /* CPU# which handles dump */
>>         int                     nr_cpus;        /* Number of CPUs */
>>         struct task_struct      *tasks[];
>> };
>>
>> Can this be changed to: struct task_struct **tasks;
>> and get away with it?
>
> or should it be:
>
>         struct task_struct       *tasks[0];
>

I have confirmation that the latter option works as intended:


> > I *think* the correct way would be: struct task_struct *tasks[0];
>
> I think so too.  struct disk_dump_header is variable length. In diskdump.c,
> one page size is allocated and read from vmcore and casted by disk_dump_header.
> So this change should work.
> I confirmed that the crash which includes this fix worked with compressed vmcore
> on my machine. Please apply.
>
> Regards,
> Nobuhiro
>

On another note, before sending in patches, please first do this:

  $ touch defs.h; make Warn

and then fix whatever it complains about (except for the cmdline.c
warnings -- they come from the gdb source, and I'm not changing it).

Thanks,
  Dave



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20051109/32b7e325/attachment.htm>


More information about the Crash-utility mailing list