The MiNT 1.10h6 MegaPatch: MiNT 1.10 Patches from the MiNT Mailing List collected by Michael Hohmuth 11 Jul 1994 This is an attempt in helping to re-synchronize the MiNT source tree between the MiNT Mailing List folks. Please note that these patches are inofficial (but there's some chance that Atari will incorporate some of these changes into MiNT 1.11). Also, they're highly experimental: Some earlier megapatches I distrubuted are known to break memory protection with Falcons and TTs, and there are known bugs still waiting to be fixed (see below). Known bugs: o background jobs write to the terminal instead of being stopped o h4 breaks memory protection Michael Hohmuth -- Email: hohmuth@inf.tu-dresden.de List of patches: (most recent changes being LAST) ************************************** Modified Files: bios.c biosfs.c console.c context.spp debug.c dos.c dosdir.c dosfile.c dosmem.c fasttext.c file.h filesys.c intr.spp main.c mem.c nalloc2.c pipefs.c proc.c procfs.c proto.h signal.c syscall.spp timeout.c tosfs.c tty.c unifs.c util.c Log Message: Message-Id: <9402190046.AA00186@jelal.north.de> Subject: Re: MiNT 1.10 biosfs select() patch Index: console.c dosfile.c tty.c intr.spp timeout.c Message-Id: <199402172223.AA06552@techfac.TechFak.Uni-Bielefeld.DE> Subject: MiNT 1.10 biosfs select() patch Index: biosfs.c Message-Id: <9402190046.AA00186@jelal.north.de> Subject: Re: MiNT 1.10 biosfs select() patch Index: fasttext.c debug.c Message-Id: <9402190046.AA00186@jelal.north.de> Subject: Re: MiNT 1.10 biosfs select() patch Index: fasttext.c intr.spp Message-Id: <199402171855.AA05725@techfac.TechFak.Uni-Bielefeld.DE> Subject: MiNT 1.10 /dev/* time stamp patch Index: dos.c main.c Message-Id: <9402181223.AA06285@topo> Subject: warnings Index: dosdir.c Message-Id: <9402180936.AA05169@issan.informatik.uni-dortmund.de> Subject: MiNT 1.10: bugs in nalloc/nfree/kmalloc Index: nalloc2.c util.c Message-Id: <9402180939.AA05174@issan.informatik.uni-dortmund.de> Subject: MiNT 1.10: some optimizations Index: bios.c biosfs.c context.spp file.h filesys.c intr.spp mem.c pipefs.c signal.c syscall.spp tosfs.c unifs.c util.c Message-Id: <9402180941.AA05180@issan.informatik.uni-dortmund.de> Subject: MiNT 1.10: misc bug fixes Index: biosfs.c main.c pipefs.c proc.c procfs.c proto.h signal.c tosfs.c tty.c unifs.c Message-Id: <9402210933.AA11762@issan.informatik.uni-dortmund.de> Subject: Re: MiNT 1.10: misc bug fixes Index: proto.h (used __NORETURN instead, from ) Message-Id: <199402241531.KAA22340@terminator.rs.itd.umich.edu> Subject: mint 1.10: biosfs.c -- bios_getxattr() Index: biosfs.c Message-Id: <199402270437.XAA29168@terminator.rs.itd.umich.edu> Subject: Job control fix Index: tty.c Message-Id: <9402221314.AA11542@math.uni-muenster.de> Subject: tosfs Index: bios.c tosfs.c (#undef'd INODE_PER_CRC) Message-Id: <9403032044.AA00193@jelal.north.de> Subject: Re: MInixfs crash ... try this :) Index: signal.c dosmem.c proc.c syscall.spp intr.spp Message-Id: <199403041113.GAA22188@terminator.rs.itd.umich.edu> Subject: mint 1.10: biosfs.c -- bios_getxattr() Index: biosfs.c Message-Id: <9403080028.AA00992@jelal.north.de> Subject: disk change crash, more patches Index: dosmem.c proc.c filesys.c dosdir.c dosfile.c proc.c Message-Id: <9403102051.AA00648@jelal.north.de> Subject: FA_DELETE fix Index: tosfs.c Message-Id: <9403150629.AA00350@jelal.north.de> Subject: control ttys again Index: dosmem.c biosfs.c Message-Id: <9403201830.AA00594@jelal.north.de> Subject: more 1.10 patches... Index: proc.c dosfile.c dosmem.c proc.c dosmem.c ************************************** Modified Files: dosfile.c Log Message: This makes Fselect interruptible by signals. This feature was present in MiNT 1.09, but was lost in 1.10. Without this patch inetd and some other programs do not work correctly. ************************************** Modified Files: dosfile.c Log Message: Different fix for Fselect() ************************************** Modified Files: file.h tty.c xbios.c Log Message: tty.c, file.h, xbios.c: ++entropy@terminator.rs.itd.umich.edu Add a real TIOCSETP (differs from TIOCSETN in that it waits for the output buffer to be empty if the device supports TIOCOUTQ.) Remove a kludge in rsconf() which is not needed if a real TIOCSETP exists. ************************************** Modified Files: tty.c Log Message: tty.c: ++entropy@terminator.rs.itd.umich.edu When the window size for a tty, has changed, send SIGWINCH to the foreground process group of the tty. ************************************** Modified Files: tty.c Log Message: tty.c: ++entropy@terminator.rs.itd.umich.edu Do CRMOD input translation only in COOKED mode. ************************************** Modified Files: signal.c Log Message: uk: give some more information in case of a crash, so that a progam which shared text can be debugged better. ************************************** Modified Files: tosfs.c Log Message: tosfs st_nblocks fix ************************************** Modified Files: dosmem.c mem.c Log Message: Howard Chu : [...] With this patch, shared-text memory regions stay in memory even after the last process using the region exits. That way the region can be used again if the same program is rerun in the future, saving load time. Unattached shared-text regions are reclaimed in get_region when memory is running low, so the overall impact shouldn't cause you to run out of memory any more often than before. ************************************** Modified Files: dos.c intr.spp proc.c proto.h Added Files: loadave.h Log Message: [This] is the latest version of my uptime/load average code. This is effectively a hybrid of the first version and the second, ie it uses the 5ms interrupt to run a timing loop but runs the main code via the Vertical Blank Interrupt. (The 5ms code merely counts down to zero from 200 and resets, the VBI routine monitors the value, if the value increases then it runs the uptime/load code.) This means that (a) minimal extra overhead is added to the 5ms interrupt code, and (b) the timing is rock solid, well as good as the 200Hz clock anyway. ************************************** Modified Files: dos.c dosdir.c proto.h Log Message: New system call Dxreaddir() ************************************** Modified Files: dos.c proto.h Log Message: [This] is a patch that implements Pseteuid()/Psetegid(), which are needed for an nfs daemon to do access checking (and probably for a lot of other things). So I would like this patch making its way into the next release of mint. ************************************** Modified Files: pipefs.c Log Message: The processes waiting on a pipe should not be waked up in pipe_close unless it is the last close for the fileptr. There is no real state change on the pipe, thus cancelling the selects on the pipe is wrong. ************************************** Modified Files: dosdir.c Log Message: Remove check for read-only files in Fdelete(). ************************************** Modified Files: dosmem.c Log Message: When a process exits both its own and its children's process time should be added to the parent's children time. Also the time reported as resource usage should include the children's time. ************************************** Modified Files: file.h main.c proc.h proto.h timeout.c Log Message: These are the patches that bring addroottimeout() and cancelroottimeout() to Mint 1.10. ************************************** Modified Files: biosfs.c pipefs.c Log Message: I don't see any reason why blksize on biosfs cannot be 1024. This is so under SunOS and Linux, and it helps utilities like cp and cat which uses blksize as the size of the buffer. The same change should be done for the pipefs. ************************************** Modified Files: dos.c proc.h proto.h Log Message: tesche: New system calls Psetauid()/Pgetauid() new system calls for supplementary groups, but not yet fully supported ************************************** Modified Files: biosfs.c Log Message: tesche: The 'old' Dcntl() function in biosfs.c didn't check for an already existing entry with the same name if you wanted to install a new device. Since the new device was linked into the chain at top position, it was at least guaranteed to be able to be opened in susequent open calls, but the old entry remained visible for directory listing. This version completely replaces an old entry, if it exists, and therefore makes directory listing looks much nicer... :-) ************************************** Modified Files: bios.c Log Message: bios.c: Removed check for root in Rwabs() to prevent side effect with Minixfs 0.60 pl 10. ************************************** mint-1.10h1: ************************************** From: Julian Reschke Message-Id: <9406081320.AA26020@math.uni-muenster.de> Subject: Pure diffs biosfs.c dos.c dosdir.c dosfile.c dosmem.c main.c memprot.c proc.c procfs.c proto.h xbios.c purec/makefile purec/mintpure.prj purec/osbind.h purec/puremint.txt: patches that make PureC happy again ************************************** From: Kay Roemer Message-Id: <9406070617.AA19921@hera.rbi.informatik.uni-frankfurt.de> Subject: Re: MiNT 1.10 re-sync proc.c: Reading from serial devices (ie /dev/modem1) blocks forever due to a lacking call to checkbttys() in sleep(). (Fixed this. --hohmuth) ************************************** mint-1.10h2: ************************************** From: Juergen Lock Message-Id: <9406091803.AA00175@jelal.north.de> Subject: Re: Latest Re-sync proc.c: A better fix from the "Reading from serial devices (ie /dev/modem1) blocks forever" bug: prevent receiver overruns RCS Version: 1.6 /usr/local/soft/cvsroot/mint/proc.c,v ************************************** From: Juergen Lock Message-Id: <9406091835.AA00187@jelal.north.de> Subject: Re: MiNT 1.10 re-sync dosmem.c: fork() doesn't copy shared text regions so why allocate memory to save them :) ************************************** From: Juergen Lock Message-Id: <9406091835.AA00187@jelal.north.de> Subject: Re: MiNT 1.10 re-sync file.h: this was missing: use new value for TIOCSETP and keep old for TIOCSETN, other way around can hang old binaries... ************************************** From: Juergen Lock Message-Id: <9406091835.AA00187@jelal.north.de> Subject: Re: MiNT 1.10 re-sync unifs.c: getcwd crashed when called from `unmounted' (Dlock) fs... ************************************** From: Juergen Lock Message-Id: <9406091835.AA00187@jelal.north.de> Subject: Re: MiNT 1.10 re-sync pipefs.c: ls -l /pipe: fix pty modes (S_IFCHR) and 14-char names ************************************** From: Juergen Lock Message-Id: <9406091835.AA00187@jelal.north.de> Subject: Re: MiNT 1.10 re-sync dosfile.c,pipefs.c: make echo >pipe/pty work when other end already open, only fail if O_EXCL or Fcreate attr != 0. (shells often creat() output redirection...) ************************************** From: Juergen Lock Message-Id: <9406091835.AA00187@jelal.north.de> Subject: Re: MiNT 1.10 re-sync intr.spp: save a long read ************************************** mint-1.10h3: ************************************** From: Juergen Lock Message-Id: <9406172301.AA00619@jelal.north.de> Subject: more diffs... bios.c: sleep() can also wake up because of signals (restart it in this case) ************************************** From: Juergen Lock Message-Id: <9406172301.AA00619@jelal.north.de> Subject: more diffs... pipefs.c: we don't need to "pipe->rsel=0;" any longer ************************************** From: Juergen Lock Subject: Re: MiNT 1.10 re-sync Message-Id: <9406091835.AA00187@jelal.north.de> dosfile.c dosmem.c filesys.c mem.c mem.h proto.h: sticky text/fragmentation megapatch... does a few things: . if F_ALTLOAD|F_SHTEXT look at F_MINALT bits to see how much memory the new process needs and free sticky text regions if necessary, all F_MINALT bits set (0xf0000000) means `as much as you can get' . execv..() frees the old process memory before allocating the new ones, and so no longer leaves holes in your memory map. this took a few ugly hacks but i think its worth it :) the only visible change should be when exec'ing a damaged binary the process gets killed, fixing that would require reading executables twice. . check the sticky bit, just making everything sharable sticky still got me too much `out of memory's... and free sticky text regions after disk changes or if open() would otherwise fail. . also free no more sticky text regions then necessary in alloc, and some other small changes. the sticky bit is of course chmod +t. (if your /bin/sh still is on GEMDOS change it now... :) and then see you no longer need _shell_p.) ************************************** From: Kay Roemer Subject: ser. overruns/deadlock fix Message-Id: <9406210727.AA03856@hera.rbi.informatik.uni-frankfurt.de> dosfile.c proc.c: a better solution (at least I think) to the 'endless serial overruns' story, because it avoids the spl7() in Fselect() completely plus fixes an Fselect deadlock ************************************** mint-1.10h4: ************************************** From: Stephan Haslbeck Subject: Sticky Text Patches Message-Id: <94Jul1.125546mesz.209301@hphalle0.informatik.tu-muenchen.de> dosmem.c: when do_vfork tries to restore the parent's memory it does not have access to it anymore; add some prot_temp()-calls in fork_restore() ************************************** From: Torsten Scherer Subject: fselect patch... (repost) Message-Id: <9406230910.AB17558@gimpel.techfak.uni-bielefeld.de> biosfs.c dosfile.c fasttext.c file.h pipefs.c procfs.c tosfs.c: A patch to add the functionality to select for exceptional conditions to MiNT. A device driver which want's to support this must also support a select mode of 2 (besides 0 for `read' and 1 for 'write', which all drivers should support) and should implement an FIOEXCEPT ioctl call to determine if a particular file pointers has got an exceptional condition to offer (just like FIONREAD and FIONWRITE for read/write selects), in which case it should set it's argument pointer to 1. If you should select an old device driver for exceptional conditions, it should just behave the way it has done without this, say block, because it neither understands the select mode 2 (and therefore can't be activated to select), nor the FIOEXCEPT call (and therefore won't never report success). Since this is only theory and even MiNT's internal device drivers do not always explicitly check both of the `old' possible modes, but use constructs like `if (mode != O_RDONLY)', some patches have been necessary to be sure. At least it doesn't seem to disturb my setup now... :-) ************************************** add README.1ST ************************************** mint-1.10h5: ************************************** From: Andreas Schwab Subject: Memory protection without MultiTOS Message-Id: <9407040915.AA00368@issan.informatik.uni-dortmund.de> dosmem.c,main.c: Here is a patch to allow running the old AES under memory protection. It turns all memory requests by the AES into global accessible, so that the resource tree can be accessed by both the program and the AES. Also the first process started by the AES (the real GEM process) is marked to have global memory protection. Note that the accessories must run in global memory too, you have to change the file header appropriately. There are still problems with accessories that dynamically request memory during runtime, since it is allocated in the context of the running program and thus private by default, but this is considered bad programming style anyway (XCONTROL 1.31 is such a beast :-/ ). This is kind of a hack, especially the distinction between Malloc from AES and VDI. This only works if the AES code is located after the VDI code in the roms, which is the case in all TOS versions i know of (1.00, 1.02, 1.04, 3.06), but it may fall over with other versions. ************************************** From: Juergen Lock Subject: Re: some more 110h4 clues... Message-Id: <9407031033.AA00399@jelal.north.de> dosmem.c,mem.c,mem.h: exec vs. memoryprotection, use parents MMU context in fork_restore; look for links to the same region in fork and when calculatig process size and also don't count sleeping fork parents memory twice... ************************************** From: Juergen Lock Subject: Re: some more 110h4 clues... Message-Id: <9407031033.AA00399@jelal.north.de> dosmem.c: GEM/toswin memleaks: only link M_KEEP regions to rootproc when its the last link, then Mfree still works after a fork. this was the only real leak, the rootproc growing and growing mostly was a result of the process size caculation... ************************************** From: Juergen Lock Subject: Re: some more 110h4 clues... Message-Id: <9407031033.AA00399@jelal.north.de> pipefs.c: pipe FIONREAD: delay writer-died error condition until pipe is empty. (can this cause problems? i think not, and it helps for example toswin, processes last words no longer appear 1-char-at-a-time...) ************************************** From: Juergen Lock Subject: Re: some more 110h4 clues... Message-Id: <9407031033.AA00399@jelal.north.de> proc.c: sleep: shouldn't we keep the ipl-too-high checks? it can still happen outside selects... ************************************** From: Juergen Lock Subject: Re: some more 110h4 clues... Message-Id: <9407031033.AA00399@jelal.north.de> biosfs.c,dosmem.c,fasttext.c,proc.c,timeout.c,tty.c: some cosmetic changes to the source (some lost tabs, etc. :) ************************************** From: Juergen Lock Subject: Re: some more 110h4 clues... Message-Id: <9407082023.AA00649@jelal.north.de> mem.c: fix unauthorized access to base->p_parent in exec ************************************** From: Juergen Lock Subject: Re: some more 110h4 clues... Message-Id: <9407082023.AA00649@jelal.north.de> bios.c,biosfs.c,types.h,xbios.c: serial lines... use the xcon* pointers etc. available thru Bconmap(-2), set DTR on SCC ports and hack around a bunch of BIOS bugs while we're at it, including TIOCSBRK for SCC ports. you still need to load debugged drivers (before MiNT!) to get reliable flow control and stop losing chars on all TOS versions _i_ know, your mileage may vary... at least the remaining bugs should not affect the rest of the system anymore. (except for the mega STe SCC/DMA hardware bug of course...) ************************************** bios.c,biosfs.c,fasttext.c,mint.h: move definition of INLINE to mint.h --hohmuth ************************************** README.1ST: update. --hohmuth ************************************** mint-1.10h6: