I'm trying to write my own system calls. I have a .c file where I'm putting the system calls. My system calls use a struct, so I have declared a global variable that is an array of my struct. Lets just call it
//Stuff is the name of the struct I declared. Stuff myStuff;
I have a function inside of my .c file called "init_Stuff". In order for the stuct to behave properly when a system call it made, init_Stuff must be called one time before any of the system calls will work. From within one of my system calls, I could just say "if the structs aren't initialized yet, go initialize them". But I'm wondering if there is a more elegant/normal way to just call init_Stuff right away. I also have a Makefile that currently just creates an object file of my .c file.
I also have one more question. My professor has said that we should not use kmalloc because he says that he has not yet taught us enough information in order for us to understand all the issues behind its proper use. So doesn't that only leave me with one other option -- setting aside all of the memory that the system calls could possibly need ahead of time? (Btw, that seems possible to me, since he gave us a limit on the total length of the messages we're passing around. But I'm concerned that perhaps the amount of memory I want will be too much - its in the MB, but what happens if the kernel decides it is too much contiguous memory, and is that a realistic worry?)
Thanks for any insight or links you guys can give.