From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 3 03:41:32 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 A390616A41C for ; Fri, 3 Jun 2005 03:41:32 +0000 (GMT) (envelope-from shiner_chen@yahoo.com.cn) Received: from web15510.mail.cnb.yahoo.com (web15510.mail.cnb.yahoo.com [202.165.102.39]) by mx1.FreeBSD.org (Postfix) with SMTP id 10F8943D4C for ; Fri, 3 Jun 2005 03:41:31 +0000 (GMT) (envelope-from shiner_chen@yahoo.com.cn) Received: (qmail 34803 invoked by uid 60001); 3 Jun 2005 03:41:30 -0000 Message-ID: <20050603034129.34801.qmail@web15510.mail.cnb.yahoo.com> Received: from [61.187.16.2] by web15510.mail.cnb.yahoo.com via HTTP; Fri, 03 Jun 2005 11:41:29 CST Date: Fri, 3 Jun 2005 11:41:29 +0800 (CST) From: shiner chen To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: a error about the kern_sendit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list 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 03:41:32 -0000 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!! int loadinfo_send(int so_fd, struct thread *td, char *snd_buf, unsigned int uBufLen) { int st = 0; /* read */ struct iovec aiov; struct msghdr msg; msg.msg_name = 0; msg.msg_namelen = 0; msg.msg_iov = &aiov; msg.msg_iovlen = 1; msg.msg_control = 0; msg.msg_flags = 0; /* 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);*/ st = keta_kern_sendit(td, control_so,&msg,0,0); if( st!=0 ){ if ( st == EAGAIN ){ loadinfo_msleep(1); } else{ log(LOG_DEBUG,"in loadinfo_send, send error(%d)!\n",st); return st; } } log(LOG_DEBUG,"send successfully !\n"); return st; } --------------------------------- DO YOU YAHOO!? 雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱