| Index: third_party/grpc/src/php/ext/grpc/call_credentials.h
|
| diff --git a/third_party/tcmalloc/chromium/src/base/thread_lister.c b/third_party/grpc/src/php/ext/grpc/call_credentials.h
|
| similarity index 55%
|
| copy from third_party/tcmalloc/chromium/src/base/thread_lister.c
|
| copy to third_party/grpc/src/php/ext/grpc/call_credentials.h
|
| index bc180dba7a9f2ba3b8261009c8af85f0b1d4a023..d2f6a92449bf7724304339cdf339b96c630c7ae8 100644
|
| --- a/third_party/tcmalloc/chromium/src/base/thread_lister.c
|
| +++ b/third_party/grpc/src/php/ext/grpc/call_credentials.h
|
| @@ -1,4 +1,6 @@
|
| -/* Copyright (c) 2005-2007, Google Inc.
|
| +/*
|
| + *
|
| + * Copyright 2015, Google Inc.
|
| * All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| @@ -27,51 +29,49 @@
|
| * (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
|
| */
|
|
|
| +#ifndef NET_GRPC_PHP_GRPC_CALL_CREDENTIALS_H_
|
| +#define NET_GRPC_PHP_GRPC_CALL_CREDENTIALS_H_
|
| +
|
| +#ifdef HAVE_CONFIG_H
|
| #include "config.h"
|
| -#include <stdio.h> /* needed for NULL on some powerpc platforms (?!) */
|
| -#ifdef HAVE_SYS_PRCTL
|
| -# include <sys/prctl.h>
|
| #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
|
| +#include "php.h"
|
| +#include "php_ini.h"
|
| +#include "ext/standard/info.h"
|
| +#include "php_grpc.h"
|
|
|
| -/* Default trivial thread lister for single-threaded applications,
|
| - * or if the multi-threading code has not been ported, yet.
|
| - */
|
| +#include "grpc/grpc.h"
|
| +#include "grpc/grpc_security.h"
|
|
|
| -int ListAllProcessThreads(void *parameter,
|
| - ListAllProcessThreadsCallBack callback, ...) {
|
| - int rc;
|
| - va_list ap;
|
| - pid_t pid;
|
| +/* Class entry for the CallCredentials PHP class */
|
| +extern zend_class_entry *grpc_ce_call_credentials;
|
|
|
| -#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;
|
| -}
|
| +/* Wrapper struct for grpc_call_credentials that can be associated
|
| + * with a PHP object */
|
| +typedef struct wrapped_grpc_call_credentials {
|
| + zend_object std;
|
| +
|
| + grpc_call_credentials *wrapped;
|
| +} wrapped_grpc_call_credentials;
|
| +
|
| +/* Struct to hold callback function for plugin creds API */
|
| +typedef struct plugin_state {
|
| + zend_fcall_info *fci;
|
| + zend_fcall_info_cache *fci_cache;
|
| +} plugin_state;
|
| +
|
| +/* Callback function for plugin creds API */
|
| +void plugin_get_metadata(void *state, grpc_auth_metadata_context context,
|
| + grpc_credentials_plugin_metadata_cb cb,
|
| + void *user_data);
|
| +
|
| +/* Cleanup function for plugin creds API */
|
| +void plugin_destroy_state(void *ptr);
|
|
|
| -int ResumeAllProcessThreads(int num_threads, pid_t *thread_pids) {
|
| - return 1;
|
| -}
|
| +/* Initializes the CallCredentials PHP class */
|
| +void grpc_init_call_credentials(TSRMLS_D);
|
|
|
| -#endif /* ifndef THREADS */
|
| +#endif /* NET_GRPC_PHP_GRPC_CALL_CREDENTIALS_H_ */
|
|
|