[완료]c언어 관련 질문 올립니다

revol2236의 이미지

최근에 linux kernel architecture 라는 책을 읽고 있는데

읽는 도중에 처음 보는 포인터 선언 방식이 쓰여서 질문 올립니다,,

제가 궁금한 코드입니다

asmlinkage int sys_clone(struct pt_regs regs){
 
//.....
 
int __user *parent_tidptr,*child_tidptr;    //제가 궁금한 부분입니다
//.....
}
qiiiiiiiip의 이미지

http://forum.kernelnewbies.org/read.php?12,270

__user tells, that the variable is outside kernel-space, in user space. You should use it always when You are doing any communication between kernel- and user-space, for example read / write functions on /dev/your_dev in Your module. I think it isn't required and I don't know if using __user takes any influence on Your program, but it is much more simple to read the code later, especially if You have two buffers, one in kernel-space and one in user-space

revol2236의 이미지

쓰지 않아도 되지만 __user를 쓸경우

프로그램이 커널공간이 아니라 user space에서 실행되고 있다는 걸 알려주는 일종의 도구였군요

감사합니다ㅜㅠ

============================================

비가오면 사람들은 눈물흘리고

그빗물에 흘러내린 눈물감추고

익명 사용자의 이미지

저도 정확하게

revol2236의 이미지

그부분이 정확히 이해가 안갑니다 ;;

============================================

비가오면 사람들은 눈물흘리고

그빗물에 흘러내린 눈물감추고

익명 사용자의 이미지

저도 정확하게

bushi의 이미지