Unix administration - How to determine available system calls on a Unix/Linux system

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > October 2004 > How to determine available system calls on a Unix/Linux system





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to determine available system calls on a Unix/Linux system
markus

2004-09-22, 9:21 pm

Hi,

There are more than 1000 defined system calls in the Unix standard
specification, however, a majority of them are optional and the
availability of system calls are dependent on the OS implementation
itself.

The question I have is: How do you determine which system calls are
available on any Unix/Linux machine?

The same question goes for determening available C library functions
on any Unix/Linux machine?

Best regards
Richard Bos

2004-09-22, 9:21 pm

dspfun@hotmail.com (markus) wrote:

> The question I have is: How do you determine which system calls are
> available on any Unix/Linux machine?
>
> The same question goes for determening available C library functions
> on any Unix/Linux machine?


If the computer has a conforming C implementation, _all_ C library
functions must be available; otherwise it simply isn't a C
implementation.
As for determining what is present, that's OS-specific, hence off-topic
on comp.lang.c.

Richard
P.T. Breuer

2004-09-22, 9:21 pm

Richard Bos <rlb@hoekstra-uitgeverij.nl> wrote:
> dspfun@hotmail.com (markus) wrote:

You don't. It's none of your business. It's the C library's business to
interface between you and the system calls.

But if you wanted to, you would read the kernel's syscall
implementation list in the source code.
[vbcol=seagreen]
[vbcol=seagreen]
> If the computer has a conforming C implementation, _all_ C library
> functions must be available; otherwise it simply isn't a C
> implementation.


Well, whther the functions work or not also enters into it. However ...

> As for determining what is present, that's OS-specific, hence off-topic
> on comp.lang.c.


In the last 20 years, I have never seen anything that is on topic on
comp.lang.c, which is why I have avoided going there like the plague
during the last 20 years. If you want language lawyery, it's an
excellent place to hang out and pick nits.

It's sort of like Wittgenstein. Anything you asked him he told you was
some other disciplines kind of problem, not philosophy.

Peter
CBFalconer

2004-09-22, 9:21 pm

markus wrote:
>
> There are more than 1000 defined system calls in the Unix standard
> specification, however, a majority of them are optional and the
> availability of system calls are dependent on the OS implementation
> itself.
>
> The question I have is: How do you determine which system calls are
> available on any Unix/Linux machine?
>
> The same question goes for determening available C library functions
> on any Unix/Linux machine?


ALL the functions specified in the ISO C standard should be
available on any hosted machine. Anything else is system
dependant and off-topic on c.l.c.

Thus code that uses such non-standard calls should be in an
isolated system dependant module, and discussed only on system
specific newsgroups. Above all they should not be cross-posted to
groups where they are OT.

--
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!


Dan Espen

2004-09-22, 9:21 pm

dspfun@hotmail.com (markus) writes:

> Hi,
>
> There are more than 1000 defined system calls in the Unix standard
> specification, however, a majority of them are optional and the
> availability of system calls are dependent on the OS implementation
> itself.
>
> The question I have is: How do you determine which system calls are
> available on any Unix/Linux machine?
>
> The same question goes for determening available C library functions
> on any Unix/Linux machine?


That is what the "configure" script in most UNIX source code packages
does. If you tell us what you are trying to do, you might get a more
useful answer.
Pascal Bourguignon

2004-09-22, 9:21 pm

dspfun@hotmail.com (markus) writes:

> Hi,
>
> There are more than 1000 defined system calls in the Unix standard
> specification, however, a majority of them are optional and the
> availability of system calls are dependent on the OS implementation
> itself.
>
> The question I have is: How do you determine which system calls are
> available on any Unix/Linux machine?


First, all linux implement the same subset of posix (for a given
version), and all MacOSX implement their own same subset. So when you
write a program for a given target (system class), you can count on
the features present.

Otherwise, if you have the API in the /usr/include header, there's a
high probability that they're actually present in the system.

Finally, this is usually done at compilation time with utilities such
as autoconf/automake and the generated configure script.

It's rarely done at run-time. You could scan /usr/include, /usr/lib,
and play with dlopen (if it's available :-).

> The same question goes for determening available C library functions
> on any Unix/Linux machine?
>
> Best regards


--
__Pascal Bourguignon__ http://www.informatimago.com/

Our enemies are innovative and resourceful, and so are we. They never
stop thinking about new ways to harm our country and our people, and
neither do we.
SM Ryan

2004-09-22, 9:21 pm

dspfun@hotmail.com (markus) wrote:
# Hi,
#
# There are more than 1000 defined system calls in the Unix standard
# specification, however, a majority of them are optional and the
# availability of system calls are dependent on the OS implementation
# itself.
#
# The question I have is: How do you determine which system calls are
# available on any Unix/Linux machine?

Trial and error, unfortunately, is too often the case. On a proper system you should be
able to look at /usr/share/man/man2 and man3 or the section 2 and 3 portion of xman to
get a rough idea. However many systems anywhere are inadequately documented. You can also
try nm /usr/lib/libc.so or similar files.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
Mention something out of a Charleton Heston movie, and suddenly
everybody's a theology scholar.
Zian Smith

2004-09-22, 9:21 pm

dspfun@hotmail.com (markus) wrote in message news:<bcb072f5.0409200250.457b60f4@posting.google.com>...
> Hi,
>
> There are more than 1000 defined system calls in the Unix standard
> specification, however, a majority of them are optional and the
> availability of system calls are dependent on the OS implementation
> itself.
>
> The question I have is: How do you determine which system calls are
> available on any Unix/Linux machine?
>
> The same question goes for determening available C library functions
> on any Unix/Linux machine?
>
> Best regards


you can try
apropos '(3)' for library functions
apropos '(2)' for system calls

This should give you a list, at least for those functions that have a
man page in the system I suppose...
Default User

2004-09-22, 9:21 pm

P.T. Breuer wrote:

> In the last 20 years, I have never seen anything that is on topic on
> comp.lang.c, which is why I have avoided going there like the plague
> during the last 20 years. If you want language lawyery, it's an
> excellent place to hang out and pick nits.



Pure lies. We handle many questions and problems each day, as long as
they fit the topicality of the newsgroup.



Brian Rodenborn
P.T. Breuer

2004-09-22, 9:21 pm

Default User <first.last@boeing.com.invalid> wrote:
> P.T. Breuer wrote:
>
[vbcol=seagreen]
> Pure lies. We handle many questions and problems each day, as long as
> they fit the topicality of the newsgroup.


There you are!

Peter
Default User

2004-09-22, 9:21 pm

P.T. Breuer wrote:

> Default User <first.last@boeing.com.invalid> wrote:
>
>
> There you are!


Quite a non-sequitur. Do you deny that we (comp.lang.c) handle many
questions and problems each day? Do I need to post examples and make
you look foolish?




Brian Rodenborn
Michael Heiming

2004-09-22, 9:21 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message

In comp.os.linux.misc Default User <first.last@boeing.com.invalid> suggested:
> P.T. Breuer wrote:


[vbcol=seagreen]
> Quite a non-sequitur. Do you deny that we (comp.lang.c) handle many
> questions and problems each day? Do I need to post examples and make
> you look foolish?


Mh, looks like both have made their points and seem to have a
quite different opinion about clc. Nothing unusual, or anything
that would make it reasonable to begin insulting each other,
while wasting bandwidth. Probably the only thing a large thread
would change are this weeks stats of colm/cua and clc (if there
is such a thing).;)

Thx for reading

--
Michael Heiming (GPG-Key ID: 0xEDD27B94)
mail: echo zvpunry@urvzvat.qr | PERL -pe 'y/a-z/n-za-m/'
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBTzB+AkPEju3Se5QRAnp4AKCMpv33rr3J
D6yK0l2jGDs0FHV1qACgsxTE
8P+pDbYLOjC+WlXKNZELMU0=
=QbXo
-----END PGP SIGNATURE-----
P.T. Breuer

2004-09-22, 9:21 pm

Default User <first.last@boeing.com.invalid> wrote:
> P.T. Breuer wrote:


[vbcol=seagreen]
> Quite a non-sequitur. Do you deny that we (comp.lang.c) handle many
> questions and problems each day? Do I need to post examples and make
> you look foolish?


:-) !!!!

Yay! They haven't changed!

It's like stepping into a time warp, except I daresay a whole new load
of lusers questons about library functions are nowadays consigned to the
bin of null. Threading anyone? Reentrancy?

Yo ho ho.

Peter
Default User

2004-09-22, 9:21 pm

P.T. Breuer wrote:


> It's like stepping into a time warp, except I daresay a whole new load
> of lusers questons about library functions are nowadays consigned to
> the bin of null. Threading anyone? Reentrancy?



You continue to dodge the question. Obviously, you've realized that
your lies are exposed.




Brian Rodenborn
Bill Marcum

2004-09-22, 9:21 pm

Xref: number1.nntp.dca.giganews.com comp.lang.c:609555 comp.unix.admin:117728 comp.os.linux.misc:576681

["Followup-To:" header set to comp.unix.admin.]
On Mon, 20 Sep 2004 11:53:52 GMT, P.T. Breuer
<ptb@oboe.it.uc3m.es> wrote:
>
> In the last 20 years, I have never seen anything that is on topic on
> comp.lang.c,
> which is why I have avoided going there like the plague
> during the last 20 years. If you want language lawyery, it's an
> excellent place to hang out and pick nits.
>

If you avoid going to comp.lang.c, you probably only see articles which
are crossposted to that group, and anything crossposted is almost
certain to be considered off-topic.

--
System Events
=-=-=-=-=-=-=
Sep 16 03:31:11 don kernel: lp0 on fire

P.T. Breuer

2004-09-22, 9:21 pm

Default User <first.last@boeing.com.invalid> wrote:
> P.T. Breuer wrote:


[vbcol=seagreen]
> You continue to dodge the question. Obviously, you've realized that
> your lies are exposed.


Ooooh, yes! It's just as I recalled!

May I go back to arguing on the kernel list now? I really would like to
tell you all about my problems parsing gnu C extensions, but I have an
urgent appointment with a paper clip.

Peter
P.T. Breuer

2004-09-22, 9:21 pm

Bill Marcum <bmarcum@iglou.com.urgent> wrote:
> On Mon, 20 Sep 2004 11:53:52 GMT, P.T. Breuer <ptb@oboe.it.uc3m.es> wrote:
> If you avoid going to comp.lang.c, you probably only see articles which
> are crossposted to that group, and anything crossposted is almost
> certain to be considered off-topic.


Hypothetically exactly so. Of course, to all intents and purposes, and
a close approximation that a microbe would say !whew! to, I NEVER see
articles posted to that group, crossposted or not.

Peter
Default User

2004-09-22, 9:21 pm

P.T. Breuer wrote:

> May I go back to arguing on the kernel list now? I really would like
> to tell you all about my problems parsing gnu C extensions, but I
> have an urgent appointment with a paper clip.



Be my guest.



Mark McIntyre

2004-09-22, 9:21 pm

On Mon, 20 Sep 2004 22:35:33 GMT, in comp.lang.c , ptb@oboe.it.uc3m.es
(P.T. Breuer) wrote:

>Bill Marcum <bmarcum@iglou.com.urgent> wrote:
>
>Hypothetically exactly so. Of course, to all intents and purposes, and
>a close approximation that a microbe would say !whew! to, I NEVER see
>articles posted to that group, crossposted or not.


It would seem, from the brief exchange I've observed, that you ought to
crawl back under your rock about now, to avoid having your mind polluted
further. Thanks for playing.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Menno Duursma

2004-09-22, 9:21 pm

On Mon, 20 Sep 2004 11:53:52 +0000, P.T. Breuer wrote:

[ Deleted comp.lang.c stuff to avoid needless flamming. ]


[ ... ]
[vbcol=seagreen]
> But if you wanted to, you would read the kernel's syscall
> implementation list in the source code.


But not everything might be baked-in on some box, or a LKM could have
overwritten/disabled them calls?
CMIIW i would think something like:

awk '!/__/{print $2}' /proc/ksyms |less

--
-Menno.

P.T. Breuer

2004-09-22, 9:21 pm

Mark McIntyre <markmcintyre@spamcop.net> wrote:
> On Mon, 20 Sep 2004 22:35:33 GMT, in comp.lang.c , ptb@oboe.it.uc3m.es
> (P.T. Breuer) wrote:


[vbcol=seagreen]
> It would seem, from the brief exchange I've observed, that you ought to
> crawl back under your rock about now, to avoid having your mind polluted
> further. Thanks for playing.


No hay problema - I'm glad to have had my prejudices confirmed! Stay in
the groove, please do!

Peter
Doug Freyburger

2004-09-22, 9:21 pm

markus wrote:
>
> There are more than 1000 defined system calls in the Unix standard
> specification, however, a majority of them are optional and the
> availability of system calls are dependent on the OS implementation
> itself.
>
> The question I have is: How do you determine which system calls are
> available on any Unix/Linux machine?


A good place to start looking is under /usr/include for C files
that give their numbers. I just looked at
/usr/include/sys/syscalls.h on an AIX box I happened to be logged on
to and the map of numbers to names was given there.

> The same question goes for determening available C library functions
> on any Unix/Linux machine?


Too dependent on the system for me to give a good answer. Start
with the man pages, and library binaries under /usr/lib.
Flash Gordon

2004-09-22, 9:21 pm

On 22 Sep 2004 10:47:56 -0700
dfreybur@yahoo.com (Doug Freyburger) wrote:

> markus wrote:


<snip>

>
> Too dependent on the system for me to give a good answer. Start
> with the man pages, and library binaries under /usr/lib.


No it isn't. If it is a conforming hosted C implementation, which I
think you will find the majority of C implementations on Linux & Unix
tend to be (obviously those predating the C standard and some since then
don't) then it supports ALL of the standard C library.

So to determine whether they are all available just check the
documentation to confirm it claims to be a conforming implementation and
if it isn't update to something that is.
--
Flash Gordon
Sometimes I think shooting would be far too good for some people.
Although my email address says spam, it is real and I read it.
Dances With Crows

2004-09-22, 9:21 pm

["Followup-To:" header set to comp.os.linux.misc.]
On Wed, 22 Sep 2004 22:24:54 +0100, Flash Gordon staggered into the
Black Sun and said:
> On 22 Sep 2004 10:47:56 -0700
> dfreybur@yahoo.com (Doug Freyburger) wrote:
> No it isn't. If it is a conforming hosted C implementation, which I
> think you will find the majority of C implementations on Linux & Unix
> tend to be (obviously those predating the C standard and some since
> then don't) then it supports ALL of the standard C library.


The OP's question was a bit vague, but I think he meant, "How can I find
out which library functions with C bindings are available on any
Unix-like OS?", not "How can I find out which standard C library
functions are available?". The stuff in glibc/libc/whatever your
standard C library is called is a relatively small subset of the useful
C functions that are available. But Flash is right; the standard C
library should behave very similarly across different Unix-like OSes.

So, look in /usr/share/man/man3 and /usr/X11R6/man/man3 for starters.
Add other directories depending on your MANPATH. That won't tell you
everything, of course; on a Linux system, GTK+ and Qt functions don't
have man pages. Even some X11 functions don't have man pages--none of
the XTest functions seem to have them, for example. Oh well.

--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong
http://www.brainbench.com / Hire me!
-----------------------------/ http://crow202.dyndns.org/~mhgraham/resume
Fred J. Bourgeois, III

2004-10-02, 9:13 pm

Menno Duursma wrote:
> On Mon, 20 Sep 2004 11:53:52 +0000, P.T. Breuer wrote:
>
> [ Deleted comp.lang.c stuff to avoid needless flamming. ]
>
>
>
> [ ... ]
>
>
>
>
> But not everything might be baked-in on some box, or a LKM could have
> overwritten/disabled them calls?
> CMIIW i would think something like:
>
> awk '!/__/{print $2}' /proc/ksyms |less
>


Not bad ... but here is an even simpler method (linux):
% ksyms | more

-fjb
--
Colorless Green Ideas Sleep Furiously, and so do I....

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com