xref: /freebsd/contrib/elftoolchain/libelftc/elftc_copyfile.3 (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
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 2315 2011-12-11 09:28:55Z jkoshy $
25.\"
26.Dd December 11, 2011
27.Os
28.Dt ELFTC_COPYFILE 3
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 VALUE
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 malloc 3 ,
62.Xr mmap 2 ,
63.Xr munmap 2 ,
64.Xr read 2
65or
66.Xr write 2 .
67.Sh SEE ALSO
68.Xr fstat 2 ,
69.Xr malloc 3 ,
70.Xr mmap 2 ,
71.Xr munmap 2 ,
72.Xr read 2 ,
73.Xr write 2
74