This is the mail archive of the
frysk@sources.redhat.com
mailing list for the frysk project.
Re: Patch: various Syscall changes
>>>>> "Yao" == Yao Qi <qiyaoltc@cn.ibm.com> writes:
Yao> if (num >= 0 && num < syscallList.length)
Yao> return syscallList[num];
Yao> else if (num < 0)
Yao> throw new RuntimeException ("Negative Syscall Number:" +
Yao> Integer.toString(num));
Yeah, I considered this. I kept it the way it was because I did not
know whether the code was intentionally written to allow negative
syscall numbers.
Yao> IMO, the name of syscall is the ID of it. We could say they are the
Yao> same syscalls only if their names are the same.
What I was going for here is having Syscall work more or less like an
'enum'. Of course we can't use enum. And Syscall has an unusual
need: unrecognized syscalls can be created.
Still, the idea is that each system call is represented by a single
Syscall object. That's why I added the cache for unrecognized
syscalls, and why equals was written the way it was.
>> * Adds syscallByName. This is needed for 'ftrace -e' (or "--trace" as
>> I spell it in my impl...)
Yao> What do you want "--trace" to do in ftrace? Only trace a certain
Yao> syscall?
Yes. I'll send my updated ftrace shortly so you can see.
Yao> I do not think syscallByName is necessary here. We could do something
Yao> like this in ftrace.java,
Yeah, it isn't strictly necessary. It just seemed like a reasonably
clean way to implement this functionality, and it was the first thing
that came to mind.
Yao> We will seldom want to know which syscall is named "read" when
Yao> the program does not meet an syscall. Comments?
I've thought about this a bit more. syscallByName has the nice
property that we can tell the user if he misspelled a syscalll name
during option processing. I think that is enough reason to keep it.
Tom