Date: Thu, 12 Jul 2001 06:58:09 -0500 From: y-carden@uniandes.edu.co To: questions@freebsd.org Subject: Some questions about kernel programming Message-ID: <M2001071206580901828@Ayax.uniandes.edu.co>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?M2001071206580901828>