fix Mac 10.5 problem with select() and fd counts > 256
svn: r7810
This commit is contained in:
parent
11b45ef610
commit
0794586020
|
@ -10,6 +10,7 @@ libdir = @libdir@
|
|||
includepltdir = @includepltdir@
|
||||
libpltdir = @libpltdir@
|
||||
collectsdir = @collectsdir@
|
||||
datarootdir = @datarootdir@
|
||||
mandir = @mandir@
|
||||
docdir = @docdir@
|
||||
builddir = @builddir@
|
||||
|
|
9802
src/configure
vendored
9802
src/configure
vendored
File diff suppressed because it is too large
Load Diff
|
@ -1519,10 +1519,6 @@ static int has_null(const char *s, long l)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef OS_X
|
||||
|
||||
/* Provided by MzScheme for Classic: */
|
||||
|
||||
int scheme_mac_path_to_spec(const char *filename, FSSpec *spec)
|
||||
{
|
||||
FSRef fsref;
|
||||
|
@ -1535,6 +1531,8 @@ int scheme_mac_path_to_spec(const char *filename, FSSpec *spec)
|
|||
if (err != noErr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(spec, 0, sizeof(FSSpec));
|
||||
|
||||
// then, convert to an FSSpec
|
||||
err = FSGetCatalogInfo(&fsref, kFSCatInfoNone, NULL, NULL, spec, NULL);
|
||||
|
@ -1572,8 +1570,6 @@ char *scheme_mac_spec_to_path(FSSpec *spec)
|
|||
return str;
|
||||
}
|
||||
|
||||
#endif // OS_X
|
||||
|
||||
static int ae_marshall(AEDescList *ae, AEDescList *list_in, AEKeyword kw, Scheme_Object *v,
|
||||
char *name, OSErr *err, char **stage)
|
||||
{
|
||||
|
|
|
@ -162,7 +162,14 @@ if test "${bindir}" != '${exec_prefix}/bin' ; then
|
|||
unixstyle=yes
|
||||
fi
|
||||
if test "${datadir}" != '${prefix}/share' ; then
|
||||
unixstyle=yes
|
||||
# Newer autoconf uses datarootdir:
|
||||
if test "${datadir}" = '${datarootdir}' ; then
|
||||
if test "${datarootdir}" != '${prefix}/share' ; then
|
||||
unixstyle=yes
|
||||
fi
|
||||
else
|
||||
unixstyle=yes
|
||||
fi
|
||||
fi
|
||||
if test "${libdir}" != '${exec_prefix}/lib' ; then
|
||||
unixstyle=yes
|
||||
|
@ -171,7 +178,13 @@ if test "${includedir}" != '${prefix}/include' ; then
|
|||
unixstyle=yes
|
||||
fi
|
||||
if test "${mandir}" != '${prefix}/man' ; then
|
||||
unixstyle=yes
|
||||
if test "${mandir}" = '${datarootdir}/man' ; then
|
||||
if test "${datarootdir}" != '${prefix}/share' ; then
|
||||
unixstyle=yes
|
||||
fi
|
||||
else
|
||||
unixstyle=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
MAKE_COPYTREE=no
|
||||
|
@ -576,8 +589,8 @@ case $OS in
|
|||
fi
|
||||
;;
|
||||
Darwin)
|
||||
|
||||
PREFLAGS="$PREFLAGS -DOS_X"
|
||||
|
||||
PREFLAGS="$PREFLAGS -D_DARWIN_UNLIMITED_SELECT -DOS_X"
|
||||
|
||||
# zlib comes with the OS
|
||||
ZLIB_A=""
|
||||
|
@ -636,6 +649,7 @@ case $OS in
|
|||
else
|
||||
PREFLAGS="$PREFLAGS -DXONX "
|
||||
X_EXTRA_LIBS="$X_EXTRA_LIBS -lz"
|
||||
X_LIBS="$X_LIBS -L/usr/X11R6/lib"
|
||||
|
||||
# need help finding fontconfig and freetype headers:
|
||||
XFT_EXTRA_FLAGS="-I/usr/X11R6/include -I/usr/X11R6/include/freetype2"
|
||||
|
@ -1451,8 +1465,9 @@ else
|
|||
echo " C headers : ${includepltdir}/..."
|
||||
echo " extra C objs : ${libpltdir}/..."
|
||||
echo " man pages : ${mandir}/..."
|
||||
echo " where prefix = ${prefix}"
|
||||
echo " where prefix = ${prefix}"
|
||||
echo " and datarootdir = ${datarootdir}"
|
||||
if test "${unixstyle}" = "yes" ; then
|
||||
echo " and exec_prefix = ${exec_prefix}"
|
||||
echo " and exec_prefix = ${exec_prefix}"
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -6,7 +6,7 @@ tgt="../configure"
|
|||
if [ ! -e "$src" ]; then echo "abort: did not find $src"; exit 1; fi
|
||||
echo "Creating $tgt from $src"
|
||||
if [ -e "$tgt" ]; then
|
||||
echo -n "overwriting $tgt, Ctrl-C to abort, enter to continue "; read R;
|
||||
/bin/echo -n "overwriting $tgt, Ctrl-C to abort, enter to continue "; read R;
|
||||
fi
|
||||
autoconf "$src" | mzscheme -qr "$0" > "$tgt"
|
||||
chmod +x "$tgt"
|
||||
|
|
|
@ -665,9 +665,9 @@ void *scheme_alloc_fdset_array(int count, int permanent)
|
|||
}
|
||||
|
||||
if (permanent)
|
||||
return scheme_malloc_eternal(count * dynamic_fd_size);
|
||||
return scheme_malloc_eternal(count * (dynamic_fd_size + sizeof(long)));
|
||||
else
|
||||
return scheme_malloc_atomic(count * dynamic_fd_size);
|
||||
return scheme_malloc_atomic(count * (dynamic_fd_size + sizeof(long)));
|
||||
}
|
||||
|
||||
#ifdef MZ_XFORM
|
||||
|
@ -681,12 +681,12 @@ void *scheme_init_fdset_array(void *fdarray, int count)
|
|||
|
||||
void *scheme_get_fdset(void *fdarray, int pos)
|
||||
{
|
||||
return ((char *)fdarray) + (pos * dynamic_fd_size);
|
||||
return ((char *)fdarray) + (pos * (dynamic_fd_size + sizeof(long)));
|
||||
}
|
||||
|
||||
void scheme_fdzero(void *fd)
|
||||
{
|
||||
memset(fd, 0, dynamic_fd_size);
|
||||
memset(fd, 0, dynamic_fd_size + sizeof(long));
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -770,6 +770,12 @@ void scheme_fdset(void *fd, int n)
|
|||
((win_extended_fd_set *)fd)->added++;
|
||||
#endif
|
||||
#if defined(FILES_HAVE_FDS) || defined(USE_SOCKETS_TCP)
|
||||
# define STORED_ACTUAL_FDSET_LIMIT
|
||||
# define FDSET_LIMIT(fd) (*(int *)((char *)fd + dynamic_fd_size))
|
||||
int mx;
|
||||
mx = FDSET_LIMIT(fd);
|
||||
if (n > mx)
|
||||
FDSET_LIMIT(fd) = n;
|
||||
FD_SET(n, ((fd_set *)fd));
|
||||
#endif
|
||||
}
|
||||
|
@ -7846,7 +7852,7 @@ static void default_sleep(float v, void *fds)
|
|||
/* Something to block on - sort our the parts in Windows. */
|
||||
|
||||
#if defined(FILES_HAVE_FDS) || defined(USE_WINSOCK_TCP)
|
||||
int limit;
|
||||
int limit, actual_limit;
|
||||
fd_set *rd, *wr, *ex;
|
||||
struct timeval time;
|
||||
|
||||
|
@ -7890,6 +7896,16 @@ static void default_sleep(float v, void *fds)
|
|||
rd = (fd_set *)fds;
|
||||
wr = (fd_set *)MZ_GET_FDSET(fds, 1);
|
||||
ex = (fd_set *)MZ_GET_FDSET(fds, 2);
|
||||
# ifdef STORED_ACTUAL_FDSET_LIMIT
|
||||
actual_limit = FDSET_LIMIT(rd);
|
||||
if (FDSET_LIMIT(wr) > actual_limit)
|
||||
actual_limit = FDSET_LIMIT(wr);
|
||||
if (FDSET_LIMIT(ex) > actual_limit)
|
||||
actual_limit = FDSET_LIMIT(ex);
|
||||
actual_limit++;
|
||||
# else
|
||||
actual_limit = limit;
|
||||
# endif
|
||||
|
||||
/******* Start Windows stuff *******/
|
||||
|
||||
|
@ -8020,11 +8036,14 @@ static void default_sleep(float v, void *fds)
|
|||
|
||||
#if defined(FILES_HAVE_FDS)
|
||||
/* Watch for external events, too: */
|
||||
if (external_event_fd)
|
||||
if (external_event_fd) {
|
||||
MZ_FD_SET(external_event_fd, rd);
|
||||
if (external_event_fd >= actual_limit)
|
||||
actual_limit = external_event_fd + 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
select(limit, rd, wr, ex, v ? &time : NULL);
|
||||
select(actual_limit, rd, wr, ex, v ? &time : NULL);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -248,14 +248,8 @@ int wxMessageBox(char* message, char* caption, long style,
|
|||
// File selector
|
||||
//****************************************************************************
|
||||
|
||||
#ifndef OS_X
|
||||
extern "C" {
|
||||
#endif
|
||||
extern char *scheme_mac_spec_to_path(FSSpec *f);
|
||||
extern int scheme_mac_path_to_spec(const char *filename, FSSpec *spec);
|
||||
#ifndef OS_X
|
||||
}
|
||||
#endif
|
||||
extern char *scheme_mac_spec_to_path(FSSpec *f);
|
||||
extern int scheme_mac_path_to_spec(const char *filename, FSSpec *spec);
|
||||
extern "C" {
|
||||
extern char *scheme_expand_filename(char* filename, int ilen, const char *errorin, int *ex, int guards);
|
||||
extern int scheme_is_complete_path(const char *s, long len, int kind);
|
||||
|
@ -339,7 +333,8 @@ static OSStatus ok_evt_handler(EventHandlerCallRef inHandlerCallRef,
|
|||
AEDesc desc;
|
||||
AECreateDesc (typeFSS, &spec, sizeof(FSSpec), &desc);
|
||||
if (scheme_file_exists(result)) {
|
||||
NavCustomControl(ccbi->cbi->dialog, kNavCtlSetSelection, &desc);
|
||||
NavCustomControl(ccbi->cbi->dialog, kNavCtlSetLocation, &desc); /* Leopard */
|
||||
NavCustomControl(ccbi->cbi->dialog, kNavCtlSetSelection, &desc); /* Tiger */
|
||||
if (ccbi->cbi->is_put) {
|
||||
NavCustomControl(ccbi->cbi->dialog, kNavCtlSetEditFileName, spec.name);
|
||||
}
|
||||
|
@ -548,6 +543,16 @@ static void do_text_path_dialog(wxCallbackInfo *cbi)
|
|||
::DisposeControl(cancel);
|
||||
::DisposeWindow(dialog);
|
||||
|
||||
{
|
||||
FSSpec spec;
|
||||
AEDesc desc;
|
||||
|
||||
scheme_mac_path_to_spec("/Users/mflatt/Desktop/ryan.scm", &spec);
|
||||
AECreateDesc (typeFSS, &spec, sizeof(FSSpec), &desc);
|
||||
NavCustomControl(cbi->dialog, kNavCtlSetSelection, &desc);
|
||||
AEDisposeDesc(&desc);
|
||||
}
|
||||
|
||||
FREE_SAFEREF(info_sr);
|
||||
info_sr = NULL;
|
||||
}
|
||||
|
|
|
@ -103,21 +103,9 @@ char *wxGetTempFileName (const char *prefix, char *dest)
|
|||
return dest;
|
||||
}
|
||||
|
||||
#ifndef OS_X
|
||||
extern "C" int scheme_mac_path_to_spec(const char *filename, FSSpec *spec);
|
||||
#endif
|
||||
|
||||
void wxRemoveFile(char *filename)
|
||||
{
|
||||
#if OS_X
|
||||
unlink(filename);
|
||||
#else
|
||||
FSSpec sp;
|
||||
|
||||
if (scheme_mac_path_to_spec(filename, &sp)) {
|
||||
FSpDelete(&sp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
|
||||
|
|
Loading…
Reference in New Issue
Block a user