diff options
| author | Mark Salyzyn <salyzyn@google.com> | 2014-01-28 21:18:01 +0000 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2014-01-28 21:18:01 +0000 |
| commit | 7b9bb36ade6c8fa2e77416143847b019ddda9e95 (patch) | |
| tree | 7333a42c3cc64b7e57b2b7fc82a8051bb27c287a /include/sysutils/SocketClient.h | |
| parent | 11322efdc63003ba7e2ba73dbbb2621e916a3773 (diff) | |
| parent | 0256e1f68bb8af10478b690c8fb772a0ec2027e3 (diff) | |
| download | system_core-7b9bb36ade6c8fa2e77416143847b019ddda9e95.zip system_core-7b9bb36ade6c8fa2e77416143847b019ddda9e95.tar.gz system_core-7b9bb36ade6c8fa2e77416143847b019ddda9e95.tar.bz2 | |
am 0256e1f6: am d2acdd82: Merge changes I70ab37d5,I716f89c0,I34c96adf,I77650923,I35b0d1ee, ...
* commit '0256e1f68bb8af10478b690c8fb772a0ec2027e3': (29 commits)
libsysutils: SocketListener export release
libsysutils: Add iovec/runOnEachSocket
liblog: support struct logger_event_v2 format
liblog: update timestamp on NOTICE file
libcutils: resolve warning in iosched_policy.c
liblog: Add const pedantics
logcat: Add -T flag (-t w/o assumption of -d)
logcat: Add logcat test suite
liblog: Add cpu utilization test
liblog: Add liblog test suite
debuggerd: Support newline split in log messages
liblog: deprecate export LOGGER ioctl definitions
liblog: deprecate export of LOGGER_LOG_* defines
liblog: Add README
liblog: resolve build warning messages
liblog: high CPU usage from logcat
liblog: fix build again
liblog: drop use of sys/cdefs.h
liblog: git_master@964770 build problem
logcat: Incorporate liblog reading API
...
Diffstat (limited to 'include/sysutils/SocketClient.h')
| -rw-r--r-- | include/sysutils/SocketClient.h | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/include/sysutils/SocketClient.h b/include/sysutils/SocketClient.h index 85b58ef..1004f06 100644 --- a/include/sysutils/SocketClient.h +++ b/include/sysutils/SocketClient.h @@ -6,22 +6,23 @@ #include <pthread.h> #include <cutils/atomic.h> #include <sys/types.h> +#include <sys/uio.h> class SocketClient { int mSocket; bool mSocketOwned; pthread_mutex_t mWriteMutex; - /* Peer process ID */ + // Peer process ID pid_t mPid; - /* Peer user ID */ + // Peer user ID uid_t mUid; - /* Peer group ID */ + // Peer group ID gid_t mGid; - /* Reference count (starts at 1) */ + // Reference count (starts at 1) pthread_mutex_t mRefCountMutex; int mRefCount; @@ -38,12 +39,15 @@ public: pid_t getPid() const { return mPid; } uid_t getUid() const { return mUid; } gid_t getGid() const { return mGid; } - void setCmdNum(int cmdNum) { android_atomic_release_store(cmdNum, &mCmdNum); } + void setCmdNum(int cmdNum) { + android_atomic_release_store(cmdNum, &mCmdNum); + } int getCmdNum() { return mCmdNum; } // Send null-terminated C strings: int sendMsg(int code, const char *msg, bool addErrno); int sendMsg(int code, const char *msg, bool addErrno, bool useCmdNum); + int sendMsg(const char *msg); // Provides a mechanism to send a response code to the client. // Sends the code and a null character. @@ -56,6 +60,8 @@ public: // Sending binary data: int sendData(const void *data, int len); + // iovec contents not preserved through call + int sendDatav(struct iovec *iov, int iovcnt); // Optional reference counting. Reference count starts at 1. If // it's decremented to 0, it deletes itself. @@ -64,19 +70,18 @@ public: void incRef(); bool decRef(); // returns true at 0 (but note: SocketClient already deleted) - // return a new string in quotes with '\\' and '\"' escaped for "my arg" transmissions + // return a new string in quotes with '\\' and '\"' escaped for "my arg" + // transmissions static char *quoteArg(const char *arg); private: - // Send null-terminated C strings - int sendMsg(const char *msg); void init(int socket, bool owned, bool useCmdNum); - // Sending binary data. The caller should use make sure this is protected + // Sending binary data. The caller should make sure this is protected // from multiple threads entering simultaneously. - // returns 0 if successful, -1 if there is a 0 byte write and -2 if any other - // error occurred (use errno to get the error) - int sendDataLocked(const void *data, int len); + // returns 0 if successful, -1 if there is a 0 byte write or if any + // other error occurred (use errno to get the error) + int sendDataLockedv(struct iovec *iov, int iovcnt); }; typedef android::sysutils::List<SocketClient *> SocketClientCollection; |
