You've already forked linux-packaging-mono
Imported Upstream version 4.2.1.36
Former-commit-id: f3008ca867fe7e4b7ae9b9a8844c0ad5798925a9
This commit is contained in:
committed by
Jo Shields
parent
afe402035c
commit
ea5caba957
@@ -1 +1 @@
|
||||
5ed261ffbbe468a2a825601134e8c516a710515c
|
||||
159eb909d9cb76fb319f686324cdbd78d1418a26
|
||||
@@ -33,7 +33,7 @@ struct _MonoPPDBFile {
|
||||
};
|
||||
|
||||
MonoPPDBFile*
|
||||
mono_ppdb_load_file (MonoImage *image)
|
||||
mono_ppdb_load_file (MonoImage *image, const guint8 *raw_contents, int size)
|
||||
{
|
||||
MonoImage *ppdb_image;
|
||||
const char *filename;
|
||||
@@ -46,18 +46,22 @@ mono_ppdb_load_file (MonoImage *image)
|
||||
#endif
|
||||
MonoPPDBFile *ppdb;
|
||||
|
||||
/* ppdb files drop the .exe/.dll extension */
|
||||
filename = mono_image_get_filename (image);
|
||||
if (strlen (filename) > 4 && (!strcmp (filename + strlen (filename) - 4, ".exe"))) {
|
||||
s = g_strdup (filename);
|
||||
s [strlen (filename) - 4] = '\0';
|
||||
ppdb_filename = g_strdup_printf ("%s.pdb", s);
|
||||
g_free (s);
|
||||
if (raw_contents) {
|
||||
ppdb_image = mono_image_open_from_data_internal ((char*)raw_contents, size, TRUE, NULL, FALSE, TRUE, NULL);
|
||||
} else {
|
||||
ppdb_filename = g_strdup_printf ("%s.pdb", filename);
|
||||
}
|
||||
/* ppdb files drop the .exe/.dll extension */
|
||||
filename = mono_image_get_filename (image);
|
||||
if (strlen (filename) > 4 && (!strcmp (filename + strlen (filename) - 4, ".exe"))) {
|
||||
s = g_strdup (filename);
|
||||
s [strlen (filename) - 4] = '\0';
|
||||
ppdb_filename = g_strdup_printf ("%s.pdb", s);
|
||||
g_free (s);
|
||||
} else {
|
||||
ppdb_filename = g_strdup_printf ("%s.pdb", filename);
|
||||
}
|
||||
|
||||
ppdb_image = mono_image_open_metadata_only (ppdb_filename, &status);
|
||||
ppdb_image = mono_image_open_metadata_only (ppdb_filename, &status);
|
||||
}
|
||||
if (!ppdb_image)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <mono/metadata/mono-debug.h>
|
||||
|
||||
MonoPPDBFile*
|
||||
mono_ppdb_load_file (MonoImage *image);
|
||||
mono_ppdb_load_file (MonoImage *image, const guint8 *raw_contents, int size);
|
||||
|
||||
void
|
||||
mono_ppdb_close (MonoDebugHandle *handle);
|
||||
|
||||
@@ -1145,7 +1145,7 @@ register_image (MonoImage *image)
|
||||
}
|
||||
|
||||
MonoImage *
|
||||
mono_image_open_from_data_with_name (char *data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus *status, gboolean refonly, const char *name)
|
||||
mono_image_open_from_data_internal (char *data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus *status, gboolean refonly, gboolean metadata_only, const char *name)
|
||||
{
|
||||
MonoCLIImageInfo *iinfo;
|
||||
MonoImage *image;
|
||||
@@ -1175,6 +1175,7 @@ mono_image_open_from_data_with_name (char *data, guint32 data_len, gboolean need
|
||||
iinfo = g_new0 (MonoCLIImageInfo, 1);
|
||||
image->image_info = iinfo;
|
||||
image->ref_only = refonly;
|
||||
image->metadata_only = metadata_only;
|
||||
|
||||
image = do_mono_image_load (image, status, TRUE, TRUE);
|
||||
if (image == NULL)
|
||||
@@ -1183,6 +1184,12 @@ mono_image_open_from_data_with_name (char *data, guint32 data_len, gboolean need
|
||||
return register_image (image);
|
||||
}
|
||||
|
||||
MonoImage *
|
||||
mono_image_open_from_data_with_name (char *data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus *status, gboolean refonly, const char *name)
|
||||
{
|
||||
return mono_image_open_from_data_internal (data, data_len, need_copy, status, refonly, FALSE, name);
|
||||
}
|
||||
|
||||
MonoImage *
|
||||
mono_image_open_from_data_full (char *data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus *status, gboolean refonly)
|
||||
{
|
||||
|
||||
@@ -803,6 +803,8 @@ MonoImage *mono_image_open_raw (const char *fname, MonoImageOpenStatus *status);
|
||||
|
||||
MonoImage *mono_image_open_metadata_only (const char *fname, MonoImageOpenStatus *status);
|
||||
|
||||
MonoImage *mono_image_open_from_data_internal (char *data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus *status, gboolean refonly, gboolean metadata_only, const char *name);
|
||||
|
||||
MonoException *mono_get_exception_field_access_msg (const char *msg);
|
||||
|
||||
MonoException *mono_get_exception_method_access_msg (const char *msg);
|
||||
|
||||
@@ -262,7 +262,7 @@ mono_debug_open_image (MonoImage *image, const guint8 *raw_contents, int size)
|
||||
mono_image_addref (image);
|
||||
|
||||
/* Try a ppdb file first */
|
||||
handle->ppdb = mono_ppdb_load_file (handle->image);
|
||||
handle->ppdb = mono_ppdb_load_file (handle->image, raw_contents, size);
|
||||
|
||||
if (!handle->ppdb)
|
||||
handle->symfile = mono_debug_open_mono_symbols (handle, raw_contents, size, FALSE);
|
||||
|
||||
@@ -1 +1 @@
|
||||
f9768ac2cfe89e79250b385f935628ab59cf5d56
|
||||
2e824e3e01a0c6978e7a49c8d921dd22984688c2
|
||||
@@ -57,37 +57,44 @@ epoll_cleanup (void)
|
||||
static void
|
||||
epoll_register_fd (gint fd, gint events, gboolean is_new)
|
||||
{
|
||||
if (events == 0) {
|
||||
if (!is_new && epoll_ctl (epoll_fd, EPOLL_CTL_DEL, fd, NULL) == -1)
|
||||
g_error ("epoll_register_fd: epoll_ctl (EPOLL_CTL_DEL) failed, error (%d) %s", errno, g_strerror (errno));
|
||||
} else {
|
||||
struct epoll_event event;
|
||||
struct epoll_event event;
|
||||
|
||||
#ifndef EPOLLONESHOT
|
||||
/* it was only defined on android in May 2013 */
|
||||
#define EPOLLONESHOT 0x40000000
|
||||
#endif
|
||||
|
||||
event.data.fd = fd;
|
||||
event.events = EPOLLONESHOT;
|
||||
if ((events & MONO_POLLIN) != 0)
|
||||
event.events |= EPOLLIN;
|
||||
if ((events & MONO_POLLOUT) != 0)
|
||||
event.events |= EPOLLOUT;
|
||||
event.data.fd = fd;
|
||||
event.events = EPOLLONESHOT;
|
||||
if ((events & EVENT_IN) != 0)
|
||||
event.events |= EPOLLIN;
|
||||
if ((events & EVENT_OUT) != 0)
|
||||
event.events |= EPOLLOUT;
|
||||
|
||||
if (epoll_ctl (epoll_fd, is_new ? EPOLL_CTL_ADD : EPOLL_CTL_MOD, event.data.fd, &event) == -1)
|
||||
g_error ("epoll_register_fd: epoll_ctl(%s) failed, error (%d) %s", is_new ? "EPOLL_CTL_ADD" : "EPOLL_CTL_MOD", errno, g_strerror (errno));
|
||||
}
|
||||
if (epoll_ctl (epoll_fd, is_new ? EPOLL_CTL_ADD : EPOLL_CTL_MOD, event.data.fd, &event) == -1)
|
||||
g_error ("epoll_register_fd: epoll_ctl(%s) failed, error (%d) %s", is_new ? "EPOLL_CTL_ADD" : "EPOLL_CTL_MOD", errno, g_strerror (errno));
|
||||
}
|
||||
|
||||
static void
|
||||
epoll_remove_fd (gint fd)
|
||||
{
|
||||
if (epoll_ctl (epoll_fd, EPOLL_CTL_DEL, fd, NULL) == -1)
|
||||
g_error ("epoll_remove_fd: epoll_ctl (EPOLL_CTL_DEL) failed, error (%d) %s", errno, g_strerror (errno));
|
||||
}
|
||||
|
||||
static gint
|
||||
epoll_event_wait (void)
|
||||
epoll_event_wait (void (*callback) (gint fd, gint events, gpointer user_data), gpointer user_data)
|
||||
{
|
||||
gint ready;
|
||||
gint i, ready;
|
||||
|
||||
memset (epoll_events, 0, sizeof (struct epoll_event) * EPOLL_NEVENTS);
|
||||
|
||||
mono_gc_set_skip_thread (TRUE);
|
||||
|
||||
ready = epoll_wait (epoll_fd, epoll_events, EPOLL_NEVENTS, -1);
|
||||
|
||||
mono_gc_set_skip_thread (FALSE);
|
||||
|
||||
if (ready == -1) {
|
||||
switch (errno) {
|
||||
case EINTR:
|
||||
@@ -100,33 +107,30 @@ epoll_event_wait (void)
|
||||
}
|
||||
}
|
||||
|
||||
return ready;
|
||||
}
|
||||
if (ready == -1)
|
||||
return -1;
|
||||
|
||||
static gint
|
||||
epoll_event_get_fd_max (void)
|
||||
{
|
||||
return EPOLL_NEVENTS;
|
||||
}
|
||||
for (i = 0; i < ready; ++i) {
|
||||
gint fd, events = 0;
|
||||
|
||||
static gint
|
||||
epoll_event_get_fd_at (gint i, gint *events)
|
||||
{
|
||||
g_assert (events);
|
||||
fd = epoll_events [i].data.fd;
|
||||
if (epoll_events [i].events & (EPOLLIN | EPOLLERR | EPOLLHUP))
|
||||
events |= EVENT_IN;
|
||||
if (epoll_events [i].events & (EPOLLOUT | EPOLLERR | EPOLLHUP))
|
||||
events |= EVENT_OUT;
|
||||
|
||||
*events = ((epoll_events [i].events & (EPOLLIN | EPOLLERR | EPOLLHUP)) ? MONO_POLLIN : 0)
|
||||
| ((epoll_events [i].events & (EPOLLOUT | EPOLLERR | EPOLLHUP)) ? MONO_POLLOUT : 0);
|
||||
callback (fd, events, user_data);
|
||||
}
|
||||
|
||||
return epoll_events [i].data.fd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ThreadPoolIOBackend backend_epoll = {
|
||||
.init = epoll_init,
|
||||
.cleanup = epoll_cleanup,
|
||||
.register_fd = epoll_register_fd,
|
||||
.remove_fd = epoll_remove_fd,
|
||||
.event_wait = epoll_event_wait,
|
||||
.event_get_fd_max = epoll_event_get_fd_max,
|
||||
.event_get_fd_at = epoll_event_get_fd_at,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,20 +15,25 @@
|
||||
static gint kqueue_fd;
|
||||
static struct kevent *kqueue_events;
|
||||
|
||||
static gint
|
||||
KQUEUE_INIT_FD (gint fd, gint events, gint flags)
|
||||
{
|
||||
struct kevent event;
|
||||
EV_SET (&event, fd, events, flags, 0, 0, 0);
|
||||
return kevent (kqueue_fd, &event, 1, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
kqueue_init (gint wakeup_pipe_fd)
|
||||
{
|
||||
struct kevent event;
|
||||
|
||||
kqueue_fd = kqueue ();
|
||||
if (kqueue_fd == -1) {
|
||||
g_warning ("kqueue_init: kqueue () failed, error (%d) %s", errno, g_strerror (errno));
|
||||
g_error ("kqueue_init: kqueue () failed, error (%d) %s", errno, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
EV_SET (&event, wakeup_pipe_fd, EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, 0);
|
||||
if (kevent (kqueue_fd, &event, 1, NULL, 0, NULL) == -1) {
|
||||
g_warning ("kqueue_init: kevent () failed, error (%d) %s", errno, g_strerror (errno));
|
||||
if (KQUEUE_INIT_FD (wakeup_pipe_fd, EVFILT_READ, EV_ADD | EV_ENABLE) == -1) {
|
||||
g_error ("kqueue_init: kevent () failed, error (%d) %s", errno, g_strerror (errno));
|
||||
close (kqueue_fd);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -48,26 +53,45 @@ kqueue_cleanup (void)
|
||||
static void
|
||||
kqueue_register_fd (gint fd, gint events, gboolean is_new)
|
||||
{
|
||||
struct kevent event;
|
||||
if (events & EVENT_IN) {
|
||||
if (KQUEUE_INIT_FD (fd, EVFILT_READ, EV_ADD | EV_ENABLE) == -1)
|
||||
g_error ("kqueue_register_fd: kevent(read,enable) failed, error (%d) %s", errno, g_strerror (errno));
|
||||
} else {
|
||||
if (KQUEUE_INIT_FD (fd, EVFILT_READ, EV_ADD | EV_DISABLE) == -1)
|
||||
g_error ("kqueue_register_fd: kevent(read,disable) failed, error (%d) %s", errno, g_strerror (errno));
|
||||
}
|
||||
if (events & EVENT_OUT) {
|
||||
if (KQUEUE_INIT_FD (fd, EVFILT_WRITE, EV_ADD | EV_ENABLE) == -1)
|
||||
g_error ("kqueue_register_fd: kevent(write,enable) failed, error (%d) %s", errno, g_strerror (errno));
|
||||
} else {
|
||||
if (KQUEUE_INIT_FD (fd, EVFILT_WRITE, EV_ADD | EV_DISABLE) == -1)
|
||||
g_error ("kqueue_register_fd: kevent(write,disable) failed, error (%d) %s", errno, g_strerror (errno));
|
||||
}
|
||||
}
|
||||
|
||||
if (events == 0)
|
||||
return;
|
||||
|
||||
if ((events & MONO_POLLIN) != 0)
|
||||
EV_SET (&event, fd, EVFILT_READ, EV_ADD | EV_ENABLE | EV_ONESHOT, 0, 0, 0);
|
||||
if ((events & MONO_POLLOUT) != 0)
|
||||
EV_SET (&event, fd, EVFILT_WRITE, EV_ADD | EV_ENABLE | EV_ONESHOT, 0, 0, 0);
|
||||
|
||||
if (kevent (kqueue_fd, &event, 1, NULL, 0, NULL) == -1)
|
||||
g_warning ("kqueue_register_fd: kevent(update) failed, error (%d) %s", errno, g_strerror (errno));
|
||||
static void
|
||||
kqueue_remove_fd (gint fd)
|
||||
{
|
||||
/* FIXME: a race between closing and adding operation in the Socket managed code trigger a ENOENT error */
|
||||
if (KQUEUE_INIT_FD (fd, EVFILT_READ, EV_DELETE) == -1)
|
||||
g_error ("kqueue_register_fd: kevent(read,delete) failed, error (%d) %s", errno, g_strerror (errno));
|
||||
if (KQUEUE_INIT_FD (fd, EVFILT_WRITE, EV_DELETE) == -1)
|
||||
g_error ("kqueue_register_fd: kevent(write,delete) failed, error (%d) %s", errno, g_strerror (errno));
|
||||
}
|
||||
|
||||
static gint
|
||||
kqueue_event_wait (void)
|
||||
kqueue_event_wait (void (*callback) (gint fd, gint events, gpointer user_data), gpointer user_data)
|
||||
{
|
||||
gint ready;
|
||||
gint i, ready;
|
||||
|
||||
memset (kqueue_events, 0, sizeof (struct kevent) * KQUEUE_NEVENTS);
|
||||
|
||||
mono_gc_set_skip_thread (TRUE);
|
||||
|
||||
ready = kevent (kqueue_fd, NULL, 0, kqueue_events, KQUEUE_NEVENTS, NULL);
|
||||
|
||||
mono_gc_set_skip_thread (FALSE);
|
||||
|
||||
if (ready == -1) {
|
||||
switch (errno) {
|
||||
case EINTR:
|
||||
@@ -75,38 +99,35 @@ kqueue_event_wait (void)
|
||||
ready = 0;
|
||||
break;
|
||||
default:
|
||||
g_warning ("kqueue_event_wait: kevent () failed, error (%d) %s", errno, g_strerror (errno));
|
||||
g_error ("kqueue_event_wait: kevent () failed, error (%d) %s", errno, g_strerror (errno));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ready;
|
||||
}
|
||||
if (ready == -1)
|
||||
return -1;
|
||||
|
||||
static gint
|
||||
kqueue_event_get_fd_at (gint i, gint *events)
|
||||
{
|
||||
g_assert (events);
|
||||
for (i = 0; i < ready; ++i) {
|
||||
gint fd, events = 0;
|
||||
|
||||
*events = ((kqueue_events [i].filter == EVFILT_READ || (kqueue_events [i].flags & EV_ERROR) != 0) ? MONO_POLLIN : 0)
|
||||
| ((kqueue_events [i].filter == EVFILT_WRITE || (kqueue_events [i].flags & EV_ERROR) != 0) ? MONO_POLLOUT : 0);
|
||||
fd = kqueue_events [i].ident;
|
||||
if (kqueue_events [i].filter == EVFILT_READ || (kqueue_events [i].flags & EV_ERROR) != 0)
|
||||
events |= EVENT_IN;
|
||||
if (kqueue_events [i].filter == EVFILT_WRITE || (kqueue_events [i].flags & EV_ERROR) != 0)
|
||||
events |= EVENT_OUT;
|
||||
|
||||
return kqueue_events [i].ident;
|
||||
}
|
||||
callback (fd, events, user_data);
|
||||
}
|
||||
|
||||
static gint
|
||||
kqueue_event_get_fd_max (void)
|
||||
{
|
||||
return KQUEUE_NEVENTS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ThreadPoolIOBackend backend_kqueue = {
|
||||
.init = kqueue_init,
|
||||
.cleanup = kqueue_cleanup,
|
||||
.register_fd = kqueue_register_fd,
|
||||
.remove_fd = kqueue_remove_fd,
|
||||
.event_wait = kqueue_event_wait,
|
||||
.event_get_fd_max = kqueue_event_get_fd_max,
|
||||
.event_get_fd_at = kqueue_event_get_fd_at,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
|
||||
#define POLL_NEVENTS 1024
|
||||
#if defined(HAVE_POLL)
|
||||
|
||||
#if defined(HAVE_POLL_H)
|
||||
#include <poll.h>
|
||||
#elif defined(HAVE_SYS_POLL_H)
|
||||
#include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
typedef struct pollfd mono_pollfd;
|
||||
|
||||
#elif defined(HOST_WIN32)
|
||||
|
||||
#include "mswsock.h"
|
||||
|
||||
typedef WSAPOLLFD mono_pollfd;
|
||||
|
||||
#else
|
||||
/* poll is not defined */
|
||||
#error
|
||||
#endif
|
||||
|
||||
static mono_pollfd *poll_fds;
|
||||
static guint poll_fds_capacity;
|
||||
@@ -16,15 +35,14 @@ POLL_INIT_FD (mono_pollfd *poll_fd, gint fd, gint events)
|
||||
static gboolean
|
||||
poll_init (gint wakeup_pipe_fd)
|
||||
{
|
||||
guint i;
|
||||
g_assert (wakeup_pipe_fd >= 0);
|
||||
|
||||
poll_fds_size = 1;
|
||||
poll_fds_capacity = POLL_NEVENTS;
|
||||
poll_fds_capacity = 64;
|
||||
|
||||
poll_fds = g_new0 (mono_pollfd, poll_fds_capacity);
|
||||
|
||||
POLL_INIT_FD (poll_fds, wakeup_pipe_fd, MONO_POLLIN);
|
||||
for (i = 1; i < poll_fds_capacity; ++i)
|
||||
POLL_INIT_FD (poll_fds + i, -1, 0);
|
||||
POLL_INIT_FD (&poll_fds [0], wakeup_pipe_fd, POLLIN);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -35,91 +53,107 @@ poll_cleanup (void)
|
||||
g_free (poll_fds);
|
||||
}
|
||||
|
||||
static inline gint
|
||||
poll_mark_bad_fds (mono_pollfd *poll_fds, gint poll_fds_size)
|
||||
{
|
||||
gint i;
|
||||
gint ret;
|
||||
gint ready = 0;
|
||||
mono_pollfd *poll_fd;
|
||||
|
||||
for (i = 0; i < poll_fds_size; i++) {
|
||||
poll_fd = poll_fds + i;
|
||||
if (poll_fd->fd == -1)
|
||||
continue;
|
||||
|
||||
ret = mono_poll (poll_fd, 1, 0);
|
||||
if (ret == 1)
|
||||
ready++;
|
||||
if (ret == -1) {
|
||||
#if !defined(HOST_WIN32)
|
||||
if (errno == EBADF)
|
||||
#else
|
||||
if (WSAGetLastError () == WSAEBADF)
|
||||
#endif
|
||||
{
|
||||
poll_fd->revents |= MONO_POLLNVAL;
|
||||
ready++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ready;
|
||||
}
|
||||
|
||||
static void
|
||||
poll_register_fd (gint fd, gint events, gboolean is_new)
|
||||
{
|
||||
gboolean found = FALSE;
|
||||
gint j, k;
|
||||
gint i;
|
||||
gint poll_event;
|
||||
|
||||
for (j = 1; j < poll_fds_size; ++j) {
|
||||
mono_pollfd *poll_fd = poll_fds + j;
|
||||
if (poll_fd->fd == fd) {
|
||||
found = TRUE;
|
||||
g_assert (fd >= 0);
|
||||
g_assert (poll_fds_size <= poll_fds_capacity);
|
||||
|
||||
g_assert ((events & ~(EVENT_IN | EVENT_OUT)) == 0);
|
||||
|
||||
poll_event = 0;
|
||||
if (events & EVENT_IN)
|
||||
poll_event |= POLLIN;
|
||||
if (events & EVENT_OUT)
|
||||
poll_event |= POLLOUT;
|
||||
|
||||
for (i = 0; i < poll_fds_size; ++i) {
|
||||
if (poll_fds [i].fd == fd) {
|
||||
g_assert (!is_new);
|
||||
POLL_INIT_FD (&poll_fds [i], fd, poll_event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
g_assert (is_new);
|
||||
|
||||
for (i = 0; i < poll_fds_size; ++i) {
|
||||
if (poll_fds [i].fd == -1) {
|
||||
POLL_INIT_FD (&poll_fds [i], fd, poll_event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
poll_fds_size += 1;
|
||||
|
||||
if (poll_fds_size > poll_fds_capacity) {
|
||||
poll_fds_capacity *= 2;
|
||||
g_assert (poll_fds_size <= poll_fds_capacity);
|
||||
|
||||
poll_fds = g_renew (mono_pollfd, poll_fds, poll_fds_capacity);
|
||||
}
|
||||
|
||||
POLL_INIT_FD (&poll_fds [poll_fds_size - 1], fd, poll_event);
|
||||
}
|
||||
|
||||
static void
|
||||
poll_remove_fd (gint fd)
|
||||
{
|
||||
gint i;
|
||||
|
||||
g_assert (fd >= 0);
|
||||
|
||||
for (i = 0; i < poll_fds_size; ++i) {
|
||||
if (poll_fds [i].fd == fd) {
|
||||
POLL_INIT_FD (&poll_fds [i], -1, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (events == 0) {
|
||||
if (found)
|
||||
POLL_INIT_FD (poll_fds + j, -1, 0);
|
||||
return;
|
||||
}
|
||||
/* if we don't find the fd in poll_fds,
|
||||
* it means we try to delete it twice */
|
||||
g_assert (i < poll_fds_size);
|
||||
|
||||
if (!found) {
|
||||
for (j = 1; j < poll_fds_capacity; ++j) {
|
||||
mono_pollfd *poll_fd = poll_fds + j;
|
||||
if (poll_fd->fd == -1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* if we find it again, it means we added
|
||||
* it twice */
|
||||
for (; i < poll_fds_size; ++i)
|
||||
g_assert (poll_fds [i].fd != fd);
|
||||
|
||||
if (j == poll_fds_capacity) {
|
||||
poll_fds_capacity += POLL_NEVENTS;
|
||||
poll_fds = g_renew (mono_pollfd, poll_fds, poll_fds_capacity);
|
||||
for (k = j; k < poll_fds_capacity; ++k)
|
||||
POLL_INIT_FD (poll_fds + k, -1, 0);
|
||||
}
|
||||
|
||||
POLL_INIT_FD (poll_fds + j, fd, events);
|
||||
|
||||
if (j >= poll_fds_size)
|
||||
poll_fds_size = j + 1;
|
||||
/* reduce the value of poll_fds_size so we
|
||||
* do not keep it too big */
|
||||
while (poll_fds_size > 1 && poll_fds [poll_fds_size - 1].fd == -1)
|
||||
poll_fds_size -= 1;
|
||||
}
|
||||
|
||||
static gint
|
||||
poll_event_wait (void)
|
||||
poll_event_wait (void (*callback) (gint fd, gint events, gpointer user_data), gpointer user_data)
|
||||
{
|
||||
gint ready;
|
||||
gint i, ready;
|
||||
|
||||
for (i = 0; i < poll_fds_size; ++i)
|
||||
poll_fds [i].revents = 0;
|
||||
|
||||
mono_gc_set_skip_thread (TRUE);
|
||||
|
||||
#if !defined(HOST_WIN32)
|
||||
ready = poll (poll_fds, poll_fds_size, -1);
|
||||
#else
|
||||
ready = WSAPoll(poll_fds, poll_fds_size, -1);
|
||||
if (ready == SOCKET_ERROR)
|
||||
ready = -1;
|
||||
#endif
|
||||
|
||||
mono_gc_set_skip_thread (FALSE);
|
||||
|
||||
ready = mono_poll (poll_fds, poll_fds_size, -1);
|
||||
if (ready == -1) {
|
||||
/*
|
||||
* Apart from EINTR, we only check EBADF, for the rest:
|
||||
* EINVAL: mono_poll() 'protects' us from descriptor
|
||||
* numbers above the limit if using select() by marking
|
||||
* then as MONO_POLLERR. If a system poll() is being
|
||||
* then as POLLERR. If a system poll() is being
|
||||
* used, the number of descriptor we're passing will not
|
||||
* be over sysconf(_SC_OPEN_MAX), as the error would have
|
||||
* happened when opening.
|
||||
@@ -139,53 +173,51 @@ poll_event_wait (void)
|
||||
#else
|
||||
case WSAEINTR:
|
||||
#endif
|
||||
{
|
||||
mono_thread_internal_check_for_interruption_critical (mono_thread_internal_current ());
|
||||
ready = 0;
|
||||
break;
|
||||
#if !defined(HOST_WIN32)
|
||||
case EBADF:
|
||||
#else
|
||||
case WSAEBADF:
|
||||
#endif
|
||||
ready = poll_mark_bad_fds (poll_fds, poll_fds_size);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
#if !defined(HOST_WIN32)
|
||||
g_warning ("poll_event_wait: mono_poll () failed, error (%d) %s", errno, g_strerror (errno));
|
||||
g_error ("poll_event_wait: mono_poll () failed, error (%d) %s", errno, g_strerror (errno));
|
||||
#else
|
||||
g_warning ("poll_event_wait: mono_poll () failed, error (%d)\n", WSAGetLastError ());
|
||||
g_error ("poll_event_wait: mono_poll () failed, error (%d)\n", WSAGetLastError ());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ready;
|
||||
}
|
||||
if (ready == -1)
|
||||
return -1;
|
||||
|
||||
static gint
|
||||
poll_event_get_fd_at (gint i, gint *events)
|
||||
{
|
||||
g_assert (events);
|
||||
for (i = 0; i < poll_fds_size; ++i) {
|
||||
gint fd, events = 0;
|
||||
|
||||
*events = ((poll_fds [i].revents & (MONO_POLLIN | MONO_POLLERR | MONO_POLLHUP | MONO_POLLNVAL)) ? MONO_POLLIN : 0)
|
||||
| ((poll_fds [i].revents & (MONO_POLLOUT | MONO_POLLERR | MONO_POLLHUP | MONO_POLLNVAL)) ? MONO_POLLOUT : 0);
|
||||
if (poll_fds [i].fd == -1)
|
||||
continue;
|
||||
if (poll_fds [i].revents == 0)
|
||||
continue;
|
||||
|
||||
/* if nothing happened on the fd, then just return
|
||||
* an invalid fd number so it is discarded */
|
||||
return poll_fds [i].revents == 0 ? -1 : poll_fds [i].fd;
|
||||
}
|
||||
fd = poll_fds [i].fd;
|
||||
if (poll_fds [i].revents & (POLLIN | POLLERR | POLLHUP | POLLNVAL))
|
||||
events |= EVENT_IN;
|
||||
if (poll_fds [i].revents & (POLLOUT | POLLERR | POLLHUP | POLLNVAL))
|
||||
events |= EVENT_OUT;
|
||||
|
||||
static gint
|
||||
poll_event_get_fd_max (void)
|
||||
{
|
||||
return poll_fds_size;
|
||||
callback (fd, events, user_data);
|
||||
|
||||
if (--ready == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ThreadPoolIOBackend backend_poll = {
|
||||
.init = poll_init,
|
||||
.cleanup = poll_cleanup,
|
||||
.register_fd = poll_register_fd,
|
||||
.remove_fd = poll_remove_fd,
|
||||
.event_wait = poll_event_wait,
|
||||
.event_get_fd_max = poll_event_get_fd_max,
|
||||
.event_get_fd_at = poll_event_get_fd_at,
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -749,7 +749,7 @@ EXTRA_DIST = TestDriver.cs \
|
||||
Makefile.am.in
|
||||
|
||||
version.h: Makefile
|
||||
echo "#define FULL_VERSION \"Stable 4.2.0.207/2701b19\"" > version.h
|
||||
echo "#define FULL_VERSION \"Stable 4.2.1.36/dbd6429\"" > version.h
|
||||
|
||||
# Utility target for patching libtool to speed up linking
|
||||
patch-libtool:
|
||||
|
||||
@@ -749,7 +749,7 @@ EXTRA_DIST = TestDriver.cs \
|
||||
Makefile.am.in
|
||||
|
||||
version.h: Makefile
|
||||
echo "#define FULL_VERSION \"Stable 4.2.0.207/2701b19\"" > version.h
|
||||
echo "#define FULL_VERSION \"Stable 4.2.1.36/dbd6429\"" > version.h
|
||||
|
||||
# Utility target for patching libtool to speed up linking
|
||||
patch-libtool:
|
||||
|
||||
@@ -1 +1 @@
|
||||
3067f960d61f7e500f6a1568f95ac6b739298ae5
|
||||
c65a3a960c9fab0078aaf2bc05b202ec039553a6
|
||||
@@ -1 +1 @@
|
||||
7b8b58e0a5fcf8f05e7b86e355902aeaf9261f82
|
||||
8d2f08962c13e0e01c89cb1f9fd8d9c9fadc43d3
|
||||
@@ -1 +1 @@
|
||||
39d38dab51642f90e7abc6171668bf4f7ceac01c
|
||||
55b292ac8dd94a1c3eeb3d05962d2d9a30b1808f
|
||||
@@ -1057,7 +1057,7 @@ emit_class_dwarf_info (MonoDwarfWriter *w, MonoClass *klass, gboolean vtype)
|
||||
const char *p;
|
||||
MonoTypeEnum def_type;
|
||||
|
||||
if (strcmp ("value__", mono_field_get_name (field)) == 0)
|
||||
if (!(field->type->attrs & FIELD_ATTRIBUTE_STATIC))
|
||||
continue;
|
||||
if (mono_field_is_deleted (field))
|
||||
continue;
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define FULL_VERSION "Stable 4.2.0.207/2701b19"
|
||||
#define FULL_VERSION "Stable 4.2.1.36/dbd6429"
|
||||
|
||||
@@ -562,9 +562,14 @@ ms_alloc_block (int size_index, gboolean pinned, gboolean has_references)
|
||||
* This is the only place where the `allocated_blocks` array can potentially grow.
|
||||
* We need to make sure concurrent sweep isn't running when that happens, so in that
|
||||
* specific case we just wait for sweep to finish.
|
||||
*
|
||||
* The memory barrier here and in `sweep_job_func()` are required because we need
|
||||
* `allocated_blocks` synchronized between this and the sweep thread.
|
||||
*/
|
||||
if (sgen_pointer_queue_will_grow (&allocated_blocks))
|
||||
if (sgen_pointer_queue_will_grow (&allocated_blocks)) {
|
||||
major_finish_sweep_checking ();
|
||||
mono_memory_barrier ();
|
||||
}
|
||||
|
||||
sgen_pointer_queue_add (&allocated_blocks, BLOCK_TAG (info));
|
||||
|
||||
@@ -1623,6 +1628,7 @@ sweep_job_func (void *thread_data_untyped, SgenThreadPoolJob *job)
|
||||
}
|
||||
|
||||
sgen_pointer_queue_remove_nulls (&allocated_blocks);
|
||||
mono_memory_barrier ();
|
||||
|
||||
sweep_finish ();
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ typedef enum {
|
||||
MONO_TRACE_AOT = (1<<5),
|
||||
MONO_TRACE_SECURITY = (1<<6),
|
||||
MONO_TRACE_THREADPOOL = (1<<7),
|
||||
MONO_TRACE_IO_THREADPOOL = (1<<8),
|
||||
MONO_TRACE_ALL = MONO_TRACE_ASSEMBLY |
|
||||
MONO_TRACE_TYPE |
|
||||
MONO_TRACE_DLLIMPORT |
|
||||
@@ -22,7 +23,8 @@ typedef enum {
|
||||
MONO_TRACE_CONFIG |
|
||||
MONO_TRACE_AOT |
|
||||
MONO_TRACE_SECURITY |
|
||||
MONO_TRACE_THREADPOOL
|
||||
MONO_TRACE_THREADPOOL |
|
||||
MONO_TRACE_IO_THREADPOOL
|
||||
} MonoTraceMask;
|
||||
|
||||
void
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user