This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [PATCH 5.8.1 @20218] OS/2 API
[perl5.git] / os2 / Changes
1 after 5.003_05:
2         PERLLIB_PREFIX was not active if it matches an element of @INC
3                 as a whole.
4         Do not need PERL_SBRK if crtdll-revision is >= 50.
5         Use -Zsmall-conv if crtdll-revision is >= 50 (in static perl!).
6 :7: warning: #warning <dirent.h> requires <sys/types.h>
7         We compile miniperl static. It cannot fork, thus there may be
8                 problems with pipes (since HAS_FORK is in
9                 place). Pipes are required by makemaker.
10         We compile perl___.exe A.OUT and dynamic. It should be able to
11                 fork.
12         If we can fork, we my_popen by popen unless "-|". Thus we
13                 write a cooky "-1" into the pid array to indicate
14                 this.
15         Apparently we can fork, and we can load dynamic extensions
16                 now, though probably not simultaneously.
17         *DB tests corrected for OS/2 one-user stat[2].
18         /bin/sh is intercepted and replaced by SH_PATH.
19         Note that having '\\' in the command line of one-arg `system'
20                 would trigger call via shell.
21         Segfault with system {'ls'} 'blah'; corrected.
22         Documentation of OS/2-different features added to main PODs.
23         New buitins in Cwd::
24
25                 Cwd::current_drive
26                 Cwd::sys_chdir          - leaves drive as it is.
27                 Cwd::change_drive
28                 Cwd::sys_is_absolute    - has drive letter and is_rooted
29                 Cwd::sys_is_rooted      - has leading [/\\] (maybe
30                                           after a drive)
31                 Cwd::sys_is_relative    - changes with current dir
32                 Cwd::sys_cwd            - Interface to cwd from EMX.
33                 Cwd::sys_abspath(name, dir)     
34                                         - Really really odious
35                                           function. Returns absolute
36                                           name of file which would 
37                                           have 'name' if CWD were 'dir'.
38                                         Dir defaults to the current dir.
39                 Cwd::extLibpath [type]  - Get/set current value of extended
40                 Cwd::extLibpath_set     - library search path.
41                         path [type]
42                                         The optional last argument redirects
43                                            to END-path if true,
44                                            default is to search BEGIN-path.
45                 (Note that some of these may be moved to different
46                   libraries - eventually).
47         Executables: 
48                 perl - can fork, can dynalink (but not simultaneously)
49                 perl_ - can fork, cannot dynalink
50                 perl__ - same as perl___, but PM.
51                 perl___ - cannot fork, can dynalink.
52         The build of the first one - perl - is rather convoluted, and
53           requires a build of miniperl_.
54
55 after 5.003_07:
56         custom tmpfile and tmpname which may use $TMP, $TEMP.
57         all the calls to OS/2 API wrapped so that it is safe to use
58                 them under DOS (may die(), though).
59         Tested that popen works under DOS with modified PDKSH and RSX.
60         File::Copy works under DOS.
61         MakeMaker modified to work under DOS (perlmain.c.tmp and sh -c true).
62
63 after 5.003_08:
64         OS2::PrfDB exports symbols as documented;
65         should work on OS/2 2.1 again.
66         uses reliable signals when spawing.
67         do not use popen() any more - no intermediate shell unless needed.
68
69 after 5.003_11:
70         Functions emx_{malloc,realloc,calloc,free} are exported from DLL.
71         get_sysinfo() bugs corrected (flags were not used and wrongly defined).
72
73 after 5.003_20:
74         _isterm is substituted instead of isatty, s?random instead of srand.
75         `register' disabled if -DDEBUGGING and not AOUT build: stupid SD386.
76         3-argument select() was stomping over memory.
77
78 after 5.003_21:
79         Can start scripts by executing 'dir/script' and
80         'script.sh'. Form without extension will call shell only if
81         the specified file exists (will not look on path) (to prohibit
82         trying to run shell commands directly). - Needed by magic.t.
83
84 after 5.003_27:
85         ALTERNATE_SHEBANG="extproc " supported, thus options on this
86         line are processed (possibly twice). -S is made legal on such
87         a line. This -S -x is not needed any more.
88         perl.dll may be used from non-EMX programs (via PERL_SYS_INIT
89         - the caller should have valid variable "env" with
90         environment). Known problems: $$ does not work - is 0, waitpid
91         returns immediately, thus Perl cannot wait for completion of
92         started programs.
93
94 after 5.004_01:
95         flock emulation added (disable by setting env PERL_USE_FLOCK=0),
96                 thanks to Rocco Caputo;
97         RSX bug with missing waitpid circomvented;
98         -S bug with full path with \ corrected.
99
100 before 5.004_02:
101         -S switch to perl enables a search with additional extensions 
102         .cmd, .btm, .bat, .pl as well.  This means that if you have
103         mycmd.pl or mycmd.bat on PATH, 
104                 perl -S mycmd
105         will work.  Perl will also look in the current directory first.
106         Moreover, a bug with \; in PATH being non-separator is fixed.
107
108 after 5.004_03:
109         $^E tracks calls to CRT now.  (May break if Perl masks some
110         changes to errno?)
111         $0 may be edited to longer lengths (at least under OS/2).
112         OS2::REXX->loads looks in the OS/2-ish fashion too.
113
114 after 5.004_04:
115         Default perl.exe was built with a shorter stack than expected.
116         Strip extensions DLLs too (unless debugging build).
117         ./os2.c being RO could stop cp.
118         When starting scripts, Perl will find them on path (using the same
119           extensions as for -S command-line switch).  If it finds magic
120           `extproc ' or `#!' cookies, it will start the scripts directly.
121         May use `cmd /c more <' as a pager.
122         If a program could not be started, this might have been hidden.
123         End of pipe was closed twice when `open'ing a pipeline.
124
125 after 5.004_53:
126         Minimal thread support added.  One needs to manually move pthread.h
127
128 after 5.004_64:
129         Make DLL names different if thread-enabled.
130         Emit more informative internal DLL descriptions.
131
132 5.004_72:
133         Updated OS2::Process (v0.2) included.
134         
135 after 5.004_73:
136         Fixed a bug with argv not NULL-terminated when starting scripts.
137         Support all the forms of starting scripts.
138         Support killing a child when receiving a signal during system()
139         (in two stage, on first send the same signal, on the next
140         send SIGKILL).
141         Add the same logic for scripts as in pdksh, including 
142                 stripping the path from #! line if needed, 
143                 calling EXECSHELL or COMSPEC for magic-less scripts;
144         Now pdksh is called only if one-arg system()/friends contains
145         metachars, or if magic-line asks for sh, or there is no magic
146         line and EXECSHELL is set to sh.
147         Shell is supplied the original command line if possible.
148
149 after 5.005_02:
150         Can start PM programs from non-PM sessions by plain system()
151                 and friends.  Can start DOS/Win programs.  Can start
152                 fullscreen programs from non-fullscreen sessions too.
153         In fact system(P_PM,...) was broken.
154         We mangle the name of perl*.DLL, to allow coexistence of different
155                 versions of Perl executables on the system.  Mangling of
156                 names of extension DLL is also changed, thus running two
157                 different versions of the executable with loaded
158                 extensions should not lead to conflicts (since 
159                 extension-full-name and Perl-version mangling work in the 
160                 same set ot 576 possible keys, this may lead to clashes).
161         $^E was reset on the second read, and contained ".\r\n" at the end.
162
163 after 5.005_53:
164         Would segfault system()ing non-existing program;
165         AOUT build was hosed;
166         warning-test for getpriority() might lock the system hard on 
167                 pre-fixpak22 configuration (calling getpriority() on 
168                 non-existing process triggers a system-wide bug).
169
170
171         PrfDB was using a bug in processing XSUBs returning U32.
172
173         Variable $OS2::emx_rev implemented (string and numberic values
174                 are the same as C variables _emx_rev and _emx_vprt).
175         Variable $OS2::emx_env implemented (same as C variable _emx_env).
176         Variable $OS2::os_ver implemented (_osmajor + 0.001 * _osminor).
177
178         Improved centralized management of HAB and HMQ.  To get Perl's
179                 HAB, call perl_hab_GET().  (After the initial call one
180                 can use Perl_hab instead.)  To require Perl's HMQ,
181                 call perl_hmq_GET(), to release it call perl_hmq_UNSET(),
182                 to obtain it between these calls use Perl_hmq.
183         HMQ management is refcounted, and the program will morph
184                 itself into/from PM if required.
185         If perl.h cannot be included, hab may be obtained by Perl_hab_GET().
186
187         New function OS2::Error(do_harderror,do_exception).  Returns
188                 undef if it was not called yet, otherwise bit 1 is
189                 set if on previous call do_harderror was enabled, bit
190                 2 is set if if on previous call do_exception was enabled.
191         This function enables/disables error popups associated with 
192                 hardware errors (Disk not ready etc.) and software exceptions.
193
194         New function OS2::Errors2Drive(drive).  Returns undef if it was 
195                 not called yet, otherwise return false if Errors were
196                 not requested to be written to a hard drive, or the
197                 drive letter if this was requested.
198         This function may redirect error popups associated with 
199                 hardware errors (Disk not ready etc.) and software exceptions
200                 to the file POPUPLOG.OS2 at the root directory of the
201                 specified drive.  Overrides OS2::Error() specified by 
202                 individual programs.  Given argument undef will
203                 disable redirection.  Has global effect, persists
204                 after the application exits.
205
206         New function OS2::SysInfo().  Returns a hash with system information.
207                 The keys of the hash are
208
209                 MAX_PATH_LENGTH, MAX_TEXT_SESSIONS, MAX_PM_SESSIONS,
210                 MAX_VDM_SESSIONS, BOOT_DRIVE, DYN_PRI_VARIATION,
211                 MAX_WAIT, MIN_SLICE, MAX_SLICE, PAGE_SIZE,
212                 VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION,
213                 MS_COUNT, TIME_LOW, TIME_HIGH, TOTPHYSMEM, TOTRESMEM,
214                 TOTAVAILMEM, MAXPRMEM, MAXSHMEM, TIMER_INTERVAL,
215                 MAX_COMP_LENGTH, FOREGROUND_FS_SESSION,
216                 FOREGROUND_PROCESS
217
218         New function OS2::BootDrive(force).  Returns a letter without colon.
219
220         New functions OS2::MorphPM(serve)/OS2::UnMorphPM(serve).  Transforms
221                 the current application into a PM application and back.
222                 The argument true means that a real message loop is
223                 going to be performed.
224         OS2::MorphPM() returns the PM message queue handle as an integer.
225
226         New function OS2::Serve_Messages(force).  Fake on-demand
227                 retrieval of outstanding PM messages.  If force is false,
228                 will not dispatch messages if a real message loop is known to
229                 be present.  Returns number of messages retrieved.
230         Dies with "QUITing..." if WM_QUIT message is obtained.
231
232         New function OS2::Process_Messages(force [, cnt]).  Retrieval
233                 of PM messages until window creation/destruction.  
234                 If force is false, will not dispatch messages 
235                 if a real message loop is known to be present.  
236                 Returns change in number of windows.  If cnt is given,
237                 it is incremented by the number of messages retrieved.
238         Dies with "QUITing..." if WM_QUIT message is obtained.
239
240 after 5.005_54:
241         Opening pipes from/to processes could fail if (un)appropriate
242         combination of STDIN/STDOUT was closed.
243  
244         If the only shell-metachars of a command are ' 2>&1' at the
245         end of a command, it is executed without calling the external shell.
246
247 after 5.005_57:
248         Make UDP sockets return correct caller address (OS2 API bug);
249         Enable TCPIPV4 defines (works with Warp 3 IAK too?!);
250         Force Unix-domain sockets to start with "/socket", convert
251           '/' to '\' in the calls;
252         Make C<system 1, $cmd> to treat $cmd as in C<system $cmd>;
253         Autopatch Configure;
254         Find name and location of g[nu]patch.exe;
255         Autocopy perl????.dll to t/ when testing;
256
257 after 5.005_62:
258         Extract a lightweight DLL access module OS2::DLL from OS2::REXX
259            which would not load REXX runtime system;
260         Allow compile with os2.h which loads os2tk.h instead of os2emx.h;
261         Put the version of EMX CRTL into -D define;
262         Use _setsyserror() to store last error of OS/2 API for $^E;
263         New macro PERL_SYS_INIT3(argvp, argcp, envp);
264         Make Dynaloader return info on the failing module after failed dl_open();
265         OS2::REXX test were done for interactive testing (were writing
266           "ok" to stderr);
267         system() and friends return -1 on failure (was 0xFF00);
268         Put the full name of executable into $^X
269           (alas, uppercased - but with /);
270         t/io/fs.t was failing on HPFS386;
271         Remove extra ';' from defines for MQ operations.
272
273 pre 5.6.1:
274         Resolved: "Bad free()" messages (e.g., from DB_File) with -Zomf build.
275            The reason was: when an extension DLL was linked, the order of
276            libraries was similar to this:
277                 f1.obj f2.obj libperl.lib -llibr1 -llibr2
278            (with C RTL implicitly after this).  When libperl.lib overrides
279            some C RTL functions, they are correctly resolved when mentioned
280            in f1.obj and f2.obj.  However, the resolution for libr1.lib and
281            libr2.lib is implementation-dependent.
282
283            With -Zomf linking the symbols are resolved for libr1.lib and
284            libr2.lib *only if* they reside in .obj-file-sections of libperl.lib
285            which were already "picked up" for symbols in f1.obj f2.obj.
286            However, libperl.lib is an import library for a .DLL, so *each
287            symbol in libperl.lib sits in its own pseudo-section*!
288
289            Corollary: only those symbol from libperl.lib which were already
290            mentioned in f1.obj f2.obj would be used for libr1.lib and
291            libr2.lib.  Example: if f1.obj f2.obj do not mention calloc() but
292            libr1.lib and libr2.lib do, then .lib's will get calloc() of C RTL,
293            not one of libperl.lib.
294
295            Solution: create a small duplicate of libperl.lib with overriding
296            symbols only.  Put it *after* -llibr1 -llibr2 on the link line.
297            Map strdup() and putenv() to Perl_strdup() and Perl_putenv()
298            inside this library.
299
300         Resolved: rmdir() and mkdir() do not accept trailing slashes.
301            Wrappers are implemented.
302         Resolved: when loading modules, FP mask may be erroneously changed by
303            _DLLInitTerm() (e.g., TCP32IP).
304                 Solutions: a) dlopen() saves/restores the FP mask.
305                            b) When starting, reset FP mask to a sane value
306                                 (if the DLL was compile-time linked).
307         New functions in package OS2:
308                 unsigned _control87(unsigned new,unsigned mask) # as in EMX
309                 unsigned get_control87()
310                 # with default values good for handling exception mask:
311                 unsigned set_control87_em(new=MCW_EM,mask=MCW_EM)
312             Needed to guard against other situations when the FP mask is
313             stompted upon.  Apparently, IBM used a compiler (for some period
314             of time around '95?) which changes FP mask right and left...
315         Resolved: $^X was always uppercased (cosmetic).  Solution:
316             use argv[0] if it differs from what the OS returns only in case.
317         Resolved: when creating PM message queues, WinCancelShutdown() was
318             not called even if the application said that it would not serve
319             messages in this queue.  Could result in PM refusing to shutdown.
320
321             Solution: resolve WinCancelShutdown at run time, keep the refcount
322             of who is going to serve the queue.
323         Resolved: Perl_Deregister_MQ() segfaulted (pid/tid not initialized).
324         Resolved: FillWinError() would not fetch the error.
325             Solution: resolve WinGetLastError at run time, call it.
326         Resolved: OS2::REXX would ignore arguments given to a Perl function
327             imported into the REXX compartment via REXX_eval_with().
328         Resolved: OS2::REXX would treat arguments given to a Perl function
329             imported into the REXX compartment via _register() as ASCIIZ
330             strings inside of binary strings.
331         Resolved: OS2::REXX did not document _register().
332         Resolved: OS2::REXX would not report the error to REXX if an error
333             condition appeared during a call to Perl function from REXX
334             compartment.  As a result, the return string was not initialized.
335         A complete example of a mini-application added to OS2::REXX.
336         README.os2 updated to reflect the current state of Perl.
337
338 pre 5.7.2:
339         aout build: kid bootstrap_* were not associated with XS.
340         bldlevel did not contain enough info.
341         extLibpath* was failing on the call of the second type.
342         Configure defines flushNULL now (EMX -Zomf bug broke autodetection).
343         Configure did not find SIGBREAK.
344         extLibpath supports LIBSTRICT, better error detection.
345         crypt() used if present in -lcrypt or -lufc.
346         dumb getpw*(), getgr*() etc. supported; as in EMX, but if no
347             $ENV{PW_PASSWD}, the passwd field contains a string which
348             cannot be returned by crypt() (for security reasons).
349         The unwound recursion in detecting executable by script was
350             using static buffers.  Thus system('pod2text') would fail if the
351             current directory contained an empty file named 'perl'.
352         Put ordinals in the base DLL.
353         Enable EXE-compression.
354             Load time (ms):  Without /e:2: 70.6; With /e:2: 75.3; Lxlite: 62.8
355             Size drops from 750K to 627K, with lxlite to 515K.
356             lxlite /c:max gives 488K, but dumps core in t/TEST
357         os2ish.h defines SYSLOG constants ==> Sys::Syslog works.
358         Corrected warnings related to OS/2 code.
359             At one place = was put instead of ==.
360         Setting $^E should work.
361         Force "SYS0dddd=0xbar: " to error messages and to dlerror().
362             ($^E == 2 printed SYS0002 itself, but 110 did not.)
363         $OS2::nsyserror=0 switches off forcing SYSdddd on $^E.
364         perl_.exe does not require PM dlls any more (symbols resolved at
365             runtime on the as needed basis).
366         OS2::Process:
367             get/set: term size; codepages; screen's cursor; screen's contents
368             reliable session name setting;
369             process's parent pid, and the session id;
370             switching to and enumeration of sessions
371             window hierarchy inspection
372             post a message to a window
373         More robust getpriority() on older Warps.
374
375         New C APIs for runtime loading of entry points from DLLs
376         (useful for entry points not present on older versions of
377         OS/2, or with DLLs not present on floppy-boot stripped down
378         setups): CallORD(), DeclFuncByORD(), DeclVoidFuncByORD(),
379         DeclOSFuncByORD(), DeclWinFuncByORD(), AssignFuncPByORD().
380
381 pre 5.7.3:
382         Testing with PERL_TEST_NOVREXX=1 in environment makes tests
383         noninteractive (VREXX test requires pressing a button on a dialog).
384
385         New (ugly and voodooish) hack to work around a bug in EMX
386         runtime architecture:
387
388           EMX.DLL is *not* initialized from its _DLL_InitTerm()
389           routine, but the initialization is postponed until
390           immediately before main() is called by the principal
391           executable (may be the initialization also happens during
392           InitTerm of -Zso -Zsys DLLs?).  The only reason I can see is
393           to postpone the initialization until the "layout" structure
394           is available, so the type of the executable is known.
395           [Instead, one should have broken the initialization into two
396           steps, with no-layout-known initialization ASAP, and the
397           finishing touch done when "layout" is known.]
398
399           It is due to this hack that -Zsys, -Zso etc. are needed so
400           often.
401
402           If during initialization of the Perl runtime environment we
403           discover that EMX environment is not set up completely, this
404           can be because of either our DLL being called from an
405           uncompatible flavor of EMX executable, or from an
406           unrelated-to-EMX.DLL (e.g., -Zsys or compiled with a
407           different compiler) executable.  In the first case only the
408           CRTL is not completely initialized, in the other case
409           EMX.DLL may be not initialized too.
410
411           We detect which of these two situations takes place, then
412           explicitly call the initialization entry points of EMX.DLL
413           and of CRT.  The large caveat is that the init-entry point
414           of EMX.DLL also moves the stack pointer (another defect of
415           EMX architecture, the init() and
416           set_exception_handlers_on_stack() entry points should have
417           been separated).  Thus we need some inline-assembler to
418           compensate for this, and need to remove the installed
419           exception handler - it is useless anyway, since exception
420           handlers need to be on the stack.  [This one is on the
421           stack, but will be overwritten on exit from the function.]
422
423           We also install an extra hack to run our atexit() handlers
424           on termination of the process (since the principal
425           executable does not know about *this* CRTL, we need to do it
426           ourselves - and longjmp() out of the chain of exception
427           handlers at a proper moment :-().
428
429         The net result: Perl DLL can be now used with an arbitrary
430         application.  PERLREXX DLL is provided which makes Perl usable
431         from any REXX-enabled application.
432
433         New test targets added to test how well Perl DLL runs with
434         different flavors of executables (see all_harness etc).  To
435         avoid waiting for the user button press, run with env
436         PERL_TEST_NOVREXX=1.
437
438         Another hack: on init of Perl runtime environment, the
439         executable is tested for being an aout EMX executable.  The
440         test is the same done by gdb, so although this test is very
441         voodoo, it should be pretty robust (the beginning of the
442         executable code - at 0x10000 - is tested for a known bit
443         pattern).  The result is used to set $OS2::can_fork, which is
444         eventually used to set $Config::Config{can_fork}.
445
446         REXX::eval_REXX() made reenterable.  ADDRESS PERLEVAL
447         available for the run REXX code.  PERLLASTERROR available.
448
449         A .map file is created for the .dll.  Now easier to debug the
450         failures which do not happen with a debugging executable.
451
452         Duplicate libperl.lib as perl.lib etc. to make Embed happier.
453
454         File::Spec better adjusted to OS/2 (still does not support aa:/dir/).
455
456         New module OS::Process::Const with necessary constants for the
457         Perl calls which mimic OS/2 API calls.
458
459 After @14577:
460         $Config{pager} better (but needs work in the binary installer!).
461
462         New API: OS2::DLLname([type], [\&sub])
463
464         New OS2::Process APIs:
465
466                  process_hwnd winTitle_set winTitle swTitle_set bothTitle_set
467                  hWindowPos hWindowPos_set DesktopWindow
468                  ActiveWindow_set
469                  EnableWindow EnableWindowUpdate IsWindowEnabled
470                  IsWindowVisible IsWindowShowing WindowPtr WindowULong
471                  WindowUShort SetWindowBits SetWindowPtr
472                  SetWindowULong
473                  SetWindowUShort MPFROMSHORT MPVOID MPFROMCHAR
474                  MPFROM2SHORT
475                  MPFROMSH2CH MPFROMLONG
476
477         OS::Process::Const symbols exportable from OS::Process too.
478
479         OS::Process: prototypes on subroutines which do not naturally
480         take "vectors" as arguments (not backwards compatible!).
481
482         New C API: SaveCroakWinError(), WinError_2_Perl_rc,
483         DeclWinFuncByORD_CACHE(), DeclWinFuncByORD_CACHE_survive(),
484         DeclWinFuncByORD_CACHE_resetError_survive(),
485         DeclWinFunc_CACHE(), DeclWinFunc_CACHE_resetError(),
486         DeclWinFunc_CACHE_survive(),
487         DeclWinFunc_CACHE_resetError_survive(); many new OS2 entry
488         points conveniently available via wrappers which will do the
489         necessary run-time dynalinking.
490
491 After @15047:
492
493         makes PerlIO preserve the binary/text mode of filehandles
494         chosen by CRT library.  (However, TTY handles still are not
495         clean, since switching them to TERMIO mode and back changes
496         the NL translation law at runtime, and PerlIO level does not
497         know this.)