diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/Foundation/src/PipeImpl_POSIX.cpp | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/Foundation/src/PipeImpl_POSIX.cpp')
-rw-r--r-- | contrib/libs/poco/Foundation/src/PipeImpl_POSIX.cpp | 222 |
1 files changed, 111 insertions, 111 deletions
diff --git a/contrib/libs/poco/Foundation/src/PipeImpl_POSIX.cpp b/contrib/libs/poco/Foundation/src/PipeImpl_POSIX.cpp index 6a3edd32df..4d1f569d66 100644 --- a/contrib/libs/poco/Foundation/src/PipeImpl_POSIX.cpp +++ b/contrib/libs/poco/Foundation/src/PipeImpl_POSIX.cpp @@ -1,111 +1,111 @@ -// -// PipeImpl_POSIX.cpp -// -// Library: Foundation -// Package: Processes -// Module: PipeImpl -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/PipeImpl_POSIX.h" -#include "Poco/Exception.h" -#include <sys/types.h> -#include <unistd.h> -#include <errno.h> - - -namespace Poco { - - -PipeImpl::PipeImpl() -{ - int fds[2]; - int rc = pipe(fds); - if (rc == 0) - { - _readfd = fds[0]; - _writefd = fds[1]; - } - else throw CreateFileException("anonymous pipe"); -} - - -PipeImpl::~PipeImpl() -{ - closeRead(); - closeWrite(); -} - - -int PipeImpl::writeBytes(const void* buffer, int length) -{ - poco_assert (_writefd != -1); - - int n; - do - { - n = write(_writefd, buffer, length); - } - while (n < 0 && errno == EINTR); - if (n >= 0) - return n; - else - throw WriteFileException("anonymous pipe"); -} - - -int PipeImpl::readBytes(void* buffer, int length) -{ - poco_assert (_readfd != -1); - - int n; - do - { - n = read(_readfd, buffer, length); - } - while (n < 0 && errno == EINTR); - if (n >= 0) - return n; - else - throw ReadFileException("anonymous pipe"); -} - - -PipeImpl::Handle PipeImpl::readHandle() const -{ - return _readfd; -} - - -PipeImpl::Handle PipeImpl::writeHandle() const -{ - return _writefd; -} - - -void PipeImpl::closeRead() -{ - if (_readfd != -1) - { - close(_readfd); - _readfd = -1; - } -} - - -void PipeImpl::closeWrite() -{ - if (_writefd != -1) - { - close(_writefd); - _writefd = -1; - } -} - - -} // namespace Poco +// +// PipeImpl_POSIX.cpp +// +// Library: Foundation +// Package: Processes +// Module: PipeImpl +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/PipeImpl_POSIX.h" +#include "Poco/Exception.h" +#include <sys/types.h> +#include <unistd.h> +#include <errno.h> + + +namespace Poco { + + +PipeImpl::PipeImpl() +{ + int fds[2]; + int rc = pipe(fds); + if (rc == 0) + { + _readfd = fds[0]; + _writefd = fds[1]; + } + else throw CreateFileException("anonymous pipe"); +} + + +PipeImpl::~PipeImpl() +{ + closeRead(); + closeWrite(); +} + + +int PipeImpl::writeBytes(const void* buffer, int length) +{ + poco_assert (_writefd != -1); + + int n; + do + { + n = write(_writefd, buffer, length); + } + while (n < 0 && errno == EINTR); + if (n >= 0) + return n; + else + throw WriteFileException("anonymous pipe"); +} + + +int PipeImpl::readBytes(void* buffer, int length) +{ + poco_assert (_readfd != -1); + + int n; + do + { + n = read(_readfd, buffer, length); + } + while (n < 0 && errno == EINTR); + if (n >= 0) + return n; + else + throw ReadFileException("anonymous pipe"); +} + + +PipeImpl::Handle PipeImpl::readHandle() const +{ + return _readfd; +} + + +PipeImpl::Handle PipeImpl::writeHandle() const +{ + return _writefd; +} + + +void PipeImpl::closeRead() +{ + if (_readfd != -1) + { + close(_readfd); + _readfd = -1; + } +} + + +void PipeImpl::closeWrite() +{ + if (_writefd != -1) + { + close(_writefd); + _writefd = -1; + } +} + + +} // namespace Poco |