diff options
author | Camm Maguire <camm@debian.org> | 2014-04-07 15:31:47 +0000 |
---|---|---|
committer | Camm Maguire <camm@debian.org> | 2014-04-21 14:21:12 +0000 |
commit | d73a97a685bfbf732b53d99e63943f871abf693a (patch) | |
tree | 96851f2d07156fdf9dc47ffb91da75697eb8a7ca | |
parent | a1af85ede7933e3866a377e86fff0b6e19377806 (diff) | |
download | gcl-d73a97a685bfbf732b53d99e63943f871abf693a.tar.gz |
trial cywin support
-rwxr-xr-x | gcl/configure | 3 | ||||
-rw-r--r-- | gcl/configure.in | 3 | ||||
-rwxr-xr-x | gcl/h/gnuwin95.defs | 25 | ||||
-rwxr-xr-x | gcl/h/gnuwin95.h | 55 | ||||
-rw-r--r-- | gcl/o/alloc.c | 7 | ||||
-rwxr-xr-x | gcl/o/file.d | 2 | ||||
-rwxr-xr-x | gcl/o/firstfile.c | 2 | ||||
-rwxr-xr-x | gcl/o/gbc.c | 4 | ||||
-rwxr-xr-x | gcl/o/lastfile.c | 2 | ||||
-rwxr-xr-x | gcl/o/main.c | 3 | ||||
-rwxr-xr-x | gcl/o/ntheap.h | 2 | ||||
-rwxr-xr-x | gcl/o/run_process.c | 4 | ||||
-rwxr-xr-x | gcl/o/unexnt.c | 17 | ||||
-rwxr-xr-x | gcl/o/unixtime.c | 6 | ||||
-rwxr-xr-x | gcl/o/xdrfuns.c | 4 |
15 files changed, 95 insertions, 44 deletions
diff --git a/gcl/configure b/gcl/configure index d07a4f6f..029e9dac 100755 --- a/gcl/configure +++ b/gcl/configure @@ -7985,6 +7985,9 @@ else #include <stdio.h> #include <unistd.h> + #ifdef __CYGWIN__ + #define getpagesize() 4096 + #endif int main () diff --git a/gcl/configure.in b/gcl/configure.in index 7b6442ad..3cff9351 100644 --- a/gcl/configure.in +++ b/gcl/configure.in @@ -1546,6 +1546,9 @@ AC_RUN_IFELSE([ AC_LANG_PROGRAM([[ #include <stdio.h> #include <unistd.h> + #ifdef __CYGWIN__ + #define getpagesize() 4096 + #endif ]],[[ size_t i=getpagesize(),j; FILE *fp=fopen("conftest1","w"); diff --git a/gcl/h/gnuwin95.defs b/gcl/h/gnuwin95.defs index d03ff006..c96393dc 100755 --- a/gcl/h/gnuwin95.defs +++ b/gcl/h/gnuwin95.defs @@ -8,24 +8,27 @@ SHELL=bash LBINDIR=/usr/local/bin -OFLAG = -O +#OFLAG = -O #LIBS = -lm -LIBC = +#LIBC = -ODIR_DEBUG= -O4 -ODIR_DEBUG= +#ODIR_DEBUG= -O4 +#ODIR_DEBUG= # This CC string will be used for compilation of the system, # and also in the compiler::*cc* variable for later compilation of # lisp files. -CC = gcc -fwritable-strings -DVOL=volatile -I$(GCLDIR)/o -fsigned-char -AS= as -AR= ar q -RANLIB= ranlib +#CC = gcc -fwritable-strings -DVOL=volatile -I$(GCLDIR)/o -fsigned-char +#AS= as +#AR= ar q +#RANLIB= ranlib LDCC=${CC} +# Unexec dependency +UNIX_SAVE_DEP = unexnt.c + # Enable the fastloading mechanism which does not use ld -A # requires c/rel_.. machine dependent code. @@ -34,8 +37,8 @@ SFASL = $(ODIR)/sfasl.o -MPFILES= $(MPDIR)/mpi-386-winnt.o $(MPDIR)/libmport.a -MPFILES= $(MPDIR)/mpi.o $(MPDIR)/libmport.a +#MPFILES= $(MPDIR)/mpi-386-winnt.o $(MPDIR)/libmport.a +#MPFILES= $(MPDIR)/mpi.o $(MPDIR)/libmport.a FIRST_FILE=$(ODIR)/firstfile.o LAST_FILE=$(ODIR)/lastfile.o @@ -55,4 +58,4 @@ LIBFILES=bsearch.o KCP=kcp-bsd # using gcc so dont need -GNULIB1= +#GNULIB1= diff --git a/gcl/h/gnuwin95.h b/gcl/h/gnuwin95.h index beec560a..3145467d 100755 --- a/gcl/h/gnuwin95.h +++ b/gcl/h/gnuwin95.h @@ -3,9 +3,9 @@ /* #include "386.h" */ /* #include "fcntl.h" */ -#undef DBEGIN -/* we want finer than config.h */ -#define DBEGIN 0x1a000000 +#define DBEGIN _dbegin +#define DBEGIN_TY unsigned long +extern DBEGIN_TY _dbegin; @@ -20,7 +20,7 @@ /* #define BABY_MALLOC_SIZE 0x5000 */ /* #define RECREATE_HEAP if (initflag) recreate_heap(argv[0]); */ -#define RECREATE_HEAP if (initflag) recreate_heap1(); +/* #define RECREATE_HEAP if (initflag) recreate_heap1(); */ #ifdef IN_UNIXTIME #undef ATT @@ -35,12 +35,6 @@ #define BSD #endif -#define NEED_TO_REINSTALL_SIGNALS - -#ifndef SIGIO -#define SIGIO 23 -#endif - /* on most machines this will test in one instruction if the pointe/r is on the C stack or the 0 pointer in winnt our heap starts at DBEGIN @@ -48,7 +42,7 @@ /* #define NULL_OR_ON_C_STACK(y)\ */ /* (((unsigned int)(y)) == 0 || \ */ /* (((unsigned int)(y)) < DBEGIN && ((unsigned int)(y)) &0xf000000)) */ -#define NULL_OR_ON_C_STACK(y) (((void *)(y)) < ((void *)0x400000)) +/* #define NULL_OR_ON_C_STACK(y) (((void *)(y)) < ((void *)0x400000)) */ @@ -58,16 +52,15 @@ #define HAVE_SIGACTION /* a noop */ #define SETUP_SIG_STACK -#define SV_ONSTACK 0 -#if 0 /* Different definition in <sys/signal.h> - 2001-12-18 */ -#define SA_RESTART 0 -#endif +#define SA_ONSTACK 0 #define brk(x) printf("not doing break\n"); #include <stdarg.h> #include <stdio.h> #define UNIXSAVE "unexnt.c" +#define MAXPATHLEN 260 +#define SEPARATE_SFASL_FILE "sfaslcoff.c" #define SPECIAL_RSYM "rsym_nt.c" #define HAVE_AOUT "wincoff.h" @@ -92,6 +85,7 @@ #define FCLOSE_SETBUF_OK +#define RUN_PROCESS #define IEEEFLOAT @@ -99,10 +93,6 @@ #define ADDITIONAL_FEATURES \ ADD_FEATURE("I386"); ADD_FEATURE("WINNT") - -#undef SET_REAL_MAXPAGE -#define SET_REAL_MAXPAGE \ - real_maxpage=MAXPAGE; /* include some low level routines for maxima */ @@ -110,8 +100,12 @@ #define RELOC_FILE "rel_coff.c" -/* FIONREAD not supported */ #undef LISTEN_FOR_INPUT +#define LISTEN_FOR_INPUT(fp) do { \ + int c = 0; \ + if (((fp)->_r <= 0) && (ioctl((fp)->_file, FIONREAD, &c), c<=0)) \ + return 0; \ +} while (0) /* adjust the start to the offset */ #define ADJUST_RELOC_START(j) \ @@ -133,11 +127,22 @@ error("Someone allocated my memory!");} \ if (core_end != (sbrk(PAGESIZE*(n - m)))) - /* allow things like //c at beginning of pathnames, and c:/ */ -#define ALLOW_DRIVE_PATH - - -#define USE_INTERNAL_REAL_TIME_FOR_RUNTIME +#include <limits.h> +#include <sys/stat.h> +#define GET_FULL_PATH_SELF(a_) do {\ + char b[20];\ + static char q[PATH_MAX];\ + struct stat ss;\ + if (snprintf(b,sizeof(b),"/proc/%d/exe",getpid())<=0)\ + error("Cannot write proc exe pathname");\ + if (stat(b,&ss)) \ + (a_)=argv[0];\ + else {\ + if (!realpath(b,q)) \ + error("realpath error");\ + (a_)=q;\ + }\ +} while(0) /* Begin for cmpinclude */ diff --git a/gcl/o/alloc.c b/gcl/o/alloc.c index 07e29713..88d65a41 100644 --- a/gcl/o/alloc.c +++ b/gcl/o/alloc.c @@ -74,6 +74,10 @@ struct rlimit data_rlimit; #endif #endif +#ifdef __CYGWIN__ +void recreate_heap1(void); +#endif + inline void add_page_to_contblock_list(void *p,fixnum m) { @@ -1546,6 +1550,9 @@ malloc(size_t size) { return baby_malloc(size); #else +#ifdef __CYGWIN__ + recreate_heap1(); +#endif if (!initflag) gcl_init_alloc(); #ifdef RECREATE_HEAP diff --git a/gcl/o/file.d b/gcl/o/file.d index 06f90c9a..ea4abbf1 100755 --- a/gcl/o/file.d +++ b/gcl/o/file.d @@ -1623,7 +1623,7 @@ BEGIN: #ifdef HAVE_READLINE if (readline_on && strm->sm.sm_fp==rl_instream) - return *rl_line_buffer ? TRUE : FALSE; + if (rl_line_buffer) return *rl_line_buffer ? TRUE : FALSE; #endif if (strm->sm.sm_fp == NULL) diff --git a/gcl/o/firstfile.c b/gcl/o/firstfile.c index dc835bff..4cc5537d 100755 --- a/gcl/o/firstfile.c +++ b/gcl/o/firstfile.c @@ -21,7 +21,6 @@ Boston, MA 02111-1307, USA. */ #include "config.h" -#ifdef _WIN32 /* See comments in lastfile.c. */ char my_begdata[] = "Beginning of Emacs initialized data"; char my_begbss[1]; /* Do not initialize this variable. */ @@ -33,4 +32,3 @@ char * my_begbss_static = _my_begbss; extern int initialized; static int * dummy = &initialized; #endif -#endif diff --git a/gcl/o/gbc.c b/gcl/o/gbc.c index 97aef9d8..06eb3309 100755 --- a/gcl/o/gbc.c +++ b/gcl/o/gbc.c @@ -1280,7 +1280,11 @@ GBC(enum type t) { (*GBC_enter_hook)(); if (!GBC_enable) +#ifdef __CYGWIN__ + return; +#else error("GBC is not enabled"); +#endif interrupt_enable = FALSE; if (saving_system) diff --git a/gcl/o/lastfile.c b/gcl/o/lastfile.c index 80366cc8..126a64b2 100755 --- a/gcl/o/lastfile.c +++ b/gcl/o/lastfile.c @@ -40,7 +40,6 @@ Boston, MA 02111-1307, USA. */ char my_edata[] = "End of Emacs initialized data"; -#ifdef _WIN32 /* Help unexec locate the end of the .bss area used by Emacs (which isn't always a separate section in NT executables). */ char my_endbss[1]; @@ -49,4 +48,3 @@ char my_endbss[1]; of the bss area used by Emacs. */ static char _my_endbss[1]; char * my_endbss_static = _my_endbss; -#endif diff --git a/gcl/o/main.c b/gcl/o/main.c index 5312e3ef..dce267f1 100755 --- a/gcl/o/main.c +++ b/gcl/o/main.c @@ -92,6 +92,9 @@ static object stack_space; #ifdef _WIN32 unsigned int _dbegin = 0x10100000; #endif +#ifdef __CYGWIN__ +unsigned long _dbegin = 0; +#endif fixnum cssize; diff --git a/gcl/o/ntheap.h b/gcl/o/ntheap.h index 94faaa53..f7c5e368 100755 --- a/gcl/o/ntheap.h +++ b/gcl/o/ntheap.h @@ -60,7 +60,7 @@ enum { extern int os_subtype; /* Emulation of Unix sbrk(). */ -extern void *sbrk (unsigned long size); +extern void *sbrk (ptrdiff_t size); /* Recreate the heap created during dumping. */ extern void recreate_heap (char *executable_path); diff --git a/gcl/o/run_process.c b/gcl/o/run_process.c index 136abc09..dd621e43 100755 --- a/gcl/o/run_process.c +++ b/gcl/o/run_process.c @@ -396,7 +396,11 @@ int server; FEerror("Connection Failed.",0); } pid = getpid(); +#ifdef __CYGWIN__ + if(fcntl(sock, F_SETOWN, pid) < 0) +#else if(ioctl(sock, SIOCSPGRP, (char *)&pid) < 0 ) +#endif { FEerror("Could not set process group of socket.",0); } diff --git a/gcl/o/unexnt.c b/gcl/o/unexnt.c index 98792d64..27a368a4 100755 --- a/gcl/o/unexnt.c +++ b/gcl/o/unexnt.c @@ -970,11 +970,16 @@ allocate_heap (void) the region below the 256MB line for our malloc arena - 229MB is still a pretty decent arena to play in! */ +#ifdef __CYGWIN__ + void *base = 0, *ptr; + reserved_heap_size = 512*1024*1024; +#else void *base = (void *)0x20000000,*ptr;/*FIXME, someday figure out how to let the heap start address default *//*(void *)0x10100000*/ reserved_heap_size=probe_heap_size(base,PAGESIZE,(1UL<<31),-1); +#endif ptr = VirtualAlloc ((void *) base,get_reserved_heap_size (),MEM_RESERVE,PAGE_NOACCESS); - printf("probe results: %lu at %p\n",reserved_heap_size,ptr); + /* printf("probe results: %lu at %p\n",reserved_heap_size,ptr); */ DBEGIN = (DBEGIN_TY) ptr; @@ -983,7 +988,7 @@ allocate_heap (void) /* Emulate Unix sbrk. */ void * -sbrk (unsigned long increment) +sbrk (ptrdiff_t increment) { void *result; long size = (long) increment; @@ -1061,6 +1066,11 @@ sbrk (unsigned long increment) return result; } +#ifdef __CYGWIN__ +/* Emulate Unix getpagesize. */ +int getpagesize (void) { return 4096; } +#endif + /* Recreate the heap from the data that was dumped to the executable. EXECUTABLE_PATH tells us where to find the executable. */ void @@ -1083,6 +1093,9 @@ recreate_heap (char *executable_path) any funny interactions between file I/O and file mapping. */ read_in_bss (executable_path); +#ifdef __CYGWIN__ + cs_org = 0; +#endif map_in_heap (executable_path); diff --git a/gcl/o/unixtime.c b/gcl/o/unixtime.c index 87fbd15b..dba00d2c 100755 --- a/gcl/o/unixtime.c +++ b/gcl/o/unixtime.c @@ -269,6 +269,12 @@ DEFUN("CURRENT-TIMEZONE",fixnum,fScurrent_timezone,SI,0,0,NONE,IO,OO,OO,OO,(void #elif defined NO_SYSTEM_TIME_ZONE return 0; +#elif defined __CYGWIN__ + struct tm gt,lt; + fixnum _t=0; + gmtime_r(&_t, >); + localtime_r(&_t, <); + return (lt.tm_mday == gt.tm_mday) ? -(lt.tm_hour) : (24 - lt.tm_hour); #else fixnum _t=time(0); return -localtime(&_t)->tm_gmtoff/3600; diff --git a/gcl/o/xdrfuns.c b/gcl/o/xdrfuns.c index 83201c5c..b0b5a429 100755 --- a/gcl/o/xdrfuns.c +++ b/gcl/o/xdrfuns.c @@ -24,7 +24,11 @@ License for more details. #ifdef AIX3 #include <sys/select.h> #endif +#ifdef __CYGWIN__ +#include <rpc/xdr.h> +#else /* __CYGWIN__ */ #include <rpc/rpc.h> +#endif /* __CYGWIN__ */ extern aet_type_struct aet_types[]; |