View | Details | Raw Unified | Return to bug 208098 | Differences between
and this patch

Collapse All | Expand All

(-)shells/ksh93/Makefile (-13 / +11 lines)
Lines 12-50 Link Here
12
12
13
PORTNAME=	ksh93
13
PORTNAME=	ksh93
14
PORTVERSION=	${KSHVERSION:S/-//g}
14
PORTVERSION=	${KSHVERSION:S/-//g}
15
PORTREVISION=	2
16
CATEGORIES=	shells
15
CATEGORIES=	shells
17
MASTER_SITES=	http://www2.research.att.com/~astopen/download/tgz/ \
18
		LOCAL/sunpoet/${PORTNAME}
19
DISTFILES=	INIT.${INITVERSION}.tgz ast-ksh.${KSHVERSION}.tgz
20
DIST_SUBDIR=	${PORTNAME}
16
DIST_SUBDIR=	${PORTNAME}
21
17
22
MAINTAINER=	saper@saper.info
18
MAINTAINER=	saper@saper.info
23
COMMENT=	Official AT&T release of KornShell 93
19
COMMENT=	KornShell 93
24
20
25
LICENSE=	EPL
21
LICENSE=	EPL
26
22
23
BROKEN_aarch64=		Fails to compile: needs sbrk
24
25
USE_GITHUB=	yes
26
GH_ACCOUNT=	att
27
GH_PROJECT=	ast
28
GH_TAGNAME=	2f2b1b8
29
27
CONFLICTS=	ksh93-devel-*
30
CONFLICTS=	ksh93-devel-*
28
31
29
OPTIONS_DEFINE=	EXAMPLES STATIC
32
OPTIONS_DEFINE=	EXAMPLES STATIC
30
33
31
FETCH_ENV=	HTTP_AUTH=basic:*:I\ accept\ www.opensource.org/licenses/cpl:.
32
LDFLAGS+=	-lm
34
LDFLAGS+=	-lm
33
MAKE_ENV=	CCFLAGS="${CFLAGS}"
35
MAKE_ENV=	CCFLAGS="-Wno-unused-value -Wno-parentheses -Wno-logical-op-parentheses ${CFLAGS}"
34
NO_WRKSUBDIR=	yes
35
36
36
INITVERSION=	2013-05-24
37
KSHVERSION=	2014-12-24
37
KSHVERSION=	2012-08-01
38
38
39
STATIC_MAKE_ENV=	LDFLAGS+=-static
39
STATIC_MAKE_ENV=	LDFLAGS+=-static
40
40
41
BROKEN_aarch64=		Fails to compile: needs sbrk
42
43
post-patch:
41
post-patch:
44
	@${REINPLACE_CMD} -e 's|SF_FLAGS|SFIO_FLAGS|g' ${WRKSRC}/src/lib/libast/include/sfio*.h ${WRKSRC}/src/lib/libast/sfio/*.c
42
	@${REINPLACE_CMD} -e 's|SF_FLAGS|SFIO_FLAGS|g' ${WRKSRC}/src/lib/libast/include/sfio*.h ${WRKSRC}/src/lib/libast/sfio/*.c
45
43
46
do-build:
44
do-build:
47
	@cd ${WRKSRC}/ && ${SETENV} -i ${MAKE_ENV} ${SH} bin/package flat make
45
	@cd ${WRKSRC}/ && ${SETENV} -i ${MAKE_ENV} ${SH} bin/package flat make ksh93
48
46
49
do-install:
47
do-install:
50
	${INSTALL_PROGRAM} ${WRKSRC}/bin/ksh ${STAGEDIR}${PREFIX}/bin/ksh93
48
	${INSTALL_PROGRAM} ${WRKSRC}/bin/ksh ${STAGEDIR}${PREFIX}/bin/ksh93
(-)shells/ksh93/distinfo (-4 / +3 lines)
Lines 1-4 Link Here
1
SHA256 (ksh93/INIT.2013-05-24.tgz) = 118b2c8a4d651727fcd680289be69941d3045951bf9e3a4d45dcb42f0658f014
1
TIMESTAMP = 1552427297
2
SIZE (ksh93/INIT.2013-05-24.tgz) = 383979
2
SHA256 (ksh93/att-ast-20141224-2f2b1b8_GH0.tar.gz) = d765434739f228d2f01b3ba2192f7914ab99cc9ff537f522adff62dee8f27096
3
SHA256 (ksh93/ast-ksh.2012-08-01.tgz) = e6192cfa52a6a9fd20618cbaf3fa81f0cc9fd83525500757e83017275e962851
3
SIZE (ksh93/att-ast-20141224-2f2b1b8_GH0.tar.gz) = 26409895
4
SIZE (ksh93/ast-ksh.2012-08-01.tgz) = 2053532
(-)shells/ksh93/files/patch-src-lib-libast-features-wchar (-10 lines)
Removed Link Here
1
--- src/lib/libast/features/wchar.orig	2012-01-12 07:40:22 UTC
2
+++ src/lib/libast/features/wchar
3
@@ -51,6 +51,7 @@ endif
4
 run{
5
 cat <<!
6
 	#if _hdr_wchar && defined(_nxt_wchar)
7
+	#define _STDFILE_DECLARED
8
 	#include ${_nxt_wchar-_nxt_wchar}	/* the native wchar.h */
9
 	#endif
10
 
(-)shells/ksh93/files/patch-src-lib-libast-hash-hashalloc.c (-19 lines)
Removed Link Here
1
--- src/lib/libast/hash/hashalloc.c.orig	2006-11-07 22:29:04 UTC
2
+++ src/lib/libast/hash/hashalloc.c
3
@@ -151,7 +151,16 @@ hashalloc(Hash_table_t* ref, ...)
4
 				va_copy(*vp, ap);
5
 				vp++;
6
 			}
7
+#if __clang__ && __SIZEOF_POINTER__ == 4
8
+			{
9
+				va_list		np;
10
+
11
+				np = va_listval(va_arg(ap, va_listarg));
12
+				va_copy(ap, np);
13
+			}
14
+#else
15
 			va_copy(ap, va_listval(va_arg(ap, va_listarg)));
16
+#endif
17
 			break;
18
 		case 0:
19
 			if (vp > va)
(-)shells/ksh93/files/patch-src-lib-libast-string-tokscan.c (-19 lines)
Removed Link Here
1
--- src/lib/libast/string/tokscan.c.orig	2006-11-07 22:29:31 UTC
2
+++ src/lib/libast/string/tokscan.c
3
@@ -233,7 +233,16 @@ tokscan(register char* s, char** nxt, co
4
 			prv_f = f;
5
 			f = va_arg(ap, char*);
6
 			va_copy(prv_ap, ap);
7
+#if __clang__ && __SIZEOF_POINTER__ == 4
8
+			{
9
+				va_list		np;
10
+
11
+				np = va_listval(va_arg(ap, va_listarg));
12
+				va_copy(ap, np);
13
+			}
14
+#else
15
 			va_copy(ap, va_listval(va_arg(ap, va_listarg)));
16
+#endif
17
 			continue;
18
 		case 'c':
19
 			p_char = va_arg(ap, char*);
(-)shells/ksh93/files/patch-src_cmd_INIT_iffe.sh (-20 lines)
Removed Link Here
1
--- src/cmd/INIT/iffe.sh.orig	2013-03-06 16:33:17 UTC
2
+++ src/cmd/INIT/iffe.sh
3
@@ -3414,7 +3414,7 @@ $src
4
 						(eval "$src") <&$nullin || e=1
5
 						;;
6
 					mac*|nomac*)
7
-						if	compile $cc -E $tmp.c <&$nullin >$tmp.i
8
+						if	compile $cc -E -P $tmp.c <&$nullin >$tmp.i
9
 						then	sed -e '/<<[ 	]*".*"[ 	]*>>/!d' -e 's/<<[ 	]*"//g' -e 's/"[ 	]*>>//g' $tmp.i
10
 						else	e=1
11
 						fi
12
@@ -3705,7 +3705,7 @@ $inc
13
 <<\"#define $v\">>	$v	<<\"/* native $v */\">>
14
 <<\"#endif\">>
15
 #endif" > $tmp.c
16
-					if	compile $cc -E $tmp.c <&$nullin >$tmp.i
17
+					if	compile $cc -E -P $tmp.c <&$nullin >$tmp.i
18
 					then	sed -e '/<<[ 	]*".*"[ 	]*>>/!d' -e 's/<<[ 	]*"//g' -e 's/"[ 	]*>>//g' $tmp.i > $tmp.t
19
 						if	test -s $tmp.t
20
 						then	success
(-)shells/ksh93/files/patch-src_cmd_proto_proto.c (+18 lines)
Added Link Here
1
--- src/cmd/proto/proto.c.orig	2017-11-30 22:35:04 UTC
2
+++ src/cmd/proto/proto.c
3
@@ -396,6 +396,15 @@ proto(char* file, char* license, char* o
4
 
5
 #if !PROTO_STANDALONE
6
 #undef	error
7
+void
8
+error( int xit, const char *msg, ... )
9
+{
10
+	va_list ap;
11
+	va_start( ap, msg );
12
+	vfprintf( stderr, msg, ap );
13
+	va_end( ap );
14
+	exit( xit );
15
+}
16
 #endif
17
 
18
 typedef struct Sufcom_s
(-)shells/ksh93/files/patch-src_cmd_std_features_procfs (+36 lines)
Added Link Here
1
--- src/cmd/std/features/procfs.orig	2017-11-30 22:35:04 UTC
2
+++ src/cmd/std/features/procfs
3
@@ -1,6 +1,6 @@
4
 hdr	kvm,procinfo,pstat,asm/param
5
 
6
-sys	procfs,sysctl
7
+sys	procfs,sysctl,user
8
 
9
 lib	getprocs
10
 lib	kvm_open,kvm_getprocs kvm.h sys/time.h sys/param.h sys/proc.h sys/sysctl.h -lkvm
11
@@ -10,7 +10,11 @@ mem	extern_proc.p_pid,extern_proc.p_star
12
 mem	procsinfo64.pi_pri procinfo.h
13
 mem	prpsinfo.pr_clname,prpsinfo.pr_cstime,prpsinfo.pr_cstime.tv_sec,prpsinfo.pr_ctime,prpsinfo.pr_cutime,prpsinfo.pr_gid,prpsinfo.pr_lttydev,prpsinfo.pr_ntpid,prpsinfo.pr_pgid,prpsinfo.pr_pgrp,prpsinfo.pr_psargs,prpsinfo.pr_refcount,prpsinfo.pr_rssize,prpsinfo.pr_sid,prpsinfo.pr_sonproc,prpsinfo.pr_start,prpsinfo.pr_start.tv_sec,prpsinfo.pr_starttime,prpsinfo.pr_starttime.tv_sec,prpsinfo.pr_state,prpsinfo.pr_stime,prpsinfo.pr_tgrp,prpsinfo.pr_time,prpsinfo.pr_time.tv_sec,prpsinfo.pr_utime,prpsinfo.pr_zomb,prpsinfo.pr_pctcpu,prpsinfo.pr_cpu,prpsinfo.pr_lwp.pr_pctcpu,prpsinfo.pr_lwp.pr_cpu -D_STRUCTURED_PROC -Dprpsinfo=psinfo sys/types.h sys/procfs.h
14
 
15
+num	PIOCPSINFO
16
+
17
 typ	struct.prpsinfo -D_STRUCTURED_PROC -Dprpsinfo=psinfo sys/types.h sys/procfs.h
18
+typ	struct.kinfo_proc sys/types.h sys/procfs.h sys/user.h
19
+typ	struct.kp_proc sys/types.h sys/procfs.h sys/user.h
20
 
21
 tst	lib_info note{ info(2) kernel table api }end link{
22
 	#include <info.h>
23
@@ -587,11 +591,11 @@ cat{
24
 #define PSS_METHOD		PSS_METHOD_getprocs
25
 #endif
26
 
27
-#if !PSS_METHOD && defined(_PS_dir)
28
+#if !PSS_METHOD && defined(_PS_dir) && (_PS_scan_binary || _num_PIOCPSINFO)
29
 #define PSS_METHOD		PSS_METHOD_procfs
30
 #endif
31
 
32
-#if !PSS_METHOD && _hdr_kvm && _sys_sysctl && _lib_kvm_open && _lib_kvm_getprocs
33
+#if !PSS_METHOD && _hdr_kvm && _sys_sysctl && _lib_kvm_open && _lib_kvm_getprocs && _typ_struct_kinfo_proc && _typ_struct_kp_proc
34
 #define PSS_METHOD		PSS_METHOD_kvm
35
 #endif
36
 
(-)shells/ksh93/files/patch-src_cmd_std_pss-kvm.c (+12 lines)
Added Link Here
1
--- src/cmd/std/pss-kvm.c.orig	2017-11-30 22:35:04 UTC
2
+++ src/cmd/std/pss-kvm.c
3
@@ -43,6 +43,9 @@ NoN(pss_kvm)
4
 #if _sys_proc
5
 #include <sys/proc.h>
6
 #endif
7
+#if _sys_user
8
+#include <sys/user.h>
9
+#endif
10
 #include <sys/sysctl.h>
11
 #include <sys/tty.h>
12
 
(-)shells/ksh93/files/patch-src_lib_libast_comp_setlocale.c (+10 lines)
Added Link Here
1
--- src/lib/libast/comp/setlocale.c.orig	2017-11-30 22:35:04 UTC
2
+++ src/lib/libast/comp/setlocale.c
3
@@ -38,6 +38,7 @@
4
 #include <namval.h>
5
 #include <iconv.h>
6
 #include <codeset.h>
7
+#include <errno.h>
8
 
9
 #if ( _lib_wcwidth || _lib_wctomb ) && _hdr_wctype
10
 #include <wctype.h>
(-)shells/ksh93/files/patch-src_lib_libast_features_mmap (+191 lines)
Added Link Here
1
--- src/lib/libast/features/mmap.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/features/mmap
3
@@ -16,14 +16,7 @@ tst	lib_mmap note{ standard mmap interfa
4
 
5
 	#define Failed(file)	(remove(file),1)
6
 
7
-	int
8
-	#if _STD_
9
-	main(int argc, char** argv)
10
-	#else
11
-	main(argc,argv)
12
-	int     argc;
13
-	char**  argv;
14
-	#endif
15
+	int main(int argc, char** argv)
16
 	{
17
 		caddr_t		mm;
18
 		char		*file;
19
@@ -165,169 +158,18 @@ tst	lib_mmap64 -D_LARGEFILE64_SOURCE not
20
 	}
21
 }end
22
 
23
-tst	mmap_anon note{ use mmap MAP_ANON to get raw memory }end execute{
24
-	#if !_lib_mmap
25
-	(
26
-	#endif
27
-	#include <unistd.h>
28
-	#include <fcntl.h>
29
-	#include <sys/types.h>
30
-	#include <sys/mman.h>
31
-	#if defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
32
-	#define MAP_ANON	MAP_ANONYMOUS
33
-	#endif
34
-	int
35
-	main()
36
-	{	void	*addr;
37
-		addr = mmap(0,1024*1024,PROT_READ|PROT_WRITE,MAP_ANON|MAP_PRIVATE,-1,0);
38
-		return (addr && addr != (void*)(-1)) ? 0 : 1;
39
-	}
40
-}end
41
-
42
-tst	mmap_devzero note{ use mmap on /dev/zero to get raw memory }end execute{
43
-	#if !_lib_mmap
44
-	(
45
-	#endif
46
-	#include <unistd.h>
47
-	#include <fcntl.h>
48
-	#include <sys/types.h>
49
-	#include <sys/mman.h>
50
-	int
51
-	main()
52
-	{	int	fd;
53
-		void	*addr;
54
-		if((fd = open("/dev/zero", O_RDWR)) < 0)
55
-			return 1;
56
-		addr = mmap(0,1024*1024,PROT_READ|PROT_WRITE,MAP_PRIVATE,fd,0);
57
-		return (addr && addr != (void*)(-1)) ? 0 : 1;
58
-	}
59
-}end
60
-
61
-tst	-D_LARGEFILE64_SOURCE note{ mmap is worth using }end output{
62
-	#if !_lib_mmap
63
-	(
64
-	#endif
65
-	#include <unistd.h>
66
-	#include <fcntl.h>
67
-	#include <string.h>
68
-	#include <sys/types.h>
69
-	#include <sys/mman.h>
70
-	#include <sys/stat.h>
71
-	#include <sys/times.h>
72
-
73
-	#if _lib_mmap64
74
-	#undef	mmap
75
-	#define mmap	mmap64
76
-	#endif
77
-
78
-	#if _lib_munmap64
79
-	#undef	munmap
80
-	#define munmap	munmap64
81
-	#endif
82
-	
83
-	#define MAPSIZE (64*1024)
84
-	#define BUFSIZE	(MAPSIZE/8)
85
-	#define WRITE   (64)
86
-	#define RUN	(64)
87
-	
88
-	#define Failed(file)	(remove(file),1)
89
-	
90
-	int
91
-	#if _STD_
92
-	main(int argc, char** argv)
93
-	#else
94
-	main(argc,argv)
95
-	int     argc;
96
-	char**  argv;
97
-	#endif
98
-	{
99
-		caddr_t		mm;
100
-		char		*file, *t;
101
-		int		i, fd, k, run;
102
-		char		buf[MAPSIZE];
103
-		struct tms	stm, etm;
104
-		clock_t		rdtm, mmtm;
105
-	
106
-		file = argv[1];
107
-		if ((fd = open(file, O_CREAT|O_TRUNC|O_WRONLY, 0666)) < 0)
108
-			return 1;
109
-	
110
-		for (i = 0; i < sizeof(buf); ++i)
111
-			buf[i] = '0' + (i%10);
112
-		for (i = 0; i < WRITE; ++i)
113
-			if (write(fd,buf,sizeof(buf)) != sizeof(buf))
114
-				return Failed(file);
115
-		close(fd);
116
-	
117
-		/* read time */
118
-		times(&stm);
119
-		for(run = 0; run < RUN; ++run)
120
-		{	if((fd = open(file, O_RDWR)) < 0)
121
-				return Failed(file);
122
-			for (i = 0; i < WRITE; ++i)
123
-			{	for(k = 0; k < MAPSIZE; k += BUFSIZE)
124
-					if (read(fd,buf,BUFSIZE) != BUFSIZE)
125
-						return Failed(file);
126
-			}
127
-			close(fd);
128
-		}
129
-		times(&etm);
130
-		rdtm = (etm.tms_utime-stm.tms_utime) + (etm.tms_stime-stm.tms_stime);
131
-	
132
-		/* mmap time */
133
-		times(&stm);
134
-		for(run = 0; run < RUN; ++run)
135
-		{	if ((fd = open(file, O_RDWR)) < 0)
136
-				return Failed(file);
137
-			for(i = 0, mm = (caddr_t)0; i < WRITE; ++i)
138
-			{	if(mm)
139
-					munmap(mm, MAPSIZE);
140
-				mm = (caddr_t)mmap((caddr_t)0, MAPSIZE,
141
-						   (PROT_READ|PROT_WRITE),
142
-						   MAP_PRIVATE, fd, i*MAPSIZE );
143
-				if(mm == (caddr_t)(-1) || mm == (caddr_t)0)
144
-					return Failed(file);
145
-	
146
-				/* the memcpy is < BUFSIZE to simulate the
147
-				   fact that functions like sfreserve/sfgetr do
148
-				   not do buffer copying.
149
-				*/
150
-				t = (char*)mm;
151
-				for(k = 0; k < MAPSIZE; k += BUFSIZE, t += BUFSIZE)
152
-					memcpy(buf,t,(3*BUFSIZE)/4);
153
-			}
154
-			close(fd);
155
-		}
156
-		times(&etm);
157
-		mmtm = (etm.tms_utime-stm.tms_utime) + (etm.tms_stime-stm.tms_stime);
158
-
159
-		remove(file);
160
-	
161
-		if(4*mmtm <= 3*rdtm)
162
-			printf("#define _mmap_worthy	2	/* mmap outperforms read on 64Ki buffers -- use it */\n");
163
-		else if(4*mmtm <= 5*rdtm)
164
-			printf("#define _mmap_worthy	2	/* mmap is slightly better than read on 64Ki buffers -- use it */\n");
165
-		else
166
-			printf("#define _mmap_worthy	2	/* mmap worse than read on 64Ki buffers -- use it anyway */\n");
167
-
168
-		return 0;
169
-	}
170
-}end
171
-
172
 cat{
173
+        /* assume MAP_ANON works */
174
+        #define _mmap_anon 1
175
 
176
 	/* some systems get it wrong but escape concise detection */
177
-	#ifndef _NO_MMAP
178
 	#if __CYGWIN__
179
 	#define _NO_MMAP	1
180
 	#endif
181
-	#endif
182
 
183
 	#if _NO_MMAP
184
 	#undef	_lib_mmap
185
 	#undef	_lib_mmap64
186
-	#undef	_mmap_anon
187
-	#undef	_mmap_devzero
188
-	#undef	_mmap_worthy
189
+	#undef  _mmap_anon
190
 	#endif
191
 }end
(-)shells/ksh93/files/patch-src_lib_libast_features_standards (+23 lines)
Added Link Here
1
--- src/lib/libast/features/standards.orig	2017-11-30 22:35:04 UTC
2
+++ src/lib/libast/features/standards
3
@@ -1,5 +1,19 @@
4
 set stdio
5
-if tst note{ _GNU_SOURCE works }end compile{
6
+# In FreeBSD, definitions like _POSIX_SOURCE and such are used to *limit*
7
+# functionality to known API; they don't enable anything. The general intent in
8
+# BSD is to enable everything by default (effectively, providing the
9
+# _KITCHEN_SINK_SOURCE mentioned below). So we look for that here, but stay
10
+# careful that we don't get fooled by presence of FreeBSD that underpins some
11
+# subsystems in Mac OS X; there are other Apple-specific portability hacks
12
+# elsewhere we should not interfere with.
13
+if tst note{ FreeBSD }end compile{
14
+		#include <sys/param.h>
15
+		#if !defined(__FreeBSD__) || defined(APPLE)
16
+		#error not a FreeBSD system
17
+		#endif
18
+	}end {
19
+	}
20
+elif tst note{ _GNU_SOURCE works }end compile{
21
 		#define _GNU_SOURCE 1
22
 		#include <sys/types.h>
23
 		#include <sys/stat.h>
(-)shells/ksh93/files/patch-src_lib_libast_features_vmalloc (+10 lines)
Added Link Here
1
--- src/lib/libast/features/vmalloc.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/features/vmalloc
3
@@ -217,7 +217,4 @@ cat{
4
 	#if _mmap_anon
5
 	#define _mem_mmap_anon	1
6
 	#endif
7
-	#if _mmap_devzero
8
-	#define _mem_mmap_zero	1
9
-	#endif
10
 }end
(-)shells/ksh93/files/patch-src_lib_libast_features_wchar (+10 lines)
Added Link Here
1
--- src/lib/libast/features/wchar.orig	2017-11-30 22:35:04 UTC
2
+++ src/lib/libast/features/wchar
3
@@ -6,6 +6,7 @@ set	include .
4
 cat{
5
 	#ifndef _AST_WCHAR_H
6
 	#define _AST_WCHAR_H	1
7
+	#define _STDFILE_DECLARED
8
 }end
9
 
10
 lib	mbstowcs,wctomb,wcscmp,wcscoll,wcslen,wcstombs,wcsxfrm,wcwidth stdlib.h stdio.h wchar.h
(-)shells/ksh93/files/patch-src_lib_libast_port_astcopy.c (+17 lines)
Added Link Here
1
--- src/lib/libast/port/astcopy.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/port/astcopy.c
3
@@ -30,14 +30,10 @@
4
 #include <ast.h>
5
 #include <ast_mmap.h>
6
 
7
-#if _mmap_worthy > 1
8
-
9
 #include <ls.h>
10
 
11
 #define MAPSIZE		(1024*256)
12
 
13
-#endif
14
-
15
 #undef	BUFSIZ
16
 #define BUFSIZ		4096
17
 
(-)shells/ksh93/files/patch-src_lib_libast_sfio_sfclose.c (+14 lines)
Added Link Here
1
--- src/lib/libast/sfio/sfclose.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/sfio/sfclose.c
3
@@ -104,11 +104,9 @@ Sfio_t*	f;
4
 
5
 	if(f->data && (!local || (f->flags&SF_STRING) || (f->bits&SF_MMAP) ) )
6
 	{	/* free buffer */
7
-#if _mmap_worthy
8
 		if(f->bits&SF_MMAP)
9
 			SFMUNMAP(f,f->data,f->endb-f->data);
10
 		else
11
-#endif
12
 		if(f->flags&SF_MALLOC)
13
 			data = (Void_t*)f->data;
14
 
(-)shells/ksh93/files/patch-src_lib_libast_sfio_sfhdr.h (+12 lines)
Added Link Here
1
--- src/lib/libast/sfio/sfhdr.h.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/sfio/sfhdr.h
3
@@ -209,9 +209,6 @@
4
 
5
 /* see if we can use memory mapping for io */
6
 #if _LARGEFILE64_SOURCE && !_lib_mmap64
7
-#undef _mmap_worthy
8
-#endif
9
-#if !_mmap_worthy
10
 #undef _hdr_mman
11
 #undef _sys_mman
12
 #endif
(-)shells/ksh93/files/patch-src_lib_libast_sfio_sfmode.c (+45 lines)
Added Link Here
1
--- src/lib/libast/sfio/sfmode.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/sfio/sfmode.c
3
@@ -404,7 +404,6 @@ reg int		local;	/* a local call */
4
 
5
 	if(f->mode&SF_GETR)
6
 	{	f->mode &= ~SF_GETR;
7
-#if _mmap_worthy
8
 		if(f->bits&SF_MMAP)
9
 		{
10
 			if (!++f->ngetr)
11
@@ -415,7 +414,6 @@ reg int		local;	/* a local call */
12
 				f->ngetr = f->tiny[0] = 0;
13
 			}
14
 		}
15
-#endif
16
 		if(f->getr)
17
 		{	f->next[-1] = f->getr;
18
 			f->getr = 0;
19
@@ -519,12 +517,10 @@ reg int		local;	/* a local call */
20
 			if((f->flags&(SF_SHARE|SF_PUBLIC)) == (SF_SHARE|SF_PUBLIC) &&
21
 			   (addr = SFSK(f,0,SEEK_CUR,f->disc)) != f->here)
22
 			{
23
-#if _mmap_worthy
24
 				if((f->bits&SF_MMAP) && f->data)
25
 				{	SFMUNMAP(f,f->data,f->endb-f->data);
26
 					f->data = NIL(uchar*);
27
 				}
28
-#endif
29
 				f->endb = f->endr = f->endw = f->next = f->data;
30
 				f->here = addr;
31
 			}
32
@@ -567,13 +563,11 @@ reg int		local;	/* a local call */
33
 		}
34
 
35
 		f->mode = SF_WRITE|SF_LOCK;
36
-#if _mmap_worthy
37
 		if(f->bits&SF_MMAP)
38
 		{	if(f->data)
39
 				SFMUNMAP(f,f->data,f->endb-f->data);
40
 			(void)SFSETBUF(f,(Void_t*)f->tiny,(size_t)SF_UNBOUND);
41
 		}
42
-#endif
43
 		if(f->data == f->tiny)
44
 		{	f->endb = f->data = f->next = NIL(uchar*);
45
 			f->size = 0;
(-)shells/ksh93/files/patch-src_lib_libast_sfio_sfpurge.c (+18 lines)
Added Link Here
1
--- src/lib/libast/sfio/sfpurge.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/sfio/sfpurge.c
3
@@ -54,7 +54,6 @@ Sfio_t*	f;
4
 	SFLOCK(f,0);
5
 
6
 	/* if memory map must be a read stream, pretend data is gone */
7
-#if _mmap_worthy
8
 	if(f->bits&SF_MMAP)
9
 	{	f->here -= f->endb - f->next;
10
 		if(f->data)
11
@@ -64,7 +63,6 @@ Sfio_t*	f;
12
 		SFOPEN(f,0);
13
 		SFMTXRETURN(f, 0);
14
 	}
15
-#endif
16
 
17
 	switch(f->mode&~SF_LOCK)
18
 	{
(-)shells/ksh93/files/patch-src_lib_libast_sfio_sfrd.c (+31 lines)
Added Link Here
1
--- src/lib/libast/sfio/sfrd.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/sfio/sfrd.c
3
@@ -92,12 +92,10 @@ Sfdisc_t*	disc;
4
 			{	f->endb = f->next = f->endr = f->data;
5
 				f->mode &= ~SF_SYNCED;
6
 			}
7
-#if _mmap_worthy
8
 			if((f->bits&SF_MMAP) && f->data)
9
 			{	SFMUNMAP(f, f->data, f->endb-f->data);
10
 				f->data = NIL(uchar*);
11
 			}
12
-#endif
13
 			f->next = f->endb = f->endr = f->endw = f->data;
14
 		}
15
 	}
16
@@ -132,7 +130,6 @@ Sfdisc_t*	disc;
17
 			}
18
 		}
19
 
20
-#if _mmap_worthy
21
 		if(f->bits&SF_MMAP)
22
 		{	reg ssize_t	a, round;
23
 			sfstat_t	st;
24
@@ -230,7 +227,6 @@ Sfdisc_t*	disc;
25
 				}
26
 			}
27
 		}
28
-#endif
29
 
30
 		/* sync unseekable write streams to prevent deadlock */
31
 		if(!dosync && f->extent < 0)
(-)shells/ksh93/files/patch-src_lib_libast_sfio_sfseek.c (+43 lines)
Added Link Here
1
--- src/lib/libast/sfio/sfseek.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/sfio/sfseek.c
3
@@ -34,12 +34,10 @@ Sfio_t*	f;
4
 Sfoff_t p;
5
 #endif
6
 {
7
-#if _mmap_worthy
8
 	if((f->bits&SF_MMAP) && f->data)
9
 	{	SFMUNMAP(f, f->data, f->endb-f->data);
10
 		f->data = NIL(uchar*);
11
 	}
12
-#endif
13
 	f->next = f->endr = f->endw = f->data;
14
 	f->endb = (f->mode&SF_WRITE) ? f->data+f->size : f->data;
15
 	if((f->here = p) < 0)
16
@@ -201,23 +199,13 @@ int	type;	/* 0: from org, 1: from here, 
17
 	if((p += type == SEEK_CUR ? s : 0) < 0)
18
 		goto done;
19
 
20
-#if _mmap_worthy
21
 	if(f->bits&SF_MMAP)
22
 	{	/* if mmap is not great, stop mmaping if moving around too much */
23
-#if _mmap_worthy < 2
24
-		if((f->next - f->data) < ((f->endb - f->data)/4) )
25
-		{	SFSETBUF(f,(Void_t*)f->tiny,(size_t)SF_UNBOUND);
26
-			hardseek = 1; /* this forces a hard seek below */
27
-		}
28
-		else
29
-#endif
30
-		{	/* for mmap, f->here can be virtual except for hardseek */
31
-			newpos(f,p);
32
-			if(!hardseek)
33
-				goto done;
34
-		}
35
+		/* for mmap, f->here can be virtual except for hardseek */
36
+		newpos(f,p);
37
+		if(!hardseek)
38
+			goto done;
39
 	}
40
-#endif
41
 
42
 	if(f->endb > f->next)
43
 	{	/* reduce wastage in future buffer fillings */
(-)shells/ksh93/files/patch-src_lib_libast_sfio_sfsetbuf.c (+34 lines)
Added Link Here
1
--- src/lib/libast/sfio/sfsetbuf.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/sfio/sfsetbuf.c
3
@@ -302,7 +302,6 @@ size_t	size;	/* buffer size, -1 for defa
4
 	okmmap = (buf || (f->flags&SF_STRING) || (f->flags&SF_RDWR) == SF_RDWR) ? 0 : 1;
5
 
6
 	/* save old buffer info */
7
-#if _mmap_worthy
8
 	if(f->bits&SF_MMAP)
9
 	{	if(f->data)
10
 		{	if(f->getr && (f->mode&SF_GETR) && f->next)
11
@@ -311,7 +310,6 @@ size_t	size;	/* buffer size, -1 for defa
12
 			f->data = NIL(uchar*);
13
 		}
14
 	} else
15
-#endif
16
 	if(f->data == f->tiny)
17
 	{	f->data = NIL(uchar*);
18
 		f->size = 0;
19
@@ -438,7 +436,6 @@ size_t	size;	/* buffer size, -1 for defa
20
 		}
21
 	}
22
 
23
-#if _mmap_worthy
24
 	if(okmmap && size && (f->mode&SF_READ) && f->extent >= 0 )
25
 	{	/* see if we can try memory mapping */
26
 		if(!disc)
27
@@ -457,7 +454,6 @@ size_t	size;	/* buffer size, -1 for defa
28
 			}
29
 		}
30
 	}
31
-#endif
32
 
33
 	/* get buffer space */
34
 setbuf:
(-)shells/ksh93/files/patch-src_lib_libast_sfio_sfsetfd.c (+15 lines)
Added Link Here
1
--- src/lib/libast/sfio/sfsetfd.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/sfio/sfsetfd.c
3
@@ -108,12 +108,10 @@ int	newfd;
4
 					SFMTXRETURN(f, -1);
5
 				}
6
 
7
-#if _mmap_worthy
8
 				if((f->bits&SF_MMAP) && f->data)
9
 				{	SFMUNMAP(f,f->data,f->endb-f->data);
10
 					f->data = NIL(uchar*);
11
 				}
12
-#endif
13
 
14
 				/* make stream appears uninitialized */
15
 				f->endb = f->endr = f->endw = f->data;
(-)shells/ksh93/files/patch-src_lib_libast_sfio_sfsize.c (+15 lines)
Added Link Here
1
--- src/lib/libast/sfio/sfsize.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/sfio/sfsize.c
3
@@ -80,12 +80,10 @@ Sfio_t*	f;
4
 
5
 	if(f->here != s && (f->mode&SF_READ) )
6
 	{	/* buffered data is known to be invalid */
7
-#if _mmap_worthy
8
 		if((f->bits&SF_MMAP) && f->data)
9
 		{	SFMUNMAP(f,f->data,f->endb-f->data);
10
 			f->data = NIL(uchar*);
11
 		}
12
-#endif
13
 		f->next = f->endb = f->endr = f->endw = f->data;
14
 	}
15
 
(-)shells/ksh93/files/patch-src_lib_libast_sfio_sfsk.c (+15 lines)
Added Link Here
1
--- src/lib/libast/sfio/sfsk.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/sfio/sfsk.c
3
@@ -49,12 +49,10 @@ Sfdisc_t*	disc;
4
 			SFMTXRETURN(f, (Sfoff_t)(-1));
5
 		if(SFSYNC(f) < 0)
6
 			SFMTXRETURN(f, (Sfoff_t)(-1));
7
-#if _mmap_worthy
8
 		if(f->mode == SF_READ && (f->bits&SF_MMAP) && f->data)
9
 		{	SFMUNMAP(f, f->data, f->endb-f->data);
10
 			f->data = NIL(uchar*);
11
 		}
12
-#endif
13
 		f->next = f->endb = f->endr = f->endw = f->data;
14
 	}
15
 
(-)shells/ksh93/files/patch-src_lib_libast_string_strexpr.c (+87 lines)
Added Link Here
1
--- src/lib/libast/string/strexpr.c.orig	2017-11-30 22:35:04 UTC
2
+++ src/lib/libast/string/strexpr.c
3
@@ -44,7 +44,7 @@
4
 #define peekchr(ex)	(*(ex)->nextchr)
5
 #define ungetchr(ex)	((ex)->nextchr--)
6
 
7
-#define error(ex,msg)	return(seterror(ex,msg))
8
+#define err(ex,msg)	return(seterror(ex,msg))
9
 
10
 typedef struct				/* expression handle		*/
11
 {
12
@@ -87,7 +87,7 @@ expr(register Expr_t* ex, register int p
13
 	case 0:
14
 		ungetchr(ex);
15
 		if (!precedence) return(0);
16
-		error(ex, "more tokens expected");
17
+		err(ex, "more tokens expected");
18
 	case '-':
19
 		n = -expr(ex, 13);
20
 		break;
21
@@ -113,17 +113,17 @@ expr(register Expr_t* ex, register int p
22
 		case 0:
23
 			goto done;
24
 		case ')':
25
-			if (!precedence) error(ex, "too many )'s");
26
+			if (!precedence) err(ex, "too many )'s");
27
 			goto done;
28
 		case '(':
29
 			n = expr(ex, 1);
30
 			if (getchr(ex) != ')')
31
 			{
32
 				ungetchr(ex);
33
-				error(ex, "closing ) expected");
34
+				err(ex, "closing ) expected");
35
 			}
36
 		gotoperand:
37
-			if (operand) error(ex, "operator expected");
38
+			if (operand) err(ex, "operator expected");
39
 			operand = 1;
40
 			continue;
41
 		case '?':
42
@@ -140,7 +140,7 @@ expr(register Expr_t* ex, register int p
43
 				if (getchr(ex) != ':')
44
 				{
45
 					ungetchr(ex);
46
-					error(ex, ": expected for ? operator");
47
+					err(ex, ": expected for ? operator");
48
 				}
49
 				if (n)
50
 				{
51
@@ -189,7 +189,7 @@ expr(register Expr_t* ex, register int p
52
 			break;
53
 		case '=':
54
 		case '!':
55
-			if (peekchr(ex) != '=') error(ex, "operator syntax error");
56
+			if (peekchr(ex) != '=') err(ex, "operator syntax error");
57
 			if (precedence > 7) goto done;
58
 			getchr(ex);
59
 			x = expr(ex, 8);
60
@@ -237,7 +237,7 @@ expr(register Expr_t* ex, register int p
61
 			if (precedence > 11) goto done;
62
 			x = expr(ex, 12);
63
 			if (c == '*') n *= x;
64
-			else if (x == 0) error(ex, "divide by zero");
65
+			else if (x == 0) err(ex, "divide by zero");
66
 			else if (c == '/') n /= x;
67
 			else n %= x;
68
 			break;
69
@@ -246,15 +246,15 @@ expr(register Expr_t* ex, register int p
70
 			pos = --ex->nextchr;
71
 			if (isdigit(c)) n = strton(ex->nextchr, &ex->nextchr, NiL, 0);
72
 			else if (ex->convert) n = (*ex->convert)(ex->nextchr, &ex->nextchr, ex->handle);
73
-			if (ex->nextchr == pos) error(ex, "syntax error");
74
+			if (ex->nextchr == pos) err(ex, "syntax error");
75
 			goto gotoperand;
76
 		}
77
 		if (ex->errmsg) return(0);
78
-		if (!operand) error(ex, "operand expected");
79
+		if (!operand) err(ex, "operand expected");
80
 	}
81
  done:
82
 	ungetchr(ex);
83
-	if (!operand) error(ex, "operand expected");
84
+	if (!operand) err(ex, "operand expected");
85
 	return(n);
86
 }
87
 
(-)shells/ksh93/files/patch-src_lib_libast_vmalloc_malloc.c (+20 lines)
Added Link Here
1
--- src/lib/libast/vmalloc/malloc.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/vmalloc/malloc.c
3
@@ -906,7 +906,7 @@ union Alloca_u
4
 	{	char*		addr;
5
 		Alloca_t*	next;
6
 	} head;
7
-	char	array[ALIGN];
8
+	char	array[MEM_ALIGN];
9
 };
10
 struct Alloca_s
11
 {	union Alloca_u	head;
12
@@ -914,7 +914,7 @@ struct Alloca_s
13
 };
14
 
15
 extern Void_t* alloca(size_t size)
16
-{	char		array[ALIGN];
17
+{	char		array[MEM_ALIGN];
18
 	char*		file;
19
 	int		line;
20
 	Void_t*		func;
(-)shells/ksh93/files/patch-src_lib_libast_vmalloc_vmbest.c (+101 lines)
Added Link Here
1
--- src/lib/libast/vmalloc/vmbest.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/vmalloc/vmbest.c
3
@@ -64,19 +64,19 @@ void _STUB_vmbest(){}
4
 #define	PK_ALLOW	128	/* min #packs allowed to be created	*/
5
 
6
 /* Small requests are rounded to 0%SM_RNDx */
7
-#define SM_RND0	(1*ALIGN)	/* round value:  1*ALIGN  ==   16	*/
8
+#define SM_RND0	(1*MEM_ALIGN)	/* round value:  1*MEM_ALIGN  ==   16	*/
9
 #define SM_BIT0	4		/* (1<<SM_BIT0) == SM_RND0		*/
10
 #define SM_CNT0	16	   	/* # caches as rounded by SM_RND0	*/
11
 #define SM_IDX0	0		/* starting cache index of this group	*/
12
 #define SM_MAX0	(SM_CNT0*SM_RND0)
13
 	
14
-#define SM_RND1	(2*ALIGN)	/* round value:  2*ALIGN  ==   32	*/
15
+#define SM_RND1	(2*MEM_ALIGN)	/* round value:  2*MEM_ALIGN  ==   32	*/
16
 #define SM_CNT1	8
17
 #define SM_BIT1	5
18
 #define SM_IDX1	(SM_IDX0+SM_CNT0)
19
 #define SM_MAX1	(SM_MAX0 + SM_CNT1*SM_RND1)
20
 
21
-#define SM_RND2	(4*ALIGN)	/* round value:  4*ALIGN  ==   64	*/
22
+#define SM_RND2	(4*MEM_ALIGN)	/* round value:  4*MEM_ALIGN  ==   64	*/
23
 #define SM_BIT2	6
24
 #define SM_CNT2	8
25
 #define SM_IDX2	(SM_IDX1+SM_CNT1)
26
@@ -167,7 +167,7 @@ static int chktree(Pack_t* pack, Block_t
27
 	if(_Vmassert & VM_check_reg)
28
 	{	if(!node) /* the empty tree is always good */
29
 			return 0;
30
-		/**/DEBUG_ASSERT(BDSZ(node) >= BODYSIZE && (BDSZ(node)%ALIGN) == 0 );
31
+		/**/DEBUG_ASSERT(BDSZ(node) >= BODYSIZE && (BDSZ(node)%MEM_ALIGN) == 0 );
32
 
33
 		if(SIZE(node) & (BUSY|PFREE)) /* should be BITS-free */
34
 			{ /**/DEBUG_MESSAGE("Free block corrupted"); /**/DEBUG_ASSERT(0); return -1; }
35
@@ -252,7 +252,7 @@ static int bestfree(Vmalloc_t* vm, Void_
36
 	if((Vmuchar_t*)data < vm->data->segmin || (Vmuchar_t*)data >= vm->data->segmax)
37
 		return -1;
38
 
39
-	blk = BLOCK(data); /**/DEBUG_ASSERT((SIZE(blk)&BUSY) && (BDSZ(blk)%ALIGN) == 0 );
40
+	blk = BLOCK(data); /**/DEBUG_ASSERT((SIZE(blk)&BUSY) && (BDSZ(blk)%MEM_ALIGN) == 0 );
41
 	pack = PACK(blk); /**/DEBUG_ASSERT(pack->best == (Vmbest_t*)vm->data);
42
 	if((sz = SIZE(blk))&SMALL )
43
 		listp = &pack->small[SMDECODE(sz)].free;
44
@@ -339,7 +339,7 @@ static Block_t* bestpackextend(Vmalloc_t
45
 
46
 	/**/DEBUG_ASSERT(!wild || (PACK(wild) == pack && BDSZ(wild) < size && PACKWILD(pack,wild)) );
47
 	blkz = BDSZ(pack->pblk); /**/DEBUG_ASSERT(blkz >= _Vmpagesize);
48
-	size += blkz - (wild ? BDSZ(wild) : 0) + EXTRA(pack); /**/DEBUG_ASSERT(size%ALIGN == 0);
49
+	size += blkz - (wild ? BDSZ(wild) : 0) + EXTRA(pack); /**/DEBUG_ASSERT(size%MEM_ALIGN == 0);
50
 	if(_Vmassert & VM_debug) debug_printf(2, "%s:%d: PACK(%p) WILD(%p)=%zd BDSZ(%p)=%zd blkz=%zd size=%zu\n", __FILE__, __LINE__, pack, wild, wild ? BDSZ(wild) : 0, pack->pblk, BDSZ(pack->pblk), blkz, size);
51
 	if(!(pblk = (*_Vmsegalloc)(vm, pack->pblk, size, segtype)) )
52
 		pblk = pack->pblk;
53
@@ -383,7 +383,7 @@ static Block_t* bestpackextract(Pack_t* 
54
 
55
 	l = r = &link;
56
 	if((root = pack->root) ) do /* top-down splay tree search */
57
-	{	/**/DEBUG_ASSERT((size%ALIGN) == 0 && !(SIZE(root)&(BUSY|PFREE)) );
58
+	{	/**/DEBUG_ASSERT((size%MEM_ALIGN) == 0 && !(SIZE(root)&(BUSY|PFREE)) );
59
 		if(size == (sz = BDSZ(root)) )
60
 			break;
61
 		if(size < sz)
62
@@ -508,7 +508,7 @@ static int bestlistreclaim(Vmalloc_t* vm
63
 			continue;
64
 
65
 		/**/DEBUG_ASSERT((SIZE(fp)&(BUSY|MARK)) == (BUSY|MARK) );
66
-		/**/DEBUG_ASSERT(BDSZ(fp) >= sizeof(Body_t) && BDSZ(fp)%ALIGN == 0);
67
+		/**/DEBUG_ASSERT(BDSZ(fp) >= sizeof(Body_t) && BDSZ(fp)%MEM_ALIGN == 0);
68
 		SIZE(fp) &= ~BITS; 
69
 		t = NEXT(fp);
70
 		SIZE(t) |= PFREE; /**/DEBUG_ASSERT(SIZE(NEXT(fp))&BUSY);
71
@@ -563,7 +563,7 @@ static Block_t* bestpackalloc(Vmalloc_t*
72
 	ssize_t		sz;
73
 	Block_t		*tp, *np, *pblk;
74
 	Vmbest_t	*best = (Vmbest_t*)vm->data;
75
-	/**/DEBUG_ASSERT(size >= sizeof(Body_t) && size%ALIGN == 0);
76
+	/**/DEBUG_ASSERT(size >= sizeof(Body_t) && size%MEM_ALIGN == 0);
77
 
78
 	if((tp = pack->alloc) ) /* fast allocation from recent memory */
79
 	{	pack->alloc = NIL(Block_t*);
80
@@ -719,9 +719,9 @@ static Void_t* bestalloc(Vmalloc_t* vm, 
81
 	asospindecl();
82
 
83
 	/**/DEBUG_COUNT(N_alloc);
84
-	/**/DEBUG_ASSERT((ALIGN%(BITS+1)) == 0 );
85
-	/**/DEBUG_ASSERT((sizeof(Head_t)%ALIGN) == 0 );
86
-	/**/DEBUG_ASSERT((sizeof(Body_t)%ALIGN) == 0 );
87
+	/**/DEBUG_ASSERT((MEM_ALIGN%(BITS+1)) == 0 );
88
+	/**/DEBUG_ASSERT((sizeof(Head_t)%MEM_ALIGN) == 0 );
89
+	/**/DEBUG_ASSERT((sizeof(Body_t)%MEM_ALIGN) == 0 );
90
 	/**/DEBUG_ASSERT(sizeof(Block_t) == (sizeof(Body_t)+sizeof(Head_t)) );
91
 	/**/DEBUG_ASSERT(chkregion((Vmbest_t*)vm->data, local) >= 0);
92
 
93
@@ -902,7 +902,7 @@ static Void_t* bestalign(Vmalloc_t* vm, 
94
 		return NIL(Void_t*);
95
 
96
 	algz = LGROUND(size);
97
-	algn = (*_Vmlcm)(align,ALIGN);
98
+	algn = (*_Vmlcm)(align,MEM_ALIGN);
99
 
100
 	/* non-Vmbest methods may require extra header space */
101
 	if(METHOD(best) != VM_MTBEST && vm->meth.eventf)
(-)shells/ksh93/files/patch-src_lib_libast_vmalloc_vmdcshare.c (+20 lines)
Added Link Here
1
--- src/lib/libast/vmalloc/vmdcshare.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/vmalloc/vmdcshare.c
3
@@ -61,7 +61,7 @@ void _STUB_vmdcshare(){}
4
 #define MM_REMOVE	02	/* remove files/segments	*/
5
 
6
 /* macros to get the data section and size */
7
-#define MMHEAD(name)	ROUND(sizeof(Mmvm_t)+strlen(name), ALIGN)
8
+#define MMHEAD(name)	ROUND(sizeof(Mmvm_t)+strlen(name), MEM_ALIGN)
9
 #define MMDATA(mmvm)	((Vmuchar_t*)(mmvm)->base + MMHEAD(mmvm->name))
10
 #define MMSIZE(mmvm)	((mmvm)->size - MMHEAD(mmvm->name))
11
 
12
@@ -178,7 +178,7 @@ static int mminit(Mmdisc_t* mmdc)
13
 	/* fixed size region so make it reasonably large */
14
 	if((size = mmdc->size) < MM_MINSIZE )
15
 		size =  MM_MINSIZE;
16
-	size += MMHEAD(mmdc->name) + ALIGN;
17
+	size += MMHEAD(mmdc->name) + MEM_ALIGN;
18
 	size  = ROUND(size, _Vmpagesize);
19
 
20
 	/* get/create the initial segment of data */
(-)shells/ksh93/files/patch-src_lib_libast_vmalloc_vmdcsystem.c (+126 lines)
Added Link Here
1
--- src/lib/libast/vmalloc/vmdcsystem.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/vmalloc/vmdcsystem.c
3
@@ -66,18 +66,16 @@ static Vmemory_f	_Vmemoryf = 0;
4
 
5
 #if _std_malloc
6
 #undef	_mem_mmap_anon
7
-#undef	_mem_mmap_zero
8
 #undef	_mem_sbrk
9
 #undef	_mem_win32
10
 #endif
11
 
12
 #if _mem_win32
13
 #undef	_mem_mmap_anon
14
-#undef	_mem_mmap_zero
15
 #undef	_mem_sbrk
16
 #endif
17
 
18
-#if _mem_mmap_anon || _mem_mmap_zero /* may get space using mmap */
19
+#if _mem_mmap_anon /* may get space using mmap */
20
 #include		<sys/mman.h>
21
 #ifndef MAP_ANON
22
 #ifdef	MAP_ANONYMOUS
23
@@ -86,7 +84,7 @@ static Vmemory_f	_Vmemoryf = 0;
24
 #define MAP_ANON	0
25
 #endif /*MAP_ANONYMOUS*/
26
 #endif /*MAP_ANON*/
27
-#endif /*_mem_mmap_anon || _mem_mmap_zero*/
28
+#endif /*_mem_mmap_anon*/
29
 
30
 /*
31
  * hint at "transparent huge pages" (=largepages) if
32
@@ -259,73 +257,6 @@ static Void_t* mmapanonmem(Vmalloc_t* vm
33
 }
34
 #endif /* _mem_mmap_anon */
35
 
36
-#if _mem_mmap_zero /* get space by mmapping from /dev/zero */
37
-#include		<fcntl.h>
38
-#ifndef OPEN_MAX
39
-#define	OPEN_MAX	64
40
-#endif
41
-#define FD_PRIVATE	(3*OPEN_MAX/4)	/* private file descriptor	*/
42
-#define FD_NONE		(-2)		/* no mapping with file desc	*/
43
-
44
-/* this is called after an initial successful call of mmapzeromeminit() */
45
-static Void_t* mmapzeromem(Vmalloc_t* vm, Void_t* caddr, size_t csize, size_t nsize, Vmdisc_t* disc)
46
-{
47
-	Memdisc_t*	mmdc = (Memdisc_t*)disc;
48
-	off_t		offset;
49
-
50
-	GETMEMCHK(vm, caddr, csize, nsize, disc);
51
-	if(csize == 0)
52
-	{	nsize = ROUND(nsize, _Vmpagesize);
53
-		offset = asoaddoff(&mmdc->offset, nsize);
54
-		RESTARTMEM(caddr, mmap(NIL(Void_t*), nsize, PROT_READ|PROT_WRITE, MAP_PRIVATE, mmdc->fd, offset));
55
-		ADVISE(vm, caddr, nsize);
56
-		RETURN(vm, caddr, nsize);
57
-	}
58
-	else if(nsize == 0)
59
-	{	Vmuchar_t	*addr = (Vmuchar_t*)sbrk(0);
60
-		if(addr < (Vmuchar_t*)caddr ) /* in sbrk space */
61
-			return NIL(Void_t*);
62
-		(void)munmap(caddr, csize);
63
-		RETURN(vm, caddr, nsize);
64
-	}
65
-	else	return NIL(Void_t*);
66
-}
67
-
68
-/* if this call succeeds then mmapzeromem() is the implementation */
69
-static Void_t* mmapzeromeminit(Vmalloc_t* vm, Void_t* caddr, size_t csize, size_t nsize, Vmdisc_t* disc)
70
-{
71
-	Memdisc_t*	mmdc = (Memdisc_t*)disc;
72
-	int		fd;
73
-
74
-	GETMEMCHK(vm, caddr, csize, nsize, disc);
75
-	if(mmdc->fd != FD_INIT)
76
-		return NIL(Void_t*);
77
-	RESTARTSYS(fd, open("/dev/zero", O_RDONLY|O_CLOEXEC));
78
-	if(fd < 0)
79
-	{	mmdc->fd = FD_NONE;
80
-		return NIL(Void_t*);
81
-	}
82
-#if O_CLOEXEC == 0
83
-	else
84
-		SETCLOEXEC(fd);
85
-#endif
86
-	if(fd >= FD_PRIVATE || (mmdc->fd = fcntl(fd, F_DUPFD_CLOEXEC, FD_PRIVATE)) < 0)
87
-		mmdc->fd = fd;
88
-	else
89
-	{	close(fd);
90
-#if F_DUPFD_CLOEXEC == F_DUPFD
91
-		SETCLOEXEC(mmdc->fd);
92
-#endif
93
-	}
94
-	RESTARTMEM(caddr, mmapzeromem(vm, caddr, csize, nsize, disc));
95
-	if(!caddr)
96
-	{	close(mmdc->fd);
97
-		mmdc->fd = FD_NONE;
98
-	}
99
-	RETURN(vm, caddr, nsize);
100
-}
101
-#endif /* _mem_mmap_zero */
102
-
103
 #if _std_malloc /* using native malloc as a last resort */
104
 static Void_t* mallocmem(Vmalloc_t* vm, Void_t* caddr, size_t csize, size_t nsize, Vmdisc_t* disc)
105
 {
106
@@ -364,12 +295,6 @@ static Void_t* getmemory(Vmalloc_t* vm, 
107
 		return (Void_t*)addr;
108
 	}
109
 #endif
110
-#if _mem_mmap_zero
111
-	if((_Vmassert & VM_zero) && (addr = mmapzeromeminit(vm, caddr, csize, nsize, disc)))
112
-	{	GETMEMUSE(mmapzeromem, disc);
113
-		return (Void_t*)addr;
114
-	}
115
-#endif
116
 #if _mem_sbrk
117
 	if((_Vmassert & VM_break) && (addr = sbrkmem(vm, caddr, csize, nsize, disc)))
118
 	{	GETMEMUSE(sbrkmem, disc);
119
@@ -386,6 +311,7 @@ static Void_t* getmemory(Vmalloc_t* vm, 
120
 	if((_Vmassert & VM_native) && (addr = mallocmem(vm, caddr, csize, nsize, disc)))
121
 	{	GETMEMUSE(mallocmem, disc);
122
 		return (Void_t*)addr;
123
+	}
124
 #endif 
125
 	write(2, "vmalloc: panic: all memory allocation disciplines failed\n", 57);
126
 	abort();
(-)shells/ksh93/files/patch-src_lib_libast_vmalloc_vmdebug.c (+29 lines)
Added Link Here
1
--- src/lib/libast/vmalloc/vmdebug.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/vmalloc/vmdebug.c
3
@@ -335,7 +335,7 @@ int		local;
4
 	if(vm->data->mode&VM_DBCHECK)
5
 		vmdbcheck(vm);
6
 
7
-	sz = ROUND(size,ALIGN) + DB_EXTRA;
8
+	sz = ROUND(size,MEM_ALIGN) + DB_EXTRA;
9
 	sz = sz >= sizeof(Body_t) ? sz : sizeof(Body_t);
10
 	if(!(data = (Vmuchar_t*)KPVALLOC(vm, sz, (*(Vmbest->allocf))) ) )
11
 	{	dbwarn(vm, NIL(Vmuchar_t*), DB_ALLOC, file, line, func, DB_ALLOC);
12
@@ -483,7 +483,7 @@ int		local;
13
 	oldline = DBLINE(addr);
14
 
15
 	/* do the resize */
16
-	sz = ROUND(size,ALIGN) + DB_EXTRA;
17
+	sz = ROUND(size,MEM_ALIGN) + DB_EXTRA;
18
 	sz = sz >= sizeof(Body_t) ? sz : sizeof(Body_t);
19
 	data = (Vmuchar_t*)KPVRESIZE(vm, (Void_t*)data, sz, (type&~VM_RSZERO), (*(Vmbest->resizef)) );
20
 	if(!data) /* failed, reset data for old block */
21
@@ -632,7 +632,7 @@ int		local;
22
 
23
 	asolock(&vm->data->dlck, KEY_DEBUG, ASO_LOCK);
24
 
25
-	if((sz = ROUND(size,ALIGN) + DB_EXTRA) < sizeof(Body_t))
26
+	if((sz = ROUND(size,MEM_ALIGN) + DB_EXTRA) < sizeof(Body_t))
27
 		sz = sizeof(Body_t);
28
 
29
 	if((data = (Vmuchar_t*)KPVALIGN(vm, sz, align, (*(Vmbest->alignf)))) )
(-)shells/ksh93/files/patch-src_lib_libast_vmalloc_vmhdr.h (+86 lines)
Added Link Here
1
--- src/lib/libast/vmalloc/vmhdr.h.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/vmalloc/vmhdr.h
3
@@ -86,7 +86,7 @@
4
 #if defined(_WIN32)
5
 #define _mem_win32	1	/* use the VirtualAlloc interface	*/
6
 #endif
7
-#if !_mem_win32 && !_mem_sbrk && !_mem_mmap_anon && !_mem_mmap_zero
8
+#if !_mem_win32 && !_mem_sbrk && !_mem_mmap_anon
9
 #undef _std_malloc
10
 #define _std_malloc	1	/* use native malloc/free/realloc	*/
11
 #endif
12
@@ -160,11 +160,11 @@ extern void		_vmmessage _ARG_((const cha
13
 				    (ABORT() ? (abort(),0) : PAUSE() ? (pause(),0) : 0)) )
14
 #define COUNT(n)	((n) += 1)
15
 #define ACCOUNT(a,b)	((a) += (b))
16
-#define INITMEMORY(m,z)	((m) ? (memset((m), 'i', (z) > 2*ALIGN ? 2*ALIGN : (z)), 0) : 0 )
17
-#define SETBUSYMEM(m,z)	(memset(((char*)(m))+2*ALIGN, 'b', (z) <= 2*ALIGN ? 0 : ALIGN ) )
18
-#define CHKBUSYMEM(m,z)	(memcmp(((char*)(m))+2*ALIGN, "bbbbbbbb", (z) <= 2*ALIGN ? 0 : 8) == 0 ? 1 : 0 )
19
-#define SETFREEMEM(m,z)	(memset(((char*)(m))+2*ALIGN, 'f', (z) <= 2*ALIGN ? 0 : ALIGN ) )
20
-#define CHKFREEMEM(m,z)	(memcmp(((char*)(m))+2*ALIGN, "ffffffff", (z) <= 2*ALIGN ? 0 : 8) == 0 ? 1 : 0 )
21
+#define INITMEMORY(m,z)	((m) ? (memset((m), 'i', (z) > 2*MEM_ALIGN ? 2*MEM_ALIGN : (z)), 0) : 0 )
22
+#define SETBUSYMEM(m,z)	(memset(((char*)(m))+2*MEM_ALIGN, 'b', (z) <= 2*MEM_ALIGN ? 0 : MEM_ALIGN ) )
23
+#define CHKBUSYMEM(m,z)	(memcmp(((char*)(m))+2*MEM_ALIGN, "bbbbbbbb", (z) <= 2*MEM_ALIGN ? 0 : 8) == 0 ? 1 : 0 )
24
+#define SETFREEMEM(m,z)	(memset(((char*)(m))+2*MEM_ALIGN, 'f', (z) <= 2*MEM_ALIGN ? 0 : MEM_ALIGN ) )
25
+#define CHKFREEMEM(m,z)	(memcmp(((char*)(m))+2*MEM_ALIGN, "ffffffff", (z) <= 2*MEM_ALIGN ? 0 : 8) == 0 ? 1 : 0 )
26
 #define DEBUGDECL(_ty_,_ob_)	_ty_ _ob_;
27
 #else
28
 #define ABORT()		(0)
29
@@ -203,7 +203,7 @@ extern void		_vmmessage _ARG_((const cha
30
 #define BITS		(BUSY|PFREE|SMALL|MARK)
31
 #define ALIGNB		(BITS+1) /* to guarantee blksize == 0%(BITS+1)	*/
32
 
33
-/* ALIGN is chosen for three conditions:
34
+/* MEM_ALIGN is chosen for three conditions:
35
 ** 1. Able to address all primitive types.
36
 ** 2. A multiple of ALIGNB==(BITS+1) as discussed above.
37
 ** 3. Large enough to cover two pointers. Note that on some machines
38
@@ -238,9 +238,9 @@ struct _two_s
39
 	void*		two;
40
 };
41
 #define ALIGNA	(sizeof(struct _a_s) - sizeof(union _align_u))
42
-#undef	ALIGN	/* Blocks will be aligned on both ALIGNA & ALIGNB */
43
+#undef	MEM_ALIGN	/* Blocks will be aligned on both ALIGNA & ALIGNB */
44
 #define ALIGNAB	MULTIPLE(ALIGNA,ALIGNB)
45
-#define ALIGN	MULTIPLE(ALIGNAB, sizeof(struct _two_s))
46
+#define MEM_ALIGN	MULTIPLE(ALIGNAB, sizeof(struct _two_s))
47
 
48
 typedef union _word_u
49
 {	size_t		size;	/* to store a size_t	*/
50
@@ -252,7 +252,7 @@ struct _head_s /* a block header has two
51
 {	Word_t		one;
52
 	Word_t		two;
53
 };
54
-#define HEADSIZE	ROUND(sizeof(struct _head_s), ALIGN)
55
+#define HEADSIZE	ROUND(sizeof(struct _head_s), MEM_ALIGN)
56
 union _head_u
57
 {	Vmuchar_t	data[HEADSIZE];	/* to standardize size	*/
58
 	struct _head_s	head;
59
@@ -264,15 +264,15 @@ struct _body_s /* Note that self is actu
60
 	Block_t*	left;	/* left child in free tree	*/
61
 	Block_t**	self;	/* self pointer when free	*/
62
 };
63
-#define BODYSIZE	ROUND(sizeof(struct _body_s), ALIGN)
64
+#define BODYSIZE	ROUND(sizeof(struct _body_s), MEM_ALIGN)
65
 union _body_u
66
 {	Vmuchar_t	data[BODYSIZE];	/* to standardize size	*/
67
 	struct _body_s	body;
68
 };
69
 
70
 /* After all the songs and dances, we should now have:
71
-**	sizeof(Head_t)%ALIGN == 0
72
-**	sizeof(Body_t)%ALIGN == 0
73
+**	sizeof(Head_t)%MEM_ALIGN == 0
74
+**	sizeof(Body_t)%MEM_ALIGN == 0
75
 ** and	sizeof(Block_t) = sizeof(Head_t)+sizeof(Body_t)
76
 */
77
 struct _block_s
78
@@ -321,7 +321,7 @@ struct _block_s
79
 #define ENDB(sgb)	((Block_t*)((Vmuchar_t*)NEXT(sgb) - sizeof(Head_t)) )
80
 
81
 /* the start of allocatable memory in a segment */
82
-#define SEGDATA(sg)	((Vmuchar_t*)(sg) + ROUND(sizeof(Seg_t),ALIGN) )
83
+#define SEGDATA(sg)	((Vmuchar_t*)(sg) + ROUND(sizeof(Seg_t),MEM_ALIGN) )
84
 
85
 /* testing to see if "sg" is the root segment of a region */
86
 #define SEGROOT(sg)	((Vmuchar_t*)(sg)->vmdt >= (sg)->base && \
(-)shells/ksh93/files/patch-src_lib_libast_vmalloc_vmlast.c (+40 lines)
Added Link Here
1
--- src/lib/libast/vmalloc/vmlast.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/vmalloc/vmlast.c
3
@@ -61,7 +61,7 @@ int		local;
4
 
5
 	LASTLOCK(last, local);
6
 
7
-	size = size < ALIGN ? ALIGN : ROUND(size,ALIGN);
8
+	size = size < MEM_ALIGN ? MEM_ALIGN : ROUND(size,MEM_ALIGN);
9
 
10
 	last->last = NIL(Vmuchar_t*); /* wipe record of last allocation */
11
 
12
@@ -119,7 +119,7 @@ int		local;
13
 	if(data != (Void_t*)last->last )
14
 		data = NIL(Void_t*);
15
 	else
16
-	{	size = last->data - last->last;	/**/DEBUG_ASSERT(size > 0 && size%ALIGN == 0);
17
+	{	size = last->data - last->last;	/**/DEBUG_ASSERT(size > 0 && size%MEM_ALIGN == 0);
18
 		last->data -= size;
19
 		last->size += size;
20
 		last->last = NIL(Vmuchar_t*);
21
@@ -166,8 +166,8 @@ int		local;
22
 	if(data != (Void_t*)last->last )
23
 		data = NIL(Void_t*);
24
 	else
25
-	{	oldz = last->data - last->last; /**/DEBUG_ASSERT(oldz > 0 && oldz%ALIGN == 0);
26
-		size = ROUND(size, ALIGN);
27
+	{	oldz = last->data - last->last; /**/DEBUG_ASSERT(oldz > 0 && oldz%MEM_ALIGN == 0);
28
+		size = ROUND(size, MEM_ALIGN);
29
 		if(size <= oldz) /* getting smaller */
30
 		{	sz = oldz - size;
31
 			last->data -= sz;
32
@@ -249,7 +249,7 @@ int		local;
33
 
34
 	LASTLOCK(last, local);
35
 
36
-	size = ROUND(size,ALIGN);
37
+	size = ROUND(size,MEM_ALIGN);
38
 	align = (*_Vmlcm)(align, 2*sizeof(Block_t));
39
 
40
 	if((data = (Vmuchar_t*)KPVALLOC(vm, size + align, lastalloc)) )
(-)shells/ksh93/files/patch-src_lib_libast_vmalloc_vmmaddress.c (+11 lines)
Added Link Here
1
--- src/lib/libast/vmalloc/vmmaddress.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/vmalloc/vmmaddress.c
3
@@ -96,7 +96,7 @@ ssize_t _vmpagesize(void)
4
 		if ((_Vmpagesize = getpagesize()) <= 0)
5
 #endif
6
 			_Vmpagesize = VM_PAGESIZE;
7
-		_Vmpagesize = (*_Vmlcm)(_Vmpagesize, ALIGN);
8
+		_Vmpagesize = (*_Vmlcm)(_Vmpagesize, MEM_ALIGN);
9
 	}
10
 #if VMCHKMEM
11
 	_Vmchkmem = _vmchkmem; /* _vmchkmem() can check memory availability */
(-)shells/ksh93/files/patch-src_lib_libast_vmalloc_vmopen.c (+61 lines)
Added Link Here
1
--- src/lib/libast/vmalloc/vmopen.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/vmalloc/vmopen.c
3
@@ -97,10 +97,10 @@ int		mode;	/* type of region		*/
4
 					write(9, "vmalloc: panic: heap initialization error #2\n", 45);
5
 				return NIL(Vmalloc_t*);
6
 			}
7
-			/**/DEBUG_ASSERT(VMLONG(vd)%ALIGN == 0);
8
+			/**/DEBUG_ASSERT(VMLONG(vd)%MEM_ALIGN == 0);
9
 
10
 			if(vd->mode & VM_MEMORYF) /* point addr to Vmalloc_t */
11
-				addr -= ROUND(sizeof(Vmalloc_t), ALIGN);
12
+				addr -= ROUND(sizeof(Vmalloc_t), MEM_ALIGN);
13
 		}
14
 	}
15
 
16
@@ -110,7 +110,7 @@ int		mode;	/* type of region		*/
17
 		incr = disc->round <= 0 ? _Vmpagesize : ROUND(disc->round, _Vmpagesize);
18
 
19
 		/* size of Vmalloc_t if embedded in the same initial segment */
20
-		vmsz = (mode&VM_MEMORYF) ? ROUND(sizeof(Vmalloc_t),ALIGN) : 0;
21
+		vmsz = (mode&VM_MEMORYF) ? ROUND(sizeof(Vmalloc_t),MEM_ALIGN) : 0;
22
 
23
 		vdsz = 0; /* get actual size of Vmdata_t including method specific data */
24
 		if(!meth->eventf || (*meth->eventf)(vmp, VM_OPEN, &vdsz) < 0 || vdsz <= 0 )
25
@@ -118,13 +118,13 @@ int		mode;	/* type of region		*/
26
 				write(9, "vmalloc: panic: heap initialization error #3\n", 45);
27
 			return NIL(Vmalloc_t*);
28
 		}
29
-		vdsz = ROUND(vdsz, ALIGN);
30
+		vdsz = ROUND(vdsz, MEM_ALIGN);
31
 
32
-		sgsz = ROUND(sizeof(Seg_t), ALIGN); /* size of segment structure */
33
+		sgsz = ROUND(sizeof(Seg_t), MEM_ALIGN); /* size of segment structure */
34
 
35
 		/* get initial memory segment containing Vmdata_t, Seg_t and some extra */
36
 		size = vmsz + vdsz + sgsz + 8*_Vmpagesize;
37
-		size = ROUND(size,incr); /**/DEBUG_ASSERT(size%ALIGN == 0 );
38
+		size = ROUND(size,incr); /**/DEBUG_ASSERT(size%MEM_ALIGN == 0 );
39
 		if(!(base = (Vmuchar_t*)(*disc->memoryf)(vmp, NIL(Void_t*), 0, size, disc)) )
40
 		{	if(initheap)
41
 				write(9, "vmalloc: panic: heap initialization error #4\n", 45);
42
@@ -136,14 +136,14 @@ int		mode;	/* type of region		*/
43
 			memset(base, 0, vmsz + vdsz + sgsz);
44
 
45
 		/* make sure memory is properly aligned */
46
-		if((algn = (ssize_t)(VMLONG(base)%ALIGN)) == 0 )
47
+		if((algn = (ssize_t)(VMLONG(base)%MEM_ALIGN)) == 0 )
48
 			addr = base;
49
-		else	addr = base + (ALIGN-algn);
50
-		/**/DEBUG_ASSERT(VMLONG(addr)%ALIGN == 0 );
51
+		else	addr = base + (MEM_ALIGN-algn);
52
+		/**/DEBUG_ASSERT(VMLONG(addr)%MEM_ALIGN == 0 );
53
 
54
 		/* addresses of Vmdata_t and root segment */
55
-		vd = (Vmdata_t*)(addr + vmsz); /**/DEBUG_ASSERT(VMLONG(vd)%ALIGN == 0);
56
-		seg = (Seg_t*)(addr + vmsz + vdsz); /**/DEBUG_ASSERT(VMLONG(seg)%ALIGN == 0);
57
+		vd = (Vmdata_t*)(addr + vmsz); /**/DEBUG_ASSERT(VMLONG(vd)%MEM_ALIGN == 0);
58
+		seg = (Seg_t*)(addr + vmsz + vdsz); /**/DEBUG_ASSERT(VMLONG(seg)%MEM_ALIGN == 0);
59
 
60
 		/* set Vmdata_t data */
61
 		vd->mode = mode;
(-)shells/ksh93/files/patch-src_lib_libast_vmalloc_vmpool.c (+20 lines)
Added Link Here
1
--- src/lib/libast/vmalloc/vmpool.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/vmalloc/vmpool.c
3
@@ -47,7 +47,7 @@ typedef struct _vmpool_s
4
 	Pool_t*		free;	/* list of free blocks	*/
5
 } Vmpool_t;
6
 
7
-#define POOLSIZE(sz)	ROUND(ROUND((sz), sizeof(Pool_t)), ALIGN)
8
+#define POOLSIZE(sz)	ROUND(ROUND((sz), sizeof(Pool_t)), MEM_ALIGN)
9
 
10
 #ifdef DEBUG
11
 static int	N_pool;	/* counter for Vmpool calls	*/
12
@@ -206,7 +206,7 @@ static int poolstat(Vmalloc_t* vm, Vmsta
13
 	if(pool->size <= 0 )
14
 		return -1;
15
 
16
-	size = ROUND(pool->size, ALIGN);
17
+	size = ROUND(pool->size, MEM_ALIGN);
18
 
19
 	for(pl = pool->free; pl; pl = pl->next )
20
 		st->n_free += 1;
(-)shells/ksh93/files/patch-src_lib_libast_vmalloc_vmsegment.c (+32 lines)
Added Link Here
1
--- src/lib/libast/vmalloc/vmsegment.c.orig	2016-02-28 17:09:23 UTC
2
+++ src/lib/libast/vmalloc/vmsegment.c
3
@@ -194,7 +194,7 @@ static Block_t* _vmseginit(Vmdata_t* vmd
4
 
5
 	/* available memory in Seg_t for allocation usage */
6
 	size = (base+size) - SEGDATA(seg);
7
-	size = (size/ALIGN)*ALIGN; /* must be multiple of ALIGN's */
8
+	size = (size/MEM_ALIGN)*MEM_ALIGN; /* must be multiple of MEM_ALIGN's */
9
 
10
 	/* block at start of memory */
11
 	seg->begb = (Block_t*)SEGDATA(seg);
12
@@ -256,7 +256,7 @@ static Block_t* _vmsegalloc(Vmalloc_t* v
13
 	static size_t	Segunit = 0;
14
 	/**/DEBUG_COUNT(N_segalloc);
15
 	/**/DEBUG_ASSERT(!blk || (isblock(vmdt, blk) && (SIZE(blk)&BUSY) ) );
16
-	/**/DEBUG_ASSERT(_Vmpagesize > 0 && _Vmpagesize%ALIGN == 0 );
17
+	/**/DEBUG_ASSERT(_Vmpagesize > 0 && _Vmpagesize%MEM_ALIGN == 0 );
18
 
19
 /* transition to a fixed place to unlock before returning */
20
 #undef	RETURN
21
@@ -381,9 +381,9 @@ static Block_t* _vmsegalloc(Vmalloc_t* v
22
 		}
23
 
24
 		/* segment must start at an aligned address */
25
-		if((sz = (size_t)(VMLONG(base)%ALIGN)) == 0)
26
+		if((sz = (size_t)(VMLONG(base)%MEM_ALIGN)) == 0)
27
 			seg = (Seg_t*)base;
28
-		else	seg = (Seg_t*)(base + ALIGN-sz);
29
+		else	seg = (Seg_t*)(base + MEM_ALIGN-sz);
30
 		blk = _vmseginit(vmdt, seg, base, segsz, 0);
31
 	}
32
 
(-)shells/ksh93/files/patch-src_lib_libcmd_ls.c (+32 lines)
Added Link Here
1
--- src/lib/libcmd/ls.c.orig	2017-11-30 22:35:04 UTC
2
+++ src/lib/libcmd/ls.c
3
@@ -1257,7 +1257,7 @@ ls(State_t* state, register FTSENT* ent)
4
 	if (!VISIBLE(state, ent))
5
 	{
6
 		fts_set(NiL, ent, FTS_SKIP);
7
-		return;
8
+		return 0;
9
 	}
10
 	switch (ent->fts_info)
11
 	{
12
@@ -1265,17 +1265,17 @@ ls(State_t* state, register FTSENT* ent)
13
 		if (ent->fts_parent->fts_info == FTS_DNX)
14
 			break;
15
 		error(2, "%s: not found", ent->fts_path);
16
-		return;
17
+		return 1;
18
 	case FTS_DC:
19
 		if (state->lsflags & LS_DIRECTORY)
20
 			break;
21
 		error(2, "%s: directory causes cycle", ent->fts_path);
22
-		return;
23
+		return 1;
24
 	case FTS_DNR:
25
 		if (state->lsflags & LS_DIRECTORY)
26
 			break;
27
 		error(2, "%s: cannot read directory", ent->fts_path);
28
-		return 0;
29
+		return 1;
30
 	case FTS_DOT:
31
 		#if 0
32
 		fts_set(NiL, ent, FTS_SKIP);

Return to bug 208098