| Index: third_party/grpc/src/core/security/credentials_posix.c
|
| diff --git a/third_party/tcmalloc/vendor/src/base/synchronization_profiling.h b/third_party/grpc/src/core/security/credentials_posix.c
|
| similarity index 66%
|
| copy from third_party/tcmalloc/vendor/src/base/synchronization_profiling.h
|
| copy to third_party/grpc/src/core/security/credentials_posix.c
|
| index cf02c218a111806189f71f7b528a83b5ceb164a4..0c92bd4a96bcfa741284b7985e16b1e1ddbf28e7 100644
|
| --- a/third_party/tcmalloc/vendor/src/base/synchronization_profiling.h
|
| +++ b/third_party/grpc/src/core/security/credentials_posix.c
|
| @@ -1,4 +1,6 @@
|
| -/* Copyright (c) 2010, Google Inc.
|
| +/*
|
| + *
|
| + * Copyright 2015, Google Inc.
|
| * All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| @@ -27,24 +29,33 @@
|
| * (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: Chris Ruemmler
|
| */
|
|
|
| -#ifndef BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_
|
| -#define BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_
|
| +#include <grpc/support/port_platform.h>
|
| +
|
| +#ifdef GPR_POSIX_FILE
|
|
|
| -#include "base/basictypes.h"
|
| +#include "src/core/security/credentials.h"
|
|
|
| -namespace base {
|
| +#include <grpc/support/alloc.h>
|
| +#include <grpc/support/log.h>
|
| +#include <grpc/support/string_util.h>
|
|
|
| -// We can do contention-profiling of SpinLocks, but the code is in
|
| -// mutex.cc, which is not always linked in with spinlock. Hence we
|
| -// provide a weak definition, which are used if mutex.cc isn't linked in.
|
| +#include "src/core/support/env.h"
|
| +#include "src/core/support/string.h"
|
|
|
| -// Submit the number of cycles the spinlock spent contending.
|
| -ATTRIBUTE_WEAK extern void SubmitSpinLockProfileData(const void *, int64);
|
| -extern void SubmitSpinLockProfileData(const void *contendedlock,
|
| - int64 wait_cycles) {}
|
| +char *grpc_get_well_known_google_credentials_file_path_impl(void) {
|
| + char *result = NULL;
|
| + char *home = gpr_getenv("HOME");
|
| + if (home == NULL) {
|
| + gpr_log(GPR_ERROR, "Could not get HOME environment variable.");
|
| + return NULL;
|
| + }
|
| + gpr_asprintf(&result, "%s/.config/%s/%s", home,
|
| + GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY,
|
| + GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE);
|
| + gpr_free(home);
|
| + return result;
|
| }
|
| -#endif // BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_
|
| +
|
| +#endif /* GPR_POSIX_FILE */
|
|
|