diff options
author | unknown <monty@donna.mysql.com> | 2001-01-12 13:52:32 +0200 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2001-01-12 13:52:32 +0200 |
commit | 1a10224cacd1036f79a387698f982bfb5e36add6 (patch) | |
tree | feed2fb14dbc49c9f89bfedaa06d5d15c58c8993 /mit-pthreads | |
parent | 5060e7f3fef7658bff42f5fa955689ec58d70e15 (diff) | |
download | mariadb-git-1a10224cacd1036f79a387698f982bfb5e36add6.tar.gz |
Patches for NetBSD/macppc
Fixed bug in LEFT JOIN
Added bdb_log_buffer_size
Docs/manual.texi:
Added documentation for mysqlhotcopy
client/mysql.cc:
Fixed core dump when column names couldn't be read
configure.in:
Fixed possible error
mit-pthreads/Changes-mysql:
Patches for NetBSD/macppc
mit-pthreads/config/config.guess:
Patches for NetBSD/macppc
mit-pthreads/config/configure.in:
Patches for NetBSD/macppc
mit-pthreads/config/configure:
Patches for NetBSD/macppc
mysql-test/r/join_outer.result:
New join test
mysql-test/t/join_outer.test:
New join test
scripts/mysqlhotcopy.sh:
Patches from ASK
sql/ha_berkeley.cc:
Adeed log buffer cache
sql/ha_berkeley.h:
Adeed log buffer cache
sql/log.cc:
Fixed possible overrun bug
sql/mysqld.cc:
Fix for Mac OS X public beta
Added bdb_log_buffer_size
sql/sql_select.cc:
Fixed bug in LEFT JOIN
tests/mail_to_db.pl:
Removed unsubscribe tails
tests/pmail.pl:
Sort mails according to date
Diffstat (limited to 'mit-pthreads')
-rw-r--r-- | mit-pthreads/Changes-mysql | 4 | ||||
-rwxr-xr-x | mit-pthreads/config/config.guess | 3 | ||||
-rwxr-xr-x | mit-pthreads/config/configure | 6 | ||||
-rwxr-xr-x | mit-pthreads/config/configure.in | 6 | ||||
-rw-r--r-- | mit-pthreads/machdep/engine-powerpc-netbsd.c | 227 | ||||
-rw-r--r-- | mit-pthreads/machdep/engine-powerpc-netbsd.h | 109 | ||||
-rw-r--r-- | mit-pthreads/machdep/syscall-powerpc-netbsd.S | 185 | ||||
-rw-r--r-- | mit-pthreads/machdep/syscall-template-powerpc-netbsd.S | 45 |
8 files changed, 584 insertions, 1 deletions
diff --git a/mit-pthreads/Changes-mysql b/mit-pthreads/Changes-mysql index d7d6af7cb23..ed557c1b927 100644 --- a/mit-pthreads/Changes-mysql +++ b/mit-pthreads/Changes-mysql @@ -196,3 +196,7 @@ Changes done to this distrubtion (pthreads-1_60_beta6) by Monty (monty@tcx.se) 00.10.18 by Monty (monty@mysql.com) - Added patch by Dave Huang <khym@bga.com> to fix problem with date/time on NETBSD/Alpha. + +01.01.11 by Monty (monty@mysql.com) +- Added patch by Allen Briggs <briggs@ninthwonder.com> for + Apple PowerMac 8500 w/ G3 upgrade running NetBSD/macppc diff --git a/mit-pthreads/config/config.guess b/mit-pthreads/config/config.guess index 36fb26d3998..287ddc13c34 100755 --- a/mit-pthreads/config/config.guess +++ b/mit-pthreads/config/config.guess @@ -295,7 +295,8 @@ EOF echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + UNAME_PROCESSOR=`uname -p 2>/dev/null` || UNAME_PROCESSOR=$UNAME_MACHINE + echo ${UNAME_PROCESSOR}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` diff --git a/mit-pthreads/config/configure b/mit-pthreads/config/configure index 589caec367d..4d99ac5c07e 100755 --- a/mit-pthreads/config/configure +++ b/mit-pthreads/config/configure @@ -1298,6 +1298,12 @@ case $host in # hpux-9.03.mk seems to be missing; what should this be? except="fork" ;; + powerpc-*-netbsd1.*) + name=powerpc-netbsd + sysincludes=netbsd-1.1 + except="fork lseek ftruncate pipe fstat" + available_syscalls="sigprocmask sigaction sigsuspend" + ;; sparc-*-sunos4.1.3* | sparc-*-sunos4.1.4*) name=sparc-sunos-4.1.3 sysincludes=sunos-4.1.3 diff --git a/mit-pthreads/config/configure.in b/mit-pthreads/config/configure.in index d7226a5bb84..45cf0c74809 100755 --- a/mit-pthreads/config/configure.in +++ b/mit-pthreads/config/configure.in @@ -175,6 +175,12 @@ changequote([,])dnl # hpux-9.03.mk seems to be missing; what should this be? except="fork" ;; + powerpc-*-netbsd1.*) + name=powerpc-netbsd + sysincludes=netbsd-1.1 + except="fork lseek ftruncate pipe fstat" + available_syscalls="sigprocmask sigaction sigsuspend" + ;; sparc-*-sunos4.1.3* | sparc-*-sunos4.1.4*) name=sparc-sunos-4.1.3 sysincludes=sunos-4.1.3 diff --git a/mit-pthreads/machdep/engine-powerpc-netbsd.c b/mit-pthreads/machdep/engine-powerpc-netbsd.c new file mode 100644 index 00000000000..fc17e3de5d0 --- /dev/null +++ b/mit-pthreads/machdep/engine-powerpc-netbsd.c @@ -0,0 +1,227 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu + * + * Description : Machine dependent functions for NetBSD/PowerPC (1.5+) + * + * 1.00 93/08/04 proven + * -Started coding this file. + * + * 2001/01/10 briggs + * -Modified to make it go with NetBSD/PowerPC + */ + +#ifndef lint +static const char rcsid[] = "engine-alpha-osf1.c,v 1.4.4.1 1995/12/13 05:41:37 proven Exp"; +#endif + +#include <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/syscall.h> +#include <stdlib.h> +#include <fcntl.h> +#include <stdio.h> + +/* ========================================================================== + * machdep_pthread_start() + */ +void machdep_pthread_start(void) +{ + context_switch_done(); + pthread_sched_resume (); + + /* XXXMLG + * This is EXTREMELY bogus, but it seems that this function is called + * with the pthread kernel locked. If this happens, __errno() will + * return the wrong address until after the first context switch. + * + * Clearly there is a leak of pthread_kernel somewhere, but until + * it is found, we force a context switch here, just before calling + * the thread start routine. When we return from pthread_yield + * the kernel will be unlocked. + */ + pthread_yield(); + + /* Run current threads start routine with argument */ + pthread_exit(pthread_run->machdep_data.start_routine + (pthread_run->machdep_data.start_argument)); + + /* should never reach here */ + PANIC(); +} + +/* ========================================================================== + * __machdep_pthread_create() + */ +void __machdep_pthread_create(struct machdep_pthread *machdep_pthread, + void *(* start_routine)(void *), void *start_argument, + long stack_size, long nsec, long flags) +{ + machdep_pthread->start_routine = start_routine; + machdep_pthread->start_argument = start_argument; + + machdep_pthread->machdep_timer.it_value.tv_sec = 0; + machdep_pthread->machdep_timer.it_interval.tv_sec = 0; + machdep_pthread->machdep_timer.it_interval.tv_usec = 0; + machdep_pthread->machdep_timer.it_value.tv_usec = nsec / 1000; + + /* Set up new stack frame so that it looks like it returned from a + longjmp() to the beginning of machdep_pthread_start(). */ + /* state is sigmask, then r8-r31 where r11 is the LR + * So, istate[3] is r10, which is the SP + * So, istate[4] is r11, which is the LR + * So, istate[5] is r12, which is the CR + */ + machdep_pthread->machdep_istate[4] = (long)machdep_pthread_start; + machdep_pthread->machdep_istate[5] = 0; + + /* PowerPC stack starts high and builds down, and needs to be 16-byte + aligned. */ + machdep_pthread->machdep_istate[3] = + ((long) machdep_pthread->machdep_stack + stack_size) & ~0xf; +} + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return( _setjmp(pthread_run->machdep_data.machdep_istate) ); +} + +void machdep_restore_state(void) +{ + _longjmp(pthread_run->machdep_data.machdep_istate, 1); +} + +void machdep_save_float_state (struct pthread *pthread) +{ + __machdep_save_fp_state(pthread->machdep_data.machdep_fstate); +} + +void machdep_restore_float_state (void) +{ + __machdep_restore_fp_state(pthread_run->machdep_data.machdep_fstate); +} + +/* ========================================================================== + * machdep_set_thread_timer() + */ +void machdep_set_thread_timer(struct machdep_pthread *machdep_pthread) +{ + if (setitimer(ITIMER_VIRTUAL, &(machdep_pthread->machdep_timer), NULL)) { + PANIC(); + } +} + +/* ========================================================================== + * machdep_unset_thread_timer() + */ +void machdep_unset_thread_timer(struct machdep_pthread *machdep_pthread) +{ + struct itimerval zeroval = { { 0, 0 }, { 0, 0} }; + + if (setitimer(ITIMER_VIRTUAL, &zeroval, NULL)) { + PANIC(); + } +} + +/* ========================================================================== + * machdep_pthread_cleanup() + */ +void *machdep_pthread_cleanup(struct machdep_pthread *machdep_pthread) +{ + return(machdep_pthread->machdep_stack); +} + +void *machdep_pthread_cleanup(struct machdep_pthread *machdep_pthread); +void machdep_pthread_start(void); + +/* ========================================================================== + * __machdep_stack_free() + */ +void +__machdep_stack_free(void * stack) +{ + free(stack); +} + +/* ========================================================================== + * __machdep_stack_alloc() + */ +void * +__machdep_stack_alloc(size_t size) +{ + return(malloc(size)); +} + +/* ========================================================================== + * machdep_sys_creat() + */ +int +machdep_sys_creat(char * path, int mode) +{ + return(machdep_sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)); +} + +/* ========================================================================== + * machdep_sys_wait3() + */ +int +machdep_sys_wait3(int * b, int c, int *d) +{ + return(machdep_sys_wait4(0, b, c, d)); +} + +/* ========================================================================== + * machdep_sys_waitpid() + */ +int +machdep_sys_waitpid(int a, int * b, int c) +{ + return(machdep_sys_wait4(a, b, c, NULL)); +} + +/* ========================================================================== + * machdep_sys_getdtablesize() + */ +int +machdep_sys_getdtablesize(void) +{ + return(sysconf(_SC_OPEN_MAX)); +} + +/* ========================================================================== + * machdep_sys_lseek() + */ +off_t +machdep_sys_lseek(int fd, off_t offset, int whence) +{ + return(__syscall((quad_t)SYS_lseek, fd, 0, offset, whence)); +} + +int +machdep_sys_ftruncate( int fd, off_t length) +{ + quad_t q; + int rv; + + q = __syscall((quad_t)SYS_ftruncate, fd,0, length); + if( /* LINTED constant */ sizeof( quad_t ) == sizeof( register_t ) || + /* LINTED constant */ BYTE_ORDER == LITTLE_ENDIAN ) + rv = (int)q; + else + rv = (int)((u_quad_t)q >> 32); + + return rv; +} + + +/* ========================================================================== + * machdep_sys_getdirentries() + */ +int +machdep_sys_getdirentries(int fd, char * buf, int len, int * seek) +{ + return(machdep_sys_getdents(fd, buf, len)); +} diff --git a/mit-pthreads/machdep/engine-powerpc-netbsd.h b/mit-pthreads/machdep/engine-powerpc-netbsd.h new file mode 100644 index 00000000000..530b7ca81e2 --- /dev/null +++ b/mit-pthreads/machdep/engine-powerpc-netbsd.h @@ -0,0 +1,109 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1994 Chris Provenzano (proven@athena.mit.edu) and + * Ken Raeburn (raeburn@mit.edu). + * + * engine-alpha-osf1.h,v 1.4.4.1 1995/12/13 05:41:42 proven Exp + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> +#include <sys/cdefs.h> +#include <sys/signal.h> /* for _NSIG */ + +/* + * The first machine dependent functions are the SEMAPHORES + * needing the test and set instruction. + */ +#define SEMAPHORE_CLEAR 0 +#define SEMAPHORE_SET 0xffff + +#define SEMAPHORE_TEST_AND_SET(lock) \ +({ \ + volatile long t1, temp = SEMAPHORE_SET; \ + __asm__ volatile( \ + "1: lwarx %0,0,%1; \ + cmpwi %0, 0; \ + bne 2f; \ + stwcx. %2,0,%1; \ + bne- 1b; \ + 2: " \ + :"=r" (t1) \ + :"m" (lock), "r" (temp)); \ + t1; \ +}) + +#define SEMAPHORE_RESET(lock) *lock = SEMAPHORE_CLEAR + +/* + * New types + */ +typedef int semaphore; + +/* + * sigset_t macros + */ +#define SIG_ANY(sig) (sig) +#define SIGMAX (_NSIG-1) + +/* + * New Strutures + */ +struct machdep_pthread { + void *(*start_routine)(void *); + void *start_argument; + void *machdep_stack; + struct itimerval machdep_timer; + jmp_buf machdep_istate; + unsigned long machdep_fstate[66]; + /* 64-bit fp regs 0-31 + fpscr */ + /* We pretend the fpscr is 64 bits */ +}; + +/* + * Static machdep_pthread initialization values. + * For initial thread only. + */ +#define MACHDEP_PTHREAD_INIT \ + { NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, { 0 }, { 0 } } + +/* + * Minimum stack size + */ +#define PTHREAD_STACK_MIN 2048 + +/* + * Some fd flag defines that are necessary to distinguish between posix + * behavior and bsd4.3 behavior. + */ +#define __FD_NONBLOCK O_NONBLOCK + +/* + * New functions + */ + +__BEGIN_DECLS + +#if defined(PTHREAD_KERNEL) + +#define __machdep_stack_get(x) (x)->machdep_stack +#define __machdep_stack_set(x, y) (x)->machdep_stack = y +#define __machdep_stack_repl(x, y) \ +{ \ + if ((stack = __machdep_stack_get(x))) { \ + __machdep_stack_free(stack); \ + } \ + __machdep_stack_set(x, y); \ +} + +int machdep_save_state(void); + +void __machdep_save_fp_state(unsigned long *); +void __machdep_restore_fp_state(unsigned long *); +void *__machdep_stack_alloc(size_t); +void __machdep_stack_free(void *); + +#endif + +__END_DECLS diff --git a/mit-pthreads/machdep/syscall-powerpc-netbsd.S b/mit-pthreads/machdep/syscall-powerpc-netbsd.S new file mode 100644 index 00000000000..bdda457f116 --- /dev/null +++ b/mit-pthreads/machdep/syscall-powerpc-netbsd.S @@ -0,0 +1,185 @@ +#include <machine/asm.h> +#define COMPAT_43 +#include <sys/syscall.h> +#ifndef __CONCAT +#include <sys/cdefs.h> +#endif +#define CONCAT __CONCAT + +#undef SYSCALL + +/* Kernel syscall interface: + Input: + 0 - system call number + 3-8 - arguments, as in C + Output: + so - (summary overflow) clear iff successful + + This macro is similar to SYSCALL in asm.h, but not completely. + There's room for optimization, if we assume this will continue to + be assembled as one file. + + This macro expansions does not include the return instruction. + If there's no other work to be done, use something like: + SYSCALL(foo) ; ret + If there is other work to do (in fork, maybe?), do it after the + SYSCALL invocation. */ + +ENTRY(machdep_cerror) + mflr 0 # Save LR in 0 + stwu 1,-16(1) # allocate new stack frame + stw 0,20(1) # Stash 0 in stack + stw 31,8(1) # Stash 31 in stack (since it's callee-saved + mr 31,3 # and we stash return there) + bl PIC_PLT(_C_LABEL(__errno)) + stw 31,0(3) # *errno() = err + lwz 0,20(1) # Restore LR from stack to 0 + neg 3,31 # return -errno to 3 + lwz 31,8(1) # Restore 31 from stack + mtlr 0 + la 1,16(1) # Restore stack frame + li 4,-1 # Put -1 in r4 for those syscalls that return + blr # two values + +/* The fork system call is special... */ +ENTRY(machdep_sys_fork) + li 0, SYS_fork + sc + bso PIC_PLT(_C_LABEL(machdep_cerror)) + addi 4,4,-1 + blr + +/* The pipe system call is special... */ +ENTRY(machdep_sys_pipe) + mr 5,3 + li 0,SYS_pipe + sc + bso PIC_PLT(_C_LABEL(machdep_cerror)) + stw 3,0(5) # Success, store fds + stw 4,4(5) + li 3,0 + blr # And return 0 + +#ifndef SYS___sigsuspend14 +/* The sigsuspend system call is special... */ +ENTRY(machdep_sys_sigsuspend) + lwz 3,0(3) + li 0,SYS_compat_13_sigsuspend13 + sc + b PIC_PLT(_C_LABEL(machdep_cerror)) +#endif /* SYS_sigsuspend14 */ + +#ifndef SYS___sigprocmask14 +/* The sigprocmask system call is special... */ +ENTRY(machdep_sys_sigprocmask) + or. 4,4,4 # Set == NULL ? + li 6,1 # how = SIG_BLOCK + beq Ldoit + lwz 4,0(4) # if not, replace it in r4 with #set + mr 6,3 +Ldoit: mr 3,6 # ... using sigprocmask(SIG_BLOCK) + li 0,SYS_compat_13_sigprocmask13 + sc + bso PIC_PLT(_C_LABEL(machdep_cerror)) + or. 5,5,5 # Check to see if oset requested + beq Ldone # if oset != NULL + stw 3,0(5) # *oset = oldmask +Ldone: + li 3,0 # return 0 + blr +#endif /* SYS_sigprocmask14 */ + +/* More stuff ... */ + +/* For fstat() we actually syscall fstat13. */ +ENTRY(machdep_sys_fstat) + li 0, SYS___fstat13 + sc + bnslr + b PIC_PLT(_C_LABEL(machdep_cerror)) + +/* Do we need to save the entire floating point state? I think so... */ +ENTRY(__machdep_save_fp_state) + stwu 1,-8(1) + stw 3,4(1) + stfd 0,0(3) + stfdu 1,8(3) + stfdu 2,8(3) + stfdu 3,8(3) + stfdu 4,8(3) + stfdu 5,8(3) + stfdu 6,8(3) + stfdu 7,8(3) + stfdu 8,8(3) + stfdu 9,8(3) + stfdu 10,8(3) + stfdu 11,8(3) + stfdu 12,8(3) + stfdu 13,8(3) + stfdu 14,8(3) + stfdu 15,8(3) + stfdu 16,8(3) + stfdu 17,8(3) + stfdu 18,8(3) + stfdu 19,8(3) + stfdu 20,8(3) + stfdu 21,8(3) + stfdu 22,8(3) + stfdu 23,8(3) + stfdu 24,8(3) + stfdu 25,8(3) + stfdu 26,8(3) + stfdu 27,8(3) + stfdu 28,8(3) + stfdu 29,8(3) + stfdu 30,8(3) + stfdu 31,8(3) + mffs 0 + stfdu 0,8(3) + lwz 3,4(1) + lwz 1,0(1) + blr + +ENTRY(__machdep_restore_fp_state) + stwu 1,-12(1) + stw 3,4(1) + stw 4,8(1) + mr 4,3 + lfdu 1,8(3) + lfdu 2,8(3) + lfdu 3,8(3) + lfdu 4,8(3) + lfdu 5,8(3) + lfdu 6,8(3) + lfdu 7,8(3) + lfdu 8,8(3) + lfdu 9,8(3) + lfdu 10,8(3) + lfdu 11,8(3) + lfdu 12,8(3) + lfdu 13,8(3) + lfdu 14,8(3) + lfdu 15,8(3) + lfdu 16,8(3) + lfdu 17,8(3) + lfdu 18,8(3) + lfdu 19,8(3) + lfdu 20,8(3) + lfdu 21,8(3) + lfdu 22,8(3) + lfdu 23,8(3) + lfdu 24,8(3) + lfdu 25,8(3) + lfdu 26,8(3) + lfdu 27,8(3) + lfdu 28,8(3) + lfdu 29,8(3) + lfdu 30,8(3) + lfdu 31,8(3) + lfdu 0,8(3) + mtfsf 127,0 + lfd 0,0(4) + lwz 3,4(1) + lwz 4,8(1) + lwz 1,0(1) + blr diff --git a/mit-pthreads/machdep/syscall-template-powerpc-netbsd.S b/mit-pthreads/machdep/syscall-template-powerpc-netbsd.S new file mode 100644 index 00000000000..1755c1ab2e8 --- /dev/null +++ b/mit-pthreads/machdep/syscall-template-powerpc-netbsd.S @@ -0,0 +1,45 @@ +#include <machine/asm.h> +#define COMPAT_43 +#include <sys/syscall.h> + +#ifdef SYS___sigsuspend14 +#define SYS_sigsuspend SYS___sigsuspend14 +#endif + +#ifdef SYS___sigaction14 +#define SYS_sigaction SYS___sigaction14 +#endif + +#ifdef SYS___sigprocmask14 +#define SYS_sigprocmask SYS___sigprocmask14 +#endif + +#undef SYSCALL + +/* Kernel syscall interface: + Input: + 0 - system call number + 3-8 - arguments, as in C + Output: + so - (summary overflow) clear iff successful + + This macro is similar to SYSCALL in asm.h, but not completely. + There's room for optimization, if we assume this will continue to + be assembled as one file. + + This macro expansions does not include the return instruction. + If there's no other work to be done, use something like: + SYSCALL(foo) ; ret + If there is other work to do (in fork, maybe?), do it after the + SYSCALL invocation. */ + +#define SYSCALL(x) \ + ENTRY(machdep_sys_ ## x) \ + li 0, SYS_ ## x ; \ + sc ; \ + bnslr ; \ + b PIC_PLT(_C_LABEL(machdep_cerror)) + +#define XSYSCALL(x) SYSCALL(x) ; blr + + XSYSCALL(SYSCALL_NAME) |