| Index: third_party/grpc/include/grpc/support/host_port.h
|
| diff --git a/third_party/tcmalloc/vendor/src/base/thread_lister.c b/third_party/grpc/include/grpc/support/host_port.h
|
| similarity index 57%
|
| copy from third_party/tcmalloc/vendor/src/base/thread_lister.c
|
| copy to third_party/grpc/include/grpc/support/host_port.h
|
| index bc180dba7a9f2ba3b8261009c8af85f0b1d4a023..53cc917acb4b6d273c7ce99c5d03d2d4c615196c 100644
|
| --- a/third_party/tcmalloc/vendor/src/base/thread_lister.c
|
| +++ b/third_party/grpc/include/grpc/support/host_port.h
|
| @@ -1,4 +1,6 @@
|
| -/* Copyright (c) 2005-2007, Google Inc.
|
| +/*
|
| + *
|
| + * Copyright 2015-2016, Google Inc.
|
| * All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| @@ -27,51 +29,38 @@
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| *
|
| - * ---
|
| - * Author: Markus Gutschke
|
| */
|
|
|
| -#include "config.h"
|
| -#include <stdio.h> /* needed for NULL on some powerpc platforms (?!) */
|
| -#ifdef HAVE_SYS_PRCTL
|
| -# include <sys/prctl.h>
|
| +#ifndef GRPC_SUPPORT_HOST_PORT_H
|
| +#define GRPC_SUPPORT_HOST_PORT_H
|
| +
|
| +#include <grpc/support/port_platform.h>
|
| +
|
| +#ifdef __cplusplus
|
| +extern "C" {
|
| #endif
|
| -#include "base/thread_lister.h"
|
| -#include "base/linuxthreads.h"
|
| -/* Include other thread listers here that define THREADS macro
|
| - * only when they can provide a good implementation.
|
| - */
|
|
|
| -#ifndef THREADS
|
| +/* Given a host and port, creates a newly-allocated string of the form
|
| + "host:port" or "[ho:st]:port", depending on whether the host contains colons
|
| + like an IPv6 literal. If the host is already bracketed, then additional
|
| + brackets will not be added.
|
|
|
| -/* Default trivial thread lister for single-threaded applications,
|
| - * or if the multi-threading code has not been ported, yet.
|
| - */
|
| + Usage is similar to gpr_asprintf: returns the number of bytes written
|
| + (excluding the final '\0'), and *out points to a string which must later be
|
| + destroyed using gpr_free().
|
|
|
| -int ListAllProcessThreads(void *parameter,
|
| - ListAllProcessThreadsCallBack callback, ...) {
|
| - int rc;
|
| - va_list ap;
|
| - pid_t pid;
|
| + In the unlikely event of an error, returns -1 and sets *out to NULL. */
|
| +GPRAPI int gpr_join_host_port(char **out, const char *host, int port);
|
|
|
| -#ifdef HAVE_SYS_PRCTL
|
| - int dumpable = prctl(PR_GET_DUMPABLE, 0);
|
| - if (!dumpable)
|
| - prctl(PR_SET_DUMPABLE, 1);
|
| -#endif
|
| - va_start(ap, callback);
|
| - pid = getpid();
|
| - rc = callback(parameter, 1, &pid, ap);
|
| - va_end(ap);
|
| -#ifdef HAVE_SYS_PRCTL
|
| - if (!dumpable)
|
| - prctl(PR_SET_DUMPABLE, 0);
|
| -#endif
|
| - return rc;
|
| -}
|
| +/* Given a name in the form "host:port" or "[ho:st]:port", split into hostname
|
| + and port number, into newly allocated strings, which must later be
|
| + destroyed using gpr_free().
|
| + Return 1 on success, 0 on failure. Guarantees *host and *port == NULL on
|
| + failure. */
|
| +GPRAPI int gpr_split_host_port(const char *name, char **host, char **port);
|
|
|
| -int ResumeAllProcessThreads(int num_threads, pid_t *thread_pids) {
|
| - return 1;
|
| +#ifdef __cplusplus
|
| }
|
| +#endif
|
|
|
| -#endif /* ifndef THREADS */
|
| +#endif /* GRPC_SUPPORT_HOST_PORT_H */
|
|
|