Archive-name: linux-faq/part4 Last-Modified: 93/06/11 Version: 1.19 ********************************************************* * * * Answers to Frequently asked questions about Linux * * * ********************************************************* This post contains Part 4 of the Linux FAQ (6 parts). It must be read *after* the 3 first parts. ===================================8<====>8============================ CONTENTS (of this part) VIII. FEATURES (part4) IX. GCC MISC INFORMATION (part4) X. SCSI SPECIAL (part4) ===================================8<====>8============================ VIII. FEATURES ============== VIII.01) I've read that linux has virtual consoles, what must I do to get them? ANSWER: Yes there are, you can access them with the left -key together with -key. With the Linux Images distribution, 4 consoles are available, getty runs on them. Notice that they are NOT accessible when running X (contrary to some commercial unices). VIII.02) When Linux boots, I get the following message "8 virtual consoles"; how can I acess to the 5-8 vc's ? ANSWER: If you want the getty to run on the 5-8, you should add the corresponding entries in /etc/inittab. You can also just run sh on them by using the doshell soft. And then in either case, the ALT-F[5-8] will access the corresponding vc. VIII.03) What kind of shell is /bin/sh ? ANSWER: It's the Bourne Again Shell, bash-1.12.3 and compilation was straightforward, just "make" that's all or nearly. BTW There does exist different shells for Linux, these are: bash, rc, zsh, tcsh and pdksh (a korn shell). VIII.04) Does there exist a man page for **** ? ANSWER: Download man.tar.Z from your favorite linux ftp site, there is most of the fileutils man page -- either **** or g****, example there is nothing on ld, but there is for gld :) --, check the whatis database provided. The files in the cat1 dir are pre-formatted man pages that the man program can use. Quite recently the man pages for section 2 have been written (thanks Drew) and can be found, at least at tsx-11 in /pub/linux/docs/man/man2.tar.Z Also manpages are in the SLS on the b? disks. BTW there is nroff and groff for Linux. Cawf 2.0 works just fine for simple man pages, and a partial ms support too. Moreover Michael Johnson is the coordinator for man pages under Linux, he is looking for volunteers, so contact the DOC Channel. VIII.05) Is there a simple man package (groff is too big): ANSWER: "Cawf -man" also "fm -m" (Al Clark) tsx-11 in /pub/linux/binaries/usr.bin/fm.tar.Z VIII.06) What are the editors available in linux? ANSWER: Right now there are uemacs-3.11, elvis-1.4 (1.5). Gnu Emacs is there, read the section devoted to it in the 5th part of this FAQ. Also the port of mg (micro gnu) has been done and can be found at least at athos.rutgers.edu (128.6.4.4) in pub/linux, mg is the binary and mg.tar.Z is the sources file. You can also find a PD ed, and elvis has an ex mode. Also available is Lucid Emacs (available on sunsite.unc.edu in pub/Linux/apps/editors/lemacs), including binary and info and lisp trees (it takes about 18MB of disk space). Finnally there are joe, vile-3.11, elle (Elle Looks Like Emacs), Xedit and aXe. VIII.07) Does there exist a printer package for Linux? ANSWER: (R. Miller) Yes. The "plp" package is currently available under the directory [/pub/linux]/BETA/plp on tsx-11 and its mirrors. You may also print things manually like so: cat filename > /dev/lp1 (Note that though "/dev/lp0" exists, most people find that their printer is on /dev/lp1. Use whatever the kernel says that it detects in the boot-up messages.) VIII.08) Are uucp, mail, and/or USENET news available for Linux? ANSWER: Yes !!! Read the section UUCP/NEWS/MAIL for LINUX in this FAQ. Moreover if you are interested in the last uucp features, join the UUCP channel (see part1 of this FAQ for more details about the multi channels list). VIII.09) How do I make swapping work? ANSWER: Quite simply, you need the swapon and the mkswap binaries. Then you can choose between a swap partition or a swap file. The mkswap is used to write the "swap signature", whilst the swapon binary is to activate the swapping. First of all you need a partition :), I assume it's the second of your first disk namely /dev/hda2, and it's 10MB big A) swap partition: you have to indicate it's a swap area, this is done via mkswap (instead of mkfs) which needs the name of the partition and the size in blocks (a block is 1Ko big); the optional -c flag is for bad block checking. So for our example you should perform: mkswap [-c] /dev/hda2 10000 Then you need to indicate that you want linux to use the swap area, this is done via swapon. In general it is set in the /etc/rc file, just put the following entry: /bin/swapon /dev/hda2 It can also be achieved via the /etc/fstab file B) swap file: The process is quite close; you need a partition, and a swap file. Assume that I prefer a swap area of 4MB (I want to keep some place in /dev/hda2). I need first to "dd" the file. dd if=/dev/hda2 of=/swap_file bs=1024 count=4096 bs stands for block size, and count is the number of blocks then I have to put the "swap signature" on that file: mkswap /swap_file 4096 At this point, you should 'sync', just to be sure the signature is effective. And finally add an entry in the rc file: /bin/swapon /swap_file VIII.10) When I boot I get one of the following messages: "Unable to find swap signature" or "Bad swap-space bitmap" ANSWER: You probably forgot to make your swap-device, use the mkswap command. VIII.11) How do I know if it is swapping? ANSWER: You will notice it :)) First of all, Linux tells you at boot time, "Adding swap: XXX pages of swap space", and if you start running out of memory, you will notice that the disk will work overtime, and things slow down. Generally a 2Meg RAM will make the system swap constantly while running gcc, 4 Meg will swap occasionnaly when optimizing big files (and having other things active, such as make). Also, the command 'free' (from the ps package) reports total enabled swap space and current swap use. VIII.12) How is it possible to remove a swap file? ANSWER: Simply perform a rm on that file, and remove the swapon of your /etc/rc file. VIII.13) How is it possible to remove a swap device? ANSWER: mkfs the device, and remove the swapon of your /etc/rc file. VIII.14) How much swap space do I need ? ANSWER: Linux does not perform real swapping, it's rather paging (see below for a more complete explanation). The swap area is *added* to the memory and can be viewed as virtual memory, so choose the size you need, example: 8MB RAM + 6MB swap => 14MB virtual memory VIII.15) Could someone explain the swap process on Linux?, is it swapping or paging ? ANSWER: (Linus) Linux uses swap as /additional/ memory, one page of the swap-space is used for the good-page bitmap and the swapspace signature. In fact Linux does only paging, no swaping in the meaning "write out one whole process to disk". The reason it's called swapping is that Linux used paging for memory management on a low level since the very beginning, but didn't page to disk at all until 0.12. VIII.16) Is demand paging different from paging and How ? ANSWER: (Linus) Demand-paging is really "demand loading of executables" and is totally independent of the page-swapping algorithms, although they have similarities. When Linux strts up a process, no actual code space is loaded: I let the page exceptions load in the executable as needed. Thus Linux demand-loads the code and initialized data it needs. Demand-loading has very good points: (a) it simplifies the exec system call; (b) it means page sharing between that have excuted the same file is easy to implement; (c) it cuts down on the amount of memory required. When Linux runs out of real memory, it starts to lock for pages it can swap out, but if it notices that the page is clean, it just forgets about it, and demand-loads it when it's needed again. Thta means that swap-file isn't needed as much, especially when running big binaries such as gcc, where the code-pages can be demand-loaded as you wish. Point (c) means that even without any swap space, you can usually run slightly larger programs that your memory setup would actually permit. I've noticed this while running X and doing a kernel compilation + something else wshen I've forgotten to turn on swapping: free reports 0 page available but things still work, although performance is slightly down... VIII.17) Is there any way to tell how much swap space you are using or have left? ANSWER: The free program provided with the ps package handles this. VIII.18) I have a 2Megs box, but "free" reports only 1Meg why? ANSWER: (Linus:) "free" doesn't concern with the memory the kernel has allocated for itself. In other words what you see is the *user* memory available. The kernel has taken the low 1Meg for it's use (~250Ko for it and the rest for buffer cache and kernel data structures); for big memory machine it could be even 2Megs. VIII.19) What tape drives work with Linux ? ANSWER: (24 sept. P. Riipinen) - There is a working QIC-02 device driver for Linux, supporting (at least) Everex/Wangtek cards. - There are additional patches for the QIC-02 to support Archive SC402/499R. You can find them in /pub/linux/alpha/qic-02 at tsx-11 There are some bugs in the driver but you can backup. - Newer drivers are all SCSI, so check the SCSI section in this FAQ. VIII.20) Is there a driver for my Colorado Jumbo tape drive ? ANSWER: (Charlie Brady 93/06) Not at this stage, although some are trying. The Colorado Memory Systems tape drive connects to the standard floppy disk controller as a third device on the cable. Similar drives are sold by Irwin, Mountain, Wangtek and others and they are collectively known as QIC-40 and QIC-80 drives. The medium is a DC-2000 or DC-2120 minicartridge. There is a pre-pre-alpha version of a driver, and appropriately skilled volunteers are encouraged to try to finish it. Be warned, the timing constraints of the interface may be a significant problem. VIII.21) Is there only the %$#@ keyboard ? ANSWER: There are Dannish, Finnish, French, German, Uk, US and DVORAK keyboards. Set it in the main Makefile of the kernel sources, then (re)compile the kernel again. Make sure the files in kernel/chr_drv directory are recompiled. VIII.22) (special FINNISH/US) I booteed up with the new image and everything work except that some keyboard keys produce wrong characters. Does anyone know what is happening? ANSWER: Since 0.95a images are US product (and so are US-keyboard oriented), BUT linux sources are FINNISH product, and so the default keyboard is set to be FINNISH. The solution is in the previous Q/A. VIII.23) Does there exist shared libs ? ANSWER: (H.J. Lu, hlu@eecs.wsu.edu, 09/01/92) The shared library under Linux started at 0.12. Peter MacDonald collaborating with Linus made the first generation of shared library, which is the base of the classic shared library which is no longer widely used. The kernel support of shared library under Linux is system call extern int uselib (const char *__filename); which loads an executable image with fixed entry point into memory, just like the ordinary executables. In crt0.s, a function which can find out if and which shared images are needed and loads them is invoked before `main ()' is called if necessary. David Engel and I developed a way to tell the loader which shared images have to be loaded, utilizing the similar technique used in global constructor in g++ 2.x with the help from GNU binary utilities. In the classic Linux shared library, we build a big executable image for several libraries and make sure no external variables outside of the participating libraries are referenced. Then we can get the absolute addresses of all the global variables defined in the libraries used to build that executable image. After that, we make a stub library for each participating library which just has the absolute addresses of all the global variable in it. For each shared image, there must be one and only one .o file, which defines a global variable containing version, name and entry point of the shared image, and a dummy global data. Among those libraries used to build the shared image, there must be one library which will always be referenced whenever any other library is referenced. We put this .o file into the stub library for that library and add a special symbol to each of the components of the stub library in order to make sure that this .o file is always linked in if any of the participating libraries are linked. In gcc 2.2.2d, jump table, developed by David Engel, was introduced in the shared library. At the beginning of each shared image, there is a table in which every library function has a fixed entry address and the instruction at that address is a jump which will lead to the real library function. So we can change the library function without changing the corresponding entry address of the jump table. For the global data we put them at the beginning of data section of the shared image. We have to separate them from text code and link them in fixed order. It is very hard to maintain the same addresses for the global data when library is changed. After the global data are set up properly and some spaces are left for possible future changes (that is a very tough procedure.), it isn't too difficult to maintain. Starting with libc.4.3, a form of dynamic linking developed by Eric Youngdale was introduced into the shared libraries. As part of this, the tools that were used to generate the sharable libraries were completely redone which made the job of building the libraries much easier, and thus the libX*.so.3.0 libraries were made as DLL jumptable libraries. VIII.24) Why do I need dynamic linking. ANSWER: The best way to illustrate this is with a simple example of what happens without dynamic linking. #include int errno; FILE * foo; main(){ foo = fopen("/usr/bin/foo","w"); printf("foo: %x errno: %d\\n",foo, errno); } Assume this program is run by a non-root user. Normally you would expect that the open will fail because the user does not have permission to write to /usr/bin - this means that fopen() would return NULL, and errno would contain 13, which means EACCES - Permission denied. If you link this to a normal jump table library, it prints foo: 0 errno: 0 Now consider the following nearly identical program: #include extern int errno; FILE * foo; main(){ foo = fopen("/usr/bin/foo","w"); printf("foo: %x errno: %d\\n",foo, errno); } The results for this program are: foo: 0 errno: 13 Why does this happen???. First of all you must realize that in the first program errno is not declared external, and thus storage will be allocated in the data segment for the variable. Unfortunately there is no way to tell libc this, and libc has it's own storage for errno. Thus libc writes the result in one location and you are looking in the other. In the second program errno is declared extern, and thus no storage will be allocated. The linker will see the need for a definition of errno, and it will find one in libc. Thus in the second example the user program is reading the same memory location that the library stored the answer in. This is of course a simple example. There are more complicated examples involving programs that want to redefine a library function and these can lead to quite bizarre behavior which is difficult to debug. With dynamic linking, both of the above programs yield the same (correct) result. VIII.25) How does dynamic linking work under linux? ANSWER: Basically, to implement dynamic linking we need to route all function calls to global functions through the jump table. We also need to make sure that all global data is accessed indirectly through a pointer. The actual libraries do not really look very much different from the actual jump table libraries that we are currently using, but there are additional pointers to the global data in the sharable image that are used internally by the library to access all global data. There are also additional symbols in the stub library that are defined as the address of the various pointers, and are used by the linker to help determine whether there is a pointer or a jmp instruction that needs to be fixed up. The linker has one new important task with dynamic linking. It watches for duplicate definitions of symbols, and if the second definition is in a sharable library, it makes a note of it as a conflict that needs to be resolved at run time. The linker puts a list of all of these conflicts into a table and makes it available to crt0 through the variable __SHARABLE_CONFLICTS_. At run time, crt0 (through the function __dynamic_resolve) will go through and fix up all of the pointers that need to be fixed. Let us say for example that you define your own malloc function in a program - in this case at run time the startup code will actually modify the jmp instruction in the jump table so that it points to the malloc function in your program, not the one in the library. The library will never refer to the malloc function directly, but it will always be referenced through the jump table - in this way we ensure that there will only be one function named malloc that is used by a given program. If you were to run the first example program in the "Why do I need dynamic linking" answer, then the pointer in the library that corresponds to the variable errno will be modified so that it points to the errno variable that is in your program. The library itself will never use errno directly - it will always use it via the special pointer variable. In this way we ensure that all references to the variable errno both in your program and in the sharable library will reference the same memory address. VIII.26) Does Linux work for SCSI drives? ANSWER: Yes since v0.96. Read the section devoted to SCSI in this FAQ (check the TOC file to find the section). VIII.27) Linux is supposed to work with ESDI drive. However I have trouble with my Magtron MT-4115E (Joincom controler), any clue? ANSWER: (Linus) Some harddisk don't like linux (even though they should). Maybe not a bug but a deficiency. (Mika) I had to remove the printk "unexpected hd interrupt" statement in hd.c because I was getting so many of those messages. Be warned that if there is any read error the system just hangs, even the ctrl-alt-del won't work. You should be able to use your ESDI drives if you could live with those nuisances. VIII.28) How does one go about applying a patch to Linux ? ANSWER: (Drew Eckhardt) In the unix world most of distribution are in source form. This includes the operating system. To apply a patch, you apply it with the 'patch' program to the affected sources. The patch program takes as input the differences between the old and the new version. After patching you need to recompile the sources. Assume I want to apply a patch enclosed in the file XXX. First of all I will look at the top of XXX, where the file affected is identified. This may have aleading path attached to it. Either cd out to the "root" of the patch, ie if I see linux/kernel/blk_drv/blk.h I would cd into /usr/src (assuming it's the place where I can find linux/kernel...) and then patch as follows patch -p0 < whatever_place/XXX or, you can specify a number of path components to strip from the path. If I am in the blk_drv directory patching would be patch -p3 < whatever_place/XXX VIII.29) There are a lot of patches available (ps patch, NFS patches, CD-ROM patches ...) can I be fairly confident the subsequent patches will work? ANSWER: This is not true yet for the current version; but it will be so I kept it :) No you can't, patching is a real beta tester art :)). People are not working on the same patched release, so you have to check if the patches you already applied works on the same kernel part, if not, /great/, just apply them. If yes, check if there is an order, patch creator knows that, and (should) try to warn patch user (in other words: beta tester) otherwise you should edit the patch files (and possibly make a brief note to others on this list/newsgroup or even a cdiff) before applying them, another solution is to keep cool and wait for the next version of Linux where, in general, the modifications have been done but this behavior is /not/ Linux helpful. VIII.30) I got the patches on some ftp sites, and applied them to the kernel and tried to compile. It didn't !!. Are the patches buggy? ANSWER: Before remake, just do a make clean in the directories involved by the patches. This will force a rebuild of the .o and .a files. If you have a RCS running on your source tree, did you checked a patched version of the files changed before /any/ CO either by you or make Finally, make sure the patches succeded. Normally, failed patches on a file FILE will leave a FILE# file. Moreover you will get a "chunk failed" message. It is possible to capture the output while patching, with the following: patch -p0 < patchfile | 2>&1 patch.result | more VIII.31) What is VFS? ANSWER: (Ted) Linux 0.96 already has Virtual FileSystem, which means that it acts as a filesystem switch. It makes it easy for someone to design another filesystem format and include it in the Linux kernel along with the standard minix filesystem format. So it /enables/ someone to design a robust filesystem which would have some nice properties (no 14 chars file name limitation, nor 64Meg limit), and could be included in the kernel in such a way that both the Minix and the new one could be mounted at the same time. This solves the uncompability problem; since the root disk could still use the Minix filesystem, while the hardisk could be using the new one. VIII.32) What's about Bus Mice ? ANSWER: (Nathan I. Laredo) Since the Linux v0.96c-pl2 the kernel does support LOGITECH and BUS MICE If you are unsure that you have a bus mouse or not, check to see if your mouse card has a selection for a sample rate switchable between 30Hz and 60Hz (or possibly 25/50Hz), if it does not, then it is NOT a true bus mouse (InPort mice for example will not work with this driver). To create a bus mouse device: mknod /dev/mouse c 10 0 VIII.33) What's about TeX ? ANSWER: The primary site for Linux TeX is 129.78.66.1, this is P. Williams' site in Australia. The stuff at tsx-11 was posted by T. Dunbar who does support/maintain the dvilj stuff. VIII.34) What's about LILO ? ANSWER: (Werner Almesberger) LILO - Generic Boot Loader for Linux ("LInux LOader") This is an ALPHA test release of a new boot loader. Be sure to have some means to boot your system from a different media if you install LILO on your hard disk. Features -------- - does not depend on the file system. (Tested with Minix, EXT FS and MS-DOS FS.) - can be used to boot from floppies and from hard disks. - can replace the master boot record. - can boot non-Linux systems (MS-DOS, DR DOS, OS/2, ...) and unstripped kernels. - supports up to 16 different boot images that can be selected at boot time. Root and swap disk/partition can be set independently for each image. - boot sector, file map and boot images can be all on different disks or partitions. Restrictions and known problems ------------------------------- - SCSI disks are not fully supported yet. (Still waiting for some kernel changes.) (Should work in current release - EY). - booting other operating systems doesn't seem to work everywhere. If everything but booting a non-Linux OS from LILO works on your system, you should boot LILO by BOOTACTV and select the alternate OS with the latter as a temporary work-around. - booting non-Linux systems from the second hard disk ("D:") is not yet supported. Please send all bug reports to almesber@nessie.cs.id.ethz.ch VIII.35) What's about MGR ? ANSWER: (General Information grabbed from various sources) There is a MGR channel available , contact the request adress with help in the body: linux-activists-request@niksula.hut.fi The stuff can be found at tsx-11 in pub/linux/packages/MGR In brief: MGR provides: - multiple overlapping windows - multiple fonts - text and graphics in each windows - a simple popup menu package - a client/server model 'a la' X - independance from any peculiar networking technology MGR consist of a server process and some clients. Each client has his own window, and can create subwindows. Clients communicate with the server via a bidirectionnal channel. A C library is provided. When a new window starts, it is as a terminal emulator running the shell; for more information you can grab the mgr-man.out from bellcore.com The information hereafter appeared on the MGR channel on 19th Jan. > From: u31b3hs@POOL.informatik.rwth-aachen.de > Subject: MGR 0.53 > > > MGR, version 0.53 for Linux and SunOS (Coherent unfinished yet). > > Unpack the src* stuff under in /src/lbin/mgr and the usr* stuff in > /usr/mgr. I splitted things that way for making it easier to ftp > them and carry them home. If you don't like these paths, then use > others, but remember to edit the Configfile after generating it. > YOU NEED TO INSTALL ALL FILES FOR COMPILING. > > This is a beta release for programmers, there are no binaries. It > makes my work available for people who either also work on MGR and > like to get new sources and for adventerous beta testers. WARNING: > I assume using Linux 0.99.2 and GCC 2.3.3. > > There is some new m4 code to generate menus. It is more powerful > than menu(1), but a little harder to use. > > MGR is currently being ported to Coherent 4.0, but this version > doesn't include everything yet. There is already a beta version > running on Coherent, although not too stable yet. > > For questions, write to the mailing list, channel MGR. Please be > sure to talk about the latest version of MGR plus having read the > README files in the directories containing the problem. > > You got this stuff from ftp.thp.uni-koeln.de:pub/linux/mgr or from > tsx-11.mit.edu:~ftp/pub/linux/packages/MGR, which is a mirror of the > Cologne directory. VIII.36) I have successfully compiled MGR, but when I try to run the program I get "can't find mouse" or "already in use", any clue? ANSWER: try the following "mgr -m /dev/ttys1" if the mouse is on the serial 1. Another possibility is to link /dev/mouse with /dev/ttys1 (assuming your mouse is on serial 1). Or if it's a bus mouse, "mknod /dev/mouse c 10 0" once. VIII.37) Any tips for MGR? ANSWER: Well, I have tried it on my 386Sx Ega/Vga; the screen is Ok but the Logitech mouse I have is not well recognized. BTW check the major/minor number for pty's; they should be character device with 4 as major and 128 and bigger as minor: ptyp0 c 4 128 ptyp1 c 4 129 ... ttyp0 c 4 192 ttyp1 c 4 193 VIII.38) What's about X11 ? ANSWER: See the section XII. devoted to X11 in this FAQ. IX. GCC MISC INFORMATION ======================== **** Last update 93/03/26 IX.A. HLU Information IX.B. OTHERS IX.A. HLU Information ~~~~~~~~~~~~~~~~~~~~~ The official release of GCC for Linux is 2.3.3. This section includes: README.gccdisk FAQ of gcc written by HLU IX.01) I don't know how to install gcc stuff, is there special places? ANSWER: This is the README.gccdisk Linux GNU C/C++ [HJ release] Introduction ------------ This is GNU C/C++ 2.3.3. It is linked with jump table 4.2. You should use it with the Linux C library disks since the C/C++ compiler has no shared images, which are required by all the binaries in it. It consists of 2 minix disks, which will fit on either 5.25" or 3.5" floppies. It is on tsx-11.mit.edu under pub/linux/GCC/gccdisk Distribution File Format ------------------------ There are two files, each of which goes on one disk A. Disk 1 (gcc233a.Z) This contains gcc, cpp, cc1 and crt0.o/gcrt0.o. There are also some header files in /usr/lib/gcc-lib/i386-linux/2.3.3/include. B. Disk 2 (gcc233b.Z) This disk contains cc1plus. Installing on the Hard Drive ---------------------------------------- 1. uncompress base[1|2].Z. 2. rawrite or dd each file to a formatted floppy disk. Now you have made a copy of gcc 2.3.3 on two floppies. To copy each floppy to your hd, you should mount the floppy and copy its contents to your hard drive. You can do this by: mount /dev/fd[0|1] /mnt cd /mnt for d in bin dev etc usr do if [ -d $d ]; then cp -av $d / fi done Note: This may overwrite some files on your hard disk. Thanks. H.J. hlu@eecs.wsu.edu 12/31/92 IX.02) What compiler should I use for Linux? ANSWER: You should only use the same version on tsx-11.mit.edu under /pub/linux/GCC. If you want to use the testing release, first join the GCC channel on the Linux mailing list, and then send a note to hlu@eecs.wsu.edu. Don't use gcc older than the one on tsx-11.mit.edu. IX.03) Where is the latest official gcc 2.xx for Linux? ANSWER: It's on tsx-11.mit.edu under /pub/Linux/GCC and under pub/linux/GCC. You may find it on the other sites. Since gcc 2.3.3, you can compile it yourself out of box from any gnu ftp sites. Just unpack the source code and do configure [i386-linux|i486-linux] You should follow the instructions in INSTALL. IX.04) Where is the latest official Linux C library? ANSWER: It's on tsx-11.mit.edu under /pub/Linux/GCC and under pub/linux/GCC. You may find it on the other sites. IX.05) What are the contents of them? ANSWER: Please read the current release note and ChangeLog for details. IX.06) How do I install them? ANSWER: Read README and release notes. IX.07) What are the main differences with the old release? ANSWER: Read README and release notes. IX.08) Can I use the old version of gcc? ANSWER: Please get rid of gcc older than gcc 2.2.2. Starting from gcc 2.2.2, you can do gcc -V xxxx where xxxx is the version number. Please read `release.xxxx' for detail. There is one catch in gcc 2.2.2d, setjmp/longjmp is changed, so the old header files is not compatible with gcc 2.2.2. Before you install gcc 2.2.2d, please do cp /usr/include/setjmp.h /usr/lib/gcc-lib/i386-linux/2.2.2/include where /usr/include/setjmp.h is come with gcc 2.2.2. IX.09) Can I delete the old shared image in /lib? ANSWER: Since the Linux C library version 4.3, we have introduced the dynamically linked library. There is no need to keep old shared images in /lib if none of your binaries are linked with the classic shared library which has been obsolete. You can just keep one version of the shared image in /lib which has the highest major and minor release numbers for each shared library. The name of the shared image is "xxxxxxxxxxxxxxx.so.major.minor". IX.10) Is stdio ANSI compatible? ANSWER: Yes, please test it. IX.11) Is g++ in 2.xx? ANSWER: Yes. IX.12) Where can I get the gcc manual? ANSWER: You can get man pages and manual come with the gcc source code on any gnu ftp sites. You should find gcc-man.tar.z on tsx-11 which has man pages for gcc. IX.13) What options can I use for gcc? ANSWER: Read the manual. There is one special flag for Linux, -static tells gcc to use the static libraries. The default is the jump table version of shared libraries. IX.14) How can I debug the C code? ANSWER: Read the gcc/gdb manuals. The simple way to do is gcc -g foo.c -o foo gdb foo IX.15) Where is the source code of the new libc.a? ANSWER: The same place you find this file. It is called libc-xx.yy.tar.z. IX.16) Why does g++ complain, even die? ANSWER: You need "expr", which is in GNU shell utilities 1.6, echo (?) and sed. IX.17) How do I generate code for 486? ANSWER: Add -m486 to CFLAGS. IX.18) I heard malloc (0) wouldn't work with Linux, what should I do? ANSWER: It *does* work in a manner which POSIX allows; unfortunately, pre-POSIX code frequently assumes that malloc(0) will not return 0 -- the standard version of malloc under Linux *does* return 0. By including , you get a definition of malloc which behaves more traditionally. If you define NO_FIX_MALLOC, then you will get the default (non-traditional) form. If you are trying to develop POSIX compliant code under Linux, you should probably define NO_FIX_MALLOC to ensure that your code doesn't make assumptions about malloc() which will not work on other systems. (Note: NO_FIX_MALLOC is specific to Linux.) (Provided by Phil.Richards@prg.oxford.ac.uk. Thanks.) IX.19) Why does gcc say "xxxxx..h not found"? ANSWER: see QUESTION: What are the contents of them? IX.20) I really followed every step in the documentation, but when I do "make", why does it say "don't how to make xxxxxx"? ANSWER: The dependency in Makefile is dated, you need to make a new one. Please get some guide on make and read Makefile. For the kernel sources, please do cd src/linux make dep IX.21) How do I compile programs under Linux? ANSWER: The Linux C library is trying to be ANSI/POSIX compliant. It is also very compatible with SYSV and BSD. The C library is loaded with SYSV and BSD functions. There are three exceptions: 1. signal in Linux is POSIX. 2. tty in Linux is POSIX. 3. time functions are POSIX, plus a few BSD and SYSV extensions. 4. setjmp/longjmp functions are POSIX. But you can use -D__FAVOR_BSD to make it BSD or use sigsigjmp/siglongjmp. When you compile a program under Linux, your best bet is include all the appropriate header files and use -Wall. All the usable functions and global variables are declared in the corresponding header files. YOU SHOULD NOT DEFINE ANY functions or global variables OF THE LINUX C LIBRARY IN YOUR CODE IF YOU WANT TO USE THE SHARED LIBRARIES. After saying all those, you now should know you can compile a program with -D_POSIX_SOURCE or -D_GNU_SOURCE (read for details). With a few modifications you can even use -DSYSV, -DUSG or -DBSD. Some codes need to define -DSTDC_HEADERS for ANSI C compiler like gcc here. To use malloc () and calloc () safely under Linux, please include and don't define NO_FIX_MALLOC. BTW, gcc -traditional should work with gcc 2.2.2d or above. Please also read ChangeLog for the latest enhancement. Please read the header files for details. Maybe you should get a book on POSIX. Any suggestion of the book list? >From Steve Robbins -- steve@nyongwa.cam.org -------- I like "POSIX Programmer's Guide", by Donald Lewine. Its essentially a list of POSIX functions' man pages, with a very brief guide in the beginning of a few things. It's published by O'Reilly & Associates, Inc. -------- IX.22) How can I get bsd style signal? ANSWER: Use -D__USE_BSD_SIGNAL. IX.23) Why does a program that should only poll for input become a CPU hog? ANSWER: The select() system call. The timeout parameter was classically used read-only by the system. Some manual pages already notes three years ago: select() should probably return the time remaining from the original timeout, if any, by modifying the time value in place. This may be implemented in future versions of the system. Thus, it is unwise to assume that the timeout pointer will be unmodified by the select() call. If you do not take this advice seriously you get a zero timeout written back to your timeout structure, which means that future calls to select() using the same timeout structure will immediately return. Fix: Put the timeout value into that structure every time you call select(). Change code like struct timeval timeout; timeout.tv_sec = 1; timeout.tv_usec = 0; while (some_condition) { select(n,readfds,writefds,exceptfds,&timeout); } to struct timeval timeout; while (some_condition) { timeout.tv_sec = 1; timeout.tv_usec = 0; select(n,readfds,writefds,exceptfds,&timeout); } IX.24) When a program is stopped using Ctrl-Z and then restarted, or in other situations that generate signals: Ctrl-C interruption, termination of a child process etc. why does it complain about "interrupted system call" or "write: unknown error" or things like that. ANSWER: The system call the program was executing has been interrupted to process the signal, and then it returned -1 and set errno = EINTR. The program then was likely to draw bad conclusions from that. Explanation: Your program has signal handlers installed, using signal() or sigaction(). When the signal occurred, your signal handler was invoked. In other Unix systems, this usually happens asynchronously or in a few slow system calls: When a signal is caught during the execution of system calls such as read(2), write(2), open(2) or ioctl(2) on a slow device (such as a terminal, but not a file), during a pause(2) system call or a wait(2) system call that does not return immediately because a previously stopped or zombie process already exists, the signal-catching function is executed and the interrupted system call then returns a -1 to the calling process with errno set to EINTR. Linux (following POSIX) checks for signals and may execute signal handlers * asynchronously (at a timer tick), * on return from *any* system call, * during the execution of the following system calls: select(), pause(), connect(), accept(), read() on terminals or sockets or pipes or /proc files, write() on terminals or sockets or pipes or line printer, open() on FIFOs or PTYs or serial lines, ioctl() on terminals, fcntl() with command F_SETLKW, wait4(), syslog(), any TCP or NFS operations. [For other operating systems you may have to include the system calls creat(), close(), getmsg(), putmsg(), msgrcv(), msgsnd(), recv(), send(), wait(), waitpid(), wait3(), tcdrain(), sigpause(), semop() to this list.] In the last two cases and assuming the program's signal handler returns, the system call returns -1 and sets errno to EINTR. If the SA_INTERRUPT flag is not set for the corresponding signal, however, in most cases the system call is automatically restarted (continued) after execution of the signal handler, and your program won't see any EINTR. You may ask why this is not the default behavior when the default Linux signal () is used to install the signal handler. This is because POSIX adopted this. As for which one is better, it is a matter of opinion. Note that in some versions of BSD Unix the default behavior is to restart system calls. To get system calls interrupted you have to use the SA_INTERRUPT flag. Fix: Either add -D__USE_BSD_SIGNAL to your CFLAGS. Or for every signal handler that you install with signal(), use sigaction() instead, without setting SA_INTERRUPT. Note that while this applies to most system calls, you must still check for EINTR on read(), write(), ioctl(), select(), pause(), connect(). You may do it like this: int result; while (len > 0) { result = read(fd,buffer,len); if (result < 0) break; buffer += result; len -= result; } --> int result; while (len > 0) { result = read(fd,buffer,len); if (result < 0) { if (errno != EINTR) break; } else { buffer += result; len -= result; } } and int result; result = ioctl(fd,cmd,addr); --> int result; do { result = ioctl(fd,cmd,addr); } while ((result == -1) && (errno == EINTR)); IX.B. OTHERS ~~~~~~~~~~~~ IX.25) I seem to be unable to compile anything with gcc. Why? ANSWER: If you have only 2 MB RAM, gcc will die silently without compiling anything. You must have at least 4 MB to do compilations BTW Since swapping is possible, I have heard that compilation works with only 2Meg and a lot disk traffic :) Isn't it great? IX.26) gcc complains about not finding crt0.o and the system include files What am I doing wrong ? ANSWER: The include files normal place is in /usr/include. lib*.a and *.o should be in /usr/lib or /usr/local/lib IX.27) I tried to port a /new/ version of gnu stuff. But in the linking phase, gcc complains about the missing libg.a. ANSWER: Yes this is well known for compiler version earlier than 2.2.2, throw away the flag -g that's all, anyway libg.a is /only/ for debugging purpose. IX.28) How to compile programs which may be debugged with gdb? ANSWER: There are different ways to handle this problem. If you have the gcc2.2.2 or later it's simple, use the -g flag. Otherwise there are different possibilities: 1) As there is no libg.a, you should throw away the -g flag in link phase, this means that the compilation must be done in two steps example: instead of "gcc -g monprog.c -o monprog", use the following "gcc -g -c monprog.c" and then "gcc -o monprog monprog.o" Alas this method is not that good if you are using Makefile. 2) The other way is to create an empty libg.a as follows (Peter MacDonald trick): - create libfake.c containing libgfake() {} - compile it with: gcc -c libfake.c - create the libg.a with: ar r libg.a libfake.o 2bis) The more tricky Humberto method: cd /usr/lib ranlib libg.a then gcc -g monprog.c -o monprog will produce a debuggable monprog IX.29) When compiling some code, cc1 complains about some insn code, what's that? ANSWER: An insn is an internal representation that gcc uses when compiling. The main part of gcc is to take ordinary c (or c++) code, and compile it, while ding optimizations in insn part, which is soft/hard independant. Then another part which is hard/Os dependant takes the insns and translate it in assembly language. The fix is only to turn off the optimization flag (-O). IX.30) When compiling #$@!, I've got some problems with "SIGBUS" signal that doesn't exist. Any clue ? ANSWER: (Louis J. LaBash, Jr.) SIGBUS is a common problem, its not needed, just comment it all out, something like: #ifdef SIGBUS .. normal sigbus code .. #endif IX.31) How can I write codes suitable for building shared library ? ANSWER: (Eric Youngdale, eric@tantalus.nrl.navy.mil, 3/1/93) In general there are very few restrictions as long as you are using the new tools for building sharable libraries. Before the DLL libraries were available there were all kinds of things you had to watch out for, but currently you can more or less build a sharable library out of the box without making any source code modifications. See the README in the tools-m-n.tar.z distribution for more information on how to build a sharable library. X. SCSI SPECIAL =============== *** This section is written by Drew Eckhardt, mail him for *** information, questions related to this section. *** Last update May 1993. X.01) What hardware is supported? ANSWER: The Adaptec 154x, Adaptec 174x, Future Domain 8xx (TMC 950 based boards?), 16x0, Seagate ST0x, Ultrastor 14F (Some of the new ALPHA code makes attempts to deal with the 34F) and Western Digital 7000 are supported. Various Adaptec clones from Bustek and Future Domain are known to work, in both ISA and EISA flavors. There is an alpha driver for the Ultrastor 24F - tsx-11.mit.edu:/pub/alpha/scsi/u24f-driver.tar.z Some of the SCSI drivers will not autodetect your SCSI host if the BIOS is disabled, and there may be IRQ, DRQ, address restrictions compiled into the distribution kernel. Virtually all SCSI disks, CD ROMS, and tapes should work. X.02) What hardware is not supported? ANSWER: The Adaptec 152x, 151x, Always IN-2000, DTC, Mylex, PS/2 SCSI boards, all SCSI ports on sound boards, the trantor parallel->SCSI adapter, Rancho SCSI boards, Grass Roots SCSI boards, Trantor SCSI boards, etc. Someone is working on a driver for the IN-2000, if you want to run Linux on one of the other boards, you'll have to get technical docs on it, and write a driver yourself or bribe someone to do it. X.03) How do I get SCSI information? ANSWER: Subscribe to the SCSI channel of the linux-activists mailing list. mail linux-activists@joker.cs.hut.fi And put in the header. X-MN-Admin: join SCSI X.04) Where is the latest version maintained? ANSWER: tsx-11.mit.edu:/pub/linux/ALPHA/scsi Please join the SCSI channel of linux-activists@joker.cs.hut.fi before you grab anything. X.05) I've found one of the following bugs : - I can't swap to a SCSI disk, or mount one as / - I get a READ CAPACITY FAILED message on bootup. - I have a removeable disk (ie Sysquest) and have problems when I change media. - I have a Seagate / Future Domain TMC-88x and the kernel panics with a kernel paging message. - I have an Adaptec 1742 and am experiencing data corruption - I have an Insite floptical drive and it won't work. - I have a TANDBERG TDC 3600 revision U07, SONYCD-ROM CDU-541 revision 4.3d, DENON DRD-25X revision V, or a SEAGATE ST296 revision 921 and the system hangs or reports multiple devices. - My Adaptec 1542C isn't recognized. ANSWER: All of these bugs have been fixed, so UPGRADE. X.06) What do I do if I find a bug that still looks like a bug after I've read the FAQ? ANSWER: Your best bet is to send it to the SCSI channel of the mailing list, where it will be seen by all of the people who've contributed to the SCSI drivers. In your bug report, please provide as much information as possible regarding your hardware configuration, and all of the messages that Linux prints when it boots. Your chances of getting the bug fixed increase exponentially with the amount of information provided. The bottom line is that if we can't reproduce your bug, and you can't point at us what's broken, it won't get fixed. X.07) What SCSI disks are supported? ANSWER: Disks up to two terabytes in size will work, since the sd driver switches to 10 byte reads when necessary. Flopticals, Bernoulis, Sysquests, and other removeable media devices are supported by the normal SCSI disk driver. X.08) What about CD ROMS? ANSWER: CD ROMS are supported. The ISO-9660 file system with Rockridge extensions is supported. You will have to make sure that you have configured the kernel to include the isofs filesystem or otherwise you will not be able to use the cdrom. X.09) What about SCSI tapes ? ANSWER: Tapes are supported. You may wish to obtain the utility program mt, which is usually available from tsx-11.mit.edu in pub/linux/ALPHA/scsi. X.10) How do I partition the disk? ANSWER: Use fdisk, efdisk, pfdisk or the DOS parititioning program of your choice. X.11) The linux partitioning programs don't work. ANSWER: Some of these default to /dev/hd*, which are disks on WD-1003 compatable controllers (IDE, MFM, RLL, ESDI, etc), rather than /dev/sd* (SCSI disks). Your solutions are to 1. Call the partitioning program with a device name, ie pfdisk /dev/sda 2. Make links from /dev/hd* to /dev/sd*. X.12) My partitioning program can't figure out the disk geoemetry The problem with partitioning SCSI disks and Linux is that Linux talks directly to the SCSI interface. Each disk is viewed as the SCSI host sees it : N blocks, numbered from 0 to N-1, all error free. There is no portable way to get disk geometry. However, DOS doesn't like things like this, it demmands that BIOS present it with a normal Cylinder / Head / Sector coordinates. So, BIOS does, and it comes up with some fabrication that fits what DOS wants to see. You don't want to disagree with what BIOS thinks when you write the partition table. The newest SCSI code will return the mapped geometry for some host adapter / disk combinations. Kernel release 0.99 and later should have this capability. QUESTION : I can't make a filesystem on /dev/hd* ANSWER : /dev/hd* aren't your SCSI disks. /dev/sd* are. See below for approproate major / minor numbers if they do not exist on your root diskette. X.13) What are the major / minor numbers for SCSI drives? ANSWER: Because of the large number of devices that can be hung off of a SCSI bus (as many as 56 if you use SCSI fanouts or bridge boards), and the possibility of 16 partitions on a SCSI disk, we'd run out of minor numbers if they were statically allocated - so a dynamic numbering scheme is used. Block device major 8 is used for SCSI drives, 11 for CD-ROMs. Character device major 9 is used for SCSI tapes. Minors are assigned in increments of 16 to SCSI disks as they are found, scaning from host 0, ID 0 to host n, ID 7, excluding the host ID. Most hosts use ID 7 for themselves. A minor where minor mod 16 = 0 is the whole drive, where minor mod 16 is between 1 and 4, that partition, extended partitions dynamically assigned from 5 to 15 inclusive. Note that the gendisk.c module prints partition tables on initialization - you should be able to see them there. Example : I have three SCSI disks, set up as follows Seagate ST02, ID=0 Seagate ST02, ID = 5 Adaptec 1542, ID = 0 The first disk on the seagate at ID 0 will become minors 0-15 inclusive, the second at ID5 16-31 inclusive, the disk on the Adaptec 48-63. X.14) My tape drive or other removeable media device isn't recognized at boot time. ANSWER: Try booting with a tape in the drive. X.15) How do I reduce kernel bloat and eliminate the drivers I don't want? ANSWER: For kernel release 0.99 and later, just go to the to directory in the kernel source tree, and type ``make config'', and answer the questions. For older kernel distributions, simply #undef CONFIG_DISTRIBUTION in include/linux/config.h, and define the macros for the SCSI hosts you want enabled. X.16) I get SCSI timeouts. ANSWER: Make sure your board has interrupts enabled correctly, and that there are no conflicts with other devices (Sound boards and serial boards sometimes try to use IRQ5). X.17) My Seagate / Future Domain TMC-88x board is not detected. ANSWER: The Seagate and Future Domain boards have memory mapped registers. To detect them, Linux scans for a signature in the ROM BIOS (typically, a copyright message) and sets the register addresses relative to that. This can fail for two reasons 1) If the BIOS is disabled. In this case, you should edit kernel/blk_drv/scsi/Makefile and add -DOVERIDE=x -DCONTROLLER=y where x is the base address of your controller (the factory default setting is 0xc8000) - note that this is *not* the segment (ie, 0xc800), and y is the controller type, either SEAGATE or FD. 2) If we don't know about your BIOS yet Please use DOS and DEBUG to find us a signature that will detect your board - Ie, if your board lives at 0xc800 do debug d c800:0 q and send me (drew@cs.colorado.edu) the nearest convienient ASCII message, with the length and offset from c800:0 or whereever. X.18) The Seagate / Future Domain TMC-88x driver doesn't work. ANSWER: There are several possibilities 1) Is the board jumpered for IRQ5 ? The factory settings are for MSDOS, and have interrupts disabled. On the Seagate, Interrupts are controlled by the W3 (ST01) or JP3 (ST02) jumper. Shorting pins F-G selects IRQ5. 2) Cached machines will not have problems if the Seagate's address space (typically C8000 - CAFFFF) is not marked "non cacheable." This applies to the i486 internal cache as well as i386/i486 external caches. This can be set in the XCMOS of most machines. If you can't disable cache for the Seagate's area (16K in size, starting at the base address), then you must disable the cache entirely, otherwise it won't work. 3) If you've defined -DFAST or -DFAST32 in the kernel, blind transfers will be used. This works fine with most disks, but some won't respond fast enough, the read/write will timeout and things will get out of sync, resulting in timeouts. Try recompiling your kernel without -DFAST or -DFAST32. X.19) The Adaptec driver doesn't work. ANSWER: A common source of difficulty is a conflict between two different boards for an IRQ level, a DMA channel, or an I/O address. Check the settings for the boards you have in your system (music boards are known to use similar IRQ or I/O addresses as the Adaptec. In the new scsi code the Adaptec can use any of the IRQ levels that it can be strapped for, it can use I/O address 0x330 or 0x334, and it can use DMA channels 5, 6 or 7. X.20) The WD-7000FASST driver doesn't work ANSWER: According to Keith Smith, "There are two different versions of the WD7000/FASST2 One uses a WD33C93A the other a WD33C93. Firmware incompatibilities in the board bios could cause a problem as the former chip fixes some problems that were discovered on the latter. We're talking BOARD firmware, as well as BIOS firmware." X.21) My Ultrastor 14F or 34F isn't detected ANSWER: The Ultrastor 14F driver won't probe for an Adapter at address 0x310. Either move it do a different address, or recompile the kernel, adding a rule to kernel/blk_drv/scsi/Makefile ultrastor.o: ultrastor.c $(CC) $(CFLAGS) -DOVERIDE_PORT=0x310 -c ultrastor.c X.22) When using a Seagate / Future Domain TMC-88x, why does my system hang when syncing to disk? ANSWER: The Seagate boards are an incredibly brain dead piece of hardware. They can only generate an interrupt when a target raises the SEL signal. So, as long as a target is connected, the Seagate driver must spin its wheels waiting for the actual data transfer. Some devices agravate the situation by connecting for long periods of time while not doing anything. X.23) My system is dog slow (ie, 60k/sec) ANSWER: SCSI commands have an incredible amount of overhead. For every command, you need to arbitrate for the bus, select the target, establish an I_T_L nexus, and send the command. Processing of that command may take as much as 1ms on older devices. Add this overhead to what you already have coming through the file system, buffer cache, etc, and you have a real problem. To work around this, we needed to maximize the amount of data that could be transfered in a single command. So, we implemented scatter-gather, which allows reads/writes from/to contiguous disk sectors to non-contiguous buffers. This typically gets you a 3-5 fold improvement in performance. The current kernel has scatter-gather support for the Adaptec, Western Digital, Ultrastor, Future Domain 16xx, Future Domain 8xx and Seagate boards. ===================8<==========>8================ -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # LaBRI | # # 351 cours de la Liberation | e-mail: corsini@geocub.greco-prog.fr # # 33405 Talence Cedex | e-mail: corsini@labri.u-bordeaux.fr # # | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- There will be a sig when our local net is reliable. For now, I would rather stay anonymous.