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