Re: sys_sem* undefined

From: Pete
Date: Sat Sep 04 2004 - 22:53:05 EST


Arne Henrichsen wrote:

From an application (userspace) or from inside the
kernel?



I need to do the syscalls from kernel space. Basically
I am porting our custom vxWorks driver to Linux. We
want to basically keep the structure of the vxWorks
driver the same, so I am porting the individual
vxWorks functions such as semBcreate, semGive etc.
Thats why I want to use the SysV IPC semaphores, as
they seem to most closely resemble the vxWorks ones. I
know that there are much better ways of writing a
driver, but that wouldn't fit in with the currect
structure we have at the moment.

Now if I want to call lets say sys_semget() from
kernel space, must I use the _syscall3() function? I
saw some people using this.

Thanks for the help.
Arne





Speaking as someone who has traveled down this road previously, I would suggest that you re-engineer your driver instead of going with your current plan. I realize that you think this would be quicker and easier, but the maintenance headaches are pretty heavy as you get further into this. Doing a driver the "right" way to fit the kernel makes sense because it becomes very easy to maintain, whereas your method will require much more work for changes to kernel versions, or changes to core logic. I'm guessing the driver is pretty mature at this point, but you still live with maintaining with the kernel.

As a side note, there are a lot of things that you might assume should be a driver because that's sort of how it works in the VxWorks system, but may map just as well to userspace, or some combo of userspace and kernel space. Essentially, all software in VxWorks is part of the kernel, so it's easy to just assume that what you are doing must be in the kernel as well. Again, I've been working on a project for 5+ years that was 3+ years of VxWorks, and is now migrating to Linux. I had to go through a lot of this stuff as well.

Basically, I'm saying that there are better ways to do what you want to do, but it's gonna involve some more up front work for you. I'd be willing to chat more about this if you feel the urge off the list.

Pete Buelow

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/