diff options
author | Vladimir Chtchetkine <vchtchetkine@google.com> | 2011-01-20 18:02:35 -0800 |
---|---|---|
committer | Vladimir Chtchetkine <vchtchetkine@google.com> | 2011-01-25 13:37:49 -0800 |
commit | 6b985d708d64008eee69fe0c3f03c6e3c61e7f73 (patch) | |
tree | 640fa2d7595e61216b042e82b4fe07c59e1742a5 /android/sync-utils.h | |
parent | b2d3df36e6e0d22c00fcddb51f9b0f4f754bfda4 (diff) | |
download | external_qemu-6b985d708d64008eee69fe0c3f03c6e3c61e7f73.zip external_qemu-6b985d708d64008eee69fe0c3f03c6e3c61e7f73.tar.gz external_qemu-6b985d708d64008eee69fe0c3f03c6e3c61e7f73.tar.bz2 |
Implement UI control service and client
Change-Id: Iecc1b5bb9ddcdaf9f22c500a5195718db3f25354
Diffstat (limited to 'android/sync-utils.h')
-rw-r--r-- | android/sync-utils.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/android/sync-utils.h b/android/sync-utils.h index 1dcf649..d99caaf 100644 --- a/android/sync-utils.h +++ b/android/sync-utils.h @@ -22,6 +22,8 @@ #ifndef ANDROID_SYNC_UTILS_H #define ANDROID_SYNC_UTILS_H +#include "sockets.h" + /* Descriptor for a connected non-blocking socket providing synchronous I/O */ typedef struct SyncSocket SyncSocket; @@ -224,4 +226,25 @@ ssize_t syncsocket_read_line(SyncSocket* ssocket, */ int syncsocket_get_socket(SyncSocket* ssocket); +/* Converts syncsocket_xxx operation status into success / failure result. + * Param: + * status - syncsocket_xxx operation status to convert. + * Return: + * 0 if status passed to this routine indicated a success, or < 0 if status + * indicated a failure. + */ +static inline int +syncsocket_result(int status) +{ + if (status == 0) { + // Status 0 returned from syncsocket_xxx means "disconnection", which is + // a failure. + status = -1; + } else if (status > 0) { + // Status > 0 means success. + status = 0; + } + return status; +} + #endif // ANDROID_SYNC_UTILS_H |