Need some help understanding a jail system call.

bert wiley bertwiley at gmail.com
Wed Aug 26 13:56:53 UTC 2009


Hello
   I found this code under a project called jailNG which has some system
calls for doing jail stuff. Im still new to freebsd and im stumped on what
this code is actually doing. In the source from the project there are few
function calls that look like it creates and access the jail layer. Here is
an example




#define JAIL_CREATE     1
#define JAIL_DESTROY    2
#define JAIL_JOIN       3

extern char *environ[];

static void
usage(void)
{

      fprintf(stderr, "usage:\n");
      fprintf(stderr, "  jailctl create [jailname]\n");
      fprintf(stderr, "  jailctl destroy [jailname]\n");
      fprintf(stderr, "  jailctl join [jailname] [-c chrootpath] [path] "
          "[cmd] [args...]\n");

      exit(-1);
}

static int
jail_create(int argc, char *argv[])
{
      int error;

      if (argc < 2)
            usage();

      error = syscall(375, JAIL_CREATE, argv[1]);
      if (error)
            perror("jailconf().create");
      return (error);
}



No where in the code do i ever see any access to the jail.h type systems
calls, so does the syscall(375, JAIL_CREATE, argv[1]); actually access the
jail subsystem and create a jail?

Here is the link i used to find this code
http://www.watson.org/~robert/freebsd/jailng/



Any help on this question is appreciated thanks.


More information about the freebsd-hackers mailing list