Linux-Development-Sys Digest #594, Volume #8 Wed, 28 Mar 01 16:13:13 EST Contents: 3c59x.c 'debug' question ("Jim Fischer") Re: Parallel Port (Kasper Dupont) broadcast detection (Marko Friedemann) Re: computer input/output devices (Nix) Re: 0-order allocation failed on 2.4.2 (Ed Clarke) Re: C++ and shell (Giovanni Meneghetti) Re: Redirect boot.msg ([EMAIL PROTECTED]) Re: problem with put_user for char device (V2.2.17 kernel). ("curmudgeon") How to call a function and don't wait for return ("tlin") Re: C++ and shell (Phil Ehrens) Re: uart (Markus Kossmann) Re: How to call a function and don't wait for return ([EMAIL PROTECTED]) compile kernel error ("Astroboy") Realtime programming (Josef Allen) Re: uart (Josef Allen) interaction userspace with kernel ([EMAIL PROTECTED]) Re: compile kernel error (Kasper Dupont) Re: can any one suggest the editor for linux,other than vi, which is similar to Editor for Windows..... ("Osiris Pedroso") ---------------------------------------------------------------------------- From: "Jim Fischer" <[EMAIL PROTECTED]> Subject: 3c59x.c 'debug' question Date: Wed, 28 Mar 2001 04:25:07 -0800 In the Linux 2.4.2 source tree, the following lines of code appear in linux/drivers/net/3c59x.c starting at about line 170: <begin> /* Put out somewhat more debugging messages. (0: no msg, 1 minimal .. 6). */ #define vortex_debug debug #ifdef VORTEX_DEBUG static int vortex_debug = VORTEX_DEBUG; #else static int vortex_debug = 1; #endif <end> My question is this: what the heck is the #define line for ??? It seems to me that it does nothing useful since the #ifdef-#else-#endif macros are guaranteed <?> to (re)define the identifier 'vortex_debug' regardless of whether the #define exists or not. Also, I'm curious about the identifier 'debug'. Where does it come from, what's its purpose, how is it used [e.g., an insmod option?], etc. Tks... Jim ------------------------------ From: Kasper Dupont <[EMAIL PROTECTED]> Subject: Re: Parallel Port Date: Wed, 28 Mar 2001 13:55:15 +0000 Jan Pietrusky wrote: > > Hello, > how can I read and write values to or from the parallel port in user > mode. If I'm root, I can use the write(), but read() failed. Why? I use > /dev/port and I use open(). > > Thanks Jan > -- I suggest you use ioperm() and the inb() and outb() macros. See the IO-Port-Programming mini howto for code examples. -- Kasper Dupont ------------------------------ From: Marko Friedemann <[EMAIL PROTECTED]> Subject: broadcast detection Date: Wed, 28 Mar 2001 16:34:51 +0200 hey guys, recently I encountered a problem while trying to install a sun4u via network (boot net:arp) with redhat-linux 7.0 as tftpd+rarpd+bootparamd server and another sun in some remote subnet as nfs server for the filesystem. to reduce it a little, after getting the installation kernel from the other sun, there is another broadcast for bootparamd. but although it is running and listening on the linux machine sitting just 3 feet away, there is no answer and the sun goes into an endless loop. i did some researching and finally found the following: the offending net infrastructure has a type B network adress. It is, however, partitioned into subnets having class C broadcast adresses. Because the sun4u boot parameter detection does only ask for IP and internally calculates the broadcast address as class B (wrong), the linux machine does not answer the request. the configuration is the following: linux: 134.xxx.184.205 -> 134.xxx.184.255 sun4u: 134.xxx.184.204 -> wrong guess to 134.xxx.255.255 result: broadcast packet to 134.xxx.255.255 not recognized by linux machine. I further investigated the problem. i tried the original rh kernel (2.2.14) and 2.4.0. then I installed an older suse (version 5.3) with kernel 2.0.35. This was known to work and in fact it did. it answered the request. i then updated the suse distro to be able to try 2.2.18. and voila, the suse now failed to answer the request, too. If, however, I temporarily change the linux machine's broadcast address to 134.xxx.255.255 then it works fine with 2.2.18 and 2.4.0. I therefore assume it must have been a change in between 2.0.x and 2.2.x that altered the behavior of detecting broadcasts. Since I got insterested, I digged a bit around in the 2.4.2 sourcecode and it seems the problem arises from fn_hash_lookup() (net/ipv4/fib_hash.c) not finding the address inside the hash table. what I'm missing is where that table is actually filled, fn_hash_insert() (net/ipv4/fib_hash.c) is obviously not used for that purpose, because it simply calls BUG(). My main concern is whether the change had anything to do with a security issue or just slipped by as an undetected flaw. I tried to find some useful information in the rfc database but failed on that. I hope someone can provide me with some helpful information, regards Marko Friedemann -- www.bmx-chemnitz.de -==- 20 Zoll in Chemnitz [EMAIL PROTECTED] ------------------------------ From: Nix <$}xinix{$@esperi.demon.co.uk> Subject: Re: computer input/output devices Date: 28 Mar 2001 08:16:15 +0100 On Tue, 27 Mar 2001, carla said: > I would like to know the definition and history of the different > input /output devices of the computer `I would like someone to do my homework for me.' Warning: it is not unknown for the person who *set* that homework to read groups like this one. -- `I've had my name crash computers. My name is a Word of Power.' --- Peter da Silva ------------------------------ From: [EMAIL PROTECTED] (Ed Clarke) Subject: Re: 0-order allocation failed on 2.4.2 Date: Wed, 28 Mar 2001 14:41:18 +0000 (UTC) On Tue, 27 Mar 2001 23:17:07 -0800, David Gray <[EMAIL PROTECTED]> wrote: >This means the kernel wasn't able to allocate any pages to satisfy >your request - that is, you ran out of kernel memory. The 0 probably >comes from get_zeroed_page() which calls alloc_pages() with an order >value of 0, this in turn eventually gets to __alloc_pages() which tries >really hard to allocate what you asked for in terms of a working set of >pages but can't. It looks like the swapper is woken up in order to swap >out whatever it can to make memory available, in your case, that didn't >work either. > >How much RAM and how much swap do you have? Two gigabytes of swap space and 1300 meg of RAM (1024meg + 256meg). As far as I can tell from the source, allocation fails, puts out a kernel message and returns a null (why in Gods name is cat trying to allocate that much RAM?????). Is this going to bite me in the rear later on? The cat program finished with seeming success (I did an md5sum on it to check against the original file). My test is as follows: cat part1 part2 part3 part4 part5 part6 > canonball.mpg Where part 1-5 are each 500000000 bytes long and part6 is 441092680 bytes long. (Stupidly huge file and an even worse movie IMHO). I had been getting solid filesystem destroying crashes with the raw 2.4.0/2.4.2 sources from ftp.us.kernel.org. I just took the 2.4.2 source from rawhide.redhat.com and compiled that instead ( they have a lot of patches to 2.4.2 ). No more crashes (yet) but this worrying allocation error in dmesg and /var/log/messages. ------------------------------ From: Giovanni Meneghetti <[EMAIL PROTECTED]> Subject: Re: C++ and shell Date: Wed, 28 Mar 2001 17:04:15 +0200 You have to dup the stdout to a file descriptor, the fork, then exec. If you need an example, I may send you one of my old works. Bye Giovanni Meneghetti FLD wrote: > I'm making a GUI for a command line tool i often use. til now i've used > the "system" command which works fine, but i'm now interested in getting > the tool output (text) in my program. How can i make it work ? > > FLD ------------------------------ From: [EMAIL PROTECTED] Subject: Re: Redirect boot.msg Date: Wed, 28 Mar 2001 08:09:13 -0700 You may need "console=ttyS0,115200" (or whatever baud rate you are using) if your serial line is running at other than 9600. Kasper Dupont wrote: > Meg Chan wrote: > > > > How can i redirect the output on system startup (which is saved to boot.msg) > > from tty0 to ttyS0? I'm using a serial terminal and want to see all the boot > > messages on it. Adding the "console" parameter to lilo only causes to print > > "Loading linux........" on ttyS0. But i want to get the rest there too. > > This works for me: > append = "console=ttyS0" > > I presume you are using the serial parameter, > which redirects all the output from LILO but > not from the kernel. The console parameter > OTOH only redirects output from the kernel, > not from LILO. So you probably need to > specify both. > > -- > Kasper Dupont ------------------------------ From: "curmudgeon" <[EMAIL PROTECTED]> Subject: Re: problem with put_user for char device (V2.2.17 kernel). Date: Wed, 28 Mar 2001 10:23:18 -0500 Yes, the problem was the omission of the -O2 flag in the compiler options I never would have figured that out. Thank you very much for your help! "Kasper Dupont" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > Soren wrote: > > > > Greetings, > > > > I am trying to write a *very* simple character device driver (straight out > > of a book) and am getting an error that I cannot fix and do not > > understand. Any help is appreciated. > > > > The pertinent details: > > Mandrake 7.2 (kernel 2.2.17) > > > > in the driver: > > > > static char * Message_Ptr; > > static char Message_buf[100]; > > > > static ssize_t device_read ( struct file * file, char * buffer, size_t > > length, loff_t * offset ) > > { > > <snip> > > while ( length && * Message_Ptr ) > > { > > put_user( *(Message_Ptr), buffer); > > Message_Ptr++; > > buffer++; > > length--; > > } > > > > > > the problem is that the module won't load with a report of : > > unresolved symbol __put_user_X > > > > which implies that the size of the target (ptr) is neither 1, 2, nor 4 > > bytes (!?) However, using copy_to_user works very well. > > > > what am I missing? > > If I try to force it (via hacking the macro) to use put_user_1 it returns > > garbage. Help? > > > > This means that either the type has incorrect size > (not 1, 2, or 4), or you forgot to compile with > optimization. Did you specify -O2 on the command > line when compiling? > > -- > Kasper Dupont ------------------------------ From: "tlin" <[EMAIL PROTECTED]> Subject: How to call a function and don't wait for return Date: Wed, 28 Mar 2001 11:12:45 -0700 hi, I want to initialize some functions when I load my module into the kernel. These functions need to share some common data within this module, and basically, they will never end until the module is terminated. I don't know whether it is possible? If yes, then how to implement it? Thanks a lot! - tao ------------------------------ From: [EMAIL PROTECTED] (Phil Ehrens) Subject: Re: C++ and shell Date: 28 Mar 2001 17:06:54 GMT Reply-To: -@- While Giovanni is preparing his example, you may want to look at: http://www.ibiblio.org/pub/gnu/Manuals/glibc-2.0.6/html_node/libc_176.html Giovanni Meneghetti wrote: >You have to dup the stdout to a file descriptor, the fork, then exec. >If you need an example, I may send you one of my old works. > >Bye >Giovanni Meneghetti > >FLD wrote: > >> I'm making a GUI for a command line tool i often use. til now i've used >> the "system" command which works fine, but i'm now interested in getting >> the tool output (text) in my program. How can i make it work ? ------------------------------ From: Markus Kossmann <[EMAIL PROTECTED]> Subject: Re: uart Date: Wed, 28 Mar 2001 18:41:03 +0200 Josef Allen wrote: > > Does anyone Know how to directly program the uart using inb() and outb > functions. > Did you allready read the IO-Port-Programming mini-Howto ? -- Markus Kossmann [EMAIL PROTECTED] ------------------------------ From: [EMAIL PROTECTED] Subject: Re: How to call a function and don't wait for return Date: Wed, 28 Mar 2001 17:49:09 -0000 On Wed, 28 Mar 2001 11:12:45 -0700 tlin <[EMAIL PROTECTED]> wrote: | I want to initialize some functions when I load my module into the kernel. | These functions need to share some common data within this module, | and basically, they will never end until the module is terminated. | | I don't know whether it is possible? If yes, then how to implement it? | Thanks a lot! If you are coding in assembly, you might be able to just branch directly to the other function. Make sure your stack integrity is correct. If you are coding in C, there's no real way to do this cleanly. If the code calling the module can stay resident, don't worry about it. If it's big and you need to get it out of there, then maybe you can reorganize so that something else calls the function to initialize, then calls the module, so that the initializer is all done. If you have flexibility in the design, maybe you can pass an optional initializer function pointer to the module and have it call that function if not NULL. I'd love it if C had an easy way to do what you want to do. But since it doesn't, you'll just have to work around it like I have. -- ================================================================= | Phil Howard - KA9WGN | Dallas | http://linuxhomepage.com/ | | [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/ | ================================================================= ------------------------------ From: "Astroboy" <[EMAIL PROTECTED]> Crossposted-To: alt.os.linux,comp.os.linux.embedded,linux.dev.kernel Subject: compile kernel error Date: Thu, 29 Mar 2001 03:14:33 +0800 when i compile the kernel, i got this error message: /usr/src/linux/include/linux/modules/i386_ksyms.ver:142:1: warning: this is the location of the previous definition make[2]: *** [ksyms.o] Error 1 make[2]: Leaving directory `/usr/src/linux-2.2.16/kernel' make[1]: *** [first_rule] Error 2 make[1]: Leaving directory `/usr/src/linux-2.2.16/kernel' make: *** [_dir_kernel] Error 2 [root@localhost linux]# Please help. Eric ------------------------------ From: Josef Allen <[EMAIL PROTECTED]> Subject: Realtime programming Date: Wed, 28 Mar 2001 14:58:31 -0500 Hey, I am a grad student and I am looking to do some programming in robotics. I would like to know if there are some development kits for such a thing and if so where. I am open to any suggestions Josef D. Allen ------------------------------ From: Josef Allen <[EMAIL PROTECTED]> Subject: Re: uart Date: Wed, 28 Mar 2001 14:59:51 -0500 Where is this web page at Josef D. Allen On Wed, 28 Mar 2001, Markus Kossmann wrote: > Josef Allen wrote: > > > > Does anyone Know how to directly program the uart using inb() and outb > > functions. > > > Did you allready read the IO-Port-Programming mini-Howto ? > > -- > Markus Kossmann > [EMAIL PROTECTED] > > ------------------------------ From: [EMAIL PROTECTED] Subject: interaction userspace with kernel Date: Wed, 28 Mar 2001 20:23:08 GMT lets say userspace does this: getsockopt(sockfd, IPPROTO_IP, EPF_SO_GET_INFO, &info, &length) in the code I have seen the kernel will use copy_from_user(destination, info, size) to get the info in kernel memory. But to get the length, the kernel just uses *length. Why doesn't the kernel have to do copy_from_user(destination2, length, sizeof(int)) ? ------------------------------ From: Kasper Dupont <[EMAIL PROTECTED]> Crossposted-To: alt.os.linux,comp.os.linux.embedded,linux.dev.kernel Subject: Re: compile kernel error Date: Wed, 28 Mar 2001 20:27:49 +0000 Astroboy wrote: > > when i compile the kernel, i got this error message: > > /usr/src/linux/include/linux/modules/i386_ksyms.ver:142:1: warning: this is > the location of the previous definition > make[2]: *** [ksyms.o] Error 1 > make[2]: Leaving directory `/usr/src/linux-2.2.16/kernel' > make[1]: *** [first_rule] Error 2 > make[1]: Leaving directory `/usr/src/linux-2.2.16/kernel' > make: *** [_dir_kernel] Error 2 > [root@localhost linux]# > > Please help. > > Eric This problem is very often seen on RedHat 7.0. RedHat 7.0 is a mess when it comes to kernel compilation. It is shipped with two different gcc versions, one set of kernel sources for install, another set which is used to build the kernel installed on the system, and header files from a third kernel. The kernel sources installed comes with a lot of patches some of which are broken. Compiling without symbol version numbers solves most of the problems. After changing this option you will have to manually delete all .ver files and a single header file which includes all the .ver files. For some obscure reason symbol version numbers is not a problem when compiling an SMP kernel. A few other hints which might help you: Touch the makefile in the top directory, this will force remaking a file which has a broken patch. You might need to remove the -traditional option in a Makefile in one directory containing some assembler sources. Also consider downloading kernel sources without RedHat patches. Some problems can be solved if /usr/src/linux, /usr/src/linux-whatever, /usr/include/asm, and /usr/include/linux are actually from the same version. Even if you have followed all of theese hints, there are still lot of potential problems: You will still have a mixture of different gcc versions, and you might have glibc compiled for some completely different kernel version. On RedHat 6.0 I have not experienced a single of theese problems. Another approach when installing a system would be to install RedHat 6.0 and upgrade all packages where you need, something newer. I think most of the SRPMS from RedHat 7.0 can be installed and build on a 6.0 system, if you first install a rpm version 4 statically linked binary somewhere, e.g. /bin/rpm4. I have never tried other distributions, but I wouldn't believe that there exist any other distribution with the same mess as RedHat 7.0. Hopefully RedHat 7.1 comes with *ONE* kernel version, *ONE* gcc version, and *ONE* glibc version that are actually compatible. -- Kasper Dupont ------------------------------ From: "Osiris Pedroso" <[EMAIL PROTECTED]> Subject: Re: can any one suggest the editor for linux,other than vi, which is similar to Editor for Windows..... Date: Wed, 28 Mar 2001 20:54:47 GMT I have used Visual Slick Edit for Linux. It is great. The Code Browsing capabilities are very nice and the Diff capabilities are also great. Check it out. Osiris ""v.nagasrinivas"" <[EMAIL PROTECTED]> wrote in message news:001601c0b11d$0efbe110$0900a8c0@srinivas... Hi , Can any body suggest the editor for linux, which is similar to Editor for windows..(www.gensoft.com). Because through the code reading ( means searching through several files at a time and other things are very easy..) thanks in advance, srinivas. v.naga srinivas YVL Software Consultancy B4,Q1,6th floor,Hi-Tec city, CyberTowers, Madhapur, Hyderabad - 500033 Andhra Pradesh INDIA phone : 091-040-3110200(off) 091-040-3810616(res) visit me: www.geocities.com/cheluvi ------------------------------ ** FOR YOUR REFERENCE ** The service address, to which questions about the list itself and requests to be added to or deleted from it should be directed, is: Internet: [EMAIL PROTECTED] You can send mail to the entire list by posting to the comp.os.linux.development.system newsgroup. Linux may be obtained via one of these FTP sites: ftp.funet.fi pub/Linux tsx-11.mit.edu pub/linux sunsite.unc.edu pub/Linux End of Linux-Development-System Digest ******************************