public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* sys_sem* undefined
@ 2004-08-25 11:50 Arne Henrichsen
  2004-08-25 16:14 ` Randy.Dunlap
  0 siblings, 1 reply; 8+ messages in thread
From: Arne Henrichsen @ 2004-08-25 11:50 UTC (permalink / raw)
  To: linux-kernel

Hi,

I am running kernel 2.6.8 and have noticed that in
linux/sem.h the function declarations for sys_semop,
sys_semop etc have been removed (as far as I can see
from 2.6.4 onwards). Now when I compile my code I get
the sys_sem* undefined warning messages. Which header
file do I need to include now to get this support? 

Also when I want to load my module with insmod it
cannot find these symbols.

Thanks for the help.
Arne


	
	
		
___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!  http://uk.messenger.yahoo.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: sys_sem* undefined
  2004-08-25 11:50 sys_sem* undefined Arne Henrichsen
@ 2004-08-25 16:14 ` Randy.Dunlap
  2004-08-26  9:05   ` Arne Henrichsen
  2004-08-26 13:44   ` Arne Henrichsen
  0 siblings, 2 replies; 8+ messages in thread
From: Randy.Dunlap @ 2004-08-25 16:14 UTC (permalink / raw)
  To: Arne Henrichsen; +Cc: linux-kernel

On Wed, 25 Aug 2004 12:50:20 +0100 (BST) Arne Henrichsen wrote:

| Hi,
| 
| I am running kernel 2.6.8 and have noticed that in
| linux/sem.h the function declarations for sys_semop,
| sys_semop etc have been removed (as far as I can see
| from 2.6.4 onwards). Now when I compile my code I get
| the sys_sem* undefined warning messages. Which header
| file do I need to include now to get this support? 

grep(1) finds sys_semop here:

./linux/syscalls.h:446:asmlinkage long sys_semop(int semid, struct sembuf __user
 *sops,

Yes, include/linux/syscalls.h contains syscall prototypes.


| Also when I want to load my module with insmod it
| cannot find these symbols.

syscalls aren't called by name, so that's no surprise.


--
~Randy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: sys_sem* undefined
  2004-08-25 16:14 ` Randy.Dunlap
@ 2004-08-26  9:05   ` Arne Henrichsen
  2004-08-26 14:08     ` Paulo Marques
  2004-08-26 13:44   ` Arne Henrichsen
  1 sibling, 1 reply; 8+ messages in thread
From: Arne Henrichsen @ 2004-08-26  9:05 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linux-kernel

Hi Randy,

thanks for the help. I am very new to Linux
programming, and I do not understand what you mean
with  'syscalls are not called by name'. 

I did find the header file syscalls.h, recompiled my
code but it still says the following:

*** Warning: "sys_semop"
[/prj/builds/host/linux/prj.ko] undefined!
*** Warning: "sys_semctl"
[/prj/builds/host/linux/prj.ko] undefined!
*** Warning: "sys_semget"
[/prj/builds/host/linux/prj.ko] undefined!

And when I load the module, then it tells me:

insmod: error inserting './prj.ko': -1 Unknown symbol
in module

So, I call sys_sem* functions from my code. What else
must I do?

Thanks again.
Arne
  


	
	
		
___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!  http://uk.messenger.yahoo.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: sys_sem* undefined
  2004-08-25 16:14 ` Randy.Dunlap
  2004-08-26  9:05   ` Arne Henrichsen
@ 2004-08-26 13:44   ` Arne Henrichsen
  2004-08-26 16:28     ` Randy.Dunlap
  1 sibling, 1 reply; 8+ messages in thread
From: Arne Henrichsen @ 2004-08-26 13:44 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linux-kernel

Hi,

I realise now that one obviously calls these functions
via system calls. Ok, I have never done that before in
Linux. This is probably not the correct group to ask
this, but where is there a good place to start? Maybe
with a simple example on how to do system calls in
Linux?

Thanks
Arne
  


	
	
		
___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!  http://uk.messenger.yahoo.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: sys_sem* undefined
  2004-08-26  9:05   ` Arne Henrichsen
@ 2004-08-26 14:08     ` Paulo Marques
  0 siblings, 0 replies; 8+ messages in thread
From: Paulo Marques @ 2004-08-26 14:08 UTC (permalink / raw)
  To: Arne Henrichsen; +Cc: Randy.Dunlap, linux-kernel

Arne Henrichsen wrote:
> Hi Randy,
> 
> thanks for the help. I am very new to Linux
> programming, and I do not understand what you mean
> with  'syscalls are not called by name'. 
> 
> I did find the header file syscalls.h, recompiled my
> code but it still says the following:
> 
> *** Warning: "sys_semop"
> [/prj/builds/host/linux/prj.ko] undefined!
> *** Warning: "sys_semctl"
> [/prj/builds/host/linux/prj.ko] undefined!
> *** Warning: "sys_semget"
> [/prj/builds/host/linux/prj.ko] undefined!
> 
> And when I load the module, then it tells me:
> 
> insmod: error inserting './prj.ko': -1 Unknown symbol
> in module
> 
> So, I call sys_sem* functions from my code. What else
> must I do?

Syscalls are supposed to be called from userspace, so that the kernel 
does something on behalf of an application.

Some syscalls have their do_<syscall name> equivalent because it makes 
sense to call them from inside the kernel, but others don't.

If you want to use semaphores inside the kernel I suggest you read the 
Rusty Rusell's Unreliable Guide to Kernel Locking first:

http://wwwos.inf.tu-dresden.de/~ch12/diplom/DocBook/kernel-locking/

I hope this helps,

-- 
Paulo Marques - www.grupopie.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: sys_sem* undefined
  2004-08-26 13:44   ` Arne Henrichsen
@ 2004-08-26 16:28     ` Randy.Dunlap
  2004-08-27  9:26       ` Arne Henrichsen
  0 siblings, 1 reply; 8+ messages in thread
From: Randy.Dunlap @ 2004-08-26 16:28 UTC (permalink / raw)
  To: Arne Henrichsen; +Cc: linux-kernel

On Thu, 26 Aug 2004 14:44:03 +0100 (BST) Arne Henrichsen wrote:

| Hi,
| 
| I realise now that one obviously calls these functions
| via system calls. Ok, I have never done that before in
| Linux. This is probably not the correct group to ask
| this, but where is there a good place to start? Maybe
| with a simple example on how to do system calls in
| Linux?

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

There are many "howto add a system call to Linux" web pages
out there (use google).  Oh, you want "howto do a system call."

>From userspace, usually use a library:  app calls library
function, which does the syscall.  Or you can roll your
own syscalls.  The howtos on adding a system call to Linux
usually show you how to do that part also.[1]

--
~Randy

[1] written for 2.4.18:
http://www.xenotime.net/linux/syscall_ex/howto_adda_syscall.txt

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: sys_sem* undefined
  2004-08-26 16:28     ` Randy.Dunlap
@ 2004-08-27  9:26       ` Arne Henrichsen
  2004-09-05  3:51         ` Pete
  0 siblings, 1 reply; 8+ messages in thread
From: Arne Henrichsen @ 2004-08-27  9:26 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linux-kernel

> 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


	
	
		
___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!  http://uk.messenger.yahoo.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: sys_sem* undefined
  2004-08-27  9:26       ` Arne Henrichsen
@ 2004-09-05  3:51         ` Pete
  0 siblings, 0 replies; 8+ messages in thread
From: Pete @ 2004-09-05  3:51 UTC (permalink / raw)
  To: Arne Henrichsen; +Cc: Randy.Dunlap, linux-kernel

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-09-05  3:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-25 11:50 sys_sem* undefined Arne Henrichsen
2004-08-25 16:14 ` Randy.Dunlap
2004-08-26  9:05   ` Arne Henrichsen
2004-08-26 14:08     ` Paulo Marques
2004-08-26 13:44   ` Arne Henrichsen
2004-08-26 16:28     ` Randy.Dunlap
2004-08-27  9:26       ` Arne Henrichsen
2004-09-05  3:51         ` Pete

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox