Skip to content

Commit 6b9a6f9

Browse files
author
Josh Peterson
committed
Initial changes to get the debugger to compile on PS4
1 parent eab4eb5 commit 6b9a6f9

File tree

8 files changed

+46
-7
lines changed

8 files changed

+46
-7
lines changed

mono/eglib/gpath.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,13 @@ g_find_program_in_path (const gchar *program)
251251

252252
x = NULL;
253253
probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program, NULL);
254+
#if !defined(NO_HAVE_ACCESS)
254255
if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions test */
255256
g_free (curdir);
256257
g_free (p);
257258
return probe_path;
258259
}
260+
#endif
259261
g_free (probe_path);
260262

261263
#ifdef G_OS_WIN32
@@ -265,12 +267,14 @@ g_find_program_in_path (const gchar *program)
265267
while (suffix_list[listx]) {
266268
program_exe = g_strjoin(NULL,program,suffix_list[listx],NULL);
267269
probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program_exe, NULL);
270+
#if !defined(NO_HAVE_ACCESS)
268271
if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions test */
269272
g_free (curdir);
270273
g_free (p);
271274
g_free (program_exe);
272275
return probe_path;
273276
}
277+
#endif
274278
listx++;
275279
g_free (probe_path);
276280
g_free (program_exe);

mono/utils/dlmalloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ extern void* sbrk(ptrdiff_t);
12141214
# define _SC_PAGE_SIZE _SC_PAGESIZE
12151215
# endif
12161216
# endif
1217-
# ifdef _SC_PAGE_SIZE
1217+
# if defined (HAVE_SYSCONF) && defined (_SC_PAGESIZE)
12181218
# define malloc_getpagesize sysconf(_SC_PAGE_SIZE)
12191219
# else
12201220
# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)

mono/utils/mono-hwcap-x86.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ mono_hwcap_arch_init (void)
147147
}
148148
}
149149

150-
#if defined(HAVE_UNISTD_H)
150+
#if defined(HAVE_UNISTD_H) && !defined(NO_HAVE_ACCESS)
151151
mono_hwcap_x86_is_xen = !access ("/proc/xen", F_OK);
152152
#endif
153153
}

mono/utils/mono-membar.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,25 @@ static inline void mono_memory_write_barrier (void)
7676
{
7777
mono_memory_barrier ();
7878
}
79-
#else
79+
80+
#elif defined(PLATFORM_UNITY) && defined(UNITY_USE_PLATFORM_STUBS)
81+
82+
static inline void mono_memory_barrier (void)
83+
{
84+
g_assert(0 && "This function is not yet implemented for the Unity platform.");
85+
}
86+
87+
static inline void mono_memory_read_barrier (void)
88+
{
89+
g_assert(0 && "This function is not yet implemented for the Unity platform.");
90+
}
91+
92+
static inline void mono_memory_write_barrier (void)
93+
{
94+
g_assert(0 && "This function is not yet implemented for the Unity platform.");
95+
}
96+
97+
#else
8098
#error "Don't know how to do memory barriers!"
8199
#endif
82100

mono/utils/mono-proclib.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@
3232
#ifdef HAVE_SYS_SYSCTL_H
3333
#include <sys/sysctl.h>
3434
#endif
35+
#ifdef HAVE_SYS_RESOURCE_H
3536
#include <sys/resource.h>
3637
#endif
38+
#endif
3739
#if defined(__HAIKU__)
3840
#include <os/kernel/OS.h>
3941
#endif
@@ -519,7 +521,7 @@ get_user_hz (void)
519521
{
520522
static int user_hz = 0;
521523
if (user_hz == 0) {
522-
#ifdef _SC_CLK_TCK
524+
#if defined (_SC_CLK_TCK) && defined (HAVE_SYSCONF)
523525
user_hz = sysconf (_SC_CLK_TCK);
524526
#endif
525527
if (user_hz == 0)
@@ -761,7 +763,7 @@ mono_cpu_count (void)
761763
* [5] https://github.com/dotnet/coreclr/blob/7058273693db2555f127ce16e6b0c5b40fb04867/src/pal/src/misc/sysinfo.cpp#L148
762764
*/
763765

764-
#ifdef _SC_NPROCESSORS_CONF
766+
#if defined (_SC_NPROCESSORS_CONF) && defined (HAVE_SYSCONF)
765767
{
766768
int count = sysconf (_SC_NPROCESSORS_CONF);
767769
if (count > 0)
@@ -778,7 +780,7 @@ mono_cpu_count (void)
778780
return CPU_COUNT (&set);
779781
}
780782
#endif
781-
#ifdef _SC_NPROCESSORS_ONLN
783+
#if defined (_SC_NPROCESSORS_ONLN) && defined (HAVE_SYSCONF)
782784
{
783785
int count = sysconf (_SC_NPROCESSORS_ONLN);
784786
if (count > 0)
@@ -913,6 +915,7 @@ gint32
913915
mono_cpu_usage (MonoCpuUsageState *prev)
914916
{
915917
gint32 cpu_usage = 0;
918+
#ifdef HAVE_GETRUSAGE
916919
gint64 cpu_total_time;
917920
gint64 cpu_busy_time;
918921
struct rusage resource_usage;
@@ -940,7 +943,7 @@ mono_cpu_usage (MonoCpuUsageState *prev)
940943

941944
if (cpu_total_time > 0 && cpu_busy_time > 0)
942945
cpu_usage = (gint32)(cpu_busy_time * 100 / cpu_total_time);
943-
946+
#endif
944947
return cpu_usage;
945948
}
946949
#endif /* !HOST_WIN32 */

mono/utils/networking-posix.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ get_address_from_sockaddr (struct sockaddr *sa)
3636
switch (sa->sa_family) {
3737
case AF_INET:
3838
return &((struct sockaddr_in*)sa)->sin_addr;
39+
#ifdef HAVE_STRUCT_SOCKADDR_IN6
3940
case AF_INET6:
4041
return &((struct sockaddr_in6*)sa)->sin6_addr;
42+
#endif
4143
}
4244
return NULL;
4345
}
@@ -92,9 +94,11 @@ mono_get_address_info (const char *hostname, int port, int flags, MonoAddressInf
9294
if (cur->family == PF_INET) {
9395
cur->address_len = sizeof (struct in_addr);
9496
cur->address.v4 = ((struct sockaddr_in*)res->ai_addr)->sin_addr;
97+
#ifdef HAVE_STRUCT_SOCKADDR_IN6
9598
} else if (cur->family == PF_INET6) {
9699
cur->address_len = sizeof (struct in6_addr);
97100
cur->address.v6 = ((struct sockaddr_in6*)res->ai_addr)->sin6_addr;
101+
#endif
98102
} else {
99103
g_warning ("Cannot handle address family %d", cur->family);
100104
res = res->ai_next;

mono/utils/networking.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ mono_address_size_for_family (int family)
1717
switch (family) {
1818
case AF_INET:
1919
return sizeof (struct in_addr);
20+
#ifdef HAVE_STRUCT_SOCKADDR_IN6
2021
case AF_INET6:
2122
return sizeof (struct in6_addr);
23+
#endif
2224
}
2325
return 0;
2426
}
@@ -53,6 +55,7 @@ mono_socket_address_init (MonoSocketAddress *sa, socklen_t *len, int family, con
5355
#if HAVE_SOCKADDR_IN_SIN_LEN
5456
sa->v4.sin_len = sizeof (*len);
5557
#endif
58+
#ifdef HAVE_STRUCT_SOCKADDR_IN6
5659
} else if (family == AF_INET6) {
5760
*len = sizeof (struct sockaddr_in6);
5861

@@ -61,6 +64,7 @@ mono_socket_address_init (MonoSocketAddress *sa, socklen_t *len, int family, con
6164
sa->v6.sin6_port = htons (port);
6265
#if HAVE_SOCKADDR_IN6_SIN_LEN
6366
sa->v6.sin6_len = sizeof (*len);
67+
#endif
6468
#endif
6569
} else {
6670
g_error ("Cannot handle address family %d", family);

mono/utils/networking.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ struct _MonoAddressEntry {
5454
int address_len;
5555
union {
5656
struct in_addr v4;
57+
#ifdef HAVE_STRUCT_SOCKADDR_IN6
5758
struct in6_addr v6;
59+
#endif
5860
} address;
5961
const char *canonical_name;
6062
MonoAddressEntry *next;
@@ -67,15 +69,19 @@ typedef struct {
6769

6870
typedef union {
6971
struct sockaddr_in v4;
72+
#ifdef HAVE_STRUCT_SOCKADDR_IN6
7073
struct sockaddr_in6 v6;
74+
#endif
7175
struct sockaddr addr;
7276
} MonoSocketAddress;
7377

7478
typedef struct {
7579
int family;
7680
union {
7781
struct in_addr v4;
82+
#ifdef HAVE_STRUCT_SOCKADDR_IN6
7883
struct in6_addr v6;
84+
#endif
7985
} addr;
8086
} MonoAddress;
8187

0 commit comments

Comments
 (0)