From owner-freebsd-jail@FreeBSD.ORG Sat Apr 18 15:35:37 2015 Return-Path: Delivered-To: freebsd-jail@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 06F95CFD for ; Sat, 18 Apr 2015 15:35:37 +0000 (UTC) Received: from BLU004-OMC3S22.hotmail.com (blu004-omc3s22.hotmail.com [65.55.116.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "*.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B8F4DC60 for ; Sat, 18 Apr 2015 15:35:36 +0000 (UTC) Received: from BLU403-EAS181 ([65.55.116.72]) by BLU004-OMC3S22.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.22751); Sat, 18 Apr 2015 08:34:29 -0700 X-TMN: [vAerE+pm5Ma+9tA5f60MmuJOD6tHwRMs] X-Originating-Email: [freekai@outlook.com] Message-ID: From: freekai To: Subject: Create Jail fail by c language Date: Sat, 18 Apr 2015 23:34:21 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 15.0 Thread-Index: AdB57Btoeh6pGnvYTyG782ByiLD25w== Content-Language: zh-cn X-OriginalArrivalTime: 18 Apr 2015 15:34:29.0352 (UTC) FILETIME=[28DCE680:01D079ED] X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Apr 2015 15:35:37 -0000 This is My Code: 1 #include 2 #include 3 #include 4 #include 5 #include 6=20 7 int main() 8 { 9 int jid; 10 struct jail j; 11 struct in_addr ip4; 12 const char *cp=3D"192.168.1.10"; 13=20 14 j.version=3DJAIL_API_VERSION; 15 j.path=3D"/home/mk/jail"; 16 j.hostname=3D"testJail"; 17 j.jailname=3D"test"; 18 j.ip4s=3Dinet_addr(cp); 19 j.ip6s=3D0; 20=20 21 if(1!=3Dinet_aton(cp,&ip4)) 22 printf("the address is invalid\r\n"); 23=20 24 j.ip4=3D&ip4; 25 j.ip6=3DNULL; 26=20 27 jid=3Djail(&j); 28=20 29 switch(errno){ 30 case EPERM: 31 printf("eperm\r\n"); 32 break; 33 case EFAULT: 34 printf("efault\r\n"); 35 break; 36 case EINVAL: 37 printf("einval\r\n"); 38 break; 39=20 40 case EAGAIN: 41 printf("eagain\r\n"); 42 } 47 return 0; 48 } The problem is it will print `einval`,it means `The version number of = the argument is not correct.` How to solve it?