Is stat function thread safe ?

A

Amandil

If you're using redhat linux, then a simple 'man stat' at the command
line will give you all the help you need.

Totally off topic, but to be cute I thought I'd say that on Linux you
might be better off typing info stat, as man is a relic from Unix...

Cheers,

-- Marty Amandil
 
A

Antoninus Twink

I thought I'd say that on Linux you might be better off typing info
stat, as man is a relic from Unix...

I assume this is meant as a joke - or can there really be someone who
likes info?
 
C

CBFalconer

Wolfgang said:
.... snip ...

At least once can say, that the interface of stat allows for
thread safety, but if it is so is implementation dependent.

No, since there is no description of a stat function in the C
standard. We have no idea what it does, or is supposed to do. If
the OP published a description of the function, then someone MIGHT
help him write it. And please don't quote other standards to me.
There are newsgroups to cover those.
 
A

Antoninus Twink

No, since there is no description of a stat function in the C
standard. We have no idea what it does, or is supposed to do.

You mean that YOU have no idea what it does. The rest of us know
perfectly well what it does.

But then, there are plenty of things to do with C that you have no idea
about, as your posts to this group demonstrate very vividly.
 
W

Wolfgang Draxinger

CBFalconer said:
No, since there is no description of a stat function in the C
standard.

Did I say that? No!

Really, is it so hard to read AND understand what I write? I
admit, that I'm not writing simplified english, but if one would
read my sentences carefully, such redundancy like this post was
avoided.
We have no idea what it does, or is supposed to do.

Which is exactly what I wrote. The interface allows it to be
implemented thread safe, but it's not assured. If it is really
thread safe depends yet solely on the implementation.

A potentially thread unsafe interface would be, if parameters
were set in a process global state vector. But even this can be
thread safe if proper locking is performed on the global state.

Wolfgang Draxinger
 
A

Antoninus Twink

CBFalconer said:

Really, is it so hard to read AND understand what I write?

Bear in mind that CBF is very old, and his mental faculties are in an
advanced state of decay. If you have an image in your mind of him
dribbling as he types, you will be able to read his nonsense with more
equanimity.
The interface allows it to be implemented thread safe, but it's not
assured. If it is really thread safe depends yet solely on the
implementation.

Well, sure.

But if the implementation conforms to the relevant standard on this
point (certainly the Single Unix Specification - probably from there
it's got into POSIX by now too), then it is obliged to provide a thread
safe implementation.

Of course, it is *possible* to implement the stat() interface in a
non-threadsafe way, and this probably happens in legacy implementations.
Do you know of a current C library that doesn't have a thread-safe
stat()?
 
R

Richard

Antoninus Twink said:
I assume this is meant as a joke - or can there really be someone who
likes info?

I do. It allows better navigation when using in a console.
 
J

jameskuyper

Amandil said:
Totally off topic, but to be cute I thought I'd say that on Linux you
might be better off typing info stat, as man is a relic from Unix...

You may consider it a relic, but its fully functional, providing all
the information about stat() that you need, and IMO opinion presents
that information in a way that's much easier to use than 'info'.
 
J

jameskuyper

CBFalconer said:
No, since there is no description of a stat function in the C
standard.

No, that only means that discussions of it are off topic in this news
group, which is why I re-directed the OP to a different information
source. That does not mean it can't be said; it doesn't even mean that
it isn't true.
... We have no idea what it does, or is supposed to do. ...

Speak for yourself. Unlike you, many of us know about things that
aren't in the C standard. This isn't the right place to discuss them,
but that doesn't mean we don't know them.
 
S

Spiros Bousbouras

You may consider it a relic, but its fully functional, providing all
the information about stat() that you need, and IMO opinion presents
that information in a way that's much easier to use than 'info'.

off_topic() {
Actually the info file also contains all the information.
After all on many occasions it is the same as the man
file. But the utility info is a POS , less is way way better.
}
 
S

Sjouke Burry

Amandil said:
Totally off topic, but to be cute I thought I'd say that on Linux you
might be better off typing info stat, as man is a relic from Unix...

Cheers,

-- Marty Amandil
I even did a google with man nm
and the second or third hit gave the man page.
 
J

James Kuyper

Richard said:
jameskuyper said:


Chuck, by his "we have no idea", is attempting to paint a topicality
picture. There's an interesting parallel in UK constitutional
history, where William Lenthall, Speaker of the House of Commons in
1642, replied to an unwelcome question from the King: "May it
please your Majesty, I have neither eyes to see nor tongue to speak
in this place but as the House is pleased to direct me, whose
servant I am here".

Clearly, Lenthall was not suggesting that he was truly blind and
dumb. To take him literally on this occasion would be to
misunderstand him. Likewise, to take Chuck literally on this
occasion would be to misunderstand him.

Taken figuratively, his comment is irrelevant to the context; only the
literal interpretation would make it relevant, and even then, only if it
were also true.
 
R

Richard

Richard Heathfield said:
jameskuyper said:


Chuck, by his "we have no idea", is attempting to paint a topicality
picture. There's an interesting parallel in UK constitutional
history, where William Lenthall, Speaker of the House of Commons in
1642, replied to an unwelcome question from the King: "May it
please your Majesty, I have neither eyes to see nor tongue to speak
in this place but as the House is pleased to direct me, whose
servant I am here".

ZZzzzzzzz........ Wikipedia and Google are a dangerous combo for the
pretentious and self anointed.
Clearly, Lenthall was not suggesting that he was truly blind and
dumb. To take him literally on this occasion would be to
misunderstand him. Likewise, to take Chuck literally on this
occasion would be to misunderstand him.

Who cares.

He's wrong. "We" can and do help where appropriate and many did indeed
help.
 
C

CBFalconer

Richard said:
jameskuyper said:

Chuck, by his "we have no idea", is attempting to paint a
topicality picture. There's an interesting parallel in UK
constitutional history, where William Lenthall, Speaker of the
House of Commons in 1642, replied to an unwelcome question from
the King: "May it please your Majesty, I have neither eyes to
see nor tongue to speak in this place but as the House is
pleased to direct me, whose servant I am here".

Clearly, Lenthall was not suggesting that he was truly blind
and dumb. To take him literally on this occasion would be to
misunderstand him. Likewise, to take Chuck literally on this
occasion would be to misunderstand him.

:) I think this requires repeating your sig:

"Usenet is a strange place" - dmr 29 July 1999
 
P

Phil Carmody

Wolfgang Draxinger said:
Did I say that?

That's a very silly question. If you /had/ said "there is no
description of a stat function in the C standard", then CBF
wouldn't have needed to say it.

At least you have worked out the same answer to your silly
question as everyone else. However that doesn't make asking
it in the first place a sensible thing to have done.
Really, is it so hard to read AND understand what I write? I
admit, that I'm not writing simplified english, but if one would
read my sentences carefully, such redundancy like this post was
avoided.

There is no redundancy. You used the phrase "the interface of stat"
as if stat were a function with a standard interface. That's a
falsity, and CBF has contradicted and corrected you. The redundancy
would perhaps be me having to contradict and correct you too.
Which is exactly what I wrote. The interface

Stop right there. Again, there is no interface. Talking about "the
interface" as if it exists, as you are doing, is misled and misleading.

Phil
 
A

Antoninus Twink

There is no redundancy. You used the phrase "the interface of stat"
as if stat were a function with a standard interface. That's a
falsity, and CBF has contradicted and corrected you.

This is a bare-faced lie.

stat() does indeed have a standard interface, in the strong sense that
it is specified by a widely-used international standard (POSIX.1): see
for example
<http://www.opengroup.org/onlinepubs/9699919799/functions/stat.html>.

This is typical of the clc "regulars": once they lose the argument, they
always fall back on LIES.
 
P

Phil Carmody

If you had meant to quibble about the use of "the" rather than
"a" you might have had a point; but you evidently didn't since

Since I didn't include "the" in the quote above?

Oh, wait a second, I did include "the" in the quote. How strange,
it's almost as if I chose the words in my post carefully. Please
elevate your reading comprehension to at least secondary school
level so you don't make such boobs in the future.

Phil
 
C

CBFalconer

Richard said:
This is truly bizarre. Is stat a function with a standard
interface? Of course it is. Is it a function defined in the
various C standards? Not in C89 or C9, though possibly in K&R C
which does not have a standard as such. That does not mean that
it is not defined and does not have a defined interface. What
Falconer said was silly; what you were saying is silly.

Try to pay attention. This is c.l.c. We depend on the various ISO
C standards (and K&R) for the language definition. The fact that
some other organization writes and publishes standards for whatever
purpose does not influence correspondence and topicality on this
news group.

If you really want to discuss a 'stat' function, you have to supply
the prototype and a full description of what it does. Then you can
ask about how to implement it. That may not be possible with
standard C. You can also ask (then) about how to use it. 'stat'
is not a reserved name, it is in the users namespace, and thus
quite available for use in any desired manner.

The same goes for discussion of threads, at least until you can
supply a reference in the standard that defines these items.

For example, I have published various C code, including hashlib,
ggets, nmalloc, and others. I do not claim that these are
standards. I do give references that allow anyone interested to
examine them, and possibly use them. I do not claim that my Pascal
systems are industry standards, nor that they are applicable here.
 
B

Barry Schwarz

K&R2 contains a description of stat() in section 8.6, you complete
jackass.

And the fact that chapter 8 is titled The UNIX System Interface
obviously doesn't limit its applicability at all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,218
Latest member
JolieDenha

Latest Threads

Top