kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* is memcpy a system call?
@ 2012-06-08 15:11 J.Hwan Kim
  2012-06-08 15:18 ` rahul dev
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: J.Hwan Kim @ 2012-06-08 15:11 UTC (permalink / raw)
  To: kernelnewbies

Hi, everyone

Is memcpy a system call?

Thanks in advnace,

Best Regards,
J.Hwna Kim

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

* is memcpy a system call?
  2012-06-08 15:11 is memcpy a system call? J.Hwan Kim
@ 2012-06-08 15:18 ` rahul dev
  2012-06-08 15:21 ` siddharth saxena
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: rahul dev @ 2012-06-08 15:18 UTC (permalink / raw)
  To: kernelnewbies


> Is memcpy a system call?
> 
> Thanks in advnace,
> 

memcpy is *not* a system call. It is a standard C library function.
System calls are those where you enter the kernel mode and ask your OS to do something for you (like read/write from disk).

For memory copy you don't need to take the service of OS. 

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

* is memcpy a system call?
  2012-06-08 15:11 is memcpy a system call? J.Hwan Kim
  2012-06-08 15:18 ` rahul dev
@ 2012-06-08 15:21 ` siddharth saxena
  2012-06-08 21:49   ` Jonathan Neuschäfer
  2012-06-12 10:17   ` Bernd Petrovitsch
  2012-06-08 21:48 ` Jonathan Neuschäfer
  2012-06-08 22:32 ` Ezequiel Garcia
  3 siblings, 2 replies; 7+ messages in thread
From: siddharth saxena @ 2012-06-08 15:21 UTC (permalink / raw)
  To: kernelnewbies

Hi

Memcpy is both- a system call as well as a user library function.
Implementation differs

Regards
Siddharth
On Jun 8, 2012 8:42 PM, "J.Hwan Kim" <frog1120@gmail.com> wrote:

> Hi, everyone
>
> Is memcpy a system call?
>
> Thanks in advnace,
>
> Best Regards,
> J.Hwna Kim
>
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120608/4ed79d9e/attachment.html 

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

* is memcpy a system call?
  2012-06-08 15:11 is memcpy a system call? J.Hwan Kim
  2012-06-08 15:18 ` rahul dev
  2012-06-08 15:21 ` siddharth saxena
@ 2012-06-08 21:48 ` Jonathan Neuschäfer
  2012-06-08 22:32 ` Ezequiel Garcia
  3 siblings, 0 replies; 7+ messages in thread
From: Jonathan Neuschäfer @ 2012-06-08 21:48 UTC (permalink / raw)
  To: kernelnewbies

On Sat, Jun 09, 2012 at 12:11:36AM +0900, J.Hwan Kim wrote:
> Hi, everyone
> 
> Is memcpy a system call?
> 
> Thanks in advnace,
> 
> Best Regards,
> J.Hwna Kim

"strace" is a good tool to find out which system calls a program is
doing.

To answer your question, I don't think it makes much sense to implement
memcpy as a syscall, because entering kernel mode is usually relatively
expensive and I can't think of any kernel mode-only memcpy optimizations
(and optimizations are the only reason to do a user space memcpy in
kernel space I can think of).

HTH,
	Jonathan Neusch?fer

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

* is memcpy a system call?
  2012-06-08 15:21 ` siddharth saxena
@ 2012-06-08 21:49   ` Jonathan Neuschäfer
  2012-06-12 10:17   ` Bernd Petrovitsch
  1 sibling, 0 replies; 7+ messages in thread
From: Jonathan Neuschäfer @ 2012-06-08 21:49 UTC (permalink / raw)
  To: kernelnewbies

On Fri, Jun 08, 2012 at 08:51:09PM +0530, siddharth saxena wrote:
> Hi
> 
> Memcpy is both- a system call as well as a user library function.
> Implementation differs

Can you give me an example of memcpy being implemented as a syscall?

Thanks,
Jonathan Neusch?fer

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

* is memcpy a system call?
  2012-06-08 15:11 is memcpy a system call? J.Hwan Kim
                   ` (2 preceding siblings ...)
  2012-06-08 21:48 ` Jonathan Neuschäfer
@ 2012-06-08 22:32 ` Ezequiel Garcia
  3 siblings, 0 replies; 7+ messages in thread
From: Ezequiel Garcia @ 2012-06-08 22:32 UTC (permalink / raw)
  To: kernelnewbies

On Fri, Jun 8, 2012 at 12:11 PM, J.Hwan Kim <frog1120@gmail.com> wrote:
> Hi, everyone
>
> Is memcpy a system call?
>

"Use the force, read the source"

uclibc:
http://git.uclibc.org/uClibc/tree/libc/string/generic/memcpy.c

glibc:
http://sourceware.org/git/?p=glibc.git;a=blob;f=string/memcpy.c;h=e167e85d7b31bda4e85ec7836631da2a15acf860;hb=c0da14cdda1fa552262ce3624156194eef43e973

Which means: No, memcpy (meaning the userspace function that gets
included by "string.h") is *not* a system call.

Hope this helps,
Ezequiel.

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

* is memcpy a system call?
  2012-06-08 15:21 ` siddharth saxena
  2012-06-08 21:49   ` Jonathan Neuschäfer
@ 2012-06-12 10:17   ` Bernd Petrovitsch
  1 sibling, 0 replies; 7+ messages in thread
From: Bernd Petrovitsch @ 2012-06-12 10:17 UTC (permalink / raw)
  To: kernelnewbies

Hi!

On Fre, 2012-06-08 at 20:51 +0530, siddharth saxena wrote:
[...]
> Memcpy is both- a system call as well as a user library function.
> Implementation differs

What makes you believe this?

	Bernd
-- 
Bernd Petrovitsch                  Email : bernd at petrovitsch.priv.at
                     LUGA : http://www.luga.at

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

end of thread, other threads:[~2012-06-12 10:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-08 15:11 is memcpy a system call? J.Hwan Kim
2012-06-08 15:18 ` rahul dev
2012-06-08 15:21 ` siddharth saxena
2012-06-08 21:49   ` Jonathan Neuschäfer
2012-06-12 10:17   ` Bernd Petrovitsch
2012-06-08 21:48 ` Jonathan Neuschäfer
2012-06-08 22:32 ` Ezequiel Garcia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).