From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 3 05:20:58 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2A96B16A41C for ; Fri, 3 Jun 2005 05:20:58 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from mail22.sea5.speakeasy.net (mail22.sea5.speakeasy.net [69.17.117.24]) by mx1.FreeBSD.org (Postfix) with ESMTP id D075E43D54 for ; Fri, 3 Jun 2005 05:20:57 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: (qmail 650 invoked from network); 3 Jun 2005 05:20:57 -0000 Received: from gate.funkthat.com (HELO hydrogen.funkthat.com) ([69.17.45.168]) (envelope-sender ) by mail22.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 3 Jun 2005 05:20:57 -0000 Received: from hydrogen.funkthat.com (axydil@localhost.funkthat.com [127.0.0.1]) by hydrogen.funkthat.com (8.12.10/8.11.6) with ESMTP id j535KuEa045169; Thu, 2 Jun 2005 22:20:56 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.12.10/8.12.10/Submit) id j535Kt4A045168; Thu, 2 Jun 2005 22:20:55 -0700 (PDT) Date: Thu, 2 Jun 2005 22:20:55 -0700 From: John-Mark Gurney To: shiner chen Message-ID: <20050603052054.GE594@funkthat.com> Mail-Followup-To: shiner chen , freebsd-hackers@freebsd.org References: <20050603034129.34801.qmail@web15510.mail.cnb.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050603034129.34801.qmail@web15510.mail.cnb.yahoo.com> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.2-RELEASE i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html Cc: freebsd-hackers@freebsd.org Subject: Re: a error about the kern_sendit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: John-Mark Gurney List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2005 05:20:58 -0000 shiner chen wrote this message on Fri, Jun 03, 2005 at 11:41 +0800: > i wrote a function to send the data of my a data structure in my kld by socket in kernel, the function as follow: > the arg 1 is file descriptor of socket. the arg 2 is the address of data structure. the arg 3 is the length of data structure and it is 20 bytes . > > the error return by kern_sendit is EFAULT(14), i check the address of data structure ,but it is right! > why ? who can tell me. thanks!! This buffer is in SYSSPACE: > /* do actual send operation now */ > aiov.iov_base = snd_buf ; > aiov.iov_len = uBufLen; > ///////// there is error//////////////////////// > /*st = kern_sendit(td, so_fd,&msg,0,0);*/ ^ but you say it's in userspace.. Look at uio.h for the enum uio_seg definition... and uio(9) is also useful... Try replacing that last zero with UIO_SYSSPACE.. > st = keta_kern_sendit(td, control_so,&msg,0,0); and possibly here... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."