Subject: RE: adding system calls-
To: 'Frank van der Linden ' <>
From: Andy Sporner <>
List: tech-kern
Date: 03/17/2000 08:19:20

> Looks like you made the right moves.. maybe you should provide
> some more details (i.e. include diffs for the regenerated files,
> and your userland code).

Here is the stuff.  I put print statements into trap.c to print a
message when the system call was being called and I got this.  I 
also learned that 'nsys' at this level was only 304 and this was
why I was getting the bad system call.  

For grins I moved it to an "unimplemented" system call and got the
same results.  My conclusion was that my view of the system call
table (as created below) was not in the kernel at all.  Interestly
I did a 'strings' on the kernel and found the text of my print 
statement in the system call implementation.

So it looks very simple that somehow my changes to the system call
table are not being honored.  I looked at the header files that are
generated by '' and these have the entry to the 
'cluster' system call in it.  So I am really confused.

BTW:  The purpose of this call is to provide a way of talking to
a new system daemon that I am writting called "rswapper" which is
going to be responsible for swapping qualifying processes from one
host to another to load balance a network of machines.


Andy sporner

#  Stuff from syscalls.master

#if defined(SYSVSHM) || !defined(_KERNEL)
303	STD		{ int sys___shmctl13(int shmid, int cmd, \
			    struct shmid_ds *buf); }
303	EXCL		__shmctl13

304	STD		{ int sys___cluster(int op, void *p); }

#    System Call Implementation....
#    (started with a shell first to make sure
#     that I was getting into it before I fill
#     this up with "real" code.)    

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/msg.h>
#include <sys/malloc.h>

#include <sys/mount.h>
#include <sys/syscallargs.h>

int sys___cluster(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
struct sys___cluster_args /* {
	syscallarg(int) op;
	syscallarg(void *) p;
};*/ *ca = v;

int	argc;
char	*argv;

	for (;;) { }
	argc = SCARG(ca, op);
	argv = SCARG(ca, p);

	printf("SYSCALL_CLUSTER: CMD=%u VAR=%s\n", argc, argv);
	*(int *)retval = 1965;


#    Userland Code

#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <stdio.h>

main(argc, argv)
int	i;

	i = syscall(304, 1965, "This is a test");

	printf("RETURN = [%u]\n", i);