From: Ilya Zakharevich Date: Wed, 18 Dec 1996 06:30:35 +0000 (+1200) Subject: OS/2 updates from Ilya X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=df3ef7a9a68db503d1aecd7cb40d5f974fa0066b;p=p5sagit%2Fp5-mst-13.2.git OS/2 updates from Ilya --- diff --git a/README.os2 b/README.os2 index 34e6e08..e6782e3 100644 --- a/README.os2 +++ b/README.os2 @@ -20,30 +20,40 @@ be read I: either as F, or F. To read the F<.INF> version of documentation (B recommended) outside of OS/2, one needs an IBM's reader (may be available on IBM -ftp sites (?) (URL anyone?)) or shipped with PC DOS 7.0. +ftp sites (?) (URL anyone?)) or shipped with PC DOS 7.0 and IBM's +Visual Age C++ 3.5. + +A copy of a Win* viewer is contained in the "Just add OS/2 Warp" package + + ftp://ftp.software.ibm.com/ps/products/os2/tools/jaow/jaow.zip + +in F. This gives one an access to B's +F<.INF> docs as well (text form is available in F in +B's distribution). =cut Contents - perlos2 - Perl under OS/2 + perlos2 - Perl under OS/2, DOS, Win0.3*, Win0.95 and WinNT. - NAME - SYNOPSIS - DESCRIPTION + NAME + SYNOPSIS + DESCRIPTION - Target - Other OSes - Prerequisites - Starting Perl programs under OS/2 - Starting OS/2 programs under Perl - Frequently asked questions + Frequently asked questions - I cannot run external programs - - I cannot embed perl into my program, or use perl.dll from my program. - INSTALLATION + - I cannot embed perl into my program, or use perl.dll from my program. + - `` and pipe-open do not work under DOS. + INSTALLATION - Automatic binary installation - Manual binary installation - Warning - Accessing documentation + Accessing documentation - OS/2 .INF file - Plain text - Manpages @@ -51,7 +61,7 @@ Contents - GNU info files - .PDF files - LaTeX docs - BUILD + BUILD - Prerequisites - Getting perl source - Application of the patches @@ -60,20 +70,21 @@ Contents - Testing - Installing the built perl - a.out-style build - Build FAQ + Build FAQ - Some / became \ in pdksh. - 'errno' - unresolved external - Problems with tr - Some problem (forget which ;-) - Library ... not found - - Segfault in make - Specific (mis)features of OS/2 port + - Segfault in make + Specific (mis)features of OS/2 port - setpriority, getpriority - system() - Additional modules: - Prebuilt methods: - Misfeatures - Perl flavors + - Modifications + Perl flavors - perl.exe - perl_.exe - perl__.exe @@ -81,20 +92,21 @@ Contents - Why strange names? - Why dynamic linking? - Why chimera build? - ENVIRONMENT + ENVIRONMENT - PERLLIB_PREFIX - PERL_BADLANG - PERL_BADFREE - PERL_SH_DIR - TMP or TEMP - Evolution + Evolution - Priorities - DLL name mangling - Threading - Calls to external programs - AUTHOR - SEE ALSO - + - Memory allocation + AUTHOR + SEE ALSO + =head1 DESCRIPTION =head2 Target @@ -675,7 +687,7 @@ You need to apply the patches in F<./os2/diff.*> and F<./os2/POSIX.mkfifo> like this: gnupatch -p0 < os2\POSIX.mkfifo - gnupatch -p0 < os2\os2\diff.configure + gnupatch -p0 < os2\diff.configure You may also need to apply the patches supplied with the binary distribution of perl. @@ -749,8 +761,8 @@ I submitted a patch to B which makes it possible to fork() with EMX dynamic libraries loaded, which makes F tests pass. This means that soon the number of failing tests may decrease yet more. -However, the test F is disabled, since it never ends, I -do not know why. +However, the test F is disabled, since it never terminates, I +do not know why. Comments/fixes welcome. The reasons for failed tests are: @@ -1327,6 +1339,25 @@ If you have some working code for C, please send it to me, I will include it into distribution. I have no need for such a module, so cannot test it. +=head2 Memory allocation + +Perl uses its own malloc() under OS/2 - interpreters are usually malloc-bound +for speed, but perl is not, since its malloc is lightning-fast. +Unfortunately, it is also quite frivolous with memory usage as well. + +Since kitchen-top machines are usually low on memory, perl is compiled with +all the possible memory-saving options. This probably makes perl's +malloc() as greedy with memory as the neighbor's malloc(), but still +much quickier. Note that this is true only for a "typical" usage, +it is possible that the perl malloc will be worse for some very special usage. + +Combination of perl's malloc() and rigid DLL name resolution creates +a special problem with library functions which expect their return value to +be free()d by system's free(). To facilitate extensions which need to call +such functions, system memory-allocation functions are still available with +the prefix C added. (Currently only DLL perl has this, it should +propagate to F shortly.) + =cut OS/2 extensions diff --git a/os2/Changes b/os2/Changes index f4a0e30..83af2d8 100644 --- a/os2/Changes +++ b/os2/Changes @@ -118,3 +118,7 @@ after 5.003_08: should work on OS/2 2.1 again. uses reliable signals when spawing. do not use popen() any more - no intermediate shell unless needed. + +after 5.003_11: + Functions emx_{malloc,realloc,calloc,free} are exported from DLL. + get_sysinfo() bugs corrected (flags were not used and wrongly defined). diff --git a/os2/Makefile.SHs b/os2/Makefile.SHs index b6564df..6b07e72 100644 --- a/os2/Makefile.SHs +++ b/os2/Makefile.SHs @@ -30,6 +30,10 @@ $(AOUT_LIBPERL_DLL): perl.imp perl.dll perl5.def perl.imp: perl5.def emximp -o perl.imp perl5.def + echo 'emx_calloc emxlibcm 400 ?' >> $@ + echo 'emx_free emxlibcm 401 ?' >> $@ + echo 'emx_malloc emxlibcm 402 ?' >> $@ + echo 'emx_realloc emxlibcm 403 ?' >> $@ perl.dll: $(obj) perl5.def perl$(OBJ_EXT) $(LD) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def diff --git a/os2/os2.c b/os2/os2.c index 14a6ea0..c9d1e55 100644 --- a/os2/os2.c +++ b/os2/os2.c @@ -60,7 +60,7 @@ get_sysinfo(ULONG pid, ULONG flags) rc = QuerySysState(flags, pid, pbuffer, buf_len); while (rc == ERROR_BUFFER_OVERFLOW) { Renew(pbuffer, buf_len *= 2, char); - rc = QuerySysState(QSS_PROCESS, pid, pbuffer, buf_len); + rc = QuerySysState(flags, pid, pbuffer, buf_len); } if (rc) { FillOSError(rc); diff --git a/os2/os2ish.h b/os2/os2ish.h index d83503d..cf945f3 100644 --- a/os2/os2ish.h +++ b/os2/os2ish.h @@ -109,6 +109,11 @@ char *my_tmpnam (char *); #define my_getenv(var) getenv(var) +void *emx_calloc (size_t, size_t); +void emx_free (void *); +void *emx_malloc (size_t); +void *emx_realloc (void *, size_t); + /*****************************************************************************/ #include /* before the following definitions */ @@ -203,8 +208,8 @@ char *os2error(int rc); Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz) #define QSS_PROCESS 1 -#define QSS_MODULE 2 -#define QSS_SEMAPHORES 4 +#define QSS_MODULE 4 +#define QSS_SEMAPHORES 2 #define QSS_FILE 8 /* Buggy until fixpack18 */ #define QSS_SHARED 16