mirror of https://github.com/mkerrisk/man-pages
Add more detail about wrapper functions
Add a few more details about work generally done by wrapper functions. Note that syscall(2) performs the same steps.
This commit is contained in:
parent
c892873d1a
commit
c8bd05f909
4
Changes
4
Changes
|
@ -32,3 +32,7 @@ Global changes
|
|||
Changes to individual pages
|
||||
---------------------------
|
||||
|
||||
syscalls.2
|
||||
mtk
|
||||
Add a few more details about work generally done by wrapper
|
||||
functions. Note that syscall(2) performs the same steps.
|
||||
|
|
|
@ -46,7 +46,22 @@ For example, glibc contains a function
|
|||
which invokes the underlying "truncate" system call.
|
||||
|
||||
Often the glibc wrapper function is quite thin, doing little work
|
||||
before invoking the system call.
|
||||
other than copying arguments to the right registers
|
||||
before invoking the system call,
|
||||
and then setting
|
||||
.I errno
|
||||
appropriately after the system call has returned.
|
||||
(These are the same steps that are performed by
|
||||
.BR syscall (2),
|
||||
which can be used to invoke system calls
|
||||
for which no wrapper function is provided.)
|
||||
Note: system calls indicate a failure by returning a negative error
|
||||
number to the caller;
|
||||
when this happens,
|
||||
the wrapper function negates the returned error number
|
||||
(to make it positive), copies it to
|
||||
.IR errno ,
|
||||
and returns \-1 to the caller of the wrapper.
|
||||
|
||||
Sometimes, however, the wrapper function does some extra work
|
||||
before invoking the system call.
|
||||
|
|
Loading…
Reference in New Issue