home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextLibrary / Documentation / NextDev / Examples / ServerVsHandler / simple_server / simple_server.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-27  |  1.0 KB  |  56 lines

  1. /*
  2.  * Simple loadable kernel server example.
  3.  *
  4.  * This server accepts two messages:
  5.  *    simple_puts() prints the (inline string) argument on the console.
  6.  *    simple_vers() returns the running kernel's version string.
  7.  */
  8. #import "simple_types.h"
  9. #import <kernserv/kern_server_types.h>
  10. #import <sys/mig_errors.h>
  11.  
  12. /*
  13.  * Allocate an instance variable to be used by the kernel server interface
  14.  * routines for initializing and accessing this service.
  15.  */
  16. kern_server_t instance;
  17.  
  18. /*
  19.  * Stamp our arival.
  20.  */
  21. void simple_init(void)
  22. {
  23.     printf("Simple kernel server initialized\n");
  24. }
  25.  
  26. /*
  27.  * Notify the world that we're going away.
  28.  */
  29. void simple_signoff(void)
  30. {
  31.     printf("Simple kernel server unloaded\n");
  32. }
  33.  
  34. /*
  35.  * Print the passed string on the console.
  36.  */
  37. kern_return_t simple_puts (
  38.     void        *arg,
  39.     simple_msg_t    string)
  40. {
  41.     printf(string);
  42.     return KERN_SUCCESS;
  43. }
  44.  
  45. /*
  46.  * Return the kernel version string to the caller.
  47.  */
  48. kern_return_t simple_vers (
  49.     void        *arg,
  50.     simple_msg_t    string)
  51. {
  52.     extern char version[];
  53.     strcpy(string, version);
  54.     return KERN_SUCCESS;
  55. }
  56.