-1
linux가 호출하는 시스템 콜을 계산하는 .c 파일이 있습니다. 이들은 단지 주요 기능입니다. 배열을 만드는 것처럼 할 일이 몇 가지 더있었습니다.시스템 콜 카운팅
부호없는 long syscall_counts [345]; 문제가 어디
사람이 어떤 생각을 가지고 :
incl syscall_counts(,%eax,4)
// This function is called each time the application calls read(). It starts the process of
// accumulating data to fill the application buffer. Return a pointer representing the current
// item. Return NULL if there are no more items.
//
static void *counter_seq_start(struct seq_file *s, loff_t *record_number)
{
if (*record_number > 347)
return NULL;
return (void*)s;
}
// This function is called to compute the next record in the sequence given a pointer to the
// current record (in bookmark). It returns a pointer to the new record (essentially, an updated
// bookmark) and updates *record_number appropriately. Return NULL if there are no more items.
//
static void *counter_seq_next(struct seq_file *s, void *bookmark, loff_t *record_number)
{
unsigned long *temp_b =(unsigned long*) bookmark;
(*temp_b)++;
if (*temp_b > 345)
return NULL;
return (void*)temp_b;
}
// This function is called whenever an application buffer is filled (or when start or next
// returns NULL. It can be used to undo any special preparations done in start (such as
// deallocating auxillary memory that was allocated in start. In simple cases, you often do not
// need to do anything in this function.
//
static void counter_seq_stop(struct seq_file *s, void *bookmark)
{
}
// This function is called after next to actually compute the output. It can use various seq_...
// printing functions (such as seq_printf) to format the output. It returns 0 if successful or a
// negative value if it fails.
//
static int counter_seq_show(struct seq_file *s, void *bookmark)
{
loff_t *bpos = (loff_t *) bookmark;
seq_printf(s, "value: %Ld\n", *bpos);
return 0;
}
// Define the only file handling function we need.
static int counter_open(struct inode *inode, struct file *file)
{
return seq_open(file, &counter_seq_ops);
}
내 출력이 매우 이상하다 :
은 다음 몇 가지 어셈블리를 다른 파일에 내가 명령을 사용하여 배열을 증가 ?
'^ @'은 값이 0 인 문자를 인쇄하는 것처럼 보입니다. 왜 그 일을하는지 알지 못합니다. –