diff options
author | cy <cy@FreeBSD.org> | 2019-06-02 02:32:40 +0800 |
---|---|---|
committer | cy <cy@FreeBSD.org> | 2019-06-02 02:32:40 +0800 |
commit | 18a61045d8fd3692deaf4067b3da465fb88b4668 (patch) | |
tree | 5fb6be931ba7653e37ffbac7acf4b74178c91a13 /shells | |
parent | 7b5af6329f2258f5ac77bfc3a0392238ea4ee502 (diff) | |
download | freebsd-ports-gnome-18a61045d8fd3692deaf4067b3da465fb88b4668.tar.gz freebsd-ports-gnome-18a61045d8fd3692deaf4067b3da465fb88b4668.tar.zst freebsd-ports-gnome-18a61045d8fd3692deaf4067b3da465fb88b4668.zip |
Resurrect the previous shells/ksh93 as shells/ast-ksh, a ksh93 port
that the maintainer wishes to use to create a shared library for use
with other applications such as CDE. It is based on ksh93v (2014-12-24)
and is incompatible with the direction that att/ast is taking the
official ksh93 implementation.
PR: 237332
Requested by: maintainer (saper@saper.info)
Diffstat (limited to 'shells')
37 files changed, 1317 insertions, 0 deletions
diff --git a/shells/Makefile b/shells/Makefile index 44b5c45f0946..3324c1e35489 100644 --- a/shells/Makefile +++ b/shells/Makefile @@ -6,6 +6,7 @@ SUBDIR += 44bsd-csh SUBDIR += ammonite SUBDIR += antibody + SUBDIR += ast-ksh SUBDIR += bash SUBDIR += bash-completion SUBDIR += bash-static diff --git a/shells/ast-ksh/Makefile b/shells/ast-ksh/Makefile new file mode 100644 index 000000000000..062b6cf85fef --- /dev/null +++ b/shells/ast-ksh/Makefile @@ -0,0 +1,61 @@ +# $FreeBSD$ + +# Make sure that your configuration DOES NOT set ANY gcc-related +# variables. ksh93 will not compile if you set even the seemingly +# most unrelated variable related to gcc configuration. This means +# especially any flag which attempts to set the cputype. Setting the +# cputype does absolutely nothing except cause systems to fail in +# horrible ways. For any modern processor, setting the cputype only +# serves to expose gcc bugs and does nothing to speed up any known +# program. If you are really unconvinced, go ahead but do not +# complain to me about it. + +PORTNAME= ast-ksh +PORTVERSION= ${KSHVERSION:S/-//g} +CATEGORIES= shells +DIST_SUBDIR= ksh93 + +MAINTAINER= saper@saper.info +COMMENT= KornShell 93 + +LICENSE= EPL + +BROKEN_aarch64= Fails to compile: needs sbrk + +USES= compiler:c11 + +USE_GITHUB= yes +GH_ACCOUNT= att +GH_PROJECT= ast +GH_TAGNAME= ksh93v + +# IMPORTANT: Disabling conflicts, i.e. -DDISABLE_CONFLICTS will result in +# arcane build failures due to already installed ksh/ksh93 in +# $PATH. +CONFLICTS= ksh93-* + +OPTIONS_DEFINE= EXAMPLES STATIC + +LDFLAGS+= -lm +MAKE_ENV= CCFLAGS="-Wno-unused-value -Wno-parentheses -Wno-logical-op-parentheses ${CFLAGS}" + +KSHVERSION= 2014-12-24 + +STATIC_MAKE_ENV= LDFLAGS+=-static + +post-patch: + @${REINPLACE_CMD} -e 's|SF_FLAGS|SFIO_FLAGS|g' ${WRKSRC}/src/lib/libast/include/sfio*.h ${WRKSRC}/src/lib/libast/sfio/*.c + +do-build: + @cd ${WRKSRC}/ && ${SETENV} -i ${MAKE_ENV} ${SH} bin/package flat make ksh93 + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/bin/ksh ${STAGEDIR}${PREFIX}/bin/ksh93 + ${INSTALL_MAN} ${WRKSRC}/man/man1/sh.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/ksh93.1 + ${MKDIR} ${STAGEDIR}${EXAMPLESDIR}/ + cd ${WRKSRC}/fun/ && ${INSTALL_SCRIPT} dirs popd pushd ${STAGEDIR}${EXAMPLESDIR}/ + +do-test: + cd ${WRKSRC}/src/cmd/ksh93/tests/ && ${SETENV} SHELL=${WRKSRC}/bin/ksh ${WRKSRC}/bin/ksh shtests + +.include <bsd.port.mk> diff --git a/shells/ast-ksh/distinfo b/shells/ast-ksh/distinfo new file mode 100644 index 000000000000..f5d140f89740 --- /dev/null +++ b/shells/ast-ksh/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1559407953 +SHA256 (ksh93/att-ast-20141224-ksh93v_GH0.tar.gz) = 89e5aeec66c28692aa392105552c06053ba60b09a62e94dc555dadf967bca643 +SIZE (ksh93/att-ast-20141224-ksh93v_GH0.tar.gz) = 26409086 diff --git a/shells/ast-ksh/files/patch-src_cmd_proto_proto.c b/shells/ast-ksh/files/patch-src_cmd_proto_proto.c new file mode 100644 index 000000000000..00bcd71de762 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_cmd_proto_proto.c @@ -0,0 +1,18 @@ +--- src/cmd/proto/proto.c.orig 2017-11-30 22:35:04 UTC ++++ src/cmd/proto/proto.c +@@ -396,6 +396,15 @@ proto(char* file, char* license, char* o + + #if !PROTO_STANDALONE + #undef error ++void ++error( int xit, const char *msg, ... ) ++{ ++ va_list ap; ++ va_start( ap, msg ); ++ vfprintf( stderr, msg, ap ); ++ va_end( ap ); ++ exit( xit ); ++} + #endif + + typedef struct Sufcom_s diff --git a/shells/ast-ksh/files/patch-src_cmd_std_features_procfs b/shells/ast-ksh/files/patch-src_cmd_std_features_procfs new file mode 100644 index 000000000000..7fc3c1fc8113 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_cmd_std_features_procfs @@ -0,0 +1,36 @@ +--- src/cmd/std/features/procfs.orig 2017-11-30 22:35:04 UTC ++++ src/cmd/std/features/procfs +@@ -1,6 +1,6 @@ + hdr kvm,procinfo,pstat,asm/param + +-sys procfs,sysctl ++sys procfs,sysctl,user + + lib getprocs + lib kvm_open,kvm_getprocs kvm.h sys/time.h sys/param.h sys/proc.h sys/sysctl.h -lkvm +@@ -10,7 +10,11 @@ mem extern_proc.p_pid,extern_proc.p_star + mem procsinfo64.pi_pri procinfo.h + 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 + ++num PIOCPSINFO ++ + typ struct.prpsinfo -D_STRUCTURED_PROC -Dprpsinfo=psinfo sys/types.h sys/procfs.h ++typ struct.kinfo_proc sys/types.h sys/procfs.h sys/user.h ++typ struct.kp_proc sys/types.h sys/procfs.h sys/user.h + + tst lib_info note{ info(2) kernel table api }end link{ + #include <info.h> +@@ -587,11 +591,11 @@ cat{ + #define PSS_METHOD PSS_METHOD_getprocs + #endif + +-#if !PSS_METHOD && defined(_PS_dir) ++#if !PSS_METHOD && defined(_PS_dir) && (_PS_scan_binary || _num_PIOCPSINFO) + #define PSS_METHOD PSS_METHOD_procfs + #endif + +-#if !PSS_METHOD && _hdr_kvm && _sys_sysctl && _lib_kvm_open && _lib_kvm_getprocs ++#if !PSS_METHOD && _hdr_kvm && _sys_sysctl && _lib_kvm_open && _lib_kvm_getprocs && _typ_struct_kinfo_proc && _typ_struct_kp_proc + #define PSS_METHOD PSS_METHOD_kvm + #endif + diff --git a/shells/ast-ksh/files/patch-src_cmd_std_pss-kvm.c b/shells/ast-ksh/files/patch-src_cmd_std_pss-kvm.c new file mode 100644 index 000000000000..4bd842573d48 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_cmd_std_pss-kvm.c @@ -0,0 +1,12 @@ +--- src/cmd/std/pss-kvm.c.orig 2017-11-30 22:35:04 UTC ++++ src/cmd/std/pss-kvm.c +@@ -43,6 +43,9 @@ NoN(pss_kvm) + #if _sys_proc + #include <sys/proc.h> + #endif ++#if _sys_user ++#include <sys/user.h> ++#endif + #include <sys/sysctl.h> + #include <sys/tty.h> + diff --git a/shells/ast-ksh/files/patch-src_lib_libast_comp_setlocale.c b/shells/ast-ksh/files/patch-src_lib_libast_comp_setlocale.c new file mode 100644 index 000000000000..631fdbac1e3f --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_comp_setlocale.c @@ -0,0 +1,10 @@ +--- src/lib/libast/comp/setlocale.c.orig 2017-11-30 22:35:04 UTC ++++ src/lib/libast/comp/setlocale.c +@@ -38,6 +38,7 @@ + #include <namval.h> + #include <iconv.h> + #include <codeset.h> ++#include <errno.h> + + #if ( _lib_wcwidth || _lib_wctomb ) && _hdr_wctype + #include <wctype.h> diff --git a/shells/ast-ksh/files/patch-src_lib_libast_features_mmap b/shells/ast-ksh/files/patch-src_lib_libast_features_mmap new file mode 100644 index 000000000000..920291f31c18 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_features_mmap @@ -0,0 +1,191 @@ +--- src/lib/libast/features/mmap.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/features/mmap +@@ -16,14 +16,7 @@ tst lib_mmap note{ standard mmap interfa + + #define Failed(file) (remove(file),1) + +- int +- #if _STD_ +- main(int argc, char** argv) +- #else +- main(argc,argv) +- int argc; +- char** argv; +- #endif ++ int main(int argc, char** argv) + { + caddr_t mm; + char *file; +@@ -165,169 +158,18 @@ tst lib_mmap64 -D_LARGEFILE64_SOURCE not + } + }end + +-tst mmap_anon note{ use mmap MAP_ANON to get raw memory }end execute{ +- #if !_lib_mmap +- ( +- #endif +- #include <unistd.h> +- #include <fcntl.h> +- #include <sys/types.h> +- #include <sys/mman.h> +- #if defined(MAP_ANONYMOUS) && !defined(MAP_ANON) +- #define MAP_ANON MAP_ANONYMOUS +- #endif +- int +- main() +- { void *addr; +- addr = mmap(0,1024*1024,PROT_READ|PROT_WRITE,MAP_ANON|MAP_PRIVATE,-1,0); +- return (addr && addr != (void*)(-1)) ? 0 : 1; +- } +-}end +- +-tst mmap_devzero note{ use mmap on /dev/zero to get raw memory }end execute{ +- #if !_lib_mmap +- ( +- #endif +- #include <unistd.h> +- #include <fcntl.h> +- #include <sys/types.h> +- #include <sys/mman.h> +- int +- main() +- { int fd; +- void *addr; +- if((fd = open("/dev/zero", O_RDWR)) < 0) +- return 1; +- addr = mmap(0,1024*1024,PROT_READ|PROT_WRITE,MAP_PRIVATE,fd,0); +- return (addr && addr != (void*)(-1)) ? 0 : 1; +- } +-}end +- +-tst -D_LARGEFILE64_SOURCE note{ mmap is worth using }end output{ +- #if !_lib_mmap +- ( +- #endif +- #include <unistd.h> +- #include <fcntl.h> +- #include <string.h> +- #include <sys/types.h> +- #include <sys/mman.h> +- #include <sys/stat.h> +- #include <sys/times.h> +- +- #if _lib_mmap64 +- #undef mmap +- #define mmap mmap64 +- #endif +- +- #if _lib_munmap64 +- #undef munmap +- #define munmap munmap64 +- #endif +- +- #define MAPSIZE (64*1024) +- #define BUFSIZE (MAPSIZE/8) +- #define WRITE (64) +- #define RUN (64) +- +- #define Failed(file) (remove(file),1) +- +- int +- #if _STD_ +- main(int argc, char** argv) +- #else +- main(argc,argv) +- int argc; +- char** argv; +- #endif +- { +- caddr_t mm; +- char *file, *t; +- int i, fd, k, run; +- char buf[MAPSIZE]; +- struct tms stm, etm; +- clock_t rdtm, mmtm; +- +- file = argv[1]; +- if ((fd = open(file, O_CREAT|O_TRUNC|O_WRONLY, 0666)) < 0) +- return 1; +- +- for (i = 0; i < sizeof(buf); ++i) +- buf[i] = '0' + (i%10); +- for (i = 0; i < WRITE; ++i) +- if (write(fd,buf,sizeof(buf)) != sizeof(buf)) +- return Failed(file); +- close(fd); +- +- /* read time */ +- times(&stm); +- for(run = 0; run < RUN; ++run) +- { if((fd = open(file, O_RDWR)) < 0) +- return Failed(file); +- for (i = 0; i < WRITE; ++i) +- { for(k = 0; k < MAPSIZE; k += BUFSIZE) +- if (read(fd,buf,BUFSIZE) != BUFSIZE) +- return Failed(file); +- } +- close(fd); +- } +- times(&etm); +- rdtm = (etm.tms_utime-stm.tms_utime) + (etm.tms_stime-stm.tms_stime); +- +- /* mmap time */ +- times(&stm); +- for(run = 0; run < RUN; ++run) +- { if ((fd = open(file, O_RDWR)) < 0) +- return Failed(file); +- for(i = 0, mm = (caddr_t)0; i < WRITE; ++i) +- { if(mm) +- munmap(mm, MAPSIZE); +- mm = (caddr_t)mmap((caddr_t)0, MAPSIZE, +- (PROT_READ|PROT_WRITE), +- MAP_PRIVATE, fd, i*MAPSIZE ); +- if(mm == (caddr_t)(-1) || mm == (caddr_t)0) +- return Failed(file); +- +- /* the memcpy is < BUFSIZE to simulate the +- fact that functions like sfreserve/sfgetr do +- not do buffer copying. +- */ +- t = (char*)mm; +- for(k = 0; k < MAPSIZE; k += BUFSIZE, t += BUFSIZE) +- memcpy(buf,t,(3*BUFSIZE)/4); +- } +- close(fd); +- } +- times(&etm); +- mmtm = (etm.tms_utime-stm.tms_utime) + (etm.tms_stime-stm.tms_stime); +- +- remove(file); +- +- if(4*mmtm <= 3*rdtm) +- printf("#define _mmap_worthy 2 /* mmap outperforms read on 64Ki buffers -- use it */\n"); +- else if(4*mmtm <= 5*rdtm) +- printf("#define _mmap_worthy 2 /* mmap is slightly better than read on 64Ki buffers -- use it */\n"); +- else +- printf("#define _mmap_worthy 2 /* mmap worse than read on 64Ki buffers -- use it anyway */\n"); +- +- return 0; +- } +-}end +- + cat{ ++ /* assume MAP_ANON works */ ++ #define _mmap_anon 1 + + /* some systems get it wrong but escape concise detection */ +- #ifndef _NO_MMAP + #if __CYGWIN__ + #define _NO_MMAP 1 + #endif +- #endif + + #if _NO_MMAP + #undef _lib_mmap + #undef _lib_mmap64 +- #undef _mmap_anon +- #undef _mmap_devzero +- #undef _mmap_worthy ++ #undef _mmap_anon + #endif + }end diff --git a/shells/ast-ksh/files/patch-src_lib_libast_features_standards b/shells/ast-ksh/files/patch-src_lib_libast_features_standards new file mode 100644 index 000000000000..afa1fd7ab0d9 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_features_standards @@ -0,0 +1,23 @@ +--- src/lib/libast/features/standards.orig 2017-11-30 22:35:04 UTC ++++ src/lib/libast/features/standards +@@ -1,5 +1,19 @@ + set stdio +-if tst note{ _GNU_SOURCE works }end compile{ ++# In FreeBSD, definitions like _POSIX_SOURCE and such are used to *limit* ++# functionality to known API; they don't enable anything. The general intent in ++# BSD is to enable everything by default (effectively, providing the ++# _KITCHEN_SINK_SOURCE mentioned below). So we look for that here, but stay ++# careful that we don't get fooled by presence of FreeBSD that underpins some ++# subsystems in Mac OS X; there are other Apple-specific portability hacks ++# elsewhere we should not interfere with. ++if tst note{ FreeBSD }end compile{ ++ #include <sys/param.h> ++ #if !defined(__FreeBSD__) || defined(APPLE) ++ #error not a FreeBSD system ++ #endif ++ }end { ++ } ++elif tst note{ _GNU_SOURCE works }end compile{ + #define _GNU_SOURCE 1 + #include <sys/types.h> + #include <sys/stat.h> diff --git a/shells/ast-ksh/files/patch-src_lib_libast_features_vmalloc b/shells/ast-ksh/files/patch-src_lib_libast_features_vmalloc new file mode 100644 index 000000000000..a90f1e720ef3 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_features_vmalloc @@ -0,0 +1,10 @@ +--- src/lib/libast/features/vmalloc.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/features/vmalloc +@@ -217,7 +217,4 @@ cat{ + #if _mmap_anon + #define _mem_mmap_anon 1 + #endif +- #if _mmap_devzero +- #define _mem_mmap_zero 1 +- #endif + }end diff --git a/shells/ast-ksh/files/patch-src_lib_libast_features_wchar b/shells/ast-ksh/files/patch-src_lib_libast_features_wchar new file mode 100644 index 000000000000..d3dca1657a59 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_features_wchar @@ -0,0 +1,10 @@ +--- src/lib/libast/features/wchar.orig 2017-11-30 22:35:04 UTC ++++ src/lib/libast/features/wchar +@@ -6,6 +6,7 @@ set include . + cat{ + #ifndef _AST_WCHAR_H + #define _AST_WCHAR_H 1 ++ #define _STDFILE_DECLARED + }end + + lib mbstowcs,wctomb,wcscmp,wcscoll,wcslen,wcstombs,wcsxfrm,wcwidth stdlib.h stdio.h wchar.h diff --git a/shells/ast-ksh/files/patch-src_lib_libast_port_astcopy.c b/shells/ast-ksh/files/patch-src_lib_libast_port_astcopy.c new file mode 100644 index 000000000000..c0bef96c2a0e --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_port_astcopy.c @@ -0,0 +1,17 @@ +--- src/lib/libast/port/astcopy.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/port/astcopy.c +@@ -30,14 +30,10 @@ + #include <ast.h> + #include <ast_mmap.h> + +-#if _mmap_worthy > 1 +- + #include <ls.h> + + #define MAPSIZE (1024*256) + +-#endif +- + #undef BUFSIZ + #define BUFSIZ 4096 + diff --git a/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfclose.c b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfclose.c new file mode 100644 index 000000000000..a105024eef4d --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfclose.c @@ -0,0 +1,14 @@ +--- src/lib/libast/sfio/sfclose.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/sfio/sfclose.c +@@ -104,11 +104,9 @@ Sfio_t* f; + + if(f->data && (!local || (f->flags&SF_STRING) || (f->bits&SF_MMAP) ) ) + { /* free buffer */ +-#if _mmap_worthy + if(f->bits&SF_MMAP) + SFMUNMAP(f,f->data,f->endb-f->data); + else +-#endif + if(f->flags&SF_MALLOC) + data = (Void_t*)f->data; + diff --git a/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfhdr.h b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfhdr.h new file mode 100644 index 000000000000..ed668e576208 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfhdr.h @@ -0,0 +1,12 @@ +--- src/lib/libast/sfio/sfhdr.h.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/sfio/sfhdr.h +@@ -209,9 +209,6 @@ + + /* see if we can use memory mapping for io */ + #if _LARGEFILE64_SOURCE && !_lib_mmap64 +-#undef _mmap_worthy +-#endif +-#if !_mmap_worthy + #undef _hdr_mman + #undef _sys_mman + #endif diff --git a/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfmode.c b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfmode.c new file mode 100644 index 000000000000..5e9133586795 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfmode.c @@ -0,0 +1,45 @@ +--- src/lib/libast/sfio/sfmode.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/sfio/sfmode.c +@@ -404,7 +404,6 @@ reg int local; /* a local call */ + + if(f->mode&SF_GETR) + { f->mode &= ~SF_GETR; +-#if _mmap_worthy + if(f->bits&SF_MMAP) + { + if (!++f->ngetr) +@@ -415,7 +414,6 @@ reg int local; /* a local call */ + f->ngetr = f->tiny[0] = 0; + } + } +-#endif + if(f->getr) + { f->next[-1] = f->getr; + f->getr = 0; +@@ -519,12 +517,10 @@ reg int local; /* a local call */ + if((f->flags&(SF_SHARE|SF_PUBLIC)) == (SF_SHARE|SF_PUBLIC) && + (addr = SFSK(f,0,SEEK_CUR,f->disc)) != f->here) + { +-#if _mmap_worthy + if((f->bits&SF_MMAP) && f->data) + { SFMUNMAP(f,f->data,f->endb-f->data); + f->data = NIL(uchar*); + } +-#endif + f->endb = f->endr = f->endw = f->next = f->data; + f->here = addr; + } +@@ -567,13 +563,11 @@ reg int local; /* a local call */ + } + + f->mode = SF_WRITE|SF_LOCK; +-#if _mmap_worthy + if(f->bits&SF_MMAP) + { if(f->data) + SFMUNMAP(f,f->data,f->endb-f->data); + (void)SFSETBUF(f,(Void_t*)f->tiny,(size_t)SF_UNBOUND); + } +-#endif + if(f->data == f->tiny) + { f->endb = f->data = f->next = NIL(uchar*); + f->size = 0; diff --git a/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfpurge.c b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfpurge.c new file mode 100644 index 000000000000..cde6c1337040 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfpurge.c @@ -0,0 +1,18 @@ +--- src/lib/libast/sfio/sfpurge.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/sfio/sfpurge.c +@@ -54,7 +54,6 @@ Sfio_t* f; + SFLOCK(f,0); + + /* if memory map must be a read stream, pretend data is gone */ +-#if _mmap_worthy + if(f->bits&SF_MMAP) + { f->here -= f->endb - f->next; + if(f->data) +@@ -64,7 +63,6 @@ Sfio_t* f; + SFOPEN(f,0); + SFMTXRETURN(f, 0); + } +-#endif + + switch(f->mode&~SF_LOCK) + { diff --git a/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfrd.c b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfrd.c new file mode 100644 index 000000000000..3edcfff7b7af --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfrd.c @@ -0,0 +1,31 @@ +--- src/lib/libast/sfio/sfrd.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/sfio/sfrd.c +@@ -92,12 +92,10 @@ Sfdisc_t* disc; + { f->endb = f->next = f->endr = f->data; + f->mode &= ~SF_SYNCED; + } +-#if _mmap_worthy + if((f->bits&SF_MMAP) && f->data) + { SFMUNMAP(f, f->data, f->endb-f->data); + f->data = NIL(uchar*); + } +-#endif + f->next = f->endb = f->endr = f->endw = f->data; + } + } +@@ -132,7 +130,6 @@ Sfdisc_t* disc; + } + } + +-#if _mmap_worthy + if(f->bits&SF_MMAP) + { reg ssize_t a, round; + sfstat_t st; +@@ -230,7 +227,6 @@ Sfdisc_t* disc; + } + } + } +-#endif + + /* sync unseekable write streams to prevent deadlock */ + if(!dosync && f->extent < 0) diff --git a/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfseek.c b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfseek.c new file mode 100644 index 000000000000..7f9e8d656d98 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfseek.c @@ -0,0 +1,43 @@ +--- src/lib/libast/sfio/sfseek.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/sfio/sfseek.c +@@ -34,12 +34,10 @@ Sfio_t* f; + Sfoff_t p; + #endif + { +-#if _mmap_worthy + if((f->bits&SF_MMAP) && f->data) + { SFMUNMAP(f, f->data, f->endb-f->data); + f->data = NIL(uchar*); + } +-#endif + f->next = f->endr = f->endw = f->data; + f->endb = (f->mode&SF_WRITE) ? f->data+f->size : f->data; + if((f->here = p) < 0) +@@ -201,23 +199,13 @@ int type; /* 0: from org, 1: from here, + if((p += type == SEEK_CUR ? s : 0) < 0) + goto done; + +-#if _mmap_worthy + if(f->bits&SF_MMAP) + { /* if mmap is not great, stop mmaping if moving around too much */ +-#if _mmap_worthy < 2 +- if((f->next - f->data) < ((f->endb - f->data)/4) ) +- { SFSETBUF(f,(Void_t*)f->tiny,(size_t)SF_UNBOUND); +- hardseek = 1; /* this forces a hard seek below */ +- } +- else +-#endif +- { /* for mmap, f->here can be virtual except for hardseek */ +- newpos(f,p); +- if(!hardseek) +- goto done; +- } ++ /* for mmap, f->here can be virtual except for hardseek */ ++ newpos(f,p); ++ if(!hardseek) ++ goto done; + } +-#endif + + if(f->endb > f->next) + { /* reduce wastage in future buffer fillings */ diff --git a/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfsetbuf.c b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfsetbuf.c new file mode 100644 index 000000000000..e534d7e4c418 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfsetbuf.c @@ -0,0 +1,34 @@ +--- src/lib/libast/sfio/sfsetbuf.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/sfio/sfsetbuf.c +@@ -302,7 +302,6 @@ size_t size; /* buffer size, -1 for defa + okmmap = (buf || (f->flags&SF_STRING) || (f->flags&SF_RDWR) == SF_RDWR) ? 0 : 1; + + /* save old buffer info */ +-#if _mmap_worthy + if(f->bits&SF_MMAP) + { if(f->data) + { if(f->getr && (f->mode&SF_GETR) && f->next) +@@ -311,7 +310,6 @@ size_t size; /* buffer size, -1 for defa + f->data = NIL(uchar*); + } + } else +-#endif + if(f->data == f->tiny) + { f->data = NIL(uchar*); + f->size = 0; +@@ -438,7 +436,6 @@ size_t size; /* buffer size, -1 for defa + } + } + +-#if _mmap_worthy + if(okmmap && size && (f->mode&SF_READ) && f->extent >= 0 ) + { /* see if we can try memory mapping */ + if(!disc) +@@ -457,7 +454,6 @@ size_t size; /* buffer size, -1 for defa + } + } + } +-#endif + + /* get buffer space */ + setbuf: diff --git a/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfsetfd.c b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfsetfd.c new file mode 100644 index 000000000000..f95d17a92c73 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfsetfd.c @@ -0,0 +1,15 @@ +--- src/lib/libast/sfio/sfsetfd.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/sfio/sfsetfd.c +@@ -108,12 +108,10 @@ int newfd; + SFMTXRETURN(f, -1); + } + +-#if _mmap_worthy + if((f->bits&SF_MMAP) && f->data) + { SFMUNMAP(f,f->data,f->endb-f->data); + f->data = NIL(uchar*); + } +-#endif + + /* make stream appears uninitialized */ + f->endb = f->endr = f->endw = f->data; diff --git a/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfsize.c b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfsize.c new file mode 100644 index 000000000000..0b05e2099c37 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfsize.c @@ -0,0 +1,15 @@ +--- src/lib/libast/sfio/sfsize.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/sfio/sfsize.c +@@ -80,12 +80,10 @@ Sfio_t* f; + + if(f->here != s && (f->mode&SF_READ) ) + { /* buffered data is known to be invalid */ +-#if _mmap_worthy + if((f->bits&SF_MMAP) && f->data) + { SFMUNMAP(f,f->data,f->endb-f->data); + f->data = NIL(uchar*); + } +-#endif + f->next = f->endb = f->endr = f->endw = f->data; + } + diff --git a/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfsk.c b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfsk.c new file mode 100644 index 000000000000..7eb1f024d8c7 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_sfio_sfsk.c @@ -0,0 +1,15 @@ +--- src/lib/libast/sfio/sfsk.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/sfio/sfsk.c +@@ -49,12 +49,10 @@ Sfdisc_t* disc; + SFMTXRETURN(f, (Sfoff_t)(-1)); + if(SFSYNC(f) < 0) + SFMTXRETURN(f, (Sfoff_t)(-1)); +-#if _mmap_worthy + if(f->mode == SF_READ && (f->bits&SF_MMAP) && f->data) + { SFMUNMAP(f, f->data, f->endb-f->data); + f->data = NIL(uchar*); + } +-#endif + f->next = f->endb = f->endr = f->endw = f->data; + } + diff --git a/shells/ast-ksh/files/patch-src_lib_libast_string_strexpr.c b/shells/ast-ksh/files/patch-src_lib_libast_string_strexpr.c new file mode 100644 index 000000000000..d4f706b9b147 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_string_strexpr.c @@ -0,0 +1,87 @@ +--- src/lib/libast/string/strexpr.c.orig 2017-11-30 22:35:04 UTC ++++ src/lib/libast/string/strexpr.c +@@ -44,7 +44,7 @@ + #define peekchr(ex) (*(ex)->nextchr) + #define ungetchr(ex) ((ex)->nextchr--) + +-#define error(ex,msg) return(seterror(ex,msg)) ++#define err(ex,msg) return(seterror(ex,msg)) + + typedef struct /* expression handle */ + { +@@ -87,7 +87,7 @@ expr(register Expr_t* ex, register int p + case 0: + ungetchr(ex); + if (!precedence) return(0); +- error(ex, "more tokens expected"); ++ err(ex, "more tokens expected"); + case '-': + n = -expr(ex, 13); + break; +@@ -113,17 +113,17 @@ expr(register Expr_t* ex, register int p + case 0: + goto done; + case ')': +- if (!precedence) error(ex, "too many )'s"); ++ if (!precedence) err(ex, "too many )'s"); + goto done; + case '(': + n = expr(ex, 1); + if (getchr(ex) != ')') + { + ungetchr(ex); +- error(ex, "closing ) expected"); ++ err(ex, "closing ) expected"); + } + gotoperand: +- if (operand) error(ex, "operator expected"); ++ if (operand) err(ex, "operator expected"); + operand = 1; + continue; + case '?': +@@ -140,7 +140,7 @@ expr(register Expr_t* ex, register int p + if (getchr(ex) != ':') + { + ungetchr(ex); +- error(ex, ": expected for ? operator"); ++ err(ex, ": expected for ? operator"); + } + if (n) + { +@@ -189,7 +189,7 @@ expr(register Expr_t* ex, register int p + break; + case '=': + case '!': +- if (peekchr(ex) != '=') error(ex, "operator syntax error"); ++ if (peekchr(ex) != '=') err(ex, "operator syntax error"); + if (precedence > 7) goto done; + getchr(ex); + x = expr(ex, 8); +@@ -237,7 +237,7 @@ expr(register Expr_t* ex, register int p + if (precedence > 11) goto done; + x = expr(ex, 12); + if (c == '*') n *= x; +- else if (x == 0) error(ex, "divide by zero"); ++ else if (x == 0) err(ex, "divide by zero"); + else if (c == '/') n /= x; + else n %= x; + break; +@@ -246,15 +246,15 @@ expr(register Expr_t* ex, register int p + pos = --ex->nextchr; + if (isdigit(c)) n = strton(ex->nextchr, &ex->nextchr, NiL, 0); + else if (ex->convert) n = (*ex->convert)(ex->nextchr, &ex->nextchr, ex->handle); +- if (ex->nextchr == pos) error(ex, "syntax error"); ++ if (ex->nextchr == pos) err(ex, "syntax error"); + goto gotoperand; + } + if (ex->errmsg) return(0); +- if (!operand) error(ex, "operand expected"); ++ if (!operand) err(ex, "operand expected"); + } + done: + ungetchr(ex); +- if (!operand) error(ex, "operand expected"); ++ if (!operand) err(ex, "operand expected"); + return(n); + } + diff --git a/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_malloc.c b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_malloc.c new file mode 100644 index 000000000000..1325590bc2fb --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_malloc.c @@ -0,0 +1,20 @@ +--- src/lib/libast/vmalloc/malloc.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/vmalloc/malloc.c +@@ -906,7 +906,7 @@ union Alloca_u + { char* addr; + Alloca_t* next; + } head; +- char array[ALIGN]; ++ char array[MEM_ALIGN]; + }; + struct Alloca_s + { union Alloca_u head; +@@ -914,7 +914,7 @@ struct Alloca_s + }; + + extern Void_t* alloca(size_t size) +-{ char array[ALIGN]; ++{ char array[MEM_ALIGN]; + char* file; + int line; + Void_t* func; diff --git a/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmbest.c b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmbest.c new file mode 100644 index 000000000000..4719be7c9872 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmbest.c @@ -0,0 +1,101 @@ +--- src/lib/libast/vmalloc/vmbest.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/vmalloc/vmbest.c +@@ -64,19 +64,19 @@ void _STUB_vmbest(){} + #define PK_ALLOW 128 /* min #packs allowed to be created */ + + /* Small requests are rounded to 0%SM_RNDx */ +-#define SM_RND0 (1*ALIGN) /* round value: 1*ALIGN == 16 */ ++#define SM_RND0 (1*MEM_ALIGN) /* round value: 1*MEM_ALIGN == 16 */ + #define SM_BIT0 4 /* (1<<SM_BIT0) == SM_RND0 */ + #define SM_CNT0 16 /* # caches as rounded by SM_RND0 */ + #define SM_IDX0 0 /* starting cache index of this group */ + #define SM_MAX0 (SM_CNT0*SM_RND0) + +-#define SM_RND1 (2*ALIGN) /* round value: 2*ALIGN == 32 */ ++#define SM_RND1 (2*MEM_ALIGN) /* round value: 2*MEM_ALIGN == 32 */ + #define SM_CNT1 8 + #define SM_BIT1 5 + #define SM_IDX1 (SM_IDX0+SM_CNT0) + #define SM_MAX1 (SM_MAX0 + SM_CNT1*SM_RND1) + +-#define SM_RND2 (4*ALIGN) /* round value: 4*ALIGN == 64 */ ++#define SM_RND2 (4*MEM_ALIGN) /* round value: 4*MEM_ALIGN == 64 */ + #define SM_BIT2 6 + #define SM_CNT2 8 + #define SM_IDX2 (SM_IDX1+SM_CNT1) +@@ -167,7 +167,7 @@ static int chktree(Pack_t* pack, Block_t + if(_Vmassert & VM_check_reg) + { if(!node) /* the empty tree is always good */ + return 0; +- /**/DEBUG_ASSERT(BDSZ(node) >= BODYSIZE && (BDSZ(node)%ALIGN) == 0 ); ++ /**/DEBUG_ASSERT(BDSZ(node) >= BODYSIZE && (BDSZ(node)%MEM_ALIGN) == 0 ); + + if(SIZE(node) & (BUSY|PFREE)) /* should be BITS-free */ + { /**/DEBUG_MESSAGE("Free block corrupted"); /**/DEBUG_ASSERT(0); return -1; } +@@ -252,7 +252,7 @@ static int bestfree(Vmalloc_t* vm, Void_ + if((Vmuchar_t*)data < vm->data->segmin || (Vmuchar_t*)data >= vm->data->segmax) + return -1; + +- blk = BLOCK(data); /**/DEBUG_ASSERT((SIZE(blk)&BUSY) && (BDSZ(blk)%ALIGN) == 0 ); ++ blk = BLOCK(data); /**/DEBUG_ASSERT((SIZE(blk)&BUSY) && (BDSZ(blk)%MEM_ALIGN) == 0 ); + pack = PACK(blk); /**/DEBUG_ASSERT(pack->best == (Vmbest_t*)vm->data); + if((sz = SIZE(blk))&SMALL ) + listp = &pack->small[SMDECODE(sz)].free; +@@ -339,7 +339,7 @@ static Block_t* bestpackextend(Vmalloc_t + + /**/DEBUG_ASSERT(!wild || (PACK(wild) == pack && BDSZ(wild) < size && PACKWILD(pack,wild)) ); + blkz = BDSZ(pack->pblk); /**/DEBUG_ASSERT(blkz >= _Vmpagesize); +- size += blkz - (wild ? BDSZ(wild) : 0) + EXTRA(pack); /**/DEBUG_ASSERT(size%ALIGN == 0); ++ size += blkz - (wild ? BDSZ(wild) : 0) + EXTRA(pack); /**/DEBUG_ASSERT(size%MEM_ALIGN == 0); + 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); + if(!(pblk = (*_Vmsegalloc)(vm, pack->pblk, size, segtype)) ) + pblk = pack->pblk; +@@ -383,7 +383,7 @@ static Block_t* bestpackextract(Pack_t* + + l = r = &link; + if((root = pack->root) ) do /* top-down splay tree search */ +- { /**/DEBUG_ASSERT((size%ALIGN) == 0 && !(SIZE(root)&(BUSY|PFREE)) ); ++ { /**/DEBUG_ASSERT((size%MEM_ALIGN) == 0 && !(SIZE(root)&(BUSY|PFREE)) ); + if(size == (sz = BDSZ(root)) ) + break; + if(size < sz) +@@ -508,7 +508,7 @@ static int bestlistreclaim(Vmalloc_t* vm + continue; + + /**/DEBUG_ASSERT((SIZE(fp)&(BUSY|MARK)) == (BUSY|MARK) ); +- /**/DEBUG_ASSERT(BDSZ(fp) >= sizeof(Body_t) && BDSZ(fp)%ALIGN == 0); ++ /**/DEBUG_ASSERT(BDSZ(fp) >= sizeof(Body_t) && BDSZ(fp)%MEM_ALIGN == 0); + SIZE(fp) &= ~BITS; + t = NEXT(fp); + SIZE(t) |= PFREE; /**/DEBUG_ASSERT(SIZE(NEXT(fp))&BUSY); +@@ -563,7 +563,7 @@ static Block_t* bestpackalloc(Vmalloc_t* + ssize_t sz; + Block_t *tp, *np, *pblk; + Vmbest_t *best = (Vmbest_t*)vm->data; +- /**/DEBUG_ASSERT(size >= sizeof(Body_t) && size%ALIGN == 0); ++ /**/DEBUG_ASSERT(size >= sizeof(Body_t) && size%MEM_ALIGN == 0); + + if((tp = pack->alloc) ) /* fast allocation from recent memory */ + { pack->alloc = NIL(Block_t*); +@@ -719,9 +719,9 @@ static Void_t* bestalloc(Vmalloc_t* vm, + asospindecl(); + + /**/DEBUG_COUNT(N_alloc); +- /**/DEBUG_ASSERT((ALIGN%(BITS+1)) == 0 ); +- /**/DEBUG_ASSERT((sizeof(Head_t)%ALIGN) == 0 ); +- /**/DEBUG_ASSERT((sizeof(Body_t)%ALIGN) == 0 ); ++ /**/DEBUG_ASSERT((MEM_ALIGN%(BITS+1)) == 0 ); ++ /**/DEBUG_ASSERT((sizeof(Head_t)%MEM_ALIGN) == 0 ); ++ /**/DEBUG_ASSERT((sizeof(Body_t)%MEM_ALIGN) == 0 ); + /**/DEBUG_ASSERT(sizeof(Block_t) == (sizeof(Body_t)+sizeof(Head_t)) ); + /**/DEBUG_ASSERT(chkregion((Vmbest_t*)vm->data, local) >= 0); + +@@ -902,7 +902,7 @@ static Void_t* bestalign(Vmalloc_t* vm, + return NIL(Void_t*); + + algz = LGROUND(size); +- algn = (*_Vmlcm)(align,ALIGN); ++ algn = (*_Vmlcm)(align,MEM_ALIGN); + + /* non-Vmbest methods may require extra header space */ + if(METHOD(best) != VM_MTBEST && vm->meth.eventf) diff --git a/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmdcshare.c b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmdcshare.c new file mode 100644 index 000000000000..0d74588f3dfa --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmdcshare.c @@ -0,0 +1,20 @@ +--- src/lib/libast/vmalloc/vmdcshare.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/vmalloc/vmdcshare.c +@@ -61,7 +61,7 @@ void _STUB_vmdcshare(){} + #define MM_REMOVE 02 /* remove files/segments */ + + /* macros to get the data section and size */ +-#define MMHEAD(name) ROUND(sizeof(Mmvm_t)+strlen(name), ALIGN) ++#define MMHEAD(name) ROUND(sizeof(Mmvm_t)+strlen(name), MEM_ALIGN) + #define MMDATA(mmvm) ((Vmuchar_t*)(mmvm)->base + MMHEAD(mmvm->name)) + #define MMSIZE(mmvm) ((mmvm)->size - MMHEAD(mmvm->name)) + +@@ -178,7 +178,7 @@ static int mminit(Mmdisc_t* mmdc) + /* fixed size region so make it reasonably large */ + if((size = mmdc->size) < MM_MINSIZE ) + size = MM_MINSIZE; +- size += MMHEAD(mmdc->name) + ALIGN; ++ size += MMHEAD(mmdc->name) + MEM_ALIGN; + size = ROUND(size, _Vmpagesize); + + /* get/create the initial segment of data */ diff --git a/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmdcsystem.c b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmdcsystem.c new file mode 100644 index 000000000000..f8eb483f045a --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmdcsystem.c @@ -0,0 +1,126 @@ +--- src/lib/libast/vmalloc/vmdcsystem.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/vmalloc/vmdcsystem.c +@@ -66,18 +66,16 @@ static Vmemory_f _Vmemoryf = 0; + + #if _std_malloc + #undef _mem_mmap_anon +-#undef _mem_mmap_zero + #undef _mem_sbrk + #undef _mem_win32 + #endif + + #if _mem_win32 + #undef _mem_mmap_anon +-#undef _mem_mmap_zero + #undef _mem_sbrk + #endif + +-#if _mem_mmap_anon || _mem_mmap_zero /* may get space using mmap */ ++#if _mem_mmap_anon /* may get space using mmap */ + #include <sys/mman.h> + #ifndef MAP_ANON + #ifdef MAP_ANONYMOUS +@@ -86,7 +84,7 @@ static Vmemory_f _Vmemoryf = 0; + #define MAP_ANON 0 + #endif /*MAP_ANONYMOUS*/ + #endif /*MAP_ANON*/ +-#endif /*_mem_mmap_anon || _mem_mmap_zero*/ ++#endif /*_mem_mmap_anon*/ + + /* + * hint at "transparent huge pages" (=largepages) if +@@ -259,73 +257,6 @@ static Void_t* mmapanonmem(Vmalloc_t* vm + } + #endif /* _mem_mmap_anon */ + +-#if _mem_mmap_zero /* get space by mmapping from /dev/zero */ +-#include <fcntl.h> +-#ifndef OPEN_MAX +-#define OPEN_MAX 64 +-#endif +-#define FD_PRIVATE (3*OPEN_MAX/4) /* private file descriptor */ +-#define FD_NONE (-2) /* no mapping with file desc */ +- +-/* this is called after an initial successful call of mmapzeromeminit() */ +-static Void_t* mmapzeromem(Vmalloc_t* vm, Void_t* caddr, size_t csize, size_t nsize, Vmdisc_t* disc) +-{ +- Memdisc_t* mmdc = (Memdisc_t*)disc; +- off_t offset; +- +- GETMEMCHK(vm, caddr, csize, nsize, disc); +- if(csize == 0) +- { nsize = ROUND(nsize, _Vmpagesize); +- offset = asoaddoff(&mmdc->offset, nsize); +- RESTARTMEM(caddr, mmap(NIL(Void_t*), nsize, PROT_READ|PROT_WRITE, MAP_PRIVATE, mmdc->fd, offset)); +- ADVISE(vm, caddr, nsize); +- RETURN(vm, caddr, nsize); +- } +- else if(nsize == 0) +- { Vmuchar_t *addr = (Vmuchar_t*)sbrk(0); +- if(addr < (Vmuchar_t*)caddr ) /* in sbrk space */ +- return NIL(Void_t*); +- (void)munmap(caddr, csize); +- RETURN(vm, caddr, nsize); +- } +- else return NIL(Void_t*); +-} +- +-/* if this call succeeds then mmapzeromem() is the implementation */ +-static Void_t* mmapzeromeminit(Vmalloc_t* vm, Void_t* caddr, size_t csize, size_t nsize, Vmdisc_t* disc) +-{ +- Memdisc_t* mmdc = (Memdisc_t*)disc; +- int fd; +- +- GETMEMCHK(vm, caddr, csize, nsize, disc); +- if(mmdc->fd != FD_INIT) +- return NIL(Void_t*); +- RESTARTSYS(fd, open("/dev/zero", O_RDONLY|O_CLOEXEC)); +- if(fd < 0) +- { mmdc->fd = FD_NONE; +- return NIL(Void_t*); +- } +-#if O_CLOEXEC == 0 +- else +- SETCLOEXEC(fd); +-#endif +- if(fd >= FD_PRIVATE || (mmdc->fd = fcntl(fd, F_DUPFD_CLOEXEC, FD_PRIVATE)) < 0) +- mmdc->fd = fd; +- else +- { close(fd); +-#if F_DUPFD_CLOEXEC == F_DUPFD +- SETCLOEXEC(mmdc->fd); +-#endif +- } +- RESTARTMEM(caddr, mmapzeromem(vm, caddr, csize, nsize, disc)); +- if(!caddr) +- { close(mmdc->fd); +- mmdc->fd = FD_NONE; +- } +- RETURN(vm, caddr, nsize); +-} +-#endif /* _mem_mmap_zero */ +- + #if _std_malloc /* using native malloc as a last resort */ + static Void_t* mallocmem(Vmalloc_t* vm, Void_t* caddr, size_t csize, size_t nsize, Vmdisc_t* disc) + { +@@ -364,12 +295,6 @@ static Void_t* getmemory(Vmalloc_t* vm, + return (Void_t*)addr; + } + #endif +-#if _mem_mmap_zero +- if((_Vmassert & VM_zero) && (addr = mmapzeromeminit(vm, caddr, csize, nsize, disc))) +- { GETMEMUSE(mmapzeromem, disc); +- return (Void_t*)addr; +- } +-#endif + #if _mem_sbrk + if((_Vmassert & VM_break) && (addr = sbrkmem(vm, caddr, csize, nsize, disc))) + { GETMEMUSE(sbrkmem, disc); +@@ -386,6 +311,7 @@ static Void_t* getmemory(Vmalloc_t* vm, + if((_Vmassert & VM_native) && (addr = mallocmem(vm, caddr, csize, nsize, disc))) + { GETMEMUSE(mallocmem, disc); + return (Void_t*)addr; ++ } + #endif + write(2, "vmalloc: panic: all memory allocation disciplines failed\n", 57); + abort(); diff --git a/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmdebug.c b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmdebug.c new file mode 100644 index 000000000000..b0f7ce75b3fc --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmdebug.c @@ -0,0 +1,29 @@ +--- src/lib/libast/vmalloc/vmdebug.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/vmalloc/vmdebug.c +@@ -335,7 +335,7 @@ int local; + if(vm->data->mode&VM_DBCHECK) + vmdbcheck(vm); + +- sz = ROUND(size,ALIGN) + DB_EXTRA; ++ sz = ROUND(size,MEM_ALIGN) + DB_EXTRA; + sz = sz >= sizeof(Body_t) ? sz : sizeof(Body_t); + if(!(data = (Vmuchar_t*)KPVALLOC(vm, sz, (*(Vmbest->allocf))) ) ) + { dbwarn(vm, NIL(Vmuchar_t*), DB_ALLOC, file, line, func, DB_ALLOC); +@@ -483,7 +483,7 @@ int local; + oldline = DBLINE(addr); + + /* do the resize */ +- sz = ROUND(size,ALIGN) + DB_EXTRA; ++ sz = ROUND(size,MEM_ALIGN) + DB_EXTRA; + sz = sz >= sizeof(Body_t) ? sz : sizeof(Body_t); + data = (Vmuchar_t*)KPVRESIZE(vm, (Void_t*)data, sz, (type&~VM_RSZERO), (*(Vmbest->resizef)) ); + if(!data) /* failed, reset data for old block */ +@@ -632,7 +632,7 @@ int local; + + asolock(&vm->data->dlck, KEY_DEBUG, ASO_LOCK); + +- if((sz = ROUND(size,ALIGN) + DB_EXTRA) < sizeof(Body_t)) ++ if((sz = ROUND(size,MEM_ALIGN) + DB_EXTRA) < sizeof(Body_t)) + sz = sizeof(Body_t); + + if((data = (Vmuchar_t*)KPVALIGN(vm, sz, align, (*(Vmbest->alignf)))) ) diff --git a/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmhdr.h b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmhdr.h new file mode 100644 index 000000000000..070b74ebaa0a --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmhdr.h @@ -0,0 +1,86 @@ +--- src/lib/libast/vmalloc/vmhdr.h.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/vmalloc/vmhdr.h +@@ -86,7 +86,7 @@ + #if defined(_WIN32) + #define _mem_win32 1 /* use the VirtualAlloc interface */ + #endif +-#if !_mem_win32 && !_mem_sbrk && !_mem_mmap_anon && !_mem_mmap_zero ++#if !_mem_win32 && !_mem_sbrk && !_mem_mmap_anon + #undef _std_malloc + #define _std_malloc 1 /* use native malloc/free/realloc */ + #endif +@@ -160,11 +160,11 @@ extern void _vmmessage _ARG_((const cha + (ABORT() ? (abort(),0) : PAUSE() ? (pause(),0) : 0)) ) + #define COUNT(n) ((n) += 1) + #define ACCOUNT(a,b) ((a) += (b)) +-#define INITMEMORY(m,z) ((m) ? (memset((m), 'i', (z) > 2*ALIGN ? 2*ALIGN : (z)), 0) : 0 ) +-#define SETBUSYMEM(m,z) (memset(((char*)(m))+2*ALIGN, 'b', (z) <= 2*ALIGN ? 0 : ALIGN ) ) +-#define CHKBUSYMEM(m,z) (memcmp(((char*)(m))+2*ALIGN, "bbbbbbbb", (z) <= 2*ALIGN ? 0 : 8) == 0 ? 1 : 0 ) +-#define SETFREEMEM(m,z) (memset(((char*)(m))+2*ALIGN, 'f', (z) <= 2*ALIGN ? 0 : ALIGN ) ) +-#define CHKFREEMEM(m,z) (memcmp(((char*)(m))+2*ALIGN, "ffffffff", (z) <= 2*ALIGN ? 0 : 8) == 0 ? 1 : 0 ) ++#define INITMEMORY(m,z) ((m) ? (memset((m), 'i', (z) > 2*MEM_ALIGN ? 2*MEM_ALIGN : (z)), 0) : 0 ) ++#define SETBUSYMEM(m,z) (memset(((char*)(m))+2*MEM_ALIGN, 'b', (z) <= 2*MEM_ALIGN ? 0 : MEM_ALIGN ) ) ++#define CHKBUSYMEM(m,z) (memcmp(((char*)(m))+2*MEM_ALIGN, "bbbbbbbb", (z) <= 2*MEM_ALIGN ? 0 : 8) == 0 ? 1 : 0 ) ++#define SETFREEMEM(m,z) (memset(((char*)(m))+2*MEM_ALIGN, 'f', (z) <= 2*MEM_ALIGN ? 0 : MEM_ALIGN ) ) ++#define CHKFREEMEM(m,z) (memcmp(((char*)(m))+2*MEM_ALIGN, "ffffffff", (z) <= 2*MEM_ALIGN ? 0 : 8) == 0 ? 1 : 0 ) + #define DEBUGDECL(_ty_,_ob_) _ty_ _ob_; + #else + #define ABORT() (0) +@@ -203,7 +203,7 @@ extern void _vmmessage _ARG_((const cha + #define BITS (BUSY|PFREE|SMALL|MARK) + #define ALIGNB (BITS+1) /* to guarantee blksize == 0%(BITS+1) */ + +-/* ALIGN is chosen for three conditions: ++/* MEM_ALIGN is chosen for three conditions: + ** 1. Able to address all primitive types. + ** 2. A multiple of ALIGNB==(BITS+1) as discussed above. + ** 3. Large enough to cover two pointers. Note that on some machines +@@ -238,9 +238,9 @@ struct _two_s + void* two; + }; + #define ALIGNA (sizeof(struct _a_s) - sizeof(union _align_u)) +-#undef ALIGN /* Blocks will be aligned on both ALIGNA & ALIGNB */ ++#undef MEM_ALIGN /* Blocks will be aligned on both ALIGNA & ALIGNB */ + #define ALIGNAB MULTIPLE(ALIGNA,ALIGNB) +-#define ALIGN MULTIPLE(ALIGNAB, sizeof(struct _two_s)) ++#define MEM_ALIGN MULTIPLE(ALIGNAB, sizeof(struct _two_s)) + + typedef union _word_u + { size_t size; /* to store a size_t */ +@@ -252,7 +252,7 @@ struct _head_s /* a block header has two + { Word_t one; + Word_t two; + }; +-#define HEADSIZE ROUND(sizeof(struct _head_s), ALIGN) ++#define HEADSIZE ROUND(sizeof(struct _head_s), MEM_ALIGN) + union _head_u + { Vmuchar_t data[HEADSIZE]; /* to standardize size */ + struct _head_s head; +@@ -264,15 +264,15 @@ struct _body_s /* Note that self is actu + Block_t* left; /* left child in free tree */ + Block_t** self; /* self pointer when free */ + }; +-#define BODYSIZE ROUND(sizeof(struct _body_s), ALIGN) ++#define BODYSIZE ROUND(sizeof(struct _body_s), MEM_ALIGN) + union _body_u + { Vmuchar_t data[BODYSIZE]; /* to standardize size */ + struct _body_s body; + }; + + /* After all the songs and dances, we should now have: +-** sizeof(Head_t)%ALIGN == 0 +-** sizeof(Body_t)%ALIGN == 0 ++** sizeof(Head_t)%MEM_ALIGN == 0 ++** sizeof(Body_t)%MEM_ALIGN == 0 + ** and sizeof(Block_t) = sizeof(Head_t)+sizeof(Body_t) + */ + struct _block_s +@@ -321,7 +321,7 @@ struct _block_s + #define ENDB(sgb) ((Block_t*)((Vmuchar_t*)NEXT(sgb) - sizeof(Head_t)) ) + + /* the start of allocatable memory in a segment */ +-#define SEGDATA(sg) ((Vmuchar_t*)(sg) + ROUND(sizeof(Seg_t),ALIGN) ) ++#define SEGDATA(sg) ((Vmuchar_t*)(sg) + ROUND(sizeof(Seg_t),MEM_ALIGN) ) + + /* testing to see if "sg" is the root segment of a region */ + #define SEGROOT(sg) ((Vmuchar_t*)(sg)->vmdt >= (sg)->base && \ diff --git a/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmlast.c b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmlast.c new file mode 100644 index 000000000000..358af02410f7 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmlast.c @@ -0,0 +1,40 @@ +--- src/lib/libast/vmalloc/vmlast.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/vmalloc/vmlast.c +@@ -61,7 +61,7 @@ int local; + + LASTLOCK(last, local); + +- size = size < ALIGN ? ALIGN : ROUND(size,ALIGN); ++ size = size < MEM_ALIGN ? MEM_ALIGN : ROUND(size,MEM_ALIGN); + + last->last = NIL(Vmuchar_t*); /* wipe record of last allocation */ + +@@ -119,7 +119,7 @@ int local; + if(data != (Void_t*)last->last ) + data = NIL(Void_t*); + else +- { size = last->data - last->last; /**/DEBUG_ASSERT(size > 0 && size%ALIGN == 0); ++ { size = last->data - last->last; /**/DEBUG_ASSERT(size > 0 && size%MEM_ALIGN == 0); + last->data -= size; + last->size += size; + last->last = NIL(Vmuchar_t*); +@@ -166,8 +166,8 @@ int local; + if(data != (Void_t*)last->last ) + data = NIL(Void_t*); + else +- { oldz = last->data - last->last; /**/DEBUG_ASSERT(oldz > 0 && oldz%ALIGN == 0); +- size = ROUND(size, ALIGN); ++ { oldz = last->data - last->last; /**/DEBUG_ASSERT(oldz > 0 && oldz%MEM_ALIGN == 0); ++ size = ROUND(size, MEM_ALIGN); + if(size <= oldz) /* getting smaller */ + { sz = oldz - size; + last->data -= sz; +@@ -249,7 +249,7 @@ int local; + + LASTLOCK(last, local); + +- size = ROUND(size,ALIGN); ++ size = ROUND(size,MEM_ALIGN); + align = (*_Vmlcm)(align, 2*sizeof(Block_t)); + + if((data = (Vmuchar_t*)KPVALLOC(vm, size + align, lastalloc)) ) diff --git a/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmmaddress.c b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmmaddress.c new file mode 100644 index 000000000000..75906dbc92aa --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmmaddress.c @@ -0,0 +1,11 @@ +--- src/lib/libast/vmalloc/vmmaddress.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/vmalloc/vmmaddress.c +@@ -96,7 +96,7 @@ ssize_t _vmpagesize(void) + if ((_Vmpagesize = getpagesize()) <= 0) + #endif + _Vmpagesize = VM_PAGESIZE; +- _Vmpagesize = (*_Vmlcm)(_Vmpagesize, ALIGN); ++ _Vmpagesize = (*_Vmlcm)(_Vmpagesize, MEM_ALIGN); + } + #if VMCHKMEM + _Vmchkmem = _vmchkmem; /* _vmchkmem() can check memory availability */ diff --git a/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmopen.c b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmopen.c new file mode 100644 index 000000000000..c580b4d6e408 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmopen.c @@ -0,0 +1,61 @@ +--- src/lib/libast/vmalloc/vmopen.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/vmalloc/vmopen.c +@@ -97,10 +97,10 @@ int mode; /* type of region */ + write(9, "vmalloc: panic: heap initialization error #2\n", 45); + return NIL(Vmalloc_t*); + } +- /**/DEBUG_ASSERT(VMLONG(vd)%ALIGN == 0); ++ /**/DEBUG_ASSERT(VMLONG(vd)%MEM_ALIGN == 0); + + if(vd->mode & VM_MEMORYF) /* point addr to Vmalloc_t */ +- addr -= ROUND(sizeof(Vmalloc_t), ALIGN); ++ addr -= ROUND(sizeof(Vmalloc_t), MEM_ALIGN); + } + } + +@@ -110,7 +110,7 @@ int mode; /* type of region */ + incr = disc->round <= 0 ? _Vmpagesize : ROUND(disc->round, _Vmpagesize); + + /* size of Vmalloc_t if embedded in the same initial segment */ +- vmsz = (mode&VM_MEMORYF) ? ROUND(sizeof(Vmalloc_t),ALIGN) : 0; ++ vmsz = (mode&VM_MEMORYF) ? ROUND(sizeof(Vmalloc_t),MEM_ALIGN) : 0; + + vdsz = 0; /* get actual size of Vmdata_t including method specific data */ + if(!meth->eventf || (*meth->eventf)(vmp, VM_OPEN, &vdsz) < 0 || vdsz <= 0 ) +@@ -118,13 +118,13 @@ int mode; /* type of region */ + write(9, "vmalloc: panic: heap initialization error #3\n", 45); + return NIL(Vmalloc_t*); + } +- vdsz = ROUND(vdsz, ALIGN); ++ vdsz = ROUND(vdsz, MEM_ALIGN); + +- sgsz = ROUND(sizeof(Seg_t), ALIGN); /* size of segment structure */ ++ sgsz = ROUND(sizeof(Seg_t), MEM_ALIGN); /* size of segment structure */ + + /* get initial memory segment containing Vmdata_t, Seg_t and some extra */ + size = vmsz + vdsz + sgsz + 8*_Vmpagesize; +- size = ROUND(size,incr); /**/DEBUG_ASSERT(size%ALIGN == 0 ); ++ size = ROUND(size,incr); /**/DEBUG_ASSERT(size%MEM_ALIGN == 0 ); + if(!(base = (Vmuchar_t*)(*disc->memoryf)(vmp, NIL(Void_t*), 0, size, disc)) ) + { if(initheap) + write(9, "vmalloc: panic: heap initialization error #4\n", 45); +@@ -136,14 +136,14 @@ int mode; /* type of region */ + memset(base, 0, vmsz + vdsz + sgsz); + + /* make sure memory is properly aligned */ +- if((algn = (ssize_t)(VMLONG(base)%ALIGN)) == 0 ) ++ if((algn = (ssize_t)(VMLONG(base)%MEM_ALIGN)) == 0 ) + addr = base; +- else addr = base + (ALIGN-algn); +- /**/DEBUG_ASSERT(VMLONG(addr)%ALIGN == 0 ); ++ else addr = base + (MEM_ALIGN-algn); ++ /**/DEBUG_ASSERT(VMLONG(addr)%MEM_ALIGN == 0 ); + + /* addresses of Vmdata_t and root segment */ +- vd = (Vmdata_t*)(addr + vmsz); /**/DEBUG_ASSERT(VMLONG(vd)%ALIGN == 0); +- seg = (Seg_t*)(addr + vmsz + vdsz); /**/DEBUG_ASSERT(VMLONG(seg)%ALIGN == 0); ++ vd = (Vmdata_t*)(addr + vmsz); /**/DEBUG_ASSERT(VMLONG(vd)%MEM_ALIGN == 0); ++ seg = (Seg_t*)(addr + vmsz + vdsz); /**/DEBUG_ASSERT(VMLONG(seg)%MEM_ALIGN == 0); + + /* set Vmdata_t data */ + vd->mode = mode; diff --git a/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmpool.c b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmpool.c new file mode 100644 index 000000000000..7a69ac7c002d --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmpool.c @@ -0,0 +1,20 @@ +--- src/lib/libast/vmalloc/vmpool.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/vmalloc/vmpool.c +@@ -47,7 +47,7 @@ typedef struct _vmpool_s + Pool_t* free; /* list of free blocks */ + } Vmpool_t; + +-#define POOLSIZE(sz) ROUND(ROUND((sz), sizeof(Pool_t)), ALIGN) ++#define POOLSIZE(sz) ROUND(ROUND((sz), sizeof(Pool_t)), MEM_ALIGN) + + #ifdef DEBUG + static int N_pool; /* counter for Vmpool calls */ +@@ -206,7 +206,7 @@ static int poolstat(Vmalloc_t* vm, Vmsta + if(pool->size <= 0 ) + return -1; + +- size = ROUND(pool->size, ALIGN); ++ size = ROUND(pool->size, MEM_ALIGN); + + for(pl = pool->free; pl; pl = pl->next ) + st->n_free += 1; diff --git a/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmsegment.c b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmsegment.c new file mode 100644 index 000000000000..f9459210fb84 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libast_vmalloc_vmsegment.c @@ -0,0 +1,32 @@ +--- src/lib/libast/vmalloc/vmsegment.c.orig 2016-02-28 17:09:23 UTC ++++ src/lib/libast/vmalloc/vmsegment.c +@@ -194,7 +194,7 @@ static Block_t* _vmseginit(Vmdata_t* vmd + + /* available memory in Seg_t for allocation usage */ + size = (base+size) - SEGDATA(seg); +- size = (size/ALIGN)*ALIGN; /* must be multiple of ALIGN's */ ++ size = (size/MEM_ALIGN)*MEM_ALIGN; /* must be multiple of MEM_ALIGN's */ + + /* block at start of memory */ + seg->begb = (Block_t*)SEGDATA(seg); +@@ -256,7 +256,7 @@ static Block_t* _vmsegalloc(Vmalloc_t* v + static size_t Segunit = 0; + /**/DEBUG_COUNT(N_segalloc); + /**/DEBUG_ASSERT(!blk || (isblock(vmdt, blk) && (SIZE(blk)&BUSY) ) ); +- /**/DEBUG_ASSERT(_Vmpagesize > 0 && _Vmpagesize%ALIGN == 0 ); ++ /**/DEBUG_ASSERT(_Vmpagesize > 0 && _Vmpagesize%MEM_ALIGN == 0 ); + + /* transition to a fixed place to unlock before returning */ + #undef RETURN +@@ -381,9 +381,9 @@ static Block_t* _vmsegalloc(Vmalloc_t* v + } + + /* segment must start at an aligned address */ +- if((sz = (size_t)(VMLONG(base)%ALIGN)) == 0) ++ if((sz = (size_t)(VMLONG(base)%MEM_ALIGN)) == 0) + seg = (Seg_t*)base; +- else seg = (Seg_t*)(base + ALIGN-sz); ++ else seg = (Seg_t*)(base + MEM_ALIGN-sz); + blk = _vmseginit(vmdt, seg, base, segsz, 0); + } + diff --git a/shells/ast-ksh/files/patch-src_lib_libcmd_ls.c b/shells/ast-ksh/files/patch-src_lib_libcmd_ls.c new file mode 100644 index 000000000000..61070f2197b1 --- /dev/null +++ b/shells/ast-ksh/files/patch-src_lib_libcmd_ls.c @@ -0,0 +1,32 @@ +--- src/lib/libcmd/ls.c.orig 2017-11-30 22:35:04 UTC ++++ src/lib/libcmd/ls.c +@@ -1257,7 +1257,7 @@ ls(State_t* state, register FTSENT* ent) + if (!VISIBLE(state, ent)) + { + fts_set(NiL, ent, FTS_SKIP); +- return; ++ return 0; + } + switch (ent->fts_info) + { +@@ -1265,17 +1265,17 @@ ls(State_t* state, register FTSENT* ent) + if (ent->fts_parent->fts_info == FTS_DNX) + break; + error(2, "%s: not found", ent->fts_path); +- return; ++ return 1; + case FTS_DC: + if (state->lsflags & LS_DIRECTORY) + break; + error(2, "%s: directory causes cycle", ent->fts_path); +- return; ++ return 1; + case FTS_DNR: + if (state->lsflags & LS_DIRECTORY) + break; + error(2, "%s: cannot read directory", ent->fts_path); +- return 0; ++ return 1; + case FTS_DOT: + #if 0 + fts_set(NiL, ent, FTS_SKIP); diff --git a/shells/ast-ksh/pkg-descr b/shells/ast-ksh/pkg-descr new file mode 100644 index 000000000000..ee3150bac1cd --- /dev/null +++ b/shells/ast-ksh/pkg-descr @@ -0,0 +1,13 @@ +KSH-93 is the most recent version of the KornShell Language described +in "The KornShell Command and Programming Language," by Morris +Bolsky and David Korn of AT&T Bell Laboratories. The KornShell is +a shell programming language, which is upward compatible with "sh" +(the Bourne Shell), and is intended to conform to the IEEE P1003.2/ISO +9945.2 Shell and Utilities standard. KSH-93 provides an enhanced +programming environment in addition to the major command-entry +features of the BSD shell "csh". With KSH-93, medium-sized programming +tasks can be performed at shell-level without a significant loss +in performance. In addition, "sh" scripts can be run on KSH-93 +without modification. + +WWW: http://www.kornshell.com/ diff --git a/shells/ast-ksh/pkg-plist b/shells/ast-ksh/pkg-plist new file mode 100644 index 000000000000..8f507eaa9f89 --- /dev/null +++ b/shells/ast-ksh/pkg-plist @@ -0,0 +1,5 @@ +@shell bin/ksh93 +man/man1/ksh93.1.gz +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/dirs +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/popd +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pushd |