I have a warning from gcc compiler, which I don't know the reason of it.
Can anyone help? The warning is:
- warning: implicit declaration of function 'f2c_generate_note'
The code is as below:
struct elf_note
{
int namesz;
int descsz;
int type;
char name[8];
};
int f2c_dump_core(const char *name, struct crashdump_foc_t *foc)
{
int file;
struct elf_note *note01;
if ((file = open(name, O_WRONLY | O_CREAT, 0777)) == NULL)
{
printf("can not open core file: %s\n", strerror(errno));
return -1;
}
f2c_generate_note01(¬e01);
if(lseek(file, 116, SEEK_SET) == NULL)
{
printf("seek note01 failed: %s.", strerror(errno));
return -1;
}
if(write(file, note01, sizeof(struct elf_note)) == NULL)
{
printf("write note01 failed: %s.", strerror(errno));
return -1;
}
close(file);
}
int f2c_generate_note01(struct elf_note *note)
{
note->descsz = sizeof(struct elf_prpsinfo);
note->type = 3;
strcpy(note->name,"CORE");
note->namesz = sizeof(note->name);
}
The role of subfunction "f2c_generate_note01" is to fill the struct elf_note.
And the role of function "f2c_dump_core" is to write the elf_note into a file.



LinkBack URL
About LinkBacks


