diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-05 21:01:39 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-05 21:01:39 +0000 |
commit | dfaf45ecc89b3f06fe1348350f06bdb63253d355 (patch) | |
tree | 5f8648bef55449135878f8dedbf8d7f8d826ef92 /manager.c | |
parent | 0b5f4d7645bf52ce4f1c4c018dc3fa68317e67ad (diff) |
move ast_carefulwrite from manager.c to utils.c so that cli.c and
res_agi.c no longer depend on manager.h (issue #6397, casper)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@25026 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'manager.c')
-rw-r--r-- | manager.c | 32 |
1 files changed, 0 insertions, 32 deletions
@@ -168,38 +168,6 @@ static struct mansession { static struct manager_action *first_action = NULL; AST_MUTEX_DEFINE_STATIC(actionlock); -/*! If you are calling ast_carefulwrite, it is assumed that you are calling - it on a file descriptor that _DOES_ have NONBLOCK set. This way, - there is only one system call made to do a write, unless we actually - have a need to wait. This way, we get better performance. */ -int ast_carefulwrite(int fd, char *s, int len, int timeoutms) -{ - /* Try to write string, but wait no more than ms milliseconds - before timing out */ - int res = 0; - struct pollfd fds[1]; - while (len) { - res = write(fd, s, len); - if ((res < 0) && (errno != EAGAIN)) { - return -1; - } - if (res < 0) - res = 0; - len -= res; - s += res; - res = 0; - if (len) { - fds[0].fd = fd; - fds[0].events = POLLOUT; - /* Wait until writable again */ - res = poll(fds, 1, timeoutms); - if (res < 1) - return -1; - } - } - return res; -} - /*! authority_to_str: Convert authority code to string with serveral options */ static char *authority_to_str(int authority, char *res, int reslen) { |