Add Linux's syscalls#2978
Conversation
|
If I understand correctly it becomes like |
Add hundreds of functions? |
|
Or just add constdefs? |
|
I don't see how using constants/enums would be better than macros? |
|
Some std modules uses this pattern: constdef Foo : inline uint
{
FOO1 = 1,
FOO2 = 2
}
const uint BAR1 = Foo.FOO1;
const uint BAR2 = Foo.FOO2;So, what about this: constdef SysCall : inline uint
{
<* (unsigned int fd, char *buf, size_t count) *>
READ = 0,
<* (unsigned int fd, const char *buf, size_t count) *>
WRITE = 1
etc.
}
<* (unsigned int fd, char *buf, size_t count) *>
const uint SYS_READ = SysCall.READ;
<* (unsigned int fd, const char *buf, size_t count) *>
const uint SYS_WRITE = SysCall.WRITE;
etc. |
|
That doesn't answer why it couldn't be macros? Wouldn't that be nicer? |
How useful are hundreds of macros without ported Linux types to C3 types? |
|
You are suggesting: SYS_READ.call(fd, buf, count); With everything untyped. I don't see why one shouldn't do macro sys_read(uint, char* buf, usz count) { ... }It seems like a gross misuse of macros and enums? |
|
This PR has been dead now for over a month, what should we do with it? |
I'll improve it later for more targets if this PoC is OK.