@@ -89,15 +89,6 @@ int swift::_stdlib_memcmp(const void *s1, const void *s2,
89
89
return memcmp (s1, s2, n);
90
90
}
91
91
92
- SWIFT_RUNTIME_STDLIB_INTERFACE
93
- int swift::_swift_stdlib_open (const char *path, int oflags) {
94
- #if defined(_WIN32)
95
- return _open (path, oflags);
96
- #else
97
- return open (path, oflags);
98
- #endif
99
- }
100
-
101
92
SWIFT_RUNTIME_STDLIB_INTERFACE
102
93
__swift_ssize_t
103
94
swift::_stdlib_read (int fd, void *buf, __swift_size_t nbyte) {
@@ -348,15 +339,15 @@ swift::_stdlib_cxx11_mt19937_uniform(__swift_uint32_t upper_bound) {
348
339
|| ( defined(TARGET_OS_IPHONE) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 10000 ) \
349
340
|| ( defined(TARGET_OS_MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 )
350
341
SWIFT_RUNTIME_STDLIB_INTERFACE
351
- void swift::_swift_stdlib_random (void *buf,
342
+ void swift::_stdlib_random (void *buf,
352
343
__swift_ssize_t nbytes,
353
344
__swift_uint32_t debug_flags) {
354
345
arc4random_buf (buf, nbytes);
355
346
}
356
347
#else
357
348
#include < Security/Security.h>
358
349
SWIFT_RUNTIME_STDLIB_INTERFACE
359
- void swift::_swift_stdlib_random (void *buf,
350
+ void swift::_stdlib_random (void *buf,
360
351
__swift_ssize_t nbytes,
361
352
__swift_uint32_t debug_flags) {
362
353
if (SecRandomCopyBytes (kSecRandomDefault , nbytes, buf) != 0 ) {
@@ -373,7 +364,7 @@ void swift::_swift_stdlib_random(void *buf,
373
364
#define _GNU_SOURCE
374
365
#include < sys/syscall.h>
375
366
SWIFT_RUNTIME_STDLIB_INTERFACE
376
- void swift::_swift_stdlib_random (void *buf,
367
+ void swift::_stdlib_random (void *buf,
377
368
__swift_ssize_t nbytes,
378
369
__swift_uint32_t debug_flags) {
379
370
int result = syscall (SYS_getrandom, buf, nbytes, 0 );
@@ -383,18 +374,18 @@ void swift::_swift_stdlib_random(void *buf,
383
374
}
384
375
#else
385
376
SWIFT_RUNTIME_STDLIB_INTERFACE
386
- void swift::_swift_stdlib_random (void *buf,
377
+ void swift::_stdlib_random (void *buf,
387
378
__swift_ssize_t nbytes,
388
379
__swift_uint32_t debug_flags) {
389
380
int oflags = O_RDONLY;
390
- int fd = swift::_swift_stdlib_open (" /dev/urandom" , oflags);
381
+ int fd = swift::_stdlib_open (" /dev/urandom" , oflags);
391
382
if (fd < 0 ) {
392
383
fatalError (debug_flags, " Fatal error: Unable to open /dev/urandom\n " );
393
384
}
394
- if (swift::_swift_stdlib_read (fd, buf, nbytes) < 0 ) {
385
+ if (swift::_stdlib_read (fd, buf, nbytes) < 0 ) {
395
386
fatalError (debug_flags, " Fatal error: Unable to read /dev/urandom\n " );
396
387
}
397
- swift::_swift_stdlib_close (fd);
388
+ swift::_stdlib_close (fd);
398
389
}
399
390
#endif
400
391
#endif
0 commit comments