Linux C Standard I / O - why duplication

Assuming that I understand the stream correctly, I would like to read a few bytes from the open stream FILE, lets talk using fread:

  • syscall readwill copy data from the kernel to the user space buffer
  • the user space buffer (either allocated by glibc or provided setvbuf...) will be copied to the buffer providedfread

Why is the second step necessary? why can I get a pointer to the user space buffer, which I will decide if I want to store (copy) or not?

Thank,

+4
source share
2 answers

, . / , . OTOH, / , , .

+4

- , . . api . /. . , , , , - os.

0

Source: https://habr.com/ru/post/1541896/


All Articles