Add helper is_unknown_or_system_descriptor()
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2005-2011, Ingo Weinhold, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef BUILDING_FS_SHELL
|
#ifdef BUILDING_FS_SHELL
|
||||||
# include "compat.h"
|
# include "compat.h"
|
||||||
@@ -507,4 +512,13 @@ delete_descriptor(int fd)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
is_unknown_or_system_descriptor(int fd)
|
||||||
|
{
|
||||||
|
Descriptor* descriptor = get_descriptor(fd);
|
||||||
|
return descriptor == NULL || descriptor->IsSystemFD();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2005-2011, Ingo Weinhold, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
#ifndef FS_DESCRIPTORS_H
|
#ifndef FS_DESCRIPTORS_H
|
||||||
#define FS_DESCRIPTORS_H
|
#define FS_DESCRIPTORS_H
|
||||||
|
|
||||||
@@ -118,6 +122,7 @@ struct AttrDirDescriptor : DirectoryDescriptor {
|
|||||||
Descriptor* get_descriptor(int fd);
|
Descriptor* get_descriptor(int fd);
|
||||||
int add_descriptor(Descriptor *descriptor);
|
int add_descriptor(Descriptor *descriptor);
|
||||||
status_t delete_descriptor(int fd);
|
status_t delete_descriptor(int fd);
|
||||||
|
bool is_unknown_or_system_descriptor(int fd);
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user