Add helper is_unknown_or_system_descriptor()

This commit is contained in:
Ingo Weinhold
2011-07-17 16:54:47 +02:00
parent 775b8d7afd
commit 18d457f8b2
2 changed files with 19 additions and 0 deletions
+14
View File
@@ -1,3 +1,8 @@
/*
* Copyright 2005-2011, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifdef BUILDING_FS_SHELL
# include "compat.h"
@@ -507,4 +512,13 @@ delete_descriptor(int fd)
return error;
}
bool
is_unknown_or_system_descriptor(int fd)
{
Descriptor* descriptor = get_descriptor(fd);
return descriptor == NULL || descriptor->IsSystemFD();
}
} // namespace BPrivate
+5
View File
@@ -1,3 +1,7 @@
/*
* Copyright 2005-2011, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef FS_DESCRIPTORS_H
#define FS_DESCRIPTORS_H
@@ -118,6 +122,7 @@ struct AttrDirDescriptor : DirectoryDescriptor {
Descriptor* get_descriptor(int fd);
int add_descriptor(Descriptor *descriptor);
status_t delete_descriptor(int fd);
bool is_unknown_or_system_descriptor(int fd);
} // namespace BPrivate