cannot freebsd jail by c

梅凱 freekai at outlook.com
Sat May 21 14:53:41 UTC 2016


This is my part c code:

 

11 int main()

12 {

13     in_addr_t addr_t=inet_addr("192.168.2.1");

14 

 15     struct in_addr in_addr=inet_makeaddr(addr_t,AF_INET);

16 

 17 

 18     struct jail j={

19         .version=JAIL_API_VERSION,

20         .path="./jail_test",

21         .hostname="myjail",

22         .ip4s=addr_t,

23         .ip6s=0,

24         .ip4=&in_addr,

25         .ip6=NULL

26     };

27 

 28     errno=0;

29     int rs=jail(&j);

30     if(0==rs){

31         printf("create jail ok!!!\r\n");

32         return 0;

33     }

34 

 35     switch(errno){

36         case EPERM:

37             printf("eperm\r\n");

38             break;

39         case EFAULT:

40             printf("efault\r\n");

41             break;

42         case EINVAL:

43             printf("einval\r\n");

44             break;

45         case EAGAIN:

46             printf("eagain\r\n");

47             break;

48         default:

49             printf("---------------\r\n");

50             break;

51     }

52     return 0;

53 }

 Unfortunately,the errno return EINVAL,it means “The version number of the argument is not correct.”,why?


More information about the freebsd-jail mailing list