Greetings,
For my own knowledge i've started coding a kernel module to learn how this
strange stuff work.
So I followed some tutorials and the example source code found in
/usr/share/lkm.
Here is the source code I wrote:
http://hinyx.info/~deather/lkm/syscall.c

So, I got it compiled with some warnings. The first seems strange. Let's have
a look:
neptune% make
cc -Wall -W -D_KERNEL -pipe -I/sys -I/sys/arch -c syscall.c
syscall.c:60: warning: missing initializer
syscall.c:60: warning: (near initialization for `_module.lkm_oldent')
syscall.c: In function `ourcall_handler':
syscall.c:66: warning: unused parameter `lkmtp'
syscall.c: In function `newcall':
syscall.c:94: warning: unused parameter `p'

The "missing initializer" is quite strange, no?
I've googled it, but nothing was found.
Then, I load the module as root:

neptune# modload -o ourcall.o -eourcall syscall.o
My kernel module loaded! :]
DDB symbols added: 129056 bytes
Module loaded as ID 0
Nov 11 22:26:06 neptune /bsd: My kernel module loaded! :]
Nov 11 22:26:06 neptune /bsd: My kernel module loaded! :]
Nov 11 22:26:06 neptune /bsd: DDB symbols added: 129056 bytes
Nov 11 22:26:06 neptune /bsd: DDB symbols added: 129056 bytes
neptune#

well everyting seems okay, thought the module seems to be run 2 times...
and, look what modstat do:

neptune# modstat
0
Type Id Off Loadaddr Size Info Rev Module Name
SYSCALL 0 2 faf50000 0001 faf502b8 2 ourcall
Nov 11 22:26:58 neptune /bsd: 0
Nov 11 22:26:58 neptune /bsd: 0
4

OpenBSD/sparc (neptune.hinyx.info) (console)

login:

Look the stranges 0 and 4, then I'm logged out!
The same thing appear if I run dmesg. If i'm logged over ssh, the ssh
connection get closed, then it's impossible to reconnect:

neptune% dmesg | tail -1
Connection to neptune closed.
barney% ssh neptune
ssh_exchange_identification: Connection closed by remote host
barney% ssh neptune
ssh: connect to host neptune port 22: Connection refused

On the console, i can see:

login: 0
0 (null)
Nov 11 22:28:15 neptune sshd[13392]: error: setsid: Operation not permitted
Nov 11 22:28:15 neptune sshd[13392]: fatal: recv_rexec_state: ssh_msg_recv failed

Note again the strange 0 and (null) :-/

If I try to log with root on the console:

login: root
0
Watchdog Reset
Type help for more information
ok

And that's all :-( I've to re-boot the Sun.

Any ideas?
Thanks in advance to anyone who'll read this
-Thomas Lecomte