LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-28-2006, 09:02 AM   #1
vishalbutte
Member
 
Registered: Dec 2005
Posts: 80

Rep: Reputation: 15
Question strcpy inside kernel space


strcpy function is used many times in the kernel though its a library function..

But i am not able to use it successfully in kernel space.
i want to copy one string into buffer and then concatenate another string to buffer.

But its not working..

Is there any equivalent function to "strcpy" that can be used inside kernel space.

Library function from same linux/string.h that is "strcmp"
works out very well inside kernl space.
 
Old 02-28-2006, 06:34 PM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
AFAIK modules can't be dynamically linked (or linked at all before 2.6), however it isn't that hard to do manually:
Code:
char *start1 = /* start point */, *start2 = start1, *copy = 0;

unsigned int size = 0;
while (*start1++) size++;

if (size) copy = new char[size];

while (size--) *copy++ = *start2++;
BTW; since the kernel isn't built with the same options as a module, it can be statically linked, which is why it can use 'strcpy'.
ta0kira
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
notify user space application from the kernel space lordofring Linux - Software 2 06-22-2009 12:32 PM
Random number generator inside kernel space zirtik Programming 2 12-26-2005 04:02 PM
User Space - Kernel Space basu_arani Programming 3 05-25-2004 11:46 AM
partitions: space used/free and folders inside joshfields Linux - Newbie 2 05-18-2004 07:21 PM
Kernel Inside Out unixbrain Linux - Newbie 6 09-23-2003 06:18 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration