struct borrowed_fd

Defined at line 292 of file ../../third_party/android/platform/system/libbase/include/android-base/unique_fd.h

A wrapper type that can be implicitly constructed from either int or

unique_fd. This supports cases where you don't actually own the file

descriptor, and can't take ownership, but are temporarily acting as if

you're the owner.

One example would be a function that needs to also allow

STDERR_FILENO, not just a newly-opened fd. Another example would be JNI code

that's using a file descriptor that's actually owned by a

ParcelFileDescriptor or whatever on the Java side, but where the JNI code

would like to enforce this weaker sense of "temporary ownership".

If you think of unique_fd as being like std::string in that represents

ownership, borrowed_fd is like std::string_view (and int is like const

char*).

Public Methods

void borrowed_fd (int fd)

implicit

Defined at line 293 of file ../../third_party/android/platform/system/libbase/include/android-base/unique_fd.h

template <typename T>
void borrowed_fd (const unique_fd_impl<T> & ufd)

implicit

Defined at line 295 of file ../../third_party/android/platform/system/libbase/include/android-base/unique_fd.h

int get ()

Defined at line 297 of file ../../third_party/android/platform/system/libbase/include/android-base/unique_fd.h

bool operator>= (int rhs)

Defined at line 299 of file ../../third_party/android/platform/system/libbase/include/android-base/unique_fd.h

bool operator< (int rhs)

Defined at line 300 of file ../../third_party/android/platform/system/libbase/include/android-base/unique_fd.h

bool operator== (int rhs)

Defined at line 301 of file ../../third_party/android/platform/system/libbase/include/android-base/unique_fd.h

bool operator!= (int rhs)

Defined at line 302 of file ../../third_party/android/platform/system/libbase/include/android-base/unique_fd.h