Debian Codegraph @

contrib/z_os_notes

raw
1 [ From Tony Reyelts. ]
2
3 Building dmalloc on z/OS 1.3
4
5 After a few tries, I've boiled down the steps to building dmalloc
6 on z/OS to run under USS. Here's how:
7
8 1. Set the environment so Makefile generates a valid compile:
9
10 export DEFINES='-D_XOPEN_SOURCE_EXTENDED -Wc,"LANGLVL(ANSI)"
11
12 2. Run configure:
13
14 configure --prefix==/some/path --disable-cxx
15
16 Note: The default is to use C++, but the make failed with it
17 because the compiler expects the extension .C, not .cc. Since I
18 don't use C++, I disabled that part.
19
20 You'll get the following message from configure:
21
22 WARNING: The library has limited support for heaps
23 that grow down. Please see the NOTES file and
24 send the author mail.
25
26 3. Edit conf.h:
27
28 - Change HEAP_GROWS_UP to 1 from 0. For some reason, configure
29 thinks it grows down when it really doesn't.
30
31 4. Edit the Makefile:
32
33 - Unset $LIBS because cc won't link with it on the end of the
34 link command.
35
36 - Set LDFLAGS to "-L ./" so libdmalloc.a can be found.
37
38 5. Create a dummy ranlib (return 0) because z/OS doesn't have one.
39
40 6. Run make to build the code.
41
42 I got a compile warning for malloc.c assigning between "long *"
43 and "unsigned long *" at line 246. It looks like this is because
44 _dmalloc_address_seen_n (unsigned long *) is being passed as the
45 third argument to _dmalloc_environ_get (long *). The code seems to
46 work ok, so I didn't bother fixing this.
47
48 Using dmalloc on z/OS 1.3
49
50 1. dmalloc uses sbrk() to allocate storage. The sbrk() function on
51 z/OS only uses the primary allocation (vs. secondary), so the
52 primary has to be set to be big enough to hold eveything.
53
54 This is a Language Environment run-time option called HEAP. In
55 USS, you can set it with the _CEE_RUNOPTS environment variable.
56 For example, I used the following:
57
58 export_CEE_RUNOPTS="heap(64M,1M,ANY,FREE)"
59
60 2. The z/OS C compiler provides functions for doing MVS-specific
61 things such as allocating data sets. The easiest way to gain access
62 is to compile with -Wc,"LANGLVL(EXTENDED)" vs. -Wc,"LANGLVL(ANSI)".
63 This makes dmalloc.h think it is a non-ANSI compile (__STDC__ is not
64 set), so the definitions of malloc(), etc fall afoul of those from
65 stdlib.h. So, if you're using LANGLVL(EXTENDED), you'll need to
66 edit dmalloc.h so the ANSI version of DMALLOC_PNT is used.
67
68 3. The following functions are known to not be tracked by dmalloc on
69 z/OS 1.3. They apparently use their own storage scheme:
70
71 - glob()/globfree()
72 - wordexp()/wordfree()