Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 May 2016 22:52:30 +0800
From:      =?UTF-8?B?5qKF5Yex?= <freekai@outlook.com>
To:        <freebsd-jail@freebsd.org>
Subject:   cannot freebsd jail by c
Message-ID:  <BLU403-EAS3867596492B5EB1C262E8B2AB4C0@phx.gbl>

next in thread | raw e-mail | index | archive | help
This is my part c code:

=20

11 int main()

12 {

13     in_addr_t addr_t=3Dinet_addr("192.168.2.1");

14=20

 15     struct in_addr in_addr=3Dinet_makeaddr(addr_t,AF_INET);

16=20

 17=20

 18     struct jail j=3D{

19         .version=3DJAIL_API_VERSION,

20         .path=3D"./jail_test",

21         .hostname=3D"myjail",

22         .ip4s=3Daddr_t,

23         .ip6s=3D0,

24         .ip4=3D&in_addr,

25         .ip6=3DNULL

26     };

27=20

 28     errno=3D0;

29     int rs=3Djail(&j);

30     if(0=3D=3Drs){

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

32         return 0;

33     }

34=20

 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 =E2=80=9CThe version =
number of the argument is not correct.=E2=80=9D,why?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BLU403-EAS3867596492B5EB1C262E8B2AB4C0>