34 absl::string_view file_prefix) {
36#if defined(__PORTABLE_PLATFORM__)
37 filename =
"Temporary files are not implemented for this platform.";
38 LOG(ERROR) << filename;
39 return absl::UnavailableError(filename);
43 int32_t tid =
static_cast<int32_t
>(pthread_self());
48 int32_t pid =
static_cast<int32_t
>(getpid());
52 int64_t now = absl::GetCurrentTimeNanos();
54 if (directory.empty()) {
58 if (file_prefix.empty()) {
59 file_prefix =
"tempfile";
62 filename = absl::StrFormat(
"%s/%s-%x-%d-%llx", directory, file_prefix, tid,