int wanted_size=sizeof(struct _WapiHandleShared_list) +
_WAPI_SHM_SCRATCH_SIZE;
+ *success=FALSE;
+
try_again:
/* No O_CREAT yet, because we need to initialise the file if
* we have to create it.
g_critical (G_GNUC_PRETTY_FUNCTION
": shared file [%s] open error: %s",
shared_file (), g_strerror (errno));
- exit (-1);
+ return(NULL);
} else {
/* We created the file, so we need to expand
* the file and fork the handle daemon too
if(lseek (fd, wanted_size, SEEK_SET)==-1) {
g_critical (G_GNUC_PRETTY_FUNCTION ": shared file [%s] lseek error: %s", shared_file (), g_strerror (errno));
_wapi_shm_destroy ();
- exit (-1);
+ return(NULL);
}
if(write (fd, "", 1)==-1) {
g_critical (G_GNUC_PRETTY_FUNCTION ": shared file [%s] write error: %s", shared_file (), g_strerror (errno));
_wapi_shm_destroy ();
- exit (-1);
+ return(NULL);
}
fork_daemon=TRUE;
g_critical (G_GNUC_PRETTY_FUNCTION
": shared file [%s] open error: %s",
shared_file (), g_strerror (errno));
- exit (-1);
+ return(NULL);
} else {
/* We dont need to fork the handle daemon */
}
if(fork_daemon==TRUE) {
_wapi_shm_destroy ();
}
- exit (-1);
+ return(NULL);
}
if(statbuf.st_size < wanted_size) {
if(fork_daemon==TRUE) {
_wapi_shm_destroy ();
}
- exit (-1);
+ return(NULL);
}
shm_seg=mmap (NULL, statbuf.st_size, PROT_READ|PROT_WRITE, MAP_SHARED,
if(fork_daemon==TRUE) {
_wapi_shm_destroy ();
}
- exit (-1);
+ return(NULL);
}
close (fd);
g_critical (G_GNUC_PRETTY_FUNCTION ": fork error: %s",
strerror (errno));
_wapi_shm_destroy ();
- exit (-1);
+ return(NULL);
} else if (pid==0) {
int i;
(strncmp (data->daemon+1, "mono-handle-daemon-", 19)!=0)) {
#endif
g_warning ("Shared memory sanity check failed.");
- *success=FALSE;
return(NULL);
}
}
_wapi_shm_destroy ();
}
g_warning ("The handle daemon didnt start up properly");
- *success=FALSE;
return(NULL);
}
_wapi_shm_destroy ();
}
g_warning ("Handle daemon failed to start");
- *success=FALSE;
return(NULL);
}
/* Shared threads don't seem to work yet */
#undef _POSIX_THREAD_PROCESS_SHARED
+/* Catch this here rather than corrupt the shared data at runtime */
+#if MONO_SIZEOF_SUNPATH==0
+#error configure failed to discover size of unix socket path
+#endif
+
/* Increment this whenever an incompatible change is made to the
* shared handle structure.
*/