是否有可能只找到由任何c程序生成的系统调用名,并将其逐个存储在向量中?
对于上面的程序,什么是系统调用,它们的名称应该存储在c程序创建的向量中。是否有可能只找到由任何c程序生成的系统调用名,并将其逐个存储在向量中?,c,C,对于上面的程序,什么是系统调用,它们的名称应该存储在c程序创建的向量中。 我可以使用strace跟踪系统调用,但我只想知道需要存储的名称及其系统调用序列。我认为strace1或ptrace2可能会有所帮助。在这种情况下,向量是什么? #include<unistd.h> #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> #include<stdlib.h> int
我可以使用strace跟踪系统调用,但我只想知道需要存储的名称及其系统调用序列。我认为strace1或ptrace2可能会有所帮助。在这种情况下,向量是什么?
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<stdlib.h>
int main( int argc,char *argv[] )
{
char buf;
int sourcefile,destfile,n;//copy a text from one file to another file
if(argc!=3)
{
write(STDOUT_FILENO,"prgm1 <sourcefile> <destination file>\n",50);
exit(1);
}
else
{
sourcefile=open(argv[1],O_RDONLY);
if(sourcefile==-1)
{
perror("SOURCE FILE ERROR");
exit(0);
}
else
{
destfile=open(argv[2],O_WRONLY | O_CREAT , 0641);
if(destfile==-1)
{
perror("DESTINATION FILE ERROR");
exit(0);
}
else
{
while((n=read(sourcefile,&buf,1)) != 0)
{
write( destfile, &buf, 1 );
}
write(STDOUT_FILENO, "FILES COPIED\n" , 15);
close(sourcefile);
close(destfile);
}
}
}
return 0;
}