tips-tricks
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tips-tricks [2018/08/30 22:24] – external edit 127.0.0.1 | tips-tricks [2022/04/15 21:35] (current) – missing link added wiki_admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | This page contains miscellaneous small bits that haven' | ||
+ | |||
====== Daemons ====== | ====== Daemons ====== | ||
- | A full install of Amix UNIX includes (and starts) some system daemons that are unlikely to be of much interest to the user. Below are brief descriptions of many of these daemons, how to disable them if they are started at boot, and how to start them if they are not. | + | A full install of Amix UNIX includes (and starts) some system daemons that are unlikely to be of much interest to the user in the modern day. Below are brief descriptions of many of these daemons, how to disable them if they are started at boot, and how to start them if they are not. There are a few other daemons (flopd, scrmenu, etc) I'm still looking into. |
- | lp | + | **lp** \\ |
+ | Printing services. Unless you want to experiment with this, disable it. The only printers likely to work with AMIX at this point are pure postscript printers. | ||
- | Printing services. Unless you want to experiment with this, disable it. The only printers likely to work with AMIX at this point are pure postscript printers. | + | Stop: kill `ps -e | grep lp | cut -f 4 -d ' ' |
+ | Disable: mv / | ||
- | news | + | **news** \\ |
+ | Maybe you use Usenet. I bet you don't want to run an NNTP server though. | ||
- | Maybe you use Usenet. I bet you don't want to run an NNTP server though. | + | Stop: / |
+ | Disable: mv / | ||
- | smtpd | + | **smtpd** \\ |
- | + | Mail services. If you intend to use this, go ahead and leave it running. I've never seen the system send mail for anything it runs on its own, so it should be fine to disable. | |
- | Mail services. If you intend to use this, go ahead and leave it running. I've never seen the system send mail for anything it runs on its own, so it should be fine to disable. | + | |
- | + | ||
- | rpc | + | |
- | + | ||
- | Various old rpc services that you probably shouldn' | + | |
- | + | ||
- | in.named | + | |
- | + | ||
- | DNS nameserver. If you are using DNS and not just hosts, your system will be much happier if this is running. For details on how to configure in.named, see details on this page. It is not enabled by default. Start: / | + | |
- | + | ||
- | There are a few other daemons (flopd, scrmenu, etc) I'm still looking into. | + | |
- | + | ||
- | ====== Tips & tricks ====== | + | |
- | + | ||
- | This will be a mess at first, it's a scribble pad for me at the moment as I work. | + | |
- | + | ||
- | bash 3.0 on AMIX Compiles correctly after I fixed one source code file. AMIX uses deprecated trap designation in / | + | |
- | if [ “$BASH” ] then trap - 2 3 fi | + | Stop: kill `ps -e | grep smtpd | cut -f 4 -d ' '` \\ |
+ | Disable: mv / | ||
- | AMIX 2.1 Don't use tar. Use gtar. tar segfaults until you patch to level 2a (2.1c). | + | **rpc** \\ |
+ | Various old rpc services that you probably shouldn't use anyway. Some people who have used more modern UNIX might think you need these for NFS to work. Nope. You can turn this off. | ||
- | When configuring software for compilation you will have better luck specifying host/build/target as m68k-cbm-sysv4 than letting configure guess on its own (typically m68k-unknown-sysv4) | + | Stop: /etc/init.d/rpc stop \\ |
+ | Disable: mv / | ||
- | Edit / | + | **in.named** \\ |
+ | DNS nameserver. If you are using DNS and not just hosts, your system will be much happier if this is running. For details on how to configure in.named, see details on [[networking|this page]]. It is not enabled | ||
- | Export CC=/usr/local/bin/gcc as some applications keep trying to use gcc-1.4.2 in /usr/public/bin during compilation | + | Start: |
+ | Enable: Create an init script in.named, start it at 70. Enable this at boot with the following: ln /etc/init.d/in.named / | ||
- | Mounting NFS shares from servers without NFS shares will panic the system. Oops! Don't Do That ™. Fixed in 2a patchlevel. | + | ====== Vulnerabilities ====== |
- | /usr/include/sys/socket.h, and types.h are too buggy to be used in many situations. Replace with files from 2a patchlevel. | + | Believe it or not, Amiga Unix is not obscure enough to //not// be mentioned by major security firms. There is a vulnerability |
- | Use sysadm | + | < |
+ | Amiga Unix allows access | ||
+ | CVE-1999-1218 | ||
- | Don't install 2a patchdisk, HD hack install method leaves kernel uncompilable with patches. Copy the include | + | Details: amiga-finger (522) reported Feb 1, 1993. The finger command in Amiga allows non-privileged users to access |
- | Patches break w and netstat (at least) without kernel upgrade. | + | Consequences: |
- | Adding swap: dd if=/dev/zero of=/tmp/swap bs=1024k count=50 && swap -a /tmp/swap 0 102400 | + | Remedy: As root, modify the permission of the existing |
+ | Issue the following command: # /bin/chmod 0755 /usr/bin/finger | ||
- | Compilation will fail on large binaries even with 100MB or more of swap. An error like this will result: ld: cc1: libelf error: Memory error: output file space elf_update: | + | — OR — |
- | collect2.c in gcc-2.95.3 has a bug for AMIX, comment out the SYS_SIGLIST defs. Hope this is right, guessing here. (it compiled after) Damn, compiling gcc-2.95.3 is proving to be really educational in a “FOR CRYING OUT LOUD JUST COMPILE” kind of way. This link will be helpful diagnosing late stage1 compile problems: http://sources.redhat.com/ml/crossgcc/1997/msg00326.html … appears 2.7.2.3 is buggy, wonderful. It may be helpful to symlink | + | As root, install |
+ | In the / | ||
+ | Optionally, save a copy of the existing / | ||
+ | # /bin/mv /usr/bin/finger | ||
+ | # /bin/chmod 0755 /usr/bin/ | ||
+ | In the /usr/src/ | ||
+ | # cd /usr/src/ | ||
+ | # make install | ||
+ | </ | ||
+ | Source: [[https:// | ||
====== Performance ====== | ====== Performance ====== | ||
- | Bonnie_Amix2.1c_A3000D | + | Overall, performance is…really poor. The NFS tests took a really long time. I won't have a good idea just how bad until I get the other tests completed, but I recall various quips and quotes from Usenet and reviews indicating disk performance being slow. There are patches to improve performance, |
- | Overall, performance is…really poor. The NFS tests took a really long time. I won't have a good idea just how bad until I get the other tests completed, but I recall various quips and quotes from Usenet and reviews indicating disk performance being slow. There are patches to improve performance, | + | |
- | + | ||
- | Bonnie testing parameters | + | |
- | + | ||
- | Bonnie was run with a 100MB test set. For AMIX it was compiled with gcc-2.7.2.3, | + | |
- | + | ||
- | Key to X axis labels: | + | |
- | + | ||
- | OChr: Output a character at a time as fast as possible. OBlk: Output intelligently as fast as possible. RW: “Rewrite test” - Read some data, change it, write it, and read it again, intelligently, | + | |
- | + | ||
- | Bonnie performance on disk | + | |
- | + | ||
- | First there' | + | |
- | + | ||
- | Bonnie performance on NFS | + | |
- | + | ||
- | This was a test of NFS performance. The NFS server was an i686 Debian GNU/Linux 5.0 system with 100Mb NIC writing to a RAID 5. I assure you the bottleneck was not the Linux machine. Plotted are the rates in KB/sec and the average CPU utilization during the test. Image | + | |
- | + | ||
- | Performance summary, disk and NFS | + | |
- | + | ||
- | This compares the data rates for disk and NFS, and disregards the CPU utilization. Plotted are the rates in KB/sec and the average CPU utilization during the test. Image | + | |
- | + | ||
- | Summary | + | |
I/O on Amix is relatively slow and uses relatively high amounts of CPU power to do the work. NFS is much slower. An advantage of NFS, though, is you can use RAID-backed storage at the other end. There is no such option for disk-based storage on AMIX. | I/O on Amix is relatively slow and uses relatively high amounts of CPU power to do the work. NFS is much slower. An advantage of NFS, though, is you can use RAID-backed storage at the other end. There is no such option for disk-based storage on AMIX. | ||
Line 88: | Line 71: | ||
Results for NFS were much tighter across 4 runs than the disk data. The first disk test for IBlk was a bit of an aberration, using far less CPU and having less speed. Probably another process was kicked off by the system during this test and multitasking caused Bonnie to get less CPU time. | Results for NFS were much tighter across 4 runs than the disk data. The first disk test for IBlk was a bit of an aberration, using far less CPU and having less speed. Probably another process was kicked off by the system during this test and multitasking caused Bonnie to get less CPU time. | ||
- | ====== | + | ====== |
- | This collection of pages is intended to provide some insight | + | This will be a mess at first, it's a scribble pad for me at the moment |
- | Performance of a different OS on the same hardware Performance of newer/ | + | bash 3.0 on AMIX Compiles correctly after I fixed one source code file. AMIX uses deprecated trap designation in / |
- | + | ||
- | So, yes, fairly dull. The way I would like to see this laid out is a seperate page for each set of tests. This way, people can easily open results up in a new window (or tabs) for comparison. If you would like to submit your own results, first take a look at the list of tests you should run. You do not have to run all of these, but you should run as many as you can. Next, take a look at my test results and try to get your report to look similar. | + | |
- | + | ||
- | The tests | + | |
- | + | ||
- | The tests are tailored for UNIX systems, but if you can get them to run in AmigaOS (and most of them are sufficiently basic that this should not be an issue) more power to you. | + | |
- | + | ||
- | Click here to see the list of tests | + | |
- | + | ||
- | The results | + | |
- | + | ||
- | Results are split into two categories: AMIX-capable hardware, which by its nature should keep the machines to roughly the same spec; and other hardware, which must be classic Amiga hardware but does not need to be able to run AMIX. | + | |
- | AMIX-capable hardware Amiga UNIX 2.1c on A3000D, run by failure | + | < |
+ | if [ " | ||
+ | then | ||
+ | trap - 2 3 | ||
+ | fi | ||
+ | </ | ||
- | other hardware | + | * Don't use tar. Use gtar. tar segfaults until you patch to level 2a (2.1c). |
+ | * When configuring software for compilation you will have better luck specifying host/ | ||
+ | * Edit / | ||
+ | * Export CC=/ | ||
+ | * Mounting NFS shares from servers without NFS shares will panic the system. Oops! Don't Do That ™. Fixed in 2a patchlevel. | ||
+ | * / | ||
+ | * Use sysadm to enable XDM, old method from 2.01/2.03 doesn' | ||
+ | * Patches break w and netstat (at least) without kernel upgrade. | ||
+ | * Adding swap: dd if=/ | ||
+ | * Compilation will fail on large binaries even with 100MB or more of swap. An error like this will result: ld: cc1: libelf error: Memory error: output file space elf_update: | ||
+ | * collect2.c in gcc-2.95.3 has a bug for AMIX, comment out the SYS_SIGLIST defs. Hope this is right, guessing here. (it compiled after) Damn, compiling gcc-2.95.3 is proving to be really educational in a “FOR CRYING OUT LOUD JUST COMPILE” kind of way. This link will be helpful diagnosing late stage1 compile problems: http:// | ||
+ | * It may be helpful to symlink /usr/X to /usr/X11 since /usr/X11 appears often on newer systems. | ||
====== mkfs ====== | ====== mkfs ====== | ||
Line 114: | Line 101: | ||
Going to need this info to write this page later... | Going to need this info to write this page later... | ||
+ | < | ||
# mkfs -F ufs / | # mkfs -F ufs / | ||
Mkfs: make ufs file system? | Mkfs: make ufs file system? | ||
Line 318: | Line 306: | ||
/ | / | ||
# | # | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== Internal Timers in Amiga Unix ====== | ||
+ | |||
+ | By David Miller (Commodore Applications and Technical Support, Commodore Business Machines, Inc.) | ||
+ | |||
+ | Copied for safekeeping from [[http:// | ||
+ | |||
+ | The Sleep() function | ||
+ | |||
+ | When you want your program to pause for a number of seconds then continue, you will typically use the sleep(3) function (the notation NAME(SECTION# | ||
+ | |||
+ | < | ||
+ | In C: | ||
+ | |||
+ | main() | ||
+ | { | ||
+ | printf(" | ||
+ | sleep(5); | ||
+ | } | ||
+ | |||
+ | |||
+ | Shell: | ||
+ | |||
+ | # | ||
+ | |||
+ | echo "Hello world!" | ||
+ | sleep 5 | ||
+ | </ | ||
+ | |||
+ | The following example is an implementation of the sleep(3) function. | ||
+ | |||
+ | < | ||
+ | Example 1: SLEEP() Using ALARM() | ||
+ | -------------------------------- | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 10 oldtime = alarm(0); | ||
+ | 11 if (oldtime && oldtime < duration) | ||
+ | 12 alarm(oldtime); | ||
+ | 13 else | ||
+ | 14 alarm(duration); | ||
+ | 15 pause(); | ||
+ | 16 signal(SIGALRM, | ||
+ | 17 if (oldtime > duration) | ||
+ | 18 alarm(oldtime - duration); | ||
+ | 19 if (oldtime && oldtime < duration) | ||
+ | 20 return(duration - oldtime); | ||
+ | 21 else | ||
+ | 22 return 0; | ||
+ | 23 } | ||
+ | |||
+ | | ||
+ | | ||
+ | 1 The file signal.h defines the parameters for the signal(2) | ||
+ | function. | ||
+ | |||
+ | 2-4 | ||
+ | another piece of code will examine. | ||
+ | |||
+ | 5 | ||
+ | |||
+ | 6-8 | ||
+ | state of the signal handler; oldtime will be used to save the | ||
+ | state of the alarm clock. | ||
+ | |||
+ | 9 | ||
+ | signal. | ||
+ | |||
+ | | ||
+ | |||
+ | 11-14 If the previous setting of alarm was sooner than duration, use | ||
+ | the old value, otherwise use duration to set the alarm. | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | 17-18 If the old alarm setting was later than duration, reset the | ||
+ | alarm with the difference between duration and oldtime (the | ||
+ | time remaining until the previous alarm). | ||
+ | |||
+ | 19-22 If an existing alarm is making sleep return early, return the | ||
+ | time remaining on the requested sleep. | ||
+ | |||
+ | </ | ||
+ | |||
+ | To schedule its wake up time, sleep(3) uses the alarm(2) system call. The alarm(2) system call asks the OS to deliver a signal (basically a software interrupt) in some number of seconds according to the system clock. However, setting an alarm for 2 seconds does not mean that you will receive an alarm signal in exactly two seconds. | ||
+ | |||
+ | The OS processes alarm requests once every second. Each time an alarm request is processed, the number of seconds remaining for that alarm is decremented by one. When the number of seconds remaining reaches zero, | ||
+ | the OS delivers a signal to the process. | ||
+ | |||
+ | deliver a signal after N-1 seconds, but before N seconds. | ||
+ | |||
+ | If you'd like to see for yourself, try running this shell script: | ||
+ | |||
+ | < | ||
+ | $ for i in 1 2 3 4 5 6 7 8 9 10 | ||
+ | > do | ||
+ | > time sleep 2 | ||
+ | > done | ||
+ | </ | ||
+ | |||
+ | How many times did the process actually take more than 2 seconds? | ||
+ | |||
+ | If you are writing a daemon that checks for some event every 5 minutes, or if you want to pause the output to give the user a chance to read it, alarm' | ||
+ | |||
+ | The answer is do not use an alarm, use an interval timer. | ||
+ | |||
+ | **Interval Timers** | ||
+ | |||
+ | Each interval timer has a resolution of 1 tick of the system' | ||
+ | |||
+ | ITIMER_REAL | ||
+ | |||
+ | This timer will count down in real time. That is, this timer will continue to run when your process is waiting for the OS to perform a system call, or when the OS preempts your process. When the timer expires, the OS will deliver a SIGALARM signal. | ||
+ | |||
+ | ITIMER_VIRTUAL | ||
+ | |||
+ | This timer counts down only when your process is running. If your process makes a system call, or is preempted, this timer will stop counting. The timer will resume when your process resumes execution. When this timer reaches zero, the process will receive a SIGVTALRM signal. | ||
+ | |||
+ | Possible uses for this timer include checkpointing (saving data after some period of execution) and multithreading. The virtual timer is more desireable for these applications since it counts only when the process is running; there is no reason to perform a checkpoint or switch threads if the process has been idle. | ||
+ | |||
+ | ITIMER_PROF | ||
+ | |||
+ | This timer will stop counting any time your process is preempted by the OS, but will not stop when the process is waiting for a system call to return. | ||
+ | |||
+ | This timer is designed to be used for execution profiling by interpreters. By having a profiling timer send a signal every second, or fraction of a second, and examining the current position in the interpreted code, the process can determine where the most execution time is being spent. | ||
+ | |||
+ | All three timers operate on the following structure: | ||
+ | |||
+ | < | ||
+ | struct itimerval | ||
+ | { | ||
+ | struct timeval it_interval; | ||
+ | struct timeval it_value; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | The timeval structure looks like this: | ||
+ | |||
+ | < | ||
+ | struct timeval | ||
+ | { | ||
+ | long tv_sec; | ||
+ | long tv_usec; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Both of these structures are defined in the < | ||
+ | |||
+ | Note that System V Release 4.0 does not guarantee that these are the only members of these structures, nor that they will occur in this order. | ||
+ | |||
+ | You set and examine timers using these two functions: | ||
+ | |||
+ | < | ||
+ | |||
+ | places the current timer setting into myvalue | ||
+ | |||
+ | < | ||
+ | |||
+ | sets the timer. | ||
+ | |||
+ | Now, let us take a look at the sleep function again. | ||
+ | |||
+ | < | ||
+ | Example 2: SLEEP() Using an Interval Timer | ||
+ | ------------------------------------------ | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 10 | ||
+ | 11 | ||
+ | 12 | ||
+ | 13 if (oldtime.it_value.tv_sec == 0 | ||
+ | && oldtime.it_value.tv_usec == 0 | ||
+ | || oldtime.it_value.tv_sec >= duration) | ||
+ | 14 { | ||
+ | 15 | ||
+ | 16 | ||
+ | 17 | ||
+ | 18 | ||
+ | 19 | ||
+ | 20 } | ||
+ | 21 | ||
+ | 22 | ||
+ | 23 if (oldtime.it_value.tv_sec > duration) | ||
+ | 24 { | ||
+ | 25 | ||
+ | 26 | ||
+ | 27 } | ||
+ | 28 if (oldtime && oldtime < n) | ||
+ | 29 | ||
+ | 30 else | ||
+ | 31 | ||
+ | 32 } | ||
+ | |||
+ | |||
+ | Line Explanation | ||
+ | ---- ----------- | ||
+ | | ||
+ | function. | ||
+ | structures used by getitimer(3) and setitimer(3). | ||
+ | |||
+ | | ||
+ | another piece of code will examine. | ||
+ | |||
+ | | ||
+ | |||
+ | 8-10 oldsig will hold the previous state of the signal handler; | ||
+ | oldtime will hold the state of the timer; and newtime will be | ||
+ | used to set the new timer parameters. | ||
+ | |||
+ | | ||
+ | signal. | ||
+ | |||
+ | | ||
+ | |||
+ | 13-20 If the timer was idle (both parts of it_value are zero) or it | ||
+ | is set to go off later than duration (it_value.tv_sec is greater | ||
+ | than duration), set the timer to go off in duration seconds. | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | 23-27 If the old timer setting was later than duration, reset the | ||
+ | timer with the difference between duration and | ||
+ | oldtime.it_value.tv_sec (the time remaining until expiration of | ||
+ | the previous setting). | ||
+ | |||
+ | 28-32 If an existing timer is making mysleep() return early, return | ||
+ | the time remaining on the requested mysleep(). | ||
+ | </ | ||
+ | |||
+ | This example uses what is called a one-shot timer. The timer goes off once, and then stops. By supplying an interval setting, the timer becomes a clock, generating alarm signals on a regular basis. | ||
+ | |||
+ | The code fragment in Example 3 shows how to set the timer to produce a 1.5 second clock that will start ticking in 1 minute. | ||
+ | |||
+ | < | ||
+ | Example 3: Using an Interval Timer as a Clock | ||
+ | --------------------------------------------- | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 10 } | ||
+ | 11 ... | ||
+ | |||
+ | |||
+ | Line Explanation | ||
+ | ---- ----------- | ||
+ | | ||
+ | used by getitimer(3) and setitimer(3). | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | 10 End of block. | ||
+ | |||
+ | 11 Other code. | ||
+ | </ | ||
+ | |||
+ | When the time interval specified by it_value expires, the contents of it_interval is copied into it_value and the timer is restarted. If the interval specified by it_interval is zero, the timer stops. | ||
+ | |||
+ | So there you have the realtime interval timer. The other timers work exactly the same way, varying only in when the timer is running. |
tips-tricks.1535660649.txt.gz · Last modified: 2021/09/19 17:58 (external edit)