All of lore.kernel.org
 help / color / mirror / Atom feed
* How to use memcpy in kernel driver
@ 2014-01-27 19:53 m silverstri
  2014-01-27 20:28 ` Valdis.Kletnieks at vt.edu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: m silverstri @ 2014-01-27 19:53 UTC (permalink / raw)
  To: kernelnewbies

Hi,

How can I use memcoyp in memcpy?
I try #include stdio.h and string.h, but .h fails to include during compilation.

Can you please help me?

Thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* How to use memcpy in kernel driver
  2014-01-27 19:53 How to use memcpy in kernel driver m silverstri
@ 2014-01-27 20:28 ` Valdis.Kletnieks at vt.edu
  2014-01-27 20:28 ` Kristof Provost
  2014-01-27 20:28 ` Augusto Mecking Caringi
  2 siblings, 0 replies; 4+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2014-01-27 20:28 UTC (permalink / raw)
  To: kernelnewbies

On Mon, 27 Jan 2014 11:53:00 -0800, m silverstri said:

> I try #include stdio.h

> Can you please help me?

stdio is a libc invention, only used in userspace.  As such, you can't
call anything in a shared library from within kernel code (although there
are similarly named routines for many things).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140127/0987739e/attachment-0001.bin 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* How to use memcpy in kernel driver
  2014-01-27 19:53 How to use memcpy in kernel driver m silverstri
  2014-01-27 20:28 ` Valdis.Kletnieks at vt.edu
@ 2014-01-27 20:28 ` Kristof Provost
  2014-01-27 20:28 ` Augusto Mecking Caringi
  2 siblings, 0 replies; 4+ messages in thread
From: Kristof Provost @ 2014-01-27 20:28 UTC (permalink / raw)
  To: kernelnewbies

On 2014-01-27 11:53:00 (-0800), m silverstri <michael.j.silverstri@gmail.com> wrote:
> How can I use memcoyp in memcpy?
> I try #include stdio.h and string.h, but .h fails to include during compilation.
> 
That's because stdio.h is a C library header. You can't use the C
library in the kernel.

You should actually be able to include string.h, but you need the kernel
version, which lives in include/linux/string.h.
The kernel provides a few of the functions usually provided by the C
library. Things like memcpy() and memset() exist. printf() doesn't, but
there is an sprintf(), ...

Kristof

^ permalink raw reply	[flat|nested] 4+ messages in thread

* How to use memcpy in kernel driver
  2014-01-27 19:53 How to use memcpy in kernel driver m silverstri
  2014-01-27 20:28 ` Valdis.Kletnieks at vt.edu
  2014-01-27 20:28 ` Kristof Provost
@ 2014-01-27 20:28 ` Augusto Mecking Caringi
  2 siblings, 0 replies; 4+ messages in thread
From: Augusto Mecking Caringi @ 2014-01-27 20:28 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Jan 27, 2014 at 5:53 PM, m silverstri <
michael.j.silverstri@gmail.com> wrote:
>
> How can I use memcoyp in memcpy?
> I try #include stdio.h and string.h, but .h fails to include during
> compilation.
>

Hi,

    stdio.h and string.h are glibc header files (userspace)... Kernelspace
is another thing.

    Try to include "linux/string.h"

-- 
Augusto Mecking Caringi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140127/eef33989/attachment.html 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-27 20:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-27 19:53 How to use memcpy in kernel driver m silverstri
2014-01-27 20:28 ` Valdis.Kletnieks at vt.edu
2014-01-27 20:28 ` Kristof Provost
2014-01-27 20:28 ` Augusto Mecking Caringi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.