-1
的輸出我寫了這個代碼,但是當試圖編譯它,它會返回THID錯誤:結構作爲一個功能
:24:8: error: conflicting types for ‘safe_syscall’
:19:10: note: previous implicit declaration of ‘safe_syscall’ was here
我指定的行數。
typedef struct syscall ditem;
void safe_syscall_set (vmi_instance_t vmi)
{
ditem *head,*tmp = NULL;
char *name;
int num;
FILE * fp;
fp = fopen ("syscall.list", "r");//file including syscall names and numbers in format "name number"
//read file of syscalls and numbers
while(fscanf(fp, "%s %d",name, &num)!= EOF);
{
tmp = head;
/* 19 */
head = safe_syscall(name,num,tmp,vmi);
}
return;
}
/* 24 */
ditem *safe_syscall (char *syscall,int num,ditem *head,vmi_instance_t vmi)
{
uint64_t *sys_call_table = 0xffffffff816003e0;
uint64_t *memory = (uint64_t *) malloc(sizeof(*sys_call_table));
char *path = "/home/ossl5/sysmap";//hardcoded
FILE *fp;
fp=fopen(path,"r");
if(!fp)
{
printf("ERROR CAN NOT OPEN SYSTEM.MAP FILE\n");
goto exit;
}
curr = (ditem *)malloc(sizeof(ditem));
curr->num = num;
curr->next = head;//new nodes are being added to head of the list
head = curr;
curr->sys_name = syscall;
//Calculating syscall handler size
curr->size = sys_routine_size(fp,syscall,num);
exit:
return head;
}
我猜東西是錯誤的結構作爲output.This結構是一個鏈表,每個調用safe_syscall
功能,新節點添加到列表的頭部和新頭由該函數返回的時間。
是什麼'24'這裏'24 ditem * safe_sys' –
@GrijeshChauhan語法錯誤。 – 2013-07-20 08:47:51
我認爲19和24是錯誤消息中指示的行號。 - 可能應該把它們放在評論中;-) – John3136