Port-atari archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: atari sysinst.fs overflow again



On Nov 23,  3:00am, tsutsui%ceres.dti.ne.jp@localhost (Izumi Tsutsui) wrote:
-- Subject: Re: atari sysinst.fs overflow again

| > It is smaller on x86:
| > 
| > [12:45pm] 139>ls -l /sbin/sysctl  /sbin/mount_kernfs
| > -r-xr-xr-x  1 root  wheel  14520 Feb 12  2017 /sbin/mount_kernfs*
| > -r-xr-xr-x  1 root  wheel  56288 Feb 12  2017 /sbin/sysctl*
| > 
| > Not only that, but if we are not using KERNFS during the installation
| > we should remove it from the kernels :-)
| 
| Adding /sbin/mount_kernfs (and /kern dir) and removing /bin/sysctl
| make instbin fit sysinst.fs 1440KB.
| 
| > >>     sed -n -e 's/\(^[ws]d[0-9]\) at/\1/p' /kern/msgbuf
| 
| "sed -n -e 's/\(^[ws]d[0-9]\) at.*/\1/p' /kern/msgbuf"
| seems to work (on i386), but it still has a problem:
| MSGBUFSIZE is 32KB on atari, then msgbuf could include messages from
| the previous kernel so the same disk could appear multiple times.
| (uniq by sed?)

You need sort -u for that and although uniq in sed is 'N;/^\(.*\)\n\1$/!P;D',
it would not work, but this does:

#!/bin/sh

getdisks() {
        local disks found disk newdisk
        sed -n -e 's/\(^[ws]d[0-9]\) at.*/\1/p' "$1" | while read newdisk; do
                found=false;
                for disk in $disks; do
                        if [ "$disk" = $newdisk ]; then
                                found=true
                                break
                        fi
                done
                $found && continue
                disks="$disks $newdisk"
                echo $newdisk
        done
}

getdisks /kern/msgbuf


christos


Home | Main Index | Thread Index | Old Index