From owner-freebsd-questions Thu Jul 12 18:27:50 2001 Delivered-To: freebsd-questions@freebsd.org Received: from ayax.uniandes.edu.co (Ayax.uniandes.edu.co [157.253.50.3]) by hub.freebsd.org (Postfix) with ESMTP id 9E32737B401 for ; Thu, 12 Jul 2001 18:27:39 -0700 (PDT) (envelope-from y-carden@uniandes.edu.co) Received: from ayax.uniandes.edu.co (ayax [157.253.50.3]) by ayax.uniandes.edu.co (8.11.0/8.11.0) with SMTP id f6CBw9G07561 for ; Thu, 12 Jul 2001 06:58:09 -0500 (GMT+5) Received: (from webmail [157.253.50.14]) by ayax.uniandes.edu.co (NAVGW 2.5 bld 90) with SMTP id M2001071206580901828 ; Thu, 12 Jul 2001 06:58:09 -0500 From: y-carden@uniandes.edu.co To: questions@freebsd.org Subject: Some questions about kernel programming X-Mailer: Netscape Messenger Express 3.5.2 [Mozilla/4.72 [en] (X11; I; FreeBSD 4.0-RELEASE i386)] Date: Thu, 12 Jul 2001 06:58:09 -0500 Message-Id: Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Dear Friends I have some questions about kernel programming: 1. Why I can call some system calls functions into the kernel but another not?, for example: I can call printf(), but I can't call socket(). 2. Into kernel I can call the socket "low level" functions that this system calls invoke sosocket(), soconnect(), etc. but, How I do replace the send() system call? Perhaps, Can I call write() into kernel with same parameters? For example : /* res = send(skt, buf, buflen, 0); */ res = write (skt, buf, buflen); 3. How I can copy a pointer string ( character array ) from user space to kernel space using copyin() without the following problem (I can't pass the length the explicitly from user land): struct MySystemCall_args { char * address; }; int MySystemCall( p,uap) struct proc *p; register struct MySystemCall_args *uap; { char *the_address; printf(" ---> uap->address : %s\n", uap->address ); printf(" ---> (strlen (uap->address) * sizeof(char)) : %d \n", (strlen (uap->address) * sizeof(char)) ); copyin(uap->address, the_address, (strlen (uap->address) * sizeof(char)) ); printf("the_address: %s \n", the_address ); printf("strlen (the_address): %d \n", strlen (the_address) ); When this code run in mode kernel: ---> uap->address : 127.0.0.1 ---> (strlen (uap->address) * sizeof(char)) : 9 the_address : 127.0.0.1\M-"\M-Y\M-GX\M-p+\M-@@\M-_\M-*\M-@ strlen (the_address): 20 This crash the kernel later... Thanks for your help. +------------------------------------------------------------------+ | YONNY CARDENAS B. Apartado Aereo 22828 | | Systems Engineer Santafe de Bogota D.C. | | Colombia - South America | | Student M.Sc. Tel: +571 6095477 | | UNIVERSIDAD DE LOS ANDES mailto: y-carden@uniandes.edu.co | | ycardena@computer.org | | http://www.geocities.com/ycardena | +------------------------------------------------------------------+ UNIX is BSD, and FreeBSD is an advanced 4.4BSD To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message