Showing content from http://caml.inria.fr/pub/old_caml_site/caml-macosx-howto/ocaml-3.06-macosx-5.patch below:
*** configure.release Wed Oct 2 17:01:39 2002 --- configure Wed Oct 2 17:04:56 2002 *************** *** 13,19 **** # # ######################################################################### ! # $Id: configure,v 1.174 2002/08/07 12:45:00 garrigue Exp $ configure_options="$*" prefix=/usr/local --- 13,19 ---- # # ######################################################################### ! # $Id: configure,v 1.177 2002/09/27 14:05:38 doligez Exp $ configure_options="$*" prefix=/usr/local *************** *** 495,501 **** # Further machine-specific hacks case "$host" in ! ia64-*-linux*) echo "Will use mmap() instead of malloc() for allocation of major heap chunks." echo "#define USE_MMAP_INSTEAD_OF_MALLOC" >> s.h;; esac --- 495,501 ---- # Further machine-specific hacks case "$host" in ! ia64-*-linux*|alpha*-*-linux*) echo "Will use mmap() instead of malloc() for allocation of major heap chunks." echo "#define USE_MMAP_INSTEAD_OF_MALLOC" >> s.h;; esac *************** *** 558,567 **** nativecccompopts="-D_XOPEN_SOURCE=500";; *,*,nextstep,*) nativecccompopts="$gcc_warnings -U__GNUC__ -posix" nativecclinkopts="-posix";; ! # SHRINKED_GNUC is not necessary for MacOS 10.1 (don't know about 10.0) ! # (but it doesn't matter for native code anyway) *,*,rhapsody,*) nativecccompopts="$gcc_warnings -DSHRINKED_GNUC";; - # *,*,rhapsody,*) nativecccompopts="$gcc_warnings";; *,gcc*,cygwin,*) nativecccompopts="$gcc_warnings -U_WIN32";; *,gcc*,*,*) nativecccompopts="$gcc_warnings";; esac --- 558,565 ---- nativecccompopts="-D_XOPEN_SOURCE=500";; *,*,nextstep,*) nativecccompopts="$gcc_warnings -U__GNUC__ -posix" nativecclinkopts="-posix";; ! *,*,rhapsody,*darwin6*) nativecccompopts="$gcc_warnings -DDARWIN_VERSION_6";; *,*,rhapsody,*) nativecccompopts="$gcc_warnings -DSHRINKED_GNUC";; *,gcc*,cygwin,*) nativecccompopts="$gcc_warnings -U_WIN32";; *,gcc*,*,*) nativecccompopts="$gcc_warnings";; esac *************** *** 610,618 **** binutils_nm='' if test "$arch" != "none"; then old_IFS="$IFS" IFS=':' ! for d in ${binutils_dir}:${PATH}; do if test -z "$d"; then continue; fi if test -f "$d/objcopy" && test -f "$d/nm"; then echo "objcopy and nm found in $d" --- 608,617 ---- binutils_nm='' if test "$arch" != "none"; then + binutils_path="${binutils_dir}:${PATH}:/usr/libexec/binutils" old_IFS="$IFS" IFS=':' ! for d in ${binutils_path}; do if test -z "$d"; then continue; fi if test -f "$d/objcopy" && test -f "$d/nm"; then echo "objcopy and nm found in $d" *** asmrun/signals.c.release Mon Nov 4 17:16:02 2002 --- asmrun/signals.c Mon Nov 4 16:11:03 2002 *************** *** 11,23 **** /* */ /***********************************************************************/ ! /* $Id: signals.c,v 1.64 2002/05/06 12:02:26 xleroy Exp $ */ #include ! #include ! #if (defined(TARGET_sparc) && defined(SYS_solaris)) #include #endif #include "alloc.h" #include "callback.h" #include "memory.h" --- 11,25 ---- /* */ /***********************************************************************/ ! /* $Id: signals.c,v 1.66 2002/11/07 11:51:39 doligez Exp $ */ #include ! #if defined(TARGET_sparc) && defined(SYS_solaris) #include #endif + #if defined(TARGET_power) && defined(SYS_rhapsody) && defined(DARWIN_VERSION_6) + #include + #endif #include "alloc.h" #include "callback.h" #include "memory.h" *************** *** 32,37 **** --- 34,41 ---- #include #endif + extern char * code_area_start, * code_area_end; + #ifdef _WIN32 typedef void (*sighandler)(int sig); extern sighandler win32_signal(int sig, sighandler action); *************** *** 39,48 **** #endif #if defined(TARGET_power) && defined(SYS_rhapsody) ! /* Confer machdep/ppc/unix_signal.c and mach/ppc/thread_status.h ! in the Darwin sources */ ! #define CONTEXT_GPR(ctx, regno) \ ! (((unsigned long *)((ctx)->sc_regs))[2 + (regno)]) #endif #if defined(TARGET_power) && defined(SYS_aix) --- 43,69 ---- #endif #if defined(TARGET_power) && defined(SYS_rhapsody) ! #ifdef DARWIN_VERSION_6 ! /* cf. xnu/bsd/dev/ppc/unix_signal.c ! xnu/osfmk/mach/ppc/thread_status.h ! xnu/bsd/sys/ucontext.h ! xnu/bsd/ppc/signal.h ! etc. etc. etc. ! */ ! #define STRUCT_SIGCONTEXT struct ucontext ! #define CONTEXT_GPR(ctx, regno) \ ! (((unsigned long *)&((ctx)->uc_mcontext->ss))[2 + (regno)]) ! #define CONTEXT_PC(ctx) \ ! (((unsigned long *)&((ctx)->uc_mcontext->ss))[0]) ! #else ! /* Confer machdep/ppc/unix_signal.c and mach/ppc/thread_status.h ! in the Darwin sources */ ! #define STRUCT_SIGCONTEXT struct sigcontext ! #define CONTEXT_GPR(ctx, regno) \ ! (((unsigned long *)((ctx)->sc_regs))[2 + (regno)]) ! #define CONTEXT_PC(ctx) \ ! (((unsigned long *)((ctx)->sc_regs))[0]) ! #endif #endif #if defined(TARGET_power) && defined(SYS_aix) *************** *** 161,167 **** #elif defined(TARGET_power) && defined(SYS_elf) void handle_signal(int sig, struct sigcontext * context) #elif defined(TARGET_power) && defined(SYS_rhapsody) ! void handle_signal(int sig, int code, struct sigcontext * context) #else void handle_signal(int sig) #endif --- 182,188 ---- #elif defined(TARGET_power) && defined(SYS_elf) void handle_signal(int sig, struct sigcontext * context) #elif defined(TARGET_power) && defined(SYS_rhapsody) ! void handle_signal(int sig, int code, STRUCT_SIGCONTEXT * context) #else void handle_signal(int sig) #endif *************** *** 184,211 **** /* Some ports cache young_limit in a register. Use the signal context to modify that register too, but not if we are inside C code (i.e. caml_last_return_address != 0). */ - if (caml_last_return_address == 0) { #if defined(TARGET_alpha) /* Cached in register $14 */ context->sc_regs[14] = (long) young_limit; #endif #if defined(TARGET_mips) /* Cached in register $23 */ context->sc_regs[23] = (int) young_limit; #endif #if defined(TARGET_power) && defined(SYS_aix) /* Cached in register 30 */ CONTEXT_GPR(context, 30) = (ulong_t) young_limit; #endif #if defined(TARGET_power) && defined(SYS_elf) /* Cached in register 30 */ context->regs->gpr[30] = (unsigned long) young_limit; #endif #if defined(TARGET_power) && defined(SYS_rhapsody) /* Cached in register 30 */ CONTEXT_GPR(context, 30) = (unsigned long) young_limit; - #endif } } } --- 205,241 ---- /* Some ports cache young_limit in a register. Use the signal context to modify that register too, but not if we are inside C code (i.e. caml_last_return_address != 0). */ #if defined(TARGET_alpha) + if (caml_last_return_address == 0) { /* Cached in register $14 */ context->sc_regs[14] = (long) young_limit; + } #endif #if defined(TARGET_mips) + if (caml_last_return_address == 0) { /* Cached in register $23 */ context->sc_regs[23] = (int) young_limit; + } #endif #if defined(TARGET_power) && defined(SYS_aix) + if (caml_last_return_address == 0) { /* Cached in register 30 */ CONTEXT_GPR(context, 30) = (ulong_t) young_limit; + } #endif #if defined(TARGET_power) && defined(SYS_elf) + if (caml_last_return_address == 0) { /* Cached in register 30 */ context->regs->gpr[30] = (unsigned long) young_limit; + } #endif #if defined(TARGET_power) && defined(SYS_rhapsody) + if (CONTEXT_PC(context) >= (unsigned long) code_area_start + && CONTEXT_PC(context) <= (unsigned long) code_area_end) { /* Cached in register 30 */ CONTEXT_GPR(context, 30) = (unsigned long) young_limit; } + #endif } } *************** *** 326,332 **** --- 356,366 ---- #ifdef POSIX_SIGNALS sigact.sa_handler = act; sigemptyset(&sigact.sa_mask); + #ifdef SYS_rhapsody + sigact.sa_flags = SA_SIGINFO; + #else sigact.sa_flags = 0; + #endif if (sigaction(sig, &sigact, &oldsigact) == -1) sys_error(NO_ARG); oldact = oldsigact.sa_handler; #else *************** *** 429,435 **** #endif #if defined(TARGET_power) && defined(SYS_rhapsody) ! static void trap_handler(int sig, int code, struct sigcontext * context) { /* Unblock SIGTRAP */ sigset_t mask; --- 463,469 ---- #endif #if defined(TARGET_power) && defined(SYS_rhapsody) ! static void trap_handler(int sig, int code, STRUCT_SIGCONTEXT * context) { /* Unblock SIGTRAP */ sigset_t mask; *************** *** 522,529 **** struct sigaction act; act.sa_handler = (void (*)(int)) trap_handler; sigemptyset(&act.sa_mask); ! #if defined(SYS_rhapsody) || defined(SYS_aix) act.sa_flags = 0; #else act.sa_flags = SA_NODEFER; #endif --- 556,565 ---- struct sigaction act; act.sa_handler = (void (*)(int)) trap_handler; sigemptyset(&act.sa_mask); ! #if defined (SYS_aix) act.sa_flags = 0; + #elif defined (SYS_rhapsody) + act.sa_flags = SA_SIGINFO; #else act.sa_flags = SA_NODEFER; #endif *** byterun/sys.c.release Wed Oct 2 17:02:00 2002 --- byterun/sys.c Wed Oct 2 17:04:56 2002 *************** *** 254,266 **** --- 254,312 ---- extern int win32_system(char * command); #endif + #if defined(SYS_rhapsody) + int rhapsody_system(const char *string) { + int old_sigmask; + pid_t pid; + + if (string == 0) + return 1; + old_sigmask = sigblock(sigmask(SIGQUIT)); + pid = vfork(); + if (pid < 0) { + /* vfork failed */ + sigsetmask(old_sigmask); + return -1; + } else if (pid == 0) { + /* We are in the child process */ + sigsetmask(old_sigmask); + execl("/bin/sh", "sh", "-c", string, 0); + _exit(127); + return -1; + } else { + /* We are in the parent process */ + int status = 0; + void* old_sigint; + void* old_sigquit; + int result; + + old_sigint = signal(SIGINT, 0); + old_sigquit = signal(SIGQUIT, 0); + do { + result = waitpid(pid, &status, 0); + } while (result < 0 && errno == EINTR); + signal(SIGINT, old_sigint); + signal(SIGQUIT, old_sigquit); + sigsetmask(old_sigmask); + if (result < 0) + return -1; + else + return status; + } + } + #endif + CAMLprim value sys_system_command(value command) { int status, retcode; enter_blocking_section (); #ifndef _WIN32 + #if defined(SYS_rhapsody) + status = rhapsody_system(String_val(command)); + #else status = system(String_val(command)); + #endif if (WIFEXITED(status)) retcode = WEXITSTATUS(status); else
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4