X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Futil%2Fos_file.h;h=cf0dc2075952c23a942b33b8b00895947755c060;hb=4b290b759a8c85c7d493f1ddd7d38b322bbe1276;hp=1972beba32b11ae2ab04a0b2f5f8a55642df9898;hpb=f76cbc7901f7d500f5a4f74aedfd29970d1efd00;p=mesa.git diff --git a/src/util/os_file.h b/src/util/os_file.h index 1972beba32b..cf0dc207595 100644 --- a/src/util/os_file.h +++ b/src/util/os_file.h @@ -24,18 +24,30 @@ extern "C" { FILE * os_file_create_unique(const char *filename, int filemode); +/* + * Duplicate a file descriptor, making sure not to keep it open after an exec*() + */ +int +os_dupfd_cloexec(int fd); + /* * Read a file. * Returns a char* that the caller must free(), or NULL and sets errno. + * If size is not null and no error occured it's set to the size of the + * file. */ char * -os_read_file(const char *filename); +os_read_file(const char *filename, size_t *size); /* - * Returns true if the two file descriptors passed in can be determined to - * reference the same file description, false otherwise + * Try to determine if two file descriptors reference the same file description + * + * Return values: + * - 0: They reference the same file description + * - > 0: They do not reference the same file description + * - < 0: Unable to determine whether they reference the same file description */ -bool +int os_same_file_description(int fd1, int fd2); #ifdef __cplusplus