This reverts commit87f0765159and implements a work-around instead. This has been reported to be unnecessary, and also returns the wrong answer (off by exactly 100x), so it is not particularly useful. This also reverts the bugfixes to the original PR: Revert "darwin: fix iOS compilation and functionality" This reverts commit1addf9b88a. Revert "macos: fix the cfdata length in uv__get_cpu_speed (#3356)" This reverts commit1e7074913e. Revert "darwin: fix -Wsometimes-uninitialized warning" This reverts commit6085bcef8d. Revert "macos: fix memleaks in uv__get_cpu_speed" This reverts commitd2482ae121. The expected behavior on failure to read this info is to report 0 (for example https://github.com/libuv/libuv/blob/8975c05d199558b0cc2e98f26ce33c6090d1 d7a1/src/unix/linux.c#L834), which is which was not the case before this PR for macos. However hw.cpufrequency sysctl seems to be missing on darwin/arm64 (Apple Silicon), so we instead hardcode a plausible value. This value matches what the mach kernel will report when running Rosetta apps. Fixes: https://github.com/libuv/libuv/issues/3642 Fixes: https://github.com/libuv/libuv/issues/2911 Refs: https://github.com/libuv/libuv/pull/2912
98 lines
3.7 KiB
C
98 lines
3.7 KiB
C
/* Copyright libuv project contributors. All rights reserved.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to
|
|
* deal in the Software without restriction, including without limitation the
|
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
* sell copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
* IN THE SOFTWARE.
|
|
*/
|
|
|
|
#ifndef UV_DARWIN_STUB_H_
|
|
#define UV_DARWIN_STUB_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
struct CFArrayCallBacks;
|
|
struct CFRunLoopSourceContext;
|
|
struct FSEventStreamContext;
|
|
|
|
typedef double CFAbsoluteTime;
|
|
typedef double CFTimeInterval;
|
|
typedef int FSEventStreamEventFlags;
|
|
typedef int OSStatus;
|
|
typedef long CFIndex;
|
|
typedef struct CFArrayCallBacks CFArrayCallBacks;
|
|
typedef struct CFRunLoopSourceContext CFRunLoopSourceContext;
|
|
typedef struct FSEventStreamContext FSEventStreamContext;
|
|
typedef uint32_t FSEventStreamCreateFlags;
|
|
typedef uint64_t FSEventStreamEventId;
|
|
typedef unsigned CFStringEncoding;
|
|
typedef void* CFAllocatorRef;
|
|
typedef void* CFArrayRef;
|
|
typedef void* CFBundleRef;
|
|
typedef void* CFDictionaryRef;
|
|
typedef void* CFRunLoopRef;
|
|
typedef void* CFRunLoopSourceRef;
|
|
typedef void* CFStringRef;
|
|
typedef void* CFTypeRef;
|
|
typedef void* FSEventStreamRef;
|
|
|
|
typedef void (*FSEventStreamCallback)(const FSEventStreamRef,
|
|
void*,
|
|
size_t,
|
|
void*,
|
|
const FSEventStreamEventFlags*,
|
|
const FSEventStreamEventId*);
|
|
|
|
struct CFRunLoopSourceContext {
|
|
CFIndex version;
|
|
void* info;
|
|
void* pad[7];
|
|
void (*perform)(void*);
|
|
};
|
|
|
|
struct FSEventStreamContext {
|
|
CFIndex version;
|
|
void* info;
|
|
void* pad[3];
|
|
};
|
|
|
|
static const CFStringEncoding kCFStringEncodingUTF8 = 0x8000100;
|
|
static const OSStatus noErr = 0;
|
|
|
|
static const FSEventStreamEventId kFSEventStreamEventIdSinceNow = -1;
|
|
|
|
static const int kFSEventStreamCreateFlagNoDefer = 2;
|
|
static const int kFSEventStreamCreateFlagFileEvents = 16;
|
|
|
|
static const int kFSEventStreamEventFlagEventIdsWrapped = 8;
|
|
static const int kFSEventStreamEventFlagHistoryDone = 16;
|
|
static const int kFSEventStreamEventFlagItemChangeOwner = 0x4000;
|
|
static const int kFSEventStreamEventFlagItemCreated = 0x100;
|
|
static const int kFSEventStreamEventFlagItemFinderInfoMod = 0x2000;
|
|
static const int kFSEventStreamEventFlagItemInodeMetaMod = 0x400;
|
|
static const int kFSEventStreamEventFlagItemIsDir = 0x20000;
|
|
static const int kFSEventStreamEventFlagItemModified = 0x1000;
|
|
static const int kFSEventStreamEventFlagItemRemoved = 0x200;
|
|
static const int kFSEventStreamEventFlagItemRenamed = 0x800;
|
|
static const int kFSEventStreamEventFlagItemXattrMod = 0x8000;
|
|
static const int kFSEventStreamEventFlagKernelDropped = 4;
|
|
static const int kFSEventStreamEventFlagMount = 64;
|
|
static const int kFSEventStreamEventFlagRootChanged = 32;
|
|
static const int kFSEventStreamEventFlagUnmount = 128;
|
|
static const int kFSEventStreamEventFlagUserDropped = 2;
|
|
|
|
#endif /* UV_DARWIN_STUB_H_ */
|