Linux-Development-Apps Digest #355, Volume #7 Tue, 24 Apr 01 10:13:12 EDT Contents: Error I can't decipher. (Pete Lewis) Re: why some processes are defunct? (Josef Moellers) Re: Error I can't decipher. (Josef Moellers) Re: Error I can't decipher. (Chris) Re: why some processes are defunct? (Chris) Re: Accessing memory on a PCI card. (Jan Atle Ramsli) Re: Error I can't decipher. (Pete Lewis) Re: why some processes are defunct? (Villy Kruse) Re: How to get a number of processors (Dave Blake) Re: why some processes are defunct? (Chris) Re: storage files under linux (Chris) Re: why some processes are defunct? (Alexander Burger) Re: How to get a number of processors (Chris) Re: Error I can't decipher. (Villy Kruse) Re: GTK and Qt (Rolf Magnus) Re: why some processes are defunct? (Josef Moellers) Re: storage files under linux (Josef Moellers) Re: GTK and Qt (Carlos Moreno) ---------------------------------------------------------------------------- From: Pete Lewis <[EMAIL PROTECTED]> Subject: Error I can't decipher. Date: Tue, 24 Apr 2001 09:22:49 +0000 Sorry, I know there is probably a really obvious answer to this question, but here goes anyway. I can't seem to find any literature on errors from gcc so I thought I'd ask here. I'm getting this error: two or more data types in declaration of `(funcname)' several times in my program and as far as I can tell they are unrelated. What does this error mean and how can I correct it please? Thanks a lot, -Pete. ------------------------------ From: Josef Moellers <[EMAIL PROTECTED]> Subject: Re: why some processes are defunct? Date: Tue, 24 Apr 2001 11:13:44 +0200 Alexander Burger wrote: > = > Eric P. McCoy <[EMAIL PROTECTED]> wrote: > > Is there a way of waiting on children that ensures that they will > > _never_ become zombies, under any circumstances? > = > If you are not interested in the child's exit status, you can simply ca= ll > = > signal(SIGCLD,SIG_IGN); > = > before the fork(). > = > Then the children of that process will never become zombies. Since this is _linux_: "According to POSIX (B.3.3.1.3) you must not set the action for SIGCHLD to SIG_IGN." (from man 2 signal). -- = Josef M=F6llers (Pinguinpfleger bei FSC) If failure had no penalty success would not be a prize -- T. Pratchett ------------------------------ From: Josef Moellers <[EMAIL PROTECTED]> Subject: Re: Error I can't decipher. Date: Tue, 24 Apr 2001 11:15:27 +0200 Pete Lewis wrote: > = > Sorry, I know there is probably a really obvious answer to this questio= n, > but here goes anyway. I can't seem to find any literature on errors fro= m > gcc so I thought I'd ask here. > = > I'm getting this error: > = > two or more data types in declaration of `(funcname)' > = > several times in my program and as far as I can tell they are unrelated= =2E > What does this error mean and how can I correct it please? This sounds pretty much like you have used a struct in the function declaration without having included the header file(s) which define this struct. Josef -- = Josef M=F6llers (Pinguinpfleger bei FSC) If failure had no penalty success would not be a prize -- T. Pratchett ------------------------------ From: Chris <[EMAIL PROTECTED]> Subject: Re: Error I can't decipher. Date: Tue, 24 Apr 2001 10:18:32 +0100 Pete Lewis wrote: > > Sorry, I know there is probably a really obvious answer to this question, > but here goes anyway. I can't seem to find any literature on errors from > gcc so I thought I'd ask here. > > I'm getting this error: > > two or more data types in declaration of `(funcname)' > > several times in my program and as far as I can tell they are unrelated. > What does this error mean and how can I correct it please? You probably have code like this: $ cat test.c struct foo { int a, b; } /* <--------- spot the deliberate mistake */ int fn(int b) { return 42; } $ cc -c test.c test.c:5: two or more data types in declaration of `fn' test.c: In function `fn': test.c:6: incompatible types in return -- Chris Lightfoot -- chris at ex dash parrot dot com -- www.ex-parrot.com/~chris/ ``Damn! I'm running out of integers!'' (maths lecture) ------------------------------ From: Chris <[EMAIL PROTECTED]> Subject: Re: why some processes are defunct? Date: Tue, 24 Apr 2001 10:20:19 +0100 Josef Moellers wrote: > > Alexander Burger wrote: > > > > Eric P. McCoy <[EMAIL PROTECTED]> wrote: > > > Is there a way of waiting on children that ensures that they will > > > _never_ become zombies, under any circumstances? > > > > If you are not interested in the child's exit status, you can simply call > > > > signal(SIGCLD,SIG_IGN); > > > > before the fork(). > > > > Then the children of that process will never become zombies. > > Since this is _linux_: > "According to POSIX (B.3.3.1.3) you must not set the action for SIGCHLD > to SIG_IGN." (from man 2 signal). Yes, though you can use SA_NOCLDSTOP to achieve much the same effect. -- Chris Lightfoot -- chris at ex dash parrot dot com -- www.ex-parrot.com/~chris/ viral marketing doesn't work... tell everyone you know ------------------------------ Date: Tue, 24 Apr 2001 12:40:56 +0200 From: Jan Atle Ramsli <[EMAIL PROTECTED]> Subject: Re: Accessing memory on a PCI card. Morten Gjetanger wrote: > > Ok. I need a quick way to access some memory located on a PCI card. I've > figured out that you can do it in two ways, either writing a kernel driver > or using mmap on the /dev/mem device from an application running as root. > > Ok, so I've tried both methods and even when I only tries to read the memory > the computer just hang! And i've really no ide why! I'm quite a newbie in > doing this with linux so I suspect it's someting simple wich is wrong with > my code. > > My code is as follows (It hangs on the readb() command): > > unsigned char * cardmem; > cardmem = ioremap(0xf8000000, 0x4000); > if(cardmem == NULL) { > printk("ioremap failed!\n"); > return -1; > } > printk("cardmem = %x\n", (unsigned int)cardmem); > printk("value = %x\n", (unsigned int)readb(cardmem+500)); // It hangs here!! > > 0xf8000000 is the adress for my PCI card reported by the lspci command. What hapens when you try to read memory from some other card? Atle ------------------------------ From: Pete Lewis <[EMAIL PROTECTED]> Subject: Re: Error I can't decipher. Date: Tue, 24 Apr 2001 10:37:29 +0000 On Tuesday 24 April 2001 09:18, Chris spouted forth: > Pete Lewis wrote: >> >> Sorry, I know there is probably a really obvious answer to this question, >> but here goes anyway. I can't seem to find any literature on errors from >> gcc so I thought I'd ask here. >> >> I'm getting this error: >> >> two or more data types in declaration of `(funcname)' >> >> several times in my program and as far as I can tell they are unrelated. >> What does this error mean and how can I correct it please? > > You probably have code like this: > > $ cat test.c > struct foo { > int a, b; > } /* <--------- spot the deliberate mistake */ > > int fn(int b) { > return 42; > } > $ cc -c test.c > test.c:5: two or more data types in declaration of `fn' > test.c: In function `fn': > test.c:6: incompatible types in return > > You know, you were right, and the typo was in another file to confuse things further! Thanks. You'd think there'd be some more useful error messages though! -Pete. ------------------------------ From: [EMAIL PROTECTED] (Villy Kruse) Subject: Re: why some processes are defunct? Date: 24 Apr 2001 09:46:48 GMT On Tue, 24 Apr 2001 10:20:19 +0100, Chris <[EMAIL PROTECTED]> wrote: >Josef Moellers wrote: >> >> Alexander Burger wrote: >> > >> > Eric P. McCoy <[EMAIL PROTECTED]> wrote: >> > > Is there a way of waiting on children that ensures that they will >> > > _never_ become zombies, under any circumstances? >> > >> > If you are not interested in the child's exit status, you can simply call >> > >> > signal(SIGCLD,SIG_IGN); >> > >> > before the fork(). >> > >> > Then the children of that process will never become zombies. >> >> Since this is _linux_: >> "According to POSIX (B.3.3.1.3) you must not set the action for SIGCHLD >> to SIG_IGN." (from man 2 signal). > >Yes, though you can use SA_NOCLDSTOP to achieve much the >same effect. > The SA_NOCLDSTOP doesn't work that way: it determines if stopping a child process will raise a SIGCHLD signal or not. Quote from "man sigaction" SA_NOCLDSTOP If signum is SIGCHLD, do not receive notifi- cation when child processes stop (i.e., when child processes receive one of SIGSTOP, SIGTSTP, SIGTTIN or SIGTTOU). Stopping a process is different from terminating it. Villy ------------------------------ From: [EMAIL PROTECTED] (Dave Blake) Crossposted-To: comp.os.linux.development.system Subject: Re: How to get a number of processors Date: 24 Apr 2001 07:04:22 GMT Reply-To: [EMAIL PROTECTED] Chris <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > In comp.os.linux.development.system Chris <[EMAIL PROTECTED]> wrote: > > > Hong Hsu wrote: > > >> processors running in the host machine, is there API which allows me to > > >> get a number of processors? > > > sysconf(2); /usr/include/bits/confname.h > > > printf("%d\n", sysconf(_SC_NPROCESSORS_CONF)); > > A better bet would be to have your program look at /proc/cpuinfo > No it wouldn't. Parsing /proc is the only way on a linux system. The kernel API does not support the POSIX sysconf standard, although the glibc maintainers do support it (I think by parsing /proc). And I think that /proc/stat is going to prove more resistant to change than /proc/cpuinfo, but neither are above change. I do know that the procps package does need to know the number of CPUs for a few things, and it parses /proc/stat to get this info. Including files directly from /usr/include/bits is kinda poor form wrt compatibility though... -- Dave Blake [EMAIL PROTECTED] ------------------------------ From: Chris <[EMAIL PROTECTED]> Subject: Re: why some processes are defunct? Date: Tue, 24 Apr 2001 11:23:53 +0100 Villy Kruse wrote: > > On Tue, 24 Apr 2001 10:20:19 +0100, Chris <[EMAIL PROTECTED]> wrote: > >Josef Moellers wrote: > >> > >> Alexander Burger wrote: > >> > > >> > Eric P. McCoy <[EMAIL PROTECTED]> wrote: > >> > > Is there a way of waiting on children that ensures that they will > >> > > _never_ become zombies, under any circumstances? > >> > > >> > If you are not interested in the child's exit status, you can simply call > >> > > >> > signal(SIGCLD,SIG_IGN); > >> > > >> > before the fork(). > >> > > >> > Then the children of that process will never become zombies. > >> > >> Since this is _linux_: > >> "According to POSIX (B.3.3.1.3) you must not set the action for SIGCHLD > >> to SIG_IGN." (from man 2 signal). > > > >Yes, though you can use SA_NOCLDSTOP to achieve much the > >same effect. > > > > The SA_NOCLDSTOP doesn't work that way: it determines if stopping a child > process will raise a SIGCHLD signal or not. Exactly so; mea culpa. -- Chris Lightfoot -- chris at ex dash parrot dot com -- www.ex-parrot.com/~chris/ Everything that is not forbidden is compulsory (Gell-Mann) ------------------------------ From: Chris <[EMAIL PROTECTED]> Subject: Re: storage files under linux Date: Tue, 24 Apr 2001 11:27:37 +0100 Fabien Derreal wrote: > > hi all, > > I'm porting on Linux a Windows app which is using IStorages. > IStorage is a Micro$oft feature which allows storing several files and/or > values on a single file, with a kind of small filesystem to organize the > data, and a library that makes everything smooth when it comes to use it. > I was wondering if the same thing existed under linux : > > - of course there are tar files, so that kind of files exist. > - BUT is there any kind of library which allows plugging it into a c or c++ > program? > > If not, I was wondering about writing it using xml files and CDATA sections. > > any comments? You could consider using GDBM or Berkeley DB, which allow arbitrary key/value mappings. man 3 gdbm or http://www.sleepycat.com/ are helpful. However, files created in this way may not be portable in binary form to other systems. -- Chris Lightfoot -- chris at ex dash parrot dot com -- www.ex-parrot.com/~chris/ The Clairvoyant Society of London will not meet Tuesday because of unforeseen circumstances (announcement in the Financial Times) ------------------------------ From: Alexander Burger <[EMAIL PROTECTED]> Subject: Re: why some processes are defunct? Date: Tue, 24 Apr 2001 13:15:25 +0200 Josef Moellers <[EMAIL PROTECTED]> wrote: > Alexander Burger wrote: >> >> Eric P. McCoy <[EMAIL PROTECTED]> wrote: >> > Is there a way of waiting on children that ensures that they will >> > _never_ become zombies, under any circumstances? >> >> If you are not interested in the child's exit status, you can simply call >> >> signal(SIGCLD,SIG_IGN); >> >> before the fork(). >> >> Then the children of that process will never become zombies. > Since this is _linux_: > "According to POSIX (B.3.3.1.3) you must not set the action for SIGCHLD > to SIG_IGN." (from man 2 signal). Yes, but I'm talking about SIGCLD, and _not_ SIGCHLD. True, SIGCLD seens not to be POSIX (stemming from System V), but it always worked well for me that way (tested only under Linux). Please look at page 280 of "Advanced Programming in the Unix Environment" by W. Richard Stevens: 1. If the process specifically sets its disposition to SIG_IGN, children of the calling process will not generate zombie processes. ... Cheers, - Alex ------------------------------ From: Chris <[EMAIL PROTECTED]> Crossposted-To: comp.os.linux.development.system Subject: Re: How to get a number of processors Date: Tue, 24 Apr 2001 12:50:50 +0100 Dave Blake wrote: > > Chris <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > > In comp.os.linux.development.system Chris <[EMAIL PROTECTED]> wrote: > > > > Hong Hsu wrote: > > > > >> processors running in the host machine, is there API which allows me to > > > >> get a number of processors? > > > > > sysconf(2); /usr/include/bits/confname.h > > > > printf("%d\n", sysconf(_SC_NPROCESSORS_CONF)); > > > > A better bet would be to have your program look at /proc/cpuinfo > > > No it wouldn't. > > Parsing /proc is the only way on a linux system. The kernel API > does not support the POSIX sysconf standard, although the glibc > maintainers do support it (I think by parsing /proc). I was incorrect in stating that it was a system call; it is not, either on Linux or Solaris. How glibc does the business is not really important, so long as it works. > And I think that /proc/stat is going to prove more resistant to > change than /proc/cpuinfo, but neither are above change. I do > know that the procps package does need to know the number of > CPUs for a few things, and it parses /proc/stat to get this > info. This is a terrible idea, because it is gratuitously non-portable. Obviously this is a linux newsgroup, but that's no reason to suggest doing something by parsing some random file in /proc when one could do it more simply by using a standard and portable interface. > Including files directly from /usr/include/bits is kinda > poor form wrt compatibility though... I wasn't suggesting including it, simply reading it to find the available names. (Most of them are in the man page, in fact.) -- Chris Lightfoot -- chris at ex dash parrot dot com -- www.ex-parrot.com/~chris/ The Clairvoyant Society of London will not meet Tuesday because of unforeseen circumstances (announcement in the Financial Times) ------------------------------ From: [EMAIL PROTECTED] (Villy Kruse) Subject: Re: Error I can't decipher. Date: 24 Apr 2001 13:12:50 GMT On Tue, 24 Apr 2001 10:37:29 +0000, Pete Lewis <[EMAIL PROTECTED]> wrote: >On Tuesday 24 April 2001 09:18, Chris spouted forth: > >> Pete Lewis wrote: >>> >>> Sorry, I know there is probably a really obvious answer to this question, >>> but here goes anyway. I can't seem to find any literature on errors from >>> gcc so I thought I'd ask here. >>> >>> I'm getting this error: >>> >>> two or more data types in declaration of `(funcname)' >>> >>> several times in my program and as far as I can tell they are unrelated. >>> What does this error mean and how can I correct it please? >> >> You probably have code like this: >> >> $ cat test.c >> struct foo { >> int a, b; >> } /* <--------- spot the deliberate mistake */ >> >> int fn(int b) { >> return 42; >> } >> $ cc -c test.c >> test.c:5: two or more data types in declaration of `fn' >> test.c: In function `fn': >> test.c:6: incompatible types in return >> >> > >You know, you were right, and the typo was in another file to confuse >things further! > >Thanks. > >You'd think there'd be some more useful error messages though! > Try this one struct foo { int a, b; } fn(int b) { return 42; } A function returning a structure. Well a function can't both return a structure and at the same time return an int. That is what the message is about. Villy ------------------------------ From: Rolf Magnus <[EMAIL PROTECTED]> Subject: Re: GTK and Qt Date: Tue, 24 Apr 2001 15:26:42 +0200 Carlos Moreno wrote: > wxWindows. > > Why? > > 1) Free Like Qt (but not under Windoze) and GTK. > 2) Extremely easy to learn and use Like Qt at least (don't know about GTK) > 3) Truly cross-platform (when I say truly, I mean that > you do get the look and feel of the native platform, > unlike Qt and even Java, where you get the look and > feel of thaat particular toolkit) What exactly is the "native" look and feel of X? With Qt, you can select the look and feel, so you can select windows look and feel under windows and e.g. motif look and feel under X if you want. Or you can make it user-configurable. ------------------------------ From: Josef Moellers <[EMAIL PROTECTED]> Subject: Re: why some processes are defunct? Date: Tue, 24 Apr 2001 15:45:21 +0200 Alexander Burger wrote: > = > Josef Moellers <[EMAIL PROTECTED]> wrote: > > Alexander Burger wrote: > >> > >> Eric P. McCoy <[EMAIL PROTECTED]> wrote: > >> > Is there a way of waiting on children that ensures that they will > >> > _never_ become zombies, under any circumstances? > >> > >> If you are not interested in the child's exit status, you can simply= call > >> > >> signal(SIGCLD,SIG_IGN); > >> > >> before the fork(). > >> > >> Then the children of that process will never become zombies. > = > > Since this is _linux_: > > "According to POSIX (B.3.3.1.3) you must not set the action for SIGCH= LD > > to SIG_IGN." (from man 2 signal). > = > Yes, but I'm talking about SIGCLD, and _not_ SIGCHLD. Again, since we are discussing Linux in this group, from the manual page: SIGCLD -,-,18 A synonym for SIGCHLD > True, SIGCLD seens not to be POSIX (stemming from System V), but it alw= ays > worked well for me that way (tested only under Linux). Please look at p= age > 280 of "Advanced Programming in the Unix Environment" by W. Richard > Stevens: All nice and well, but Richard mayherestinpeace didn't discuss Linux. -- = Josef M=F6llers (Pinguinpfleger bei FSC) If failure had no penalty success would not be a prize -- T. Pratchett ------------------------------ From: Josef Moellers <[EMAIL PROTECTED]> Subject: Re: storage files under linux Date: Tue, 24 Apr 2001 15:47:36 +0200 Fabien Derreal wrote: > = > hi all, > = > I'm porting on Linux a Windows app which is using IStorages. > IStorage is a Micro$oft feature which allows storing several files and/= or > values on a single file, with a kind of small filesystem to organize th= e > data, and a library that makes everything smooth when it comes to use i= t. > I was wondering if the same thing existed under linux : > = > - of course there are tar files, so that kind of files exist. > - BUT is there any kind of library which allows plugging it into a c or= c++ > program? > = > If not, I was wondering about writing it using xml files and CDATA sect= ions. > = > any comments? Have you looked at the loop device? You can create a file of appropriate size, make a file system inside that file and mount it through the loop device just as if it were a device. -- = Josef M=F6llers (Pinguinpfleger bei FSC) If failure had no penalty success would not be a prize -- T. Pratchett ------------------------------ From: Carlos Moreno <[EMAIL PROTECTED]> Subject: Re: GTK and Qt Date: Tue, 24 Apr 2001 09:54:52 -0400 Rolf Magnus wrote: > > Carlos Moreno wrote: > > > wxWindows. > > > > Why? > > > > 1) Free > > Like Qt (but not under Windoze) and GTK. False. Qt is only free if you're not using it for proprietary applications. wxWindows is free no matter what. > > 2) Extremely easy to learn and use > > Like Qt at least (don't know about GTK) Well, we have a disagreement there... But it's too hard to argue in a situation like this > > 3) Truly cross-platform (when I say truly, I mean that > > you do get the look and feel of the native platform, > > unlike Qt and even Java, where you get the look and > > feel of thaat particular toolkit) > > What exactly is the "native" look and feel of X? If you run it on GNOME, you get the look and feel of GNOME; if you run it on KDE, you get the look and feel of KDE; if you run it on Windows, look and feel of Windows, if you run it on MAC (yes, wxWindows also compiles on MAC!!), then you get the (ugly! :-)) look and feel of MACs, etc. Carlos -- ------------------------------ ** 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.apps 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-Apps Digest ******************************