Linux-Development-Sys Digest #303, Volume #8 Mon, 27 Nov 00 04:13:06 EST
Contents:
Re: How to implement a timer (Christopher GAUTIER)
Re: rdtsc() timestamps synchronized between SMP CPU's? (Kaelin Colclasure)
Critical sections necessary in kernel module? ([EMAIL PROTECTED])
I admit it! ("Andreas Haberstroh")
Re: rdtsc() timestamps synchronized between SMP CPU's? (Robert Redelmeier)
Re: I admit it! (Stefaan A Eeckels)
Re: Critical sections necessary in kernel module? (Kaz Kylheku)
Re: I admit it! (Kaz Kylheku)
Re: [Q] How to get the Ethernet address ? (scz)
Re: [Q] How to get the Ethernet address ? ("Pillonel =?ISO-8859-1?Q?C=E9dric?=,
NWS-PD-71")
If yer lookin for a good pay site go here !!!! ([EMAIL PROTECTED])
Re: C++ thread lib wanted (Arne Driescher)
partition formating (MESMEUR Philippe)
Re: [Q] How to get the Ethernet address ?
----------------------------------------------------------------------------
From: Christopher GAUTIER <[EMAIL PROTECTED]>
Subject: Re: How to implement a timer
Date: Sun, 26 Nov 2000 21:30:55 +0100
Bruce Stephens wrote:
> Look up setitimer, alarm, and the handler-setting functions signal and
> sigaction.
Thanks, it should be perfect with this.
------------------------------
From: Kaelin Colclasure <[EMAIL PROTECTED]>
Subject: Re: rdtsc() timestamps synchronized between SMP CPU's?
Date: 26 Nov 2000 12:52:28 -0800
Robert Redelmeier <[EMAIL PROTECTED]> writes:
> Kaelin Colclasure wrote:
> >
> > Are the 64-bit timestamps (well, clock cycle counts) that are accessed
> > via rdtsc() synchronized between CPU's on an SMP Linux system? That
> > is, supposing it were somehow possible to execute a rdtsc instruction
> > on each CPU in the system at the exact same instant, would they all
> > have the same value?
> >
> > If not, would they be close enough to allow reasonably meaningful
> > comparisons between values from two different CPU's?
>
> On an SMP machine, try: `dmesg | grep TSC`
> You should see a nice message saying " TSC synchronization: passed"
> Have a grep through arch/i386/kernel and you will see the code
> that generated that message.
>
> If you don't like what the kernel does, remember that the TSC is
> _writable_, but only in Ring0. So you can write a module driver
> to do whatever you like.
>
> You can issue an IPI (Interprocessor Interrupt) to all CPUs and
> have them execute some unspinlocked synchronization code. This
> should get you close (<200 CPU clocks), but I'll bet the remote
> CPUs take a little longer to receive the acknowledge the IPI.
> You could try a spinlock to synchronize the CPUs, but then you
> are guaranteed some offset.
>
> If you suspect the CPUs have different multipliers, which violates
> both the SMP specification and common sense, this is very obvious
> from /proc/cpuinfo. Anyone who sticks in different CPUs deserves
> the scheduling favoritism they are sure to get. Plus the hardware
> instability that might occur.
Thanks, Robert, for a very informative response! I don't suppose you
know of a good book that talks about all this wonderfully arcane
stuff? (Meaning IPI's and that the TSC is writable, etc.) I haven't
really looked closely at computer architecture since the golden era of
the MC68000 (sigh).
-- Kaelin
------------------------------
From: [EMAIL PROTECTED]
Subject: Critical sections necessary in kernel module?
Date: Sun, 26 Nov 2000 23:12:28 +0100
Is it necessary to use critical sections in a kernel module? Or is all
my memory access exclusive? If so what will happen in a multiprocessor
situation?
Bas
------------------------------
Reply-To: "Andreas Haberstroh" <[EMAIL PROTECTED]>
From: "Andreas Haberstroh" <[EMAIL PROTECTED]>
Subject: I admit it!
Date: Sun, 26 Nov 2000 22:40:39 GMT
Okay, I admit it.
I'm spoiled. I have grown to love the VC IDE debugger. Makes life SOOOOO
simple.
Is there something like this in linux?
Not the gdb, but, something with a GUI.
------------------------------
Date: Sun, 26 Nov 2000 17:39:44 -0600
From: Robert Redelmeier <[EMAIL PROTECTED]>
Subject: Re: rdtsc() timestamps synchronized between SMP CPU's?
Kaelin Colclasure wrote in part:
> Thanks, Robert, for a very informative response! I don't suppose you
> know of a good book that talks about all this wonderfully arcane
> stuff? (Meaning IPI's and that the TSC is writable, etc.) I haven't
> really looked closely at computer architecture since the golden era of
> the MC68000 (sigh).
Arcane is right. The best reference is the Intel manuals,
especially Volume 3, IA32 Systems programming at:
http://developer.intel.com/design/Pentium4/manuals/
Unfortunately, I don't know of any textbook.
-- Robert
------------------------------
From: [EMAIL PROTECTED] (Stefaan A Eeckels)
Subject: Re: I admit it!
Date: Mon, 27 Nov 2000 00:05:36 +0100
In article <HjgU5.14306$[EMAIL PROTECTED]>,
"Andreas Haberstroh" <[EMAIL PROTECTED]> writes:
> Okay, I admit it.
> I'm spoiled. I have grown to love the VC IDE debugger. Makes life SOOOOO
> simple.
>
> Is there something like this in linux?
> Not the gdb, but, something with a GUI.
You're looking for ddd. It's quite nice. If you like
alternative interfaces, and a built-in 'C' interpreter,
try ups.
--
Stefaan
--
Ninety-Ninety Rule of Project Schedules:
The first ninety percent of the task takes ninety percent of
the time, and the last ten percent takes the other ninety percent.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Critical sections necessary in kernel module?
Reply-To: [EMAIL PROTECTED]
Date: Mon, 27 Nov 2000 03:15:04 GMT
On Sun, 26 Nov 2000 23:12:28 +0100, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>Is it necessary to use critical sections in a kernel module? Or is all
>my memory access exclusive? If so what will happen in a multiprocessor
>situation?
Linux doesn't have critical sections; you must be thinking of the oddly named
Windows type CRITICAL_SECTION.
Yes, you must protect all critical regions of your code using spinlocks.
In a multiprocessor situation, it's possible for two or more processors
to concurrently call into a module. There is also concurrency between
interrupt service routines and regular execution.
--
Any hyperlinks appearing in this article were inserted by the unscrupulous
operators of a Usenet-to-web gateway, without obtaining the proper permission
of the author, who does not endorse any of the linked-to products or services.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: I admit it!
Reply-To: [EMAIL PROTECTED]
Date: Mon, 27 Nov 2000 03:19:30 GMT
On Sun, 26 Nov 2000 22:40:39 GMT, Andreas Haberstroh <[EMAIL PROTECTED]> wrote:
>Okay, I admit it.
>I'm spoiled. I have grown to love the VC IDE debugger. Makes life SOOOOO
>simple.
You must not be working on any non-trivial code to sound so optimistic about a
debugger GUI. If your life is so simple, maybe the bugs aren't that hard? :)
>Is there something like this in linux?
>Not the gdb, but, something with a GUI.
There are GUI front ends to gdb, like xxgdb or ddd. In ddd you can plot views
of variables on a graph-like thing. Can't speak from experience; I looked over
the shoulder of someone who was odoing it. ;)
------------------------------
From: scz <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: Re: [Q] How to get the Ethernet address ?
Date: Mon, 27 Nov 2000 03:39:31 GMT
[EMAIL PROTECTED] wrote:
>
> On Sun, 26 Nov 2000 02:33:40 GMT scz <[EMAIL PROTECTED]> wrote:
>
> | Since the original post reads "the Ethernet address", one might
> | infer that the machine has one (1) Ethernet interface. Tricky,
> | eh?
>
> Or one might infer that the original poster could not imagine
> a machine having more than one, because (as you so kindly point
> out) his has only one, but that he may be faced with a program
> he is developing that needs to have "the Ethernet address".
True. But the majority of userland (ie desktop) systems have only
one interface, and he may be developing for machines serving in
this particular role. However, I don't know this to be true - and
neither, I suspect, do you. I would like to reiterate the need
for clarification before jumping to conclusions.
> | Note also the domain from which the original post was sent:
> | swisscom.com. A quick perusal of www.swisscom.com shows that
> | content is available in a number of languages. Perhaps Cedric
> | is not a native speaker of English, and he meant "an" vice "the".
> | Why don't you ask him for clarification instead of providing
> | empty (and nitpicky) rhetoric in response?
>
> The response was quite far from empty. It was full of advice
> on how to understand the complexity of computer concepts that
> frequently escape people who make limited observations of just
> a few sample machines. Of course he might have mean "an".
If he is developing *only* for that limited subset - entirely possible,
such as in a lab environment - then the extraneous points you introduce
become quite obviously irrelevant.
> In that case my response might be slightly rephrased because
> just "an" address suggests one of many. But which one? The
> one the application currently has a socket open with?
Possibly. But you won't know unless you ask for clarification. I
go back to the original request, which seemed rather straightforward:
"How can I get the Ethernet address from my C++ application ?" I
daresay that most reasonable folk would infer that he meant the
Ethernet address of the [desktop] machine on which he is working.
> |> Or maybe you want the address associated with the name the
> |> machine is called? And what if there are multiple of those?
> |> What if the machine has many alias hostnames? You want those,
> |> too?
> |
> | He didn't ask for hostnames or hostids, either. Why is this
> | so confusing [to you]?
>
> I believe you are the one who is confused. Why do you insist on
> responses being very narrow and, in the case of an ill-formed
> question, possibly being misleading?
By way of an analogy, if someone asks for the current time you needn't
tell him how to build a clock: sometimes the very simple answer is
entirely correct/appropriate.
> |> Do you want ethernet MAC addresses, or IP addresses? Do you
> |> want IPv4 addresses or IPv6 addresses?
> |
> | Let's ask a few more farfetched and irrelevant questions. The
> | answer to all of your rambling is, of course, mu. 'Mu' is the
> | correct response to a question predicated upon an incorrect
> | assumption.
>
> Utterly useless.
Just a bit of information - lost on you, apparently - regarding
incorrect suppositions and their effect on discourse. This was a vain
attempt on my part to point out that your IP-address-related questions
are irrelevant because Ethernet address != IP address.
> |> Will your program become corrupt if a syscall returns an array
> |> of over 20000 addresses (yes, I've had that many on one machine)?
> |
> | That would be up to him, I imagine. And I'm sure he is mightily
> | impressed by the size of your array.
>
> There are way too many poorly designed (indeed too often not even
> designed at all) programs out there to just stand by and let yet
> another misunderstanding go by. In your case, I won't bother.
> But the original poster has not offended me in any way, so I am
> willing to help him and point out all the issues he may need to
> consider (in his development project I suspect he may be doing).
In the time you spent trying to read volumes into a very simple
question, you could have gotten clarification on Cedric's problem
and provided some [potentially] useful feedback. If you haven't
contacted him directly (and I gather you haven't), doing so is
likely the most productive action to take.
> |> I hope you're still in the specification design phase of your
> |> application.
> |
> | I hope you take a deep breath (or a Midol) before you provide
> | another obnoxious response to a succinct question. At the very
> | least you could behave with a bit more politesse in a public
> | forum. Everyone has bad days, but each person must decide what
> | to do with his.
>
> I had a good day today. I take it you didn't.
I had a fantastic day, but thanks!
Scott
------------------------------
From: "Pillonel =?ISO-8859-1?Q?C=E9dric?=, NWS-PD-71"
Subject: Re: [Q] How to get the Ethernet address ?
Date: Mon, 27 Nov 2000 07:43:08 +0100
Reply-To: [EMAIL PROTECTED]
Why nobody answers my question ? If you can't answer why do post so many messages ?
Here is my question, with some precisions !!!
I have "one" Ethernet interface and I want to get the MAC adresse of that
interface. Which system call should I use in C++ to obtain this information ?
Is it clear enough ? If you don't know how, please don't answer !
scz wrote:
> [EMAIL PROTECTED] wrote:
>
>> On Sun, 26 Nov 2000 02:33:40 GMT scz <[EMAIL PROTECTED]> wrote:
>>
>> | Since the original post reads "the Ethernet address", one might
>> | infer that the machine has one (1) Ethernet interface. Tricky,
>> | eh?
>>
>> Or one might infer that the original poster could not imagine
>> a machine having more than one, because (as you so kindly point
>> out) his has only one, but that he may be faced with a program
>> he is developing that needs to have "the Ethernet address".
>
>
> True. But the majority of userland (ie desktop) systems have only
> one interface, and he may be developing for machines serving in
> this particular role. However, I don't know this to be true - and
> neither, I suspect, do you. I would like to reiterate the need
> for clarification before jumping to conclusions.
>
>
>> | Note also the domain from which the original post was sent:
>> | swisscom.com. A quick perusal of www.swisscom.com shows that
>> | content is available in a number of languages. Perhaps Cedric
>> | is not a native speaker of English, and he meant "an" vice "the".
>> | Why don't you ask him for clarification instead of providing
>> | empty (and nitpicky) rhetoric in response?
>>
>> The response was quite far from empty. It was full of advice
>> on how to understand the complexity of computer concepts that
>> frequently escape people who make limited observations of just
>> a few sample machines. Of course he might have mean "an".
>
>
> If he is developing *only* for that limited subset - entirely possible,
> such as in a lab environment - then the extraneous points you introduce
> become quite obviously irrelevant.
>
>
>> In that case my response might be slightly rephrased because
>> just "an" address suggests one of many. But which one? The
>> one the application currently has a socket open with?
>
>
> Possibly. But you won't know unless you ask for clarification. I
> go back to the original request, which seemed rather straightforward:
> "How can I get the Ethernet address from my C++ application ?" I
> daresay that most reasonable folk would infer that he meant the
> Ethernet address of the [desktop] machine on which he is working.
>
>
>> |> Or maybe you want the address associated with the name the
>> |> machine is called? And what if there are multiple of those?
>> |> What if the machine has many alias hostnames? You want those,
>> |> too?
>> |
>> | He didn't ask for hostnames or hostids, either. Why is this
>> | so confusing [to you]?
>>
>> I believe you are the one who is confused. Why do you insist on
>> responses being very narrow and, in the case of an ill-formed
>> question, possibly being misleading?
>
>
> By way of an analogy, if someone asks for the current time you needn't
> tell him how to build a clock: sometimes the very simple answer is
> entirely correct/appropriate.
>
>
>> |> Do you want ethernet MAC addresses, or IP addresses? Do you
>> |> want IPv4 addresses or IPv6 addresses?
>> |
>> | Let's ask a few more farfetched and irrelevant questions. The
>> | answer to all of your rambling is, of course, mu. 'Mu' is the
>> | correct response to a question predicated upon an incorrect
>> | assumption.
>>
>> Utterly useless.
>
>
> Just a bit of information - lost on you, apparently - regarding
> incorrect suppositions and their effect on discourse. This was a vain
> attempt on my part to point out that your IP-address-related questions
> are irrelevant because Ethernet address != IP address.
>
>
>> |> Will your program become corrupt if a syscall returns an array
>> |> of over 20000 addresses (yes, I've had that many on one machine)?
>> |
>> | That would be up to him, I imagine. And I'm sure he is mightily
>> | impressed by the size of your array.
>>
>> There are way too many poorly designed (indeed too often not even
>> designed at all) programs out there to just stand by and let yet
>> another misunderstanding go by. In your case, I won't bother.
>> But the original poster has not offended me in any way, so I am
>> willing to help him and point out all the issues he may need to
>> consider (in his development project I suspect he may be doing).
>
>
> In the time you spent trying to read volumes into a very simple
> question, you could have gotten clarification on Cedric's problem
> and provided some [potentially] useful feedback. If you haven't
> contacted him directly (and I gather you haven't), doing so is
> likely the most productive action to take.
>
>
>> |> I hope you're still in the specification design phase of your
>> |> application.
>> |
>> | I hope you take a deep breath (or a Midol) before you provide
>> | another obnoxious response to a succinct question. At the very
>> | least you could behave with a bit more politesse in a public
>> | forum. Everyone has bad days, but each person must decide what
>> | to do with his.
>>
>> I had a good day today. I take it you didn't.
>
>
> I had a fantastic day, but thanks!
>
> Scott
--
================================================================
Cedric Pillonel |
Swisscom | phone: +41 (0)31 342 45 74
NWS-ENG-V-VT | Fax: +41 (0)31 342 59 59
Zentweg 9 | e-mail: [EMAIL PROTECTED]
CH-3000 Berne 30, Switzerland |
================================================================
------------------------------
From: [EMAIL PROTECTED]
Subject: If yer lookin for a good pay site go here !!!!
Date: Mon, 27 Nov 2000 06:53:16 GMT
http://www.cashwars.com/r/sike3
begin 644 Cashwar.HTML
M/&$@:')E9CTB:'1T<#HO+W=W=RYC87-H=V%R<RYC;VTO<B]S:6ME,R(^/&EM
M9R!B;W)D97(](C$B('-R8STB:'1T<#HO+W=W=RYC87-H=V%R<RYC;VTO:6UA
M9V5S+V-W;&]G;V)L=64N9VEF(B!W:61T:#TB,3<U(B!H96EG:'0](C0X(CX\
#+V$^
`
end
------------------------------
From: Arne Driescher <[EMAIL PROTECTED]>
Subject: Re: C++ thread lib wanted
Date: Mon, 27 Nov 2000 09:11:59 +0100
Yingfei Dong wrote:
>
> hi, folks,
>
> I am looking for a C++ wrapper of thread on RedHat 6.1 or FreeBSD4.1?
> Please let me know if you have any inputs. Thanks.
>
> pthread is supported in C. But I didn't find any info about similar info
> for C++.
>
> Yingfei Dong
Hi,
take a look at
http://www.cs.wustl.edu/~schmidt/ACE.html
This is much more than a thread wrapper. But if you are
going to use threads for real world problems you will
probably like the rest too :-)
-Arne
------------------------------
From: MESMEUR Philippe <[EMAIL PROTECTED]>
Subject: partition formating
Date: Mon, 27 Nov 2000 09:19:12 +0100
Hi, I'm looking for a way to format BSD partition under Linux.
Do you know a command that does this?
thanks
------------------------------
From: <[EMAIL PROTECTED]>
Subject: Re: [Q] How to get the Ethernet address ?
Date: Mon, 27 Nov 2000 09:05:34 GMT
Pillonel C�dric, NWS-PD-71 <[EMAIL PROTECTED]> wrote:
> Here is my question, with some precisions !!!
> I have "one" Ethernet interface and I want to get the MAC adresse of that
> interface. Which system call should I use in C++ to obtain this information ?
I can gice you a hint:
'strace ifconfig' spits out among other stuff these lines:
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
ioctl(4, SIOCGIFCONF, 0xbffff1c4) = 0
ioctl(4, SIOCGIFFLAGS, 0xbffff35c) = 0
ioctl(4, SIOCGIFHWADDR, 0xbffff35c) = 0
ioctl(4, SIOCGIFMETRIC, 0xbffff35c) = 0
ioctl(4, SIOCGIFMTU, 0xbffff35c) = 0
ioctl(4, SIOCGIFMAP, 0xbffff35c) = 0
ioctl(4, SIOCGIFMAP, 0xbffff35c) = 0
ioctl(4, 0x8942, 0xbffff35c) = 0
ioctl(4, SIOCGIFADDR, 0xbffff35c) = 0
ioctl(4, SIOCGIFDSTADDR, 0xbffff35c) = 0
ioctl(4, SIOCGIFBRDADDR, 0xbffff35c) = 0
ioctl(4, SIOCGIFNETMASK, 0xbffff35c) = 0
So I guess that SIOCGIFHWADDR ioctl gives the hw address of the interface
Roope
--
Microsoft? Is that some kind of a toilet paper?
===================================================================
Email: [EMAIL PROTECTED] / [EMAIL PROTECTED]
Mobile: +358407504480
------------------------------
** 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 (and comp.os.linux.development.system) via:
Internet: [EMAIL PROTECTED]
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
******************************