Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
d310f3e9
Commit
d310f3e9
authored
Aug 10, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
system/FileDescriptor: add method IsValid()
parent
8c832f4c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
FileDescriptor.cxx
src/system/FileDescriptor.cxx
+10
-0
FileDescriptor.hxx
src/system/FileDescriptor.hxx
+8
-0
No files found.
src/system/FileDescriptor.cxx
View file @
d310f3e9
...
...
@@ -57,6 +57,16 @@
#define O_CLOEXEC 0
#endif
#ifndef _WIN32
bool
FileDescriptor
::
IsValid
()
const
noexcept
{
return
IsDefined
()
&&
fcntl
(
fd
,
F_GETFL
)
>=
0
;
}
#endif
bool
FileDescriptor
::
Open
(
const
char
*
pathname
,
int
flags
,
mode_t
mode
)
noexcept
{
...
...
src/system/FileDescriptor.hxx
View file @
d310f3e9
...
...
@@ -64,6 +64,14 @@ public:
return
fd
>=
0
;
}
#ifndef _WIN32
/**
* Ask the kernel whether this is a valid file descriptor.
*/
gcc_pure
bool
IsValid
()
const
noexcept
;
#endif
/**
* Returns the file descriptor. This may only be called if
* IsDefined() returns true.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment