Debian Codegraph @

src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/pal/ios-osx/platform_appleios.c

raw
1 // Copyright (c) Microsoft. All rights reserved.
2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
4 #include "azure_c_shared_utility/xlogging.h"
5 #include "azure_c_shared_utility/platform.h"
6
7 #include <stdlib.h>
8 #include <unistd.h>
9 #include <sys/utsname.h>
10
11 #include "tlsio_appleios.h"
12
13 int platform_init(void)
14 {
15 return 0;
16 }
17
18 const IO_INTERFACE_DESCRIPTION* platform_get_default_tlsio(void)
19 {
20 return tlsio_appleios_get_interface_description();
21 }
22
23 STRING_HANDLE platform_get_platform_info(PLATFORM_INFO_OPTION options)
24 {
25 // No applicable options, so ignoring parameter
26 (void)options;
27
28 STRING_HANDLE result;
29 struct utsname nnn;
30
31 if (uname(&nnn) == 0)
32 {
33 result = STRING_construct_sprintf("(%s; %s)", nnn.sysname, nnn.machine);
34
35 if (result == NULL)
36 {
37 LogInfo("ERROR: Failed to create machine info string");
38 }
39 }
40 else
41 {
42 LogInfo("WARNING: failed to find machine info.");
43 result = STRING_construct("iOS");
44
45 if (result == NULL)
46 {
47 LogInfo("ERROR: Failed to create machine info string");
48 }
49 }
50
51 return result;
52 }
53
54 void platform_deinit(void)
55 {
56 }