pipe2 where possible
This commit is contained in:
parent
aa816e98a9
commit
65f87efca9
4 changed files with 14 additions and 1 deletions
|
@ -567,6 +567,7 @@ include(CheckIncludeFile)
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
include(CheckLibraryExists)
|
include(CheckLibraryExists)
|
||||||
include(CheckTypeSize)
|
include(CheckTypeSize)
|
||||||
|
include(CheckCSourceCompiles)
|
||||||
|
|
||||||
if (LWS_WITHOUT_BUILTIN_SHA1)
|
if (LWS_WITHOUT_BUILTIN_SHA1)
|
||||||
set(LWS_SHA1_USE_OPENSSL_NAME 1)
|
set(LWS_SHA1_USE_OPENSSL_NAME 1)
|
||||||
|
@ -1359,6 +1360,11 @@ else()
|
||||||
CHECK_FUNCTION_EXISTS(TLS_client_method LWS_HAVE_TLS_CLIENT_METHOD)
|
CHECK_FUNCTION_EXISTS(TLS_client_method LWS_HAVE_TLS_CLIENT_METHOD)
|
||||||
CHECK_FUNCTION_EXISTS(TLSv1_2_client_method LWS_HAVE_TLSV1_2_CLIENT_METHOD)
|
CHECK_FUNCTION_EXISTS(TLSv1_2_client_method LWS_HAVE_TLSV1_2_CLIENT_METHOD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# ideally we want to use pipe2()
|
||||||
|
|
||||||
|
CHECK_C_SOURCE_COMPILES("#define _GNU_SOURCE\n#include <unistd.h>\nint main(void) {int fd[2];\n return pipe2(fd, 0);\n}\n" LWS_HAVE_PIPE2)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${temp})
|
set(CMAKE_REQUIRED_LIBRARIES ${temp})
|
||||||
# Generate the lws_config.h that includes all the public compilation settings.
|
# Generate the lws_config.h that includes all the public compilation settings.
|
||||||
configure_file(
|
configure_file(
|
||||||
|
|
|
@ -164,6 +164,8 @@
|
||||||
|
|
||||||
#cmakedefine LWS_HAVE_MALLOC_H
|
#cmakedefine LWS_HAVE_MALLOC_H
|
||||||
|
|
||||||
|
#cmakedefine LWS_HAVE_PIPE2
|
||||||
|
|
||||||
/* OpenSSL various APIs */
|
/* OpenSSL various APIs */
|
||||||
|
|
||||||
#cmakedefine LWS_HAVE_TLS_CLIENT_METHOD
|
#cmakedefine LWS_HAVE_TLS_CLIENT_METHOD
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
* MA 02110-1301 USA
|
* MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
#include "private-libwebsockets.h"
|
#include "private-libwebsockets.h"
|
||||||
|
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
@ -40,7 +41,11 @@ lws_plat_pipe_create(struct lws *wsi)
|
||||||
{
|
{
|
||||||
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
|
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
|
||||||
|
|
||||||
|
#if defined(LWS_HAVE_PIPE2)
|
||||||
|
return pipe2(pt->dummy_pipe_fds, O_NONBLOCK);
|
||||||
|
#else
|
||||||
return pipe(pt->dummy_pipe_fds);
|
return pipe(pt->dummy_pipe_fds);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -26,7 +26,7 @@ rops_handle_POLLIN_pipe(struct lws_context_per_thread *pt, struct lws *wsi,
|
||||||
struct lws_pollfd *pollfd)
|
struct lws_pollfd *pollfd)
|
||||||
{
|
{
|
||||||
#if !defined(WIN32) && !defined(_WIN32)
|
#if !defined(WIN32) && !defined(_WIN32)
|
||||||
char s[10];
|
char s[100];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue