libzypp
11.13.5
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Fd.cc
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
extern
"C"
13
{
14
#include <sys/types.h>
15
#include <sys/stat.h>
16
#include <fcntl.h>
17
}
18
19
#include <iostream>
20
21
#include "
zypp/base/Exception.h
"
22
#include "
zypp/base/Fd.h
"
23
25
namespace
zypp
26
{
27
28
namespace
base
29
{
30
32
//
33
// METHOD NAME : Fd::Fd
34
// METHOD TYPE : Ctor
35
//
36
Fd::Fd
(
const
Pathname & file_r,
int
open_flags, mode_t mode )
37
: m_fd( -1 )
38
{
39
m_fd
= open( file_r.asString().c_str(), open_flags, mode );
40
if
(
m_fd
== -1 )
41
ZYPP_THROW_ERRNO_MSG
(
Exception
, std::string(
"open "
)+file_r.
asString
() );
42
}
43
45
//
46
// METHOD NAME : Fd::close
47
// METHOD TYPE : void
48
//
49
void
Fd::close
()
50
{
51
if
(
m_fd
!= -1 )
52
{
53
::close
(
m_fd
);
54
m_fd
= -1;
55
}
56
}
57
59
}
// namespace base
62
}
// namespace zypp
zypp
base
Fd.cc
Generated by
1.8.1