xref: /freebsd/contrib/elftoolchain/libelftc/elftc_copyfile.3 (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1.\" Copyright (c) 2011 Joseph Koshy.  All rights reserved.
2.\"
3.\" Redistribution and use in source and binary forms, with or without
4.\" modification, are permitted provided that the following conditions
5.\" are met:
6.\" 1. Redistributions of source code must retain the above copyright
7.\"    notice, this list of conditions and the following disclaimer.
8.\" 2. Redistributions in binary form must reproduce the above copyright
9.\"    notice, this list of conditions and the following disclaimer in the
10.\"    documentation and/or other materials provided with the distribution.
11.\"
12.\" This software is provided by Joseph Koshy ``as is'' and
13.\" any express or implied warranties, including, but not limited to, the
14.\" implied warranties of merchantability and fitness for a particular purpose
15.\" are disclaimed.  in no event shall Joseph Koshy be liable
16.\" for any direct, indirect, incidental, special, exemplary, or consequential
17.\" damages (including, but not limited to, procurement of substitute goods
18.\" or services; loss of use, data, or profits; or business interruption)
19.\" however caused and on any theory of liability, whether in contract, strict
20.\" liability, or tort (including negligence or otherwise) arising in any way
21.\" out of the use of this software, even if advised of the possibility of
22.\" such damage.
23.\"
24.\" $Id: elftc_copyfile.3 3645 2018-10-15 20:17:14Z jkoshy $
25.\"
26.Dd December 11, 2011
27.Dt ELFTC_COPYFILE 3
28.Os
29.Sh NAME
30.Nm elftc_copyfile
31.Nd convenience function to copy data
32.Sh LIBRARY
33.Lb libelftc
34.Sh SYNOPSIS
35.In libelftc.h
36.Ft in
37.Fn elftc_copyfile "int ifd" "int ofd"
38.Sh DESCRIPTION
39The function
40.Fn elftc_copyfile
41copies the contents of the file referenced by argument
42.Ar ifd
43to the file referenced by argument
44.Ar ofd .
45.Pp
46The argument
47.Ar ifd
48should contain a file descriptor opened for reading, with its file
49offset at the beginning of the file.
50.Pp
51The argument
52.Ar ofd
53should contain a file descriptor opened for writing.
54.Sh RETURN VALUES
55.Rv -std
56.Sh ERRORS
57The function
58.Fn elftc_copyfile
59may fail with any of the errors returned by
60.Xr fstat 2 ,
61.Xr mmap 2 ,
62.Xr munmap 2 ,
63.Xr read 2 ,
64.Xr write 2 ,
65or
66.Xr malloc 3 .
67.Sh SEE ALSO
68.Xr fstat 2 ,
69.Xr mmap 2 ,
70.Xr munmap 2 ,
71.Xr read 2 ,
72.Xr write 2 ,
73.Xr malloc 3
74