reswitched / SwIPC

IPC interface specifications and other useful info
https://reswitched.github.io/SwIPC/
ISC License
50 stars 15 forks source link

Read takes three u64 #25

Closed roblabla closed 6 years ago

roblabla commented 6 years ago

Otherwise, I get Port Closed when calling Read

Auto.id has the problem too. @hthh Should I change genallipc or something ?

roblabla commented 6 years ago

So it actually takes an u32 and two u64. The u64 must be aligned, so it still has the correct size.

roblabla commented 6 years ago

Fixed a similar problem in write.

Maybe I should write a script that checks every manually created service definition with the auto.id and ensures they match 🤔

hthh commented 6 years ago

I think that's a great idea. My thoughts on a variant I wanted to do, in case it's any use:

Some information is missing from auto.id because we don't know the argument types, but I think this looks the same as methods with no parameters, which is a bit confusing. Also, this means that sometimes auto.id won't match other files where the arguments weren't found automatically but were figured out by hand.

We have complete and accurate (to my knowledge) server-side data https://gist.githubusercontent.com/hthh/bb896c743878a2c0c337f41febdc0426/raw/fed4f4186ede55813e2507e79acd2f5db7b2ef90/data3.py which includes total parameter in/out sizes, but not information about arguments.

So to help the problem of "not knowing when we're missing information, or have made a mistake", we could use the server-side data to do some further validation, by calculating the total number of input and output bytes and buffers (and interfaces, and whether or not it sends pid) from the id files, and showing where they don't match the server data (e.g. highlighted red in the HTML, or by not generating a wrapper method, or as a useful diagnostic message from a script).

If your generated code already calculates the total sizes this might be relatively easy (and help check your code/alignments are working as expected), but I'm not sure if that's the case.

roblabla commented 6 years ago

My codegen currently calculates the total size of the raw buffer, but it does it wrong without checking for alignment, embarassingly enough ^^'. I'm probably going to trash that and just generate anonymous struct, letting C handle the sizing and stuff.

Some information is missing from auto.id because we don't know the argument types, but I think this looks the same as methods with no parameters, which is a bit confusing.

I actually thought about this. I think we should either add an attribute for this (similar to @version, maybe @unknownargs ?) or, to go the C route, have function(void) denote a function without parameters, and function() denote a function whose param list we do not know (ewww).

roblabla commented 6 years ago

This really ought to get merged in the meantime. It fixes a few very confusing mistakes in the SwIPC generated docs :).