Linux-Development-Sys Digest #386, Volume #8 Wed, 3 Jan 01 01:13:09 EST
Contents:
Re: First sector of a partition? (Oliver Dick)
Re: Before I go bald... Socket problem! (ratz)
Re: Documentation for /proc filesystem support for a driver? (Kaelin Colclasure)
Timer triggered by serial port activity ("Theo van der Merwe")
Realtime audio processing ("Theo van der Merwe")
Re: redirecting stdin to a memory buffer (Juergen Heinzl)
Re: Timer triggered by serial port activity ("Norman Dresner")
Re: Before I go bald... Socket problem!
Re: smp and gcc (David Wragg)
Re: Realtime audio processing ("Timo Weggen")
Re: Error compiling gcc 2.95.2 ("Fruitbat")
Re: ramfs root(/) explained ([EMAIL PROTECTED])
Does Linux kernel have an IRQL-like enforcement like NT? ("Electric Ninja")
Kernel Memory Sizeing ("Nathan Dyer")
what is "load average" ("�̿���")
Re: what is "load average" ([EMAIL PROTECTED])
How to send a signal (Guo zhenfeng)
Re: what is "load average" ("�̿���")
----------------------------------------------------------------------------
From: Oliver Dick <[EMAIL PROTECTED]>
Subject: Re: First sector of a partition?
Date: Tue, 02 Jan 2001 20:06:45 +0100
Thanks for your help. I will try to find something...
[EMAIL PROTECTED] wrote:
>
> On Tue, 02 Jan 2001 04:02:19 +0100 Oliver Dick <[EMAIL PROTECTED]> wrote:
>
> | I am writing a tool for Linux and need to know the start of
> | a partition. The only information I have is the dev-filename,
> | for example /dev/hda2. How can I determine the first sector
> | of this partition? Are there any (kernel-)functions available
> | for this?
>
> ioctl(,HDIO_GETGEO,)
>
> struct hd_geometry {
> unsigned char heads;
> unsigned char sectors;
> unsigned short cylinders;
> unsigned long start;
> };
>
> Search for these in kernel source for specific details.
>
> --
> -----------------------------------------------------------------
> | Phil Howard - KA9WGN | Dallas | http://linuxhomepage.com/ |
> | [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/ |
> -----------------------------------------------------------------
--
Best regards
Oliver Dick
[EMAIL PROTECTED]
http://www.evilstorm.de
------------------------------
From: ratz <[EMAIL PROTECTED]>
Crossposted-To:
alt.os.linux.redhat,comp.os.linux.development.apps,comp.os.linux.networking,linux.dev.apps,linux.dev.net,linux.redhat.devel
Subject: Re: Before I go bald... Socket problem!
Date: Tue, 02 Jan 2001 20:24:42 +0100
Jem wrote:
>
> PLEASE PLEASE COULD YOU CC ANY REPLIES TO MY MAIL ADDRESS!!! Too many
> groups and I'm not 100% sure where I should best post this question...
Don't crosspost! The chance of getting a response doesn't necessarily
rise. You rather piss off people. Ok, let's see what your problem is:
> Argh argh argh!
whatever.
> OK, before I lose loads of hair.. I am trying desperately to get the MAC
> address of the PC that my program (C++) is running on. I have some
Now this is really funky. Either you're running your program locally or
you assume that your programm does some network stuff. If your program
is running on a remote node and f.e. just does a printf("hello world\n");
You will never be able to find a tool that will print you the MAC addr
of that node since how could the tool find out on what machine you're
running your ``hello world'' on. I just can't get the relation between
you program and the MAC of your NIC and especially not what the C++ info
has to do with it. Why don't you tell us what you really like to do. You
can get the MAC with: /sbin/ifconfig | grep HWaddr
With this command line you get at least the station address. However if you
like to get the node address or the oem station address you need to do some
ioctl's or have a look into the nettools from http://www.scyld.com
> source code for it that I found from several locations on the web but I
> can't get it to compile because the constants that it uses don't seem to
> be defined, specifically:
> AF_ROUTE
> AF_LINK
> NET_RT_IFLIST
> RTM_IFINFO
> ETHER_ADDR_LEN
What kind of source code is this? For what kind of system?
> Now I've done searches on this and, as far as I can determine, BSD
> Sockets.h should have these constants in #define statements. I have the
> FreeBSD version of socket.h
Is the tool written for BSD systems?
> (http://minnie.cs.adfa.edu.au/FreeBSD-srctree/newsrc/sys/socket.h.html)
>
> and it has just about everything I need neatly laid out - or at least
> some of the constants anyway and I'm hoping other related files will
> have the rest of them.
:)
> Now I don't understand this. I am running RedHat 6.2 and the Socket.h
Where did you find Socket.h? I know of /usr/src/linux/include/linux/socket.h.
> file has NONE of this stuff defined. I have done a search on my system
> for any ".h" files with ANY of these constants defined and there is
> nothing, zilch. Should the FreeBSD and Linux versions of Socket.h not be
> extremely similar??
zar:~ # find /usr/src/linux/include/ -exec egrep \
"AF_ROUTE|AF_LINK|NET_RT_IFLIST|RTM_IFINFO|ETHER_ADDR_LEN" \
/dev/null {} \; 2>/dev/null
/usr/src/linux/include/linux/socket.h:#define AF_ROUTE AF_NETLINK /* Alias to
emulate 4.4BSD */
/usr/src/linux/include/linux/socket.h:#define PF_ROUTE AF_ROUTE
zar:~ # find /usr/include/ -exec egrep \
"AF_ROUTE|AF_LINK|NET_RT_IFLIST|RTM_IFINFO|ETHER_ADDR_LEN" \
/dev/null {} \; 2>/dev/null
/usr/include/net/ethernet.h:#define ETHER_ADDR_LEN ETH_ALEN /*
size of ethernet addr */
/usr/include/libnet/libnet-headers.h:#ifndef ETHER_ADDR_LEN
/usr/include/libnet/libnet-headers.h:#define ETHER_ADDR_LEN 6
/usr/include/libnet/libnet-headers.h: u_char ether_dhost[ETHER_ADDR_LEN];
/* destination ethernet address */
/usr/include/libnet/libnet-headers.h: u_char ether_shost[ETHER_ADDR_LEN];
/* source ethernet address */
/usr/include/bits/socket.h:#define AF_ROUTE PF_ROUTE
zar:~ #
hmm, my system does have at least AF_ROUTE and ETHER_ADDR_LEN, which you
actually
don't need for your problem.
> Has anyone ANY ideas where these constants could possibly be defined or
> why my Socket.h seems to be missing these definitions?
Nope, me not, I'm sorry.
> Alternatively, has anyone got a bit of C source for MAC determination
> that does compile under RedHat?
Nope but some hint:
char *interface;
int fd;
struct ifreq req;
fd = socket(AF_INET, SOCK_DGRAM, 0);
strcpy(req.ifr_name, interface);
ioctl(fd, SIOCGIFHWADDR, &req);
close(fd);
This is it basically I hope. I haven't tried it but I will because I need such a
tool
too.
HTH, regards,
Roberto Nibali, ratz
--
mailto: `echo [EMAIL PROTECTED] | sed 's/[NOSPAM]//g'`
------------------------------
From: Kaelin Colclasure <[EMAIL PROTECTED]>
Subject: Re: Documentation for /proc filesystem support for a driver?
Date: 02 Jan 2001 12:20:18 -0800
Having just gone through the exercise of figuring out all the dynamic
/proc support code, I can tell you that most reference material you'll
be able to find is out-of-date. Not unusably so -- but enough that you
will have to resort to reading the source.
OR, you could mine my project for example code. It's the OpenTNF tracing
system:
<https://sourceforge.net/projects/opentnf/>
The 0.1 preview is not recommended for general use -- but is probably
ideal for mining examples of /proc usage, since there's not a lot of
other code to distract you.
If you decide to look, see opentnf/kernel-module/linux/tnf-proc.c for
starters...
-- Kaelin
------------------------------
From: "Theo van der Merwe" <[EMAIL PROTECTED]>
Subject: Timer triggered by serial port activity
Date: Tue, 2 Jan 2001 23:36:37 +0200
I would like to implement a very accurate timer on a Linux machine. The
exact time between a series of trigger pulses on the serial port is desired
(the time between pulses would typically be larger than 10 ms -
milliseconds). Can you provide me with feedback on:
1) What timing accuracy can be achieved with a standard PC?
2) How can I minimize the delay from activity on the serial port to
processing of the serial data under Redhat Linux (e.g. a realtime kernel
patch)? What would typical delay times be?
3) How would one log the time between pulses (activity on the serial port)
accurately under Redhat Linux? I am only interested in the time between
pulses, not the exact time the pulses occur (unless the delay in processing
is too long of course).
Best regards,
Theo van der Merwe ([EMAIL PROTECTED])
------------------------------
From: "Theo van der Merwe" <[EMAIL PROTECTED]>
Subject: Realtime audio processing
Date: Tue, 2 Jan 2001 23:39:42 +0200
I would like to do some processing on audio data (using a sound card
compatible with Linux) in realtime. How do I obtain the raw audio data using
Redhat Linux?
Best regards,
Theo van der Merwe ([EMAIL PROTECTED])
------------------------------
From: [EMAIL PROTECTED] (Juergen Heinzl)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: redirecting stdin to a memory buffer
Date: 2 Jan 2001 22:01:57 GMT
In article <[EMAIL PROTECTED]>, Floyd Davidson wrote:
>[EMAIL PROTECTED] (Juergen Heinzl) wrote:
>>Bob Steele wrote:
>>>Does anyone know how to redirect stdin to a memory buffer in C. I am
>>>using glibc 2.2 with GCC on a Red Had 7.0 linux box.
>>>
>>>For example:
>>>stdin=(FILE *)freopen("test.txt","r",stdin); correctly redirects stdin
>...
>>>fclose(stdin);
>>>stdin=(FILE *)fmemopen(buffer,strlen(buffer),"r");
>...
>>It does, here's a slightly modified example.
>>
>>#include <stdio.h>
>>static char buffer[] = "foobar";
>>
>>int
>>main()
>>{
>> int ch;
>>
>> fclose(stdin);
>> stdin = fmemopen (buffer, strlen (buffer), "r");
>> while((ch = fgetc (stdin)) != EOF)
>> printf ("Got %c\n", ch);
>>
>> return 0;
>>}
>
>Both of the above methods should be avoided. stdin is not
>necessarily an lvalue, and should never be assigned to. It may
>work with any given platform/implementation, but the code is
>inherently non-portable and may fail to compile on another
>platform, or for that matter on the same platform with different
>compiler options or different #defines enabled in the code.
>
>The above code resulted in the following error on my machine:
>
>tanana:floyd ~/tst >gcc -W -Wall foo.c
>foo.c: In function `main':
>foo.c:11: warning: implicit declaration of function `fmemopen'
>foo.c:11: invalid lvalue in assignment
[-]
As mentioned you need to pass -D_GNU_SOURCE to the compiler. It's an
extension, yes and as such not meant to be portable.
In so far I don't agree with what the documentation has to say about
this ... "We recommend you use `_GNU_SOURCE' in new programs" ... but
the final decision is not up to me.
Cheers,
Juergen
--
\ Real name : J�rgen Heinzl \ no flames /
\ EMail Private : [EMAIL PROTECTED] \ send money instead /
------------------------------
From: "Norman Dresner" <[EMAIL PROTECTED]>
Subject: Re: Timer triggered by serial port activity
Date: Tue, 02 Jan 2001 22:16:06 GMT
Using Real-Time Linux (or RTAI), you can get very rapid response to a
serial-port event and for Pentium-class CPU's at least you can get time
resolution at the rate of the CPU's clock.
Look at http://www.rtlinux.org for RTLinux
and at http://www.zentropix.com/ for the RTAI variant.
Norm
Theo van der Merwe <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> I would like to implement a very accurate timer on a Linux machine. The
> exact time between a series of trigger pulses on the serial port is
desired
> (the time between pulses would typically be larger than 10 ms -
> milliseconds). Can you provide me with feedback on:
>
> 1) What timing accuracy can be achieved with a standard PC?
>
> 2) How can I minimize the delay from activity on the serial port to
> processing of the serial data under Redhat Linux (e.g. a realtime kernel
> patch)? What would typical delay times be?
>
> 3) How would one log the time between pulses (activity on the serial port)
> accurately under Redhat Linux? I am only interested in the time between
> pulses, not the exact time the pulses occur (unless the delay in
processing
> is too long of course).
>
>
> Best regards,
> Theo van der Merwe ([EMAIL PROTECTED])
>
>
>
>
>
>
>
------------------------------
From: [EMAIL PROTECTED] ()
Crossposted-To:
alt.os.linux.redhat,comp.os.linux.development.apps,comp.os.linux.networking,linux.dev.apps,linux.dev.net,linux.redhat.devel
Subject: Re: Before I go bald... Socket problem!
Date: Tue, 02 Jan 2001 22:47:00 -0000
In article <[EMAIL PROTECTED]>,
Jem <[EMAIL PROTECTED]> wrote:
>OK, before I lose loads of hair.. I am trying desperately to get the MAC
>address of the PC that my program (C++) is running on. I have some
>source code for it that I found from several locations on the web but I
>can't get it to compile because the constants that it uses don't seem to
>be defined, specifically:
> AF_ROUTE
> AF_LINK
> NET_RT_IFLIST
> RTM_IFINFO
> ETHER_ADDR_LEN
>
>Now I've done searches on this and, as far as I can determine, BSD
>Sockets.h should have these constants in #define statements. I have the
>FreeBSD version of socket.h
Did you try searching through the .h files on your system? I found
AF_ROUTE right away. Try including <sys/socket.h>.
--
http://www.spinics.net/linux
------------------------------
From: David Wragg <[EMAIL PROTECTED]>
Subject: Re: smp and gcc
Date: 02 Jan 2001 01:27:01 +0000
Ronald Cole <[EMAIL PROTECTED]> writes:
> I think there is a confusion. Parallelism is achieved through the use
> of threads, which is a library issue and not a compiler issue. It is
> the scheduler in the kernel that places threads on CPUs.
In current practice, thread-level parallelism tends not to be a
compiler issue (though instruction-level parallelism certainly is).
However, this is partly a reflection of the state of the art in
parallelizing compilers, and partly because C is an awful language as
far as parallelizing compilers are concerned. As someone else
mentioned, parallelizing FORTRAN compilers are available, and a lot of
academic research effort has been directed at parallel implementations
of other more obscure languages.
David Wragg
------------------------------
From: "Timo Weggen" <[EMAIL PROTECTED]>
Subject: Re: Realtime audio processing
Date: Tue, 02 Jan 2001 23:51:21 +0100
Reply-To: [EMAIL PROTECTED]
In article <[EMAIL PROTECTED]>, "Theo van der Merwe"
<[EMAIL PROTECTED]> wrote:
> I would like to do some processing on audio data (using a sound card
> compatible with Linux) in realtime. How do I obtain the raw audio data
> using Redhat Linux?
>
> Best regards, Theo van der Merwe ([EMAIL PROTECTED])
AFAIK, you could either use the legacy way (open /dev/dsp, ioctl all the
stuff you need, IOCTLs are in <linux/soundcard.h>) or use ALSA
API.; both works fine for me. Audio data just comes in the way you
specify it (8/16 bit; signed unsigned) and, important for U, if you wanna
perform realtime; you can specify the block size.
Is this ok for you or are you looking for another solution?
Timo
------------------------------
From: "Fruitbat" <[EMAIL PROTECTED]>
Subject: Re: Error compiling gcc 2.95.2
Date: Wed, 03 Jan 2001 01:46:34 GMT
Has anyone successfully applied the glibc 2.2 patch to gcc 2.95.2? I have
tried but it continually fails.
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: ramfs root(/) explained
Date: Tue, 02 Jan 2001 18:38:53 -0800
Try this address. Sourceforge's email system has been in chaos.
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
wrote:
> On Wed, 20 Dec 2000 11:21:00 -0800 Repairlix <[EMAIL PROTECTED]>
> wrote:
>
> [...]
>
> I tried to reply directly to you, but I got:
>
> A message that you sent could not be delivered to one or more of its
> recipients. This is a permanent error. The following address(es) failed:
>
> [EMAIL PROTECTED]:
> unknown local-part "xant" in domain "sourceforge.net"
>
>
------------------------------
From: "Electric Ninja" <[EMAIL PROTECTED]>
Subject: Does Linux kernel have an IRQL-like enforcement like NT?
Date: Wed, 03 Jan 2001 02:57:48 GMT
------------------------------
From: "Nathan Dyer" <[EMAIL PROTECTED]>
Subject: Kernel Memory Sizeing
Date: Wed, 3 Jan 2001 11:12:03 +0800
Does anyone have any information on how the linux kernel finds out how much
physical RAM is installed in the computer?
Thanks
Nathan Dyer
------------------------------
From: "�̿���" <[EMAIL PROTECTED]>
Subject: what is "load average"
Date: Wed, 3 Jan 2001 13:25:37 +0900
After excuting uptime program, we can get system load average for the past
1, 5, 15 minutes.
what is "load average"?
Is this show CPU usage?
If this show CPU usage, how can we calculate cpu % usage using this?
please ~~~
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: what is "load average"
Date: Wed, 03 Jan 2001 04:39:07 GMT
"�̿���" <[EMAIL PROTECTED]> writes:
> After excuting uptime program, we can get system load average for the past
> 1, 5, 15 minutes.
>
> what is "load average"?
>
> Is this show CPU usage?
>
> If this show CPU usage, how can we calculate cpu % usage using this?
Take a look at the manual page for top(1).
It mentions about "uptime," that:
"This line displays the time the system has been up, and the three
load averages for the system. The load averages are the average
number of processes ready to run during the last 1, 5, and 15
minutes."
Essentially, it represents a measure based on counting how many
processes were queued up waiting to run. That is very loosely
representative of "how busy the CPU is."
Mind you, if the system is busy because of waiting for I/O, as happens
when you have insufficient memory for the processes you're trying to
run, the load average can get very high due to a memory shortage. As
a result, the numbers are not greatly useful as a direct measure of
CPU utilization...
--
(reverse (concatenate 'string "ac.notelrac.teneerf@" "454aa"))
<http://www.ntlug.org/~cbbrowne/>
"KDE isn't a window manager. It *includes* one, but kwm is only one
of *many* components of KDE. And kwm is an *optional* component.
GNOME is the same, except that it doesn't include a wm..."
-- [EMAIL PROTECTED]
------------------------------
From: Guo zhenfeng <[EMAIL PROTECTED]>
Subject: How to send a signal
Date: Wed, 03 Jan 2001 13:22:53 +0800
How can I send a special signal in my process to a sepcified process
,which function could do this work ?
Many thanks
Guo Zhenfeng
------------------------------
From: "�̿���" <[EMAIL PROTECTED]>
Subject: Re: what is "load average"
Date: Wed, 3 Jan 2001 14:50:41 +0900
thanks.. *^^*
but i have another question.
How can i get precise kernel's usage(%)?
help me~~
<[EMAIL PROTECTED]> wrote in message
news:K1y46.159201$[EMAIL PROTECTED]...
> "�̿���" <[EMAIL PROTECTED]> writes:
> > After excuting uptime program, we can get system load average for the
past
> > 1, 5, 15 minutes.
> >
> > what is "load average"?
> >
> > Is this show CPU usage?
> >
> > If this show CPU usage, how can we calculate cpu % usage using this?
>
> Take a look at the manual page for top(1).
>
> It mentions about "uptime," that:
>
> "This line displays the time the system has been up, and the three
> load averages for the system. The load averages are the average
> number of processes ready to run during the last 1, 5, and 15
> minutes."
>
> Essentially, it represents a measure based on counting how many
> processes were queued up waiting to run. That is very loosely
> representative of "how busy the CPU is."
>
> Mind you, if the system is busy because of waiting for I/O, as happens
> when you have insufficient memory for the processes you're trying to
> run, the load average can get very high due to a memory shortage. As
> a result, the numbers are not greatly useful as a direct measure of
> CPU utilization...
>
> --
> (reverse (concatenate 'string "ac.notelrac.teneerf@" "454aa"))
> <http://www.ntlug.org/~cbbrowne/>
> "KDE isn't a window manager. It *includes* one, but kwm is only one
> of *many* components of KDE. And kwm is an *optional* component.
> GNOME is the same, except that it doesn't include a wm..."
> -- [EMAIL PROTECTED]
------------------------------
** 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
******************************