diff options
author | Dan Albert <danalbert@google.com> | 2015-02-24 21:26:58 -0800 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2015-02-25 15:07:57 -0800 |
commit | cc731cc76786b6bdc58764aad9924c0d0c8d645f (patch) | |
tree | 57906636c803e1ae089c2fcf2905d82488b0ba72 /adb/sysdeps.h | |
parent | a035d5003ea593322ba565df9a4f4d0dd6647acf (diff) | |
download | system_core-cc731cc76786b6bdc58764aad9924c0d0c8d645f.zip system_core-cc731cc76786b6bdc58764aad9924c0d0c8d645f.tar.gz system_core-cc731cc76786b6bdc58764aad9924c0d0c8d645f.tar.bz2 |
Test readx/writex (now renamed).
Renamed readx/writex to ReadFdExactly/WriteFdExactly respectively.
These read/write a full fixed-size buffer. If the whole buffer cannot
be read/written, these functions return an error.
Rename write_string to WriteStringFully.
Move the TEMP_FAILURE_RETRY definition in sysdeps.h out of the
!Windows section. It seems Windows won't actually interrupt a call,
but it's easier to just define it than to #ifdef each call.
Change-Id: Ia8ddffa2a52764a2f9a281c96c937660e002b9b9
Diffstat (limited to 'adb/sysdeps.h')
-rw-r--r-- | adb/sysdeps.h | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/adb/sysdeps.h b/adb/sysdeps.h index ec847b5..c317e3a 100644 --- a/adb/sysdeps.h +++ b/adb/sysdeps.h @@ -24,6 +24,21 @@ # undef _WIN32 #endif +/* + * TEMP_FAILURE_RETRY is defined by some, but not all, versions of + * <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's + * not already defined, then define it here. + */ +#ifndef TEMP_FAILURE_RETRY +/* Used to retry syscalls that can return EINTR. */ +#define TEMP_FAILURE_RETRY(exp) ({ \ + typeof (exp) _rc; \ + do { \ + _rc = (exp); \ + } while (_rc == -1 && errno == EINTR); \ + _rc; }) +#endif + #ifdef _WIN32 #include <ctype.h> @@ -264,10 +279,6 @@ static __inline__ int adb_is_absolute_host_path( const char* path ) extern char* adb_strtok_r(char *str, const char *delim, char **saveptr); -#ifdef __cplusplus -} -#endif - #else /* !_WIN32 a.k.a. Unix */ #include "fdevent.h" @@ -291,21 +302,6 @@ extern char* adb_strtok_r(char *str, const char *delim, char **saveptr); extern "C" { #endif -/* - * TEMP_FAILURE_RETRY is defined by some, but not all, versions of - * <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's - * not already defined, then define it here. - */ -#ifndef TEMP_FAILURE_RETRY -/* Used to retry syscalls that can return EINTR. */ -#define TEMP_FAILURE_RETRY(exp) ({ \ - typeof (exp) _rc; \ - do { \ - _rc = (exp); \ - } while (_rc == -1 && errno == EINTR); \ - _rc; }) -#endif - #define OS_PATH_SEPARATOR '/' #define OS_PATH_SEPARATOR_STR "/" #define ENV_PATH_SEPARATOR_STR ":" |