diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/Makefile | 18 | ||||
-rw-r--r-- | win32/config.bc | 21 | ||||
-rw-r--r-- | win32/config.gc | 21 | ||||
-rw-r--r-- | win32/config.vc | 21 | ||||
-rw-r--r-- | win32/config_H.bc | 5 | ||||
-rw-r--r-- | win32/config_H.gc | 5 | ||||
-rw-r--r-- | win32/config_H.vc | 5 | ||||
-rw-r--r-- | win32/makedef.pl | 8 | ||||
-rw-r--r-- | win32/makefile.mk | 28 | ||||
-rw-r--r-- | win32/win32.c | 89 | ||||
-rw-r--r-- | win32/win32.h | 25 |
11 files changed, 168 insertions, 78 deletions
diff --git a/win32/Makefile b/win32/Makefile index 29e92d15ec..05e3c3a467 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -1,4 +1,3 @@ -# # Makefile to build perl on Windowns NT using Microsoft NMAKE. # Works with MS command line compilers from VC++ etc. # @@ -31,12 +30,14 @@ OBJECT = -DPERL_OBJECT # # if you have the source for des_fcrypt(), uncomment this and make sure the -# file exists (see README.win32) +# file exists (see README.win32). File should be located at the perl +# top level directory. #CRYPT_SRC = des_fcrypt.c # # if you didn't set CRYPT_SRC and if you have des_fcrypt() available in a # library, uncomment this, and make sure the library exists (see README.win32) +# Specify the full pathname of the library. #CRYPT_LIB = des_fcrypt.lib # @@ -48,6 +49,9 @@ OBJECT = -DPERL_OBJECT # # set the install locations of the compiler include/libraries +# (you'll need to quote the value if it contains spaces: i.e. +# CCHOME = "f:\Program Files\vc" +# #CCHOME = f:\msvc20 CCHOME = $(MSVCDIR) CCINCDIR = $(CCHOME)\include @@ -476,7 +480,7 @@ $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl $(XCOPY) *.h $(COREDIR)\*.* $(RCOPY) include $(COREDIR)\*.* $(MINIPERL) -I..\lib config_h.PL || $(MAKE) $(MAKEFLAGS) $(CONFIGPM) - + $(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(LINK32) -subsystem:console -out:$@ @<< $(LINK_FLAGS) $(LIBFILES) $(MINI_OBJ) @@ -689,12 +693,18 @@ realclean: clean -rmdir /s /q $(COREDIR) || rmdir /s $(COREDIR) -rmdir /s /q $(MINIDIR) || rmdir /s $(MINIDIR) -install : all doc utils +install : all installbare installutils installhtml + +installbare : $(PERLEXE) ..\installperl $(XCOPY) $(PERL95EXE) $(INST_BIN)\*.* + +installutils : utils $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.* $(XCOPY) bin\*.bat $(INST_BIN)\*.* $(XCOPY) ..\pod\*.bat $(INST_BIN)\*.* + +installhtml : doc $(RCOPY) html\*.* $(INST_HTML)\*.* inst_lib : $(CONFIGPM) diff --git a/win32/config.bc b/win32/config.bc index 0364c329dd..fe9f297b4b 100644 --- a/win32/config.bc +++ b/win32/config.bc @@ -159,10 +159,10 @@ d_mkfifo='undef' d_mkstemp='undef' d_mktime='define' d_msg='undef' -d_msgctl='define' -d_msgget='define' -d_msgrcv='define' -d_msgsnd='define' +d_msgctl='undef' +d_msgget='undef' +d_msgrcv='undef' +d_msgsnd='undef' d_mymalloc='undef' d_nice='undef' d_oldpthreads='undef' @@ -181,6 +181,7 @@ d_pwchange='undef' d_pwclass='undef' d_pwcomment='undef' d_pwexpire='undef' +d_pwgecos='undef' d_pwquota='undef' d_readdir='define' d_readlink='undef' @@ -194,9 +195,9 @@ d_sched_yield='undef' d_seekdir='define' d_select='define' d_sem='undef' -d_semctl='define' -d_semget='define' -d_semop='define' +d_semctl='undef' +d_semget='undef' +d_semop='undef' d_setegid='undef' d_seteuid='undef' d_setgrps='undef' @@ -222,9 +223,9 @@ d_sfio='undef' d_shm='undef' d_shmat='undef' d_shmatprototype='undef' -d_shmctl='define' -d_shmdt='define' -d_shmget='define' +d_shmctl='undef' +d_shmdt='undef' +d_shmget='undef' d_sigaction='undef' d_sigsetjmp='undef' d_socket='define' diff --git a/win32/config.gc b/win32/config.gc index ec41c2ec68..5e732ab3f2 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -159,10 +159,10 @@ d_mkfifo='undef' d_mkstemp='undef' d_mktime='define' d_msg='undef' -d_msgctl='define' -d_msgget='define' -d_msgrcv='define' -d_msgsnd='define' +d_msgctl='undef' +d_msgget='undef' +d_msgrcv='undef' +d_msgsnd='undef' d_mymalloc='undef' d_nice='undef' d_oldpthreads='undef' @@ -181,6 +181,7 @@ d_pwchange='undef' d_pwclass='undef' d_pwcomment='undef' d_pwexpire='undef' +d_pwgecos='undef' d_pwquota='undef' d_readdir='define' d_readlink='undef' @@ -194,9 +195,9 @@ d_sched_yield='undef' d_seekdir='define' d_select='define' d_sem='undef' -d_semctl='define' -d_semget='define' -d_semop='define' +d_semctl='undef' +d_semget='undef' +d_semop='undef' d_setegid='undef' d_seteuid='undef' d_setgrps='undef' @@ -222,9 +223,9 @@ d_sfio='undef' d_shm='undef' d_shmat='undef' d_shmatprototype='undef' -d_shmctl='define' -d_shmdt='define' -d_shmget='define' +d_shmctl='undef' +d_shmdt='undef' +d_shmget='undef' d_sigaction='undef' d_sigsetjmp='undef' d_socket='define' diff --git a/win32/config.vc b/win32/config.vc index 62cd537c78..1fdbcbfbc2 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -159,10 +159,10 @@ d_mkfifo='undef' d_mkstemp='undef' d_mktime='define' d_msg='undef' -d_msgctl='define' -d_msgget='define' -d_msgrcv='define' -d_msgsnd='define' +d_msgctl='undef' +d_msgget='undef' +d_msgrcv='undef' +d_msgsnd='undef' d_mymalloc='undef' d_nice='undef' d_oldpthreads='undef' @@ -181,6 +181,7 @@ d_pwchange='undef' d_pwclass='undef' d_pwcomment='undef' d_pwexpire='undef' +d_pwgecos='undef' d_pwquota='undef' d_readdir='define' d_readlink='undef' @@ -194,9 +195,9 @@ d_sched_yield='undef' d_seekdir='define' d_select='define' d_sem='undef' -d_semctl='define' -d_semget='define' -d_semop='define' +d_semctl='undef' +d_semget='undef' +d_semop='undef' d_setegid='undef' d_seteuid='undef' d_setgrps='undef' @@ -222,9 +223,9 @@ d_sfio='undef' d_shm='undef' d_shmat='undef' d_shmatprototype='undef' -d_shmctl='define' -d_shmdt='define' -d_shmget='define' +d_shmctl='undef' +d_shmdt='undef' +d_shmget='undef' d_sigaction='undef' d_sigsetjmp='undef' d_socket='define' diff --git a/win32/config_H.bc b/win32/config_H.bc index 9a8043d4a4..2e645a8e99 100644 --- a/win32/config_H.bc +++ b/win32/config_H.bc @@ -924,6 +924,10 @@ * This symbol, if defined, indicates to the C program that struct passwd * contains pw_expire. */ +/* PWGECOS: + * This symbol, if defined, indicates to the C program that struct passwd + * contains pw_gecos. + */ /* PWCOMMENT: * This symbol, if defined, indicates to the C program that struct passwd * contains pw_comment. @@ -934,6 +938,7 @@ /*#define PWCHANGE /**/ /*#define PWCLASS /**/ /*#define PWEXPIRE /**/ +/*#define PWGECOS /**/ /*#define PWCOMMENT /**/ /* I_SFIO: diff --git a/win32/config_H.gc b/win32/config_H.gc index b9486c8616..44aafe7c4c 100644 --- a/win32/config_H.gc +++ b/win32/config_H.gc @@ -924,6 +924,10 @@ * This symbol, if defined, indicates to the C program that struct passwd * contains pw_expire. */ +/* PWGECOS: + * This symbol, if defined, indicates to the C program that struct passwd + * contains pw_gecos. + */ /* PWCOMMENT: * This symbol, if defined, indicates to the C program that struct passwd * contains pw_comment. @@ -934,6 +938,7 @@ /*#define PWCHANGE /**/ /*#define PWCLASS /**/ /*#define PWEXPIRE /**/ +/*#define PWGECOS /**/ /*#define PWCOMMENT /**/ /* I_SFIO: diff --git a/win32/config_H.vc b/win32/config_H.vc index bdce05ee95..07e6e235c5 100644 --- a/win32/config_H.vc +++ b/win32/config_H.vc @@ -924,6 +924,10 @@ * This symbol, if defined, indicates to the C program that struct passwd * contains pw_expire. */ +/* PWGECOS: + * This symbol, if defined, indicates to the C program that struct passwd + * contains pw_gecos. + */ /* PWCOMMENT: * This symbol, if defined, indicates to the C program that struct passwd * contains pw_comment. @@ -934,6 +938,7 @@ /*#define PWCHANGE /**/ /*#define PWCLASS /**/ /*#define PWEXPIRE /**/ +/*#define PWGECOS /**/ /*#define PWCOMMENT /**/ /* I_SFIO: diff --git a/win32/makedef.pl b/win32/makedef.pl index e688eb5075..acaa64b232 100644 --- a/win32/makedef.pl +++ b/win32/makedef.pl @@ -254,6 +254,8 @@ if ($define{'MYMALLOC'}) unless ($define{'USE_THREADS'}) { skip_symbols [qw( +Perl_getTHR +Perl_setTHR Perl_condpair_magic Perl_thr_key Perl_sv_mutex @@ -432,6 +434,7 @@ __DATA__ perl_init_i18nl10n perl_init_ext perl_alloc +perl_atexit perl_construct perl_destruct perl_free @@ -448,6 +451,11 @@ perl_call_sv perl_require_pv perl_eval_pv perl_eval_sv +perl_new_ctype +perl_new_collate +perl_new_numeric +perl_set_numeric_standard +perl_set_numeric_local boot_DynaLoader Perl_thread_create win32_errno diff --git a/win32/makefile.mk b/win32/makefile.mk index cd2a95adae..d7476452a8 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -36,12 +36,14 @@ OBJECT *= -DPERL_OBJECT # # if you have the source for des_fcrypt(), uncomment this and make sure the -# file exists (see README.win32) +# file exists (see README.win32). File should be located at the perl +# top level directory. #CRYPT_SRC *= des_fcrypt.c # # if you didn't set CRYPT_SRC and if you have des_fcrypt() available in a # library, uncomment this, and make sure the library exists (see README.win32) +# Specify the full pathname of the library. #CRYPT_LIB *= des_fcrypt.lib # @@ -53,6 +55,9 @@ OBJECT *= -DPERL_OBJECT # # set the install locations of the compiler include/libraries +# (you'll need to quote the value if it contains spaces: i.e. +# CCHOME *= "f:\Program Files\vc" +# #CCHOME *= f:\msdev\vc CCHOME *= C:\bc5 #CCHOME *= D:\packages\mingw32 @@ -135,7 +140,7 @@ LIBFILES = $(CRYPT_LIB) import32.lib $(LIBC) odbc32.lib odbccp32.lib OPTIMIZE = -v $(RUNTIME) -DDEBUGGING LINK_DBG = -v .ELSE -OPTIMIZE = -5 -O2 $(RUNTIME) +OPTIMIZE = -O2 $(RUNTIME) LINK_DBG = .ENDIF @@ -165,8 +170,8 @@ SUBSYS = console CXX_FLAG = -xc++ LIBC = -lcrtdll -LIBFILES = $(CRYPT_LIB) -ladvapi32 -luser32 -lwsock32 -lmingw32 -lgcc \ - -lmoldname $(LIBC) -lkernel32 +LIBFILES = $(CRYPT_LIB) -ladvapi32 -luser32 -lnetapi32 -lwsock32 -lmingw32 \ + -lgcc -lmoldname $(LIBC) -lkernel32 .IF "$(CFG)" == "Debug" OPTIMIZE = -g -O2 $(RUNTIME) -DDEBUGGING @@ -199,7 +204,7 @@ RUNTIME = -MT RUNTIME = -MD .ENDIF -INCLUDES = -I.\include -I. -I.. +INCLUDES = -I.\include -I. -I.. #PCHFLAGS = -Fpc:\temp\vcmoduls.pch -YX DEFINES = -DWIN32 -D_CONSOLE $(BUILDOPT) $(CRYPT_FLAG) LOCDEFS = -DPERLDLL -DPERL_CORE @@ -750,6 +755,11 @@ $(ATTRS_DLL): $(PERLEXE) $(ATTRS).xs ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl cd $(EXTDIR)\$(*B) && $(MAKE) +$(POSIX_DLL): $(PERLEXE) $(POSIX).xs + cd $(EXTDIR)\$(*B) && \ + ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl + cd $(EXTDIR)\$(*B) && $(MAKE) + $(IO_DLL): $(PERLEXE) $(IO).xs cd $(EXTDIR)\$(*B) && \ ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl @@ -800,6 +810,8 @@ distclean: clean -del /f $(EXTENSION_C) -del /f $(PODDIR)\*.html -del /f $(PODDIR)\*.bat + -cd ..\utils && del /f h2ph splain perlbug pl2pm c2ph h2xs perldoc pstruct *.bat + -cd ..\x2p && del /f find2perl s2p *.bat -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new -del /f ..\lib\Config.pm .IF "$(PERL95EXE)" != "" @@ -811,14 +823,18 @@ distclean: clean -rmdir /s /q $(COREDIR) || rmdir /s $(COREDIR) -rmdir /s /q $(MINIDIR) || rmdir /s $(MINIDIR) -install : all doc utils +installbare : $(PERLEXE) ..\installperl .IF "$(PERL95EXE)" != "" $(XCOPY) $(PERL95EXE) $(INST_BIN)\*.* .ENDIF + +installutils : utils $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.* $(XCOPY) bin\*.bat $(INST_BIN)\*.* $(XCOPY) ..\pod\*.bat $(INST_BIN)\*.* + +installhtml : doc $(RCOPY) html\*.* $(INST_HTML)\*.* inst_lib : $(CONFIGPM) diff --git a/win32/win32.c b/win32/win32.c index 674b047446..d4be76a7bd 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -112,48 +112,29 @@ static long filetime_to_clock(PFILETIME ft); static BOOL filetime_from_time(PFILETIME ft, time_t t); -char * w32_perlshell_tokens = Nullch; -char ** w32_perlshell_vec; -long w32_perlshell_items = -1; -DWORD w32_platform = (DWORD)-1; -char w32_perllib_root[MAX_PATH+1]; HANDLE w32_perldll_handle = INVALID_HANDLE_VALUE; -#ifndef __BORLANDC__ -long w32_num_children = 0; -HANDLE w32_child_pids[MAXIMUM_WAIT_OBJECTS]; -#endif - -#ifndef FOPEN_MAX -# if defined(_NSTREAM_) -# define FOPEN_MAX _NSTREAM_ -# elsif defined(_NFILE_) -# define FOPEN_MAX _NFILE_ -# elsif defined(_NFILE) -# define FOPEN_MAX _NFILE -# endif -#endif - -#ifndef USE_CRT_POPEN -int w32_popen_pids[FOPEN_MAX]; -#endif +static DWORD w32_platform = (DWORD)-1; #ifdef USE_THREADS # ifdef USE_DECLSPEC_THREAD __declspec(thread) char strerror_buffer[512]; __declspec(thread) char getlogin_buffer[128]; +__declspec(thread) char w32_perllib_root[MAX_PATH+1]; # ifdef HAVE_DES_FCRYPT __declspec(thread) char crypt_buffer[30]; # endif # else # define strerror_buffer (thr->i.Wstrerror_buffer) # define getlogin_buffer (thr->i.Wgetlogin_buffer) +# define w32_perllib_root (thr->i.Ww32_perllib_root) # define crypt_buffer (thr->i.Wcrypt_buffer) # endif #else -char strerror_buffer[512]; -char getlogin_buffer[128]; +static char strerror_buffer[512]; +static char getlogin_buffer[128]; +static char w32_perllib_root[MAX_PATH+1]; # ifdef HAVE_DES_FCRYPT -char crypt_buffer[30]; +static char crypt_buffer[30]; # endif #endif @@ -1113,7 +1094,7 @@ win32_utime(const char *filename, struct utimbuf *times) DllExport int win32_wait(int *status) { -#ifdef __BORLANDC__ +#ifdef USE_RTL_WAIT return wait(status); #else /* XXX this wait emulation only knows about processes @@ -1638,7 +1619,7 @@ win32_pipe(int *pfd, unsigned int size, int mode) DllExport FILE* win32_popen(const char *command, const char *mode) { -#ifdef USE_CRT_POPEN +#ifdef USE_RTL_POPEN return _popen(command, mode); #else int p[2]; @@ -1698,7 +1679,7 @@ win32_popen(const char *command, const char *mode) /* close saved handle */ win32_close(oldfd); - w32_popen_pids[p[parent]] = childpid; + sv_setiv(*av_fetch(w32_fdpid, p[parent], TRUE), childpid); /* we have an fd, return a file stream */ return (win32_fdopen(p[parent], (char *)mode)); @@ -1713,7 +1694,7 @@ cleanup: } return (NULL); -#endif /* USE_CRT_POPEN */ +#endif /* USE_RTL_POPEN */ } /* @@ -1723,13 +1704,22 @@ cleanup: DllExport int win32_pclose(FILE *pf) { -#ifdef USE_CRT_POPEN +#ifdef USE_RTL_POPEN return _pclose(pf); #else - int fd, childpid, status; - fd = win32_fileno(pf); - childpid = w32_popen_pids[fd]; +#ifndef USE_RTL_WAIT + int child; +#endif + + int childpid, status; + SV *sv; + + sv = *av_fetch(w32_fdpid, win32_fileno(pf), TRUE); + if (SvIOK(sv)) + childpid = SvIVX(sv); + else + childpid = 0; if (!childpid) { errno = EBADF; @@ -1737,7 +1727,18 @@ win32_pclose(FILE *pf) } win32_fclose(pf); - w32_popen_pids[fd] = 0; + SvIVX(sv) = 0; + +#ifndef USE_RTL_WAIT + for (child = 0 ; child < w32_num_children ; ++child) { + if (w32_child_pids[child] == (HANDLE)childpid) { + Copy(&w32_child_pids[child+1], &w32_child_pids[child], + (w32_num_children-child-1), HANDLE); + w32_num_children--; + break; + } + } +#endif /* wait for the child */ if (cwait(&status, childpid, WAIT_CHILD) == -1) @@ -1749,7 +1750,7 @@ win32_pclose(FILE *pf) return (status); #endif -#endif /* USE_CRT_OPEN */ +#endif /* USE_RTL_POPEN */ } DllExport int @@ -1844,8 +1845,13 @@ win32_spawnvp(int mode, const char *cmdname, const char *const *argv) { int status; +#ifndef USE_RTL_WAIT + if (mode == P_NOWAIT && w32_num_children >= MAXIMUM_WAIT_OBJECTS) + return -1; +#endif + status = spawnvp(mode, cmdname, (char * const *) argv); -#ifndef __BORLANDC__ +#ifndef USE_RTL_WAIT /* XXX For the P_NOWAIT case, Borland RTL returns pinfo.dwProcessId * while VC RTL returns pinfo.hProcess. For purposes of the custom * implementation of win32_wait(), we assume the latter. @@ -3050,6 +3056,13 @@ Perl_init_os_extras() char *file = __FILE__; dXSUB_SYS; + w32_perlshell_tokens = Nullch; + w32_perlshell_items = -1; + w32_fdpid = newAV(); /* XXX needs to be in Perl_win32_init()? */ +#ifndef USE_RTL_WAIT + w32_num_children = 0; +#endif + /* these names are Activeware compatible */ newXS("Win32::GetCwd", w32_GetCwd, file); newXS("Win32::SetCwd", w32_SetCwd, file); @@ -3126,7 +3139,7 @@ Perl_win32_init(int *argcp, char ***argvp) #if !defined(_ALPHA_) && !defined(__GNUC__) _control87(MCW_EM, MCW_EM); #endif - MALLOC_INIT; + MALLOC_INIT; } #ifdef USE_BINMODE_SCRIPTS diff --git a/win32/win32.h b/win32/win32.h index 1930e391da..021cc48186 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -138,6 +138,8 @@ struct tms { #pragma warn -csu /* "comparing signed and unsigned values" */ #pragma warn -pro /* "call to function with no prototype" */ +#define USE_RTL_WAIT /* Borland has a working wait() */ + /* Borland is picky about a bare member function name used as its ptr */ #ifdef PERL_OBJECT #define FUNC_NAME_TO_PTR(name) &(name) @@ -248,6 +250,28 @@ EXT void win32_strip_return(struct sv *sv); #define win32_strip_return(sv) NOOP #endif +#define HAVE_INTERP_INTERN +struct interp_intern { + char * w32_perlshell_tokens; + char ** w32_perlshell_vec; + long w32_perlshell_items; + struct av * w32_fdpid; +#ifndef USE_RTL_WAIT + long w32_num_children; + HANDLE w32_child_pids[MAXIMUM_WAIT_OBJECTS]; +#endif +}; + +#define w32_perlshell_tokens (sys_intern.w32_perlshell_tokens) +#define w32_perlshell_vec (sys_intern.w32_perlshell_vec) +#define w32_perlshell_items (sys_intern.w32_perlshell_items) +#define w32_fdpid (sys_intern.w32_fdpid) + +#ifndef USE_RTL_WAIT +# define w32_num_children (sys_intern.w32_num_children) +# define w32_child_pids (sys_intern.w32_child_pids) +#endif + /* * Now Win32 specific per-thread data stuff */ @@ -261,6 +285,7 @@ struct thread_intern { char Wstrerror_buffer[512]; struct servent Wservent; char Wgetlogin_buffer[128]; + char Ww32_perllib_root[MAX_PATH+1]; # ifdef USE_SOCKETS_AS_HANDLES int Winit_socktype; # endif |