Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to know the path where i can find the library function definitions. I want the definition for copy_to_user() function in particular. Please help.
copy_to_user is one of two functions used to copy data between kernel space and user-space.
It is a kernel function, not a library function.
You will find its definition somewhere under /usr/include/linux, assuming that you have the kernel headers installed.
I have the kernel headers installed. When i tried searching the "copy_to_user" with locate or grep commands to find any related file, i found a lot of files containing this content and most with assembly like coding. I am confused wich file is actually the source. I found functions "__copy_user" with definitions.
I have the kernel headers installed. When i tried searching the "copy_to_user" with locate or grep commands to find any related file, i found a lot of files containing this content and most with assembly like coding. I am confused wich file is actually the source. I found functions "__copy_user" with definitions.
The actual definition is in asm/uaccess.h. And this is an assembler file, so asm will be a symbolic link to the asm directory of your architecture.
The methods with leading underscores (__copy_user etc) are normally implementation methods that you wouldn't use directly. You can normally ignore these unless you are looking at how it works.
The actual definition is in asm/uaccess.h. And this is an assembler file, so asm will be a symbolic link to the asm directory of your architecture.
The methods with leading underscores (__copy_user etc) are normally implementation methods that you wouldn't use directly. You can normally ignore these unless you are looking at how it works.
Hope that helps,
由obert J Lee
Thanks Mr.Robert. This really gave me a clear picture. And I am actually trying to understand how these kernel functions work. In particular, copy_to_user and copy_from_user. I had a look into the file "../Linux/asm-i386/uaccess.h". I couldn't understand how the conversion "__copy_user" to "copy_to_user"-which we use in proramming work. I found a lot of macro definitions like..
Thanks Mr.Robert. This really gave me a clear picture. And I am actually trying to understand how these kernel functions work. In particular, copy_to_user and copy_from_user. I had a look into the file "../Linux/asm-i386/uaccess.h". I couldn't understand how the conversion "__copy_user" to "copy_to_user"-which we use in proramming work. I found a lot of macro definitions like..
You could go and look up the definition of indirect_copy_user, and eventually you would get to a definition. Which would probably be in assembler.
In general, the symbols with two underscores are implementations of the ones without them; __indirect_copy_user would implement the logic behind indirect_copy_user. This is done so that extra checking can be put into the "public" symbol, if the architecture allows it.
If you're just interested to know what copy_to_user and copy_from_user do, then you might be better off looking at a reference on kernel programming; you might try http://kernelbook.sourceforge.net/
You could go and look up the definition of indirect_copy_user, and eventually you would get to a definition. Which would probably be in assembler.
In general, the symbols with two underscores are implementations of the ones without them; __indirect_copy_user would implement the logic behind indirect_copy_user. This is done so that extra checking can be put into the "public" symbol, if the architecture allows it.
If you're just interested to know what copy_to_user and copy_from_user do, then you might be better off looking at a reference on kernel programming; you might try http://kernelbook.sourceforge.net/
I read the header file for the fn. "pcibios_read_config_dword()" as "bios32.h". But i couldn't found only "bios32.c" where the function call for "pcibios_read_config_dword()" is made. Also I found the fn. declaration in "pci.h" and a macro mapping to "pci_read_config_dword" in "compatmac.h". I need the definition for "pcibios_read_config_dword()"........ please help
I read the header file for the fn. "pcibios_read_config_dword()" as "bios32.h". But i couldn't found only "bios32.c" where the function call for "pcibios_read_config_dword()" is made. Also I found the fn. declaration in "pci.h" and a macro mapping to "pci_read_config_dword" in "compatmac.h". I need the definition for "pcibios_read_config_dword()"........ please help
Typing pcibios_read_config_dword declaration into Google yields as the first match
Quote:
/org/scratch/cerb/linux/include/linux/pci.h:568: warning: static declaration for `pcibios_read_config_dword' follows non-static ...
So you might try linux/pci.h in you kernel headers directory.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.