Commit Graph

104 Commits

Author SHA1 Message Date
tg c7c8637e63 let struct proc allocate 64 chars even on !ILP32 platforms
(don’t fragment memory that much)
2012-02-06 17:49:52 +00:00
tg 929bc9ee9e make jobs reporting deal with UTF-8 (in utf8-mode)
reported by Andrew Kudryashov, 10x
2012-02-06 17:42:24 +00:00
tg 18dc21bd85 clang3 says: Branch condition evaluates to a garbage value 2011-12-31 00:52:22 +00:00
tg 577c918beb patch most of Jerker Bäck’s concerns out, unless not applicable 2011-08-27 18:06:52 +00:00
tg f51883e350 eek, only be a ksh_nice if we HAVE_NICE 2011-07-16 23:37:58 +00:00
tg 0168f6dc48 some distributions declare nice(3) with warn-unused-result; annoy mksh users running into this so they complain to their distros 2011-07-16 17:41:50 +00:00
tg 45cd3a340b this is about the amount -Wl,--gc-sections can help me to eliminate 2011-04-22 12:21:55 +00:00
tg 2a3d4db123 lint is your friend 2011-03-13 01:20:25 +00:00
tg 1f392ab09b • more fixes (some regression, some new)
• more testcases, stricter testcases
2011-03-06 17:08:14 +00:00
tg 0b57abd4d3 • add -u option (POSIX: unbuffered ⇒ nop) to the built-in cat
• PIPESTATUS now supported (like bash 2) whose last member
  may actually differ from $? since the latter may not be the
  result of a pipeline partial command
• add regression tests, documentation, etc.
2011-02-18 22:26:13 +00:00
tg bdfcdc56c8 introduce MKSH_NOPROSPECTOFWORK which is like pdksh’s JOB_SIGS in reverse, like MKSH_UNEMPLOYED is pdksh’s JOBS in reverse; allows mksh to work (hah! no pun intended…) with klibc (and possibly, Syllable Desktop and Plan 9) for now, until they fix their bugs 2011-01-30 01:35:35 +00:00
tg cc31d86e3b • implement KSHEGID, KSHGID, KSHUID variables by suggestion of Richard K.
(KSHEUID aka USER_ID already exists)
• simplify, speed up LCG and $RANDOM handling again
2011-01-21 21:04:48 +00:00
tg 06c6be0a70 shave off another 468 bytes: we’re 300 bytes smaller than BEFORE the
cat builtin was added now… (also removed utf-8 from source files, in
favour of just ASCII)
2010-08-28 20:22:24 +00:00
tg 3747722db4 improve string pooling: saves 316 bytes in .text 2010-08-28 18:50:58 +00:00
tg 4e08a79555 whitespace 2010-08-28 15:48:20 +00:00
tg 4cbb5a9d46 to speed up mksh, get rid of arc4random(3) uses and use the LCG always;
depend on ASLR for seeding
2010-07-04 17:33:58 +00:00
tg 2d6b4acba1 simplify a bunch of things (no SIGWINCH handler, errno is saved for
an shtrap automatically) and gratitutous reformatting of comments
2010-07-04 13:36:43 +00:00
tg c413edb34a jobs.c: apply patch from deraadt@o:
│remember to restore errno (ie. stop someone from making a mistake later)
│ok guenther
check.t, sh.h: bump vsn

I wonder though why errno must be restored even if nothing was
called after reading it… moid?
2009-12-31 14:05:44 +00:00
tg 769e222586 re-vamp __attribute__ handling; let this pass on HP-UX bundled compiler
as well as HP aCC
2009-12-12 22:27:10 +00:00
tg c49852b4dc Revision 1.38: [7]download - view: [8]text, [9]markup, [10]annotated - [11]select for diffs
Sat Dec 12 04:28:44 2009 UTC (13 hours, 14 minutes ago) by deraadt
   Branches: [12]MAIN
   CVS tags: [13]HEAD
   Diff to: previous 1.37: [14]preferred, [15]coloured
   Changes since revision 1.37: +2 -3 lines
a dangling do / while that was very very ugly
2009-12-12 17:45:42 +00:00
tg df51db99c9 another Valgrind würgaround 2009-12-05 22:03:39 +00:00
tg 09b96b8fc7 25 is a better (POSIX) CHILD_MAX 2009-11-22 14:14:42 +00:00
tg eafe88aa74 • overhaul handling of special variables
• use a combination of the one-at-a-time hash and an LCG for handling
  the $RANDOM special if !HAVE_ARC4RANDOM instead of rand(3)/srand(3)
  and get rid of time(3) usage to reduce import footprint
• raise entropy state (mostly in the !HAVE_ARC4RANDOM case though…)
• simplify handling of the $RANDOM_SPECIAL generally
• tweak hash() to save a temp var for non-optimising compilers
• some int → mksh_ari_t and other type fixes
• general tweaking of code and comments
2009-10-17 21:16:05 +00:00
tg a59d14b565 further optimise and simplify the handling of $RANDOM, reads and writes
to it are now either arc4random or rand/srand, but srand retains the old
state; set +o arc4random is no longer possible, but if it's there we use
arc4random(3), if not, we use rand(3) for $RANDOM reads; optimise special
variable handling too and fix a few consts and other minor things
2009-09-26 03:40:03 +00:00
tg 588921333e more of this:
• shell flags are now handled in one single place (sh_flags.h)
• sync comments (between enum and array) and manpage with reality
• FMONITOR is now no longer needed for Hartz IV shells
2009-09-20 16:40:58 +00:00
tg ed0299042c more use of memcpy(3) when we know destination and source sizes 2009-08-01 20:32:45 +00:00
tg 758dc5c6fe * improve CPPFLAGS vs #define handling again: do not touch CPPFLAGS from
Build.sh but use 'if defined(PRECOND) && !defined(TOBEDEFINED)'if possible
* for all of the source code, drop annotations "imake style" (if we check
  for specific OSes, bad, instead of using mirtoconf checks proper) and
  "conditions correct?" (if I'm not entirely sure if that #if catches all
  cases and no false positives) where I can see it by grepping immediately
* bump mksh patchlevel
* refresh Makefiles
2009-07-25 21:31:27 +00:00
tg e1d8d7ed01 capitalise AT&T® 2009-06-11 12:42:21 +00:00
tg 0432f97ffe more KNF, mostly whitespace, this time more manual labour applying style(9) 2009-06-10 18:12:51 +00:00
tg 571546c562 • Check if killpg(3) is available; if not, use kill(2) with negative
process ID and hope it works (is POSIXly killpg-endowed)
• bump version
• sync clog
2009-06-08 20:34:40 +00:00
tg 6b2ad96bac some rather mechanical KNF, now that style(9) clarified on the status
of sizeof() as a function-like unary operator; use parenthesēs around
sizeof and return args consistently too
2009-06-08 20:06:50 +00:00
tg b145ca5c9f • sync distrib/special/mksh/Makefile with bin/mksh/Build.sh and
fix the regression test’s results while here, which have been
  broken since cid 10049D9BE5254CE65B8
• get rid of separate copyright file which was intended for De-
  bian; track down commits in all files of oksh-mirbsd and mksh
  to get correct copyright years per-file, as is BSD custom
2009-05-16 16:59:42 +00:00
tg 9e83002841 try to do some optimum struct packing except for struct env
(pointers, longs, size_t first; time_t next; int etc. then enum, bool)
2009-04-07 18:41:37 +00:00
tg 5bfb6c97df remove extra parenthesēs; the error on WIFSIGNALED is still there:
unary - and & prios on Minix are correct, but gcc4 warns too much…
2009-04-05 13:37:37 +00:00
tg 7e7c648bd8 more extra parenthesēs (gcc4 strict warnings + broken system headers) 2009-04-05 13:07:11 +00:00
tg 398be9867a fix jobless mksh so much to make it work on Minix 3 2009-04-05 12:35:32 +00:00
tg e6a4798170 extra parens around WIFSIGNALLED seem necessary on some OSes (gcc 4.1) 2009-04-03 09:48:10 +00:00
tg e64197ba90 experimental: prevent FMONITOR from being set on, say, Minix 3, Plan 9 2009-04-03 09:42:25 +00:00
tg 40debc6f55 another cast to void to silence gcc1 on BSD/OS
XXX rlim_t = quad_t there is not detected
2009-03-26 11:22:53 +00:00
tg b20f49adae patch from oksh (except manpage, I'll merge that later):
pass "xerrok" status across the execution call stack to more closely
match what both POSIX and [18]ksh.1 already describe in regards to set
-e/errexit's behavior in determining when to exit from nonzero return
values.

specifically, the truth values tested as operands to &&' and ||', as
well as the resulting compound expression itself, along with the truth
value resulting from a negated command (i.e. a pipeline prefixed !'),
should not make the shell exit when -e is in effect.

issue reported by matthieu.
testing matthieu, naddy.
ok miod (earlier version), otto.
man page ok jmc.
2009-03-22 17:47:38 +00:00
tg 1552bf1576 CHILD_MAX isn’t defined in klibc either, copy dietlibc’s definition
thanks fefe (btw, funny tempnam link time warning… never used colours…)

pending Debian #516294, #516773, #516774, mksh might work with klcc now
2009-02-23 16:17:44 +00:00
tg 2fb7225499 give tty_init() another argument for silent initialisation 2008-12-29 20:47:16 +00:00
tg 31d1499219 * back out almost all of the memory allocator related changes, as aalloc
was hard to type and hard to fix, galloc is also hard to fix, and some
  things I learned will probably improve things more but make me use the
  original form as base (especially for space savings)
* let sizeofN die though, remove even more casts
* optimise, polish
* regen Makefiles
* sprinkle a few /* CONSTCOND */ while here
2008-12-13 17:02:18 +00:00
tg c0703f5f26 if MKSH_SMALL and HAVE_ARC4RANDOM, there is no need to use rand()/srand(3)
ever, since MKSH_SMALL is not required to be as close to compatibility as
normal/generic shells; we can also get rid of time(3) calls
2008-11-30 10:33:40 +00:00
tg 4d3fc2413e switch to a (nmemb,size) API from a (nmemb*size) API
cost: text += (308, 256, 4, -100)
2008-11-12 00:54:52 +00:00
tg 65b1923b61 build warning-free with LLVM+Clang on MirBSD itself
$ (CCC_LD=mgcc CC=ccc sh Build.sh -r && ./test.sh -v) 2>&1 | tee log
Total failed: 2 (as expected)
Total passed: 278

Just the result is huge, and we could of course build to intermediate
byte code to optimise globally…
2008-11-09 20:32:18 +00:00
ahoka 776cc76ccb Add check for the nice(3) system call.
It may be not implemented on some plaforms, though it's usually present.

Required to compile on Haiku as of 2008 October.
2008-10-26 21:51:27 +00:00
tg c11187f993 fix some of the things scan-build[1] found (but not some false positives)
10x

From: Elias Pipping <elias@pipping.org>
[1] http://clang.llvm.org/StaticAnalysis.html
2008-10-13 23:06:04 +00:00
tg 72f9cf1c9b optimise based upon the following assumption:
• my_pid = getpid(); setpgid(0, my_pid);
• if it hasn’t failed, the following is true: getpgrp() == my_pid

at least this is what I gather from TFM and the kernel source
waldi _thinks_ so, too
2008-05-17 19:03:25 +00:00
tg f17b8b1c8b • alloc() can’t fail, afree() can take NULL
‣ macro afreechk() is superfluous
• get rid of macro afreechv() by re-doing the “don’t leak that much” code
• some KNF (mostly, whitespace and 80c) while here
2008-05-17 18:47:03 +00:00