我在做一個新的系統調用來獲得FCFS調度的平均等待時間。 我將系統調用名稱命名爲「add2」。現在編譯內核成功後,我在測試系統調用時遇到問題。在linux 2.6.39.4內核中測試系統調用
隨着一些研究,我想出了這兩個程序來測試我的系統調用。但這些問題仍然存在一些問題。我認爲問題在於爭論。請幫忙。
這裏是addnewsystemcall.h
#include<linux/unistd.h>
#define __NR_add2 307
long add2(int at[], int bt[], int n)
{
return syscall(__NR_atvfcfs,i);
}
這裏是addnewsystemcall.c
#include<string.h>
#include <stdio.h>
#include "add2.h"
int main()
{
int avgwt;
int n,i,at[50],bt[50];
printf("\n\nEnter the number of processes:");
scanf("%d",&n);
printf("\n\n BURST TIME and ARRIVAL TIME of thr process");
for(i=0;i<n;i++)
{
printf("\n ARRIVAL TIME :");
scanf("%d",&at[i]);
printf(" BURST TIME : ");
scanf("%d",&bt[i]);
}
printf("\n\nAverage waiting time = ");
printf("%d\n", add2(int at[], int bt[], int n));
return 0;
}
此代碼不會編譯。你在'printf'語句中是否指'add2(a,b,n)'?在'add2'的執行過程中是在哪裏聲明的?您沒有使用通過 – 2012-04-28 19:40:11