Program Assignment Four, CSCI 523, Advanced Operating Systems Write a system call that passes string pointers into the kernel and returns an integer value indicating the number of characters printed. 1. Start with the system call you did for assignment three. 2. Assuming your system call was named "doit()," modify the user-level test program so that it now passes different strings like: doit("Hi Mom\n", 6); doit("Hi Dad\n", 6); doit("Hello World\n", 11); 3. If a null pointer "doit()" or a pointer to a null string "doit("")" is passed into the kernel, have your service return the appropriate error code to the user-level program. See /usr/include/asm/errno.h for the definitions. For example, your user-level program control flow might look like this: if ((ret = doit("") == StringSize) { printf ("Everything worked fine"); } else if (ret < 0) { perror ("Problem in doit service:"); } Note the use of perror() to automatically print a errno.h string. 4. Modify the "_syscallx" macros found in /usr/include/asm/unistd.h where "x" is the number of parameters to pass into the kernel. 5. In the linux/kernel/sys.c file expand your service so that it tests for a null pointer or a null string: if (p == 0 || *p == 0){ ret = EXXXXX; } Also test that string size will fit in your preallocated local buffer. 6. Use the example "copy_from_user()" to fetch the string from user space into a local buffer. 7. Count the number of characters in the string. For example: for (ret = 0, p = StartOfBuffer; *p != 0; ret++, p++) ; or for (ret = 0; StartOfBuffer->ret != 0; ret++) ; 8. Print the user string into the log files. 9. Recompile and boot the new kernel. To copy your new bzImage file over to /boot folder, you will have to be superuser. Just type "su" and give the password. The new "#" prompt means you are now the superuser. 10. Type D to return to being a regular user and compile the user test program. Then cross your fingers, and run it. 11. When you demo the program, show at least two working messages, and the error return for the two pointer problems. Also, you may want to check for a message that is too large.