FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 07-01-2010, 01:49 PM
fred smith
 
Default more on identifying the system a program is running on...

I asked recently about using /etc/redhat-release and got some useful answers.
My thanks to all who replied.

Now a slight variant:

Can anyone suggest some resource that a PROGRAM (compiled C program) can
examine while running to find out what platform it is runninng on ?

Things that come to mind include:
1. output of uname to see if the kernel version contains "elX" where X
is a digit, such as el4, el5, etc., identifying RHEL-4, RHEL-5, etc.
2. do the same thing by exmining the filename of the kernel (if I knew
how to find the file for the currently running kernel, that is.

can anyone suggest any other checks I could do?

Thanks again!

--
---- Fred Smith -- fredex@fcshome.stoneham.ma.us -----------------------------
The Lord detests the way of the wicked
but he loves those who pursue righteousness.
----------------------------- Proverbs 15:9 (niv) -----------------------------
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 07-01-2010, 01:55 PM
Frank Murphy
 
Default more on identifying the system a program is running on...

On 01/07/10 14:49, fred smith wrote:
>
> Can anyone suggest some resource that a PROGRAM (compiled C program) can
> examine while running to find out what platform it is runninng on ?
>

cd /proc | cat version

--
Regards,

Frank Murphy
UTF_8 Encoded
Friend of Fedora
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 07-01-2010, 01:58 PM
Bruno Wolff III
 
Default more on identifying the system a program is running on...

On Thu, Jul 01, 2010 at 09:49:49 -0400,
fred smith <fredex@fcshome.stoneham.ma.us> wrote:
>
> Can anyone suggest some resource that a PROGRAM (compiled C program) can
> examine while running to find out what platform it is runninng on ?

You could look at the source for uname and see what it does.

> can anyone suggest any other checks I could do?

What are you really trying to do? Normally you want to check to see if some
feature is supported or an ABI versiob, not really a program version.
Sometimes a program version makes a good proxy for those. It's hard to suggest
something without knowing your higher level goal.
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 07-01-2010, 02:14 PM
Jerry Feldman
 
Default more on identifying the system a program is running on...

On 07/01/2010 09:49 AM, fred smith wrote:
> I asked recently about using /etc/redhat-release and got some useful answers.
> My thanks to all who replied.
>
> Now a slight variant:
>
> Can anyone suggest some resource that a PROGRAM (compiled C program) can
> examine while running to find out what platform it is runninng on ?
>
> Things that come to mind include:
> 1. output of uname to see if the kernel version contains "elX" where X
> is a digit, such as el4, el5, etc., identifying RHEL-4, RHEL-5, etc.
> 2. do the same thing by exmining the filename of the kernel (if I knew
> how to find the file for the currently running kernel, that is.
>
>
>

(1) There is a uname(2) system call that any C or C++ program can call
that has all the information that the uname(1) command provides. Do a
'man 2 uname' for details.

(2) I'm not exactly sure how to get at the physical kernel file without
first doing a uname, then matching that information with
/boot/vmlinux-xxxx. /proc/versions can tell you more information, but
not exactly the file name.



--
Jerry Feldman <gaf@blu.org>
Boston Linux and Unix
PGP key id: 537C5846
PGP Key fingerprint: 3D1B 8377 A3C0 A5F2 ECBB CA3B 4607 4319 537C 5846


--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 07-01-2010, 02:21 PM
Patrick O'Callaghan
 
Default more on identifying the system a program is running on...

On Thu, 2010-07-01 at 14:55 +0100, Frank Murphy wrote:
> On 01/07/10 14:49, fred smith wrote:
> >
> > Can anyone suggest some resource that a PROGRAM (compiled C program) can
> > examine while running to find out what platform it is runninng on ?
> >
>
> cd /proc | cat version

Huh?

poc

--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 07-01-2010, 03:56 PM
JD
 
Default more on identifying the system a program is running on...

On 07/01/2010 06:55 AM, Frank Murphy wrote:
> cd /proc | cat version
$ cd /proc | cat version
cat: version: No such file or directory
$ ls /proc/version
/proc/version
$ cat /proc/version
Linux version 2.6.34-git16.fc13.i686 (jd@localhost.localdomain) (gcc
version 4.4.4 20100503 (Red Hat 4.4.4-2) (GCC) ) #3 PREEMPT Sun May 30
21:17:11 PDT 2010

--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 07-01-2010, 04:02 PM
Frank Murphy
 
Default more on identifying the system a program is running on...

On 01/07/10 16:56, JD wrote:
> On 07/01/2010 06:55 AM, Frank Murphy wrote:
>> cd /proc | cat version
> $ cd /proc | cat version
> cat: version: No such file or directory
> $ ls /proc/version
> /proc/version
> $ cat /proc/version
> Linux version 2.6.34-git16.fc13.i686 (jd@localhost.localdomain) (gcc
> version 4.4.4 20100503 (Red Hat 4.4.4-2) (GCC) ) #3 PREEMPT Sun May 30
> 21:17:11 PDT 2010
>
My mistake:
$ cd /proc |cat version
Linux version 2.6.33.5-124.fc13.i686.PAE
(mockbuild@x86-11.phx2.fedoraproject.org) (gcc version 4.4.4 20100503
(Red Hat 4.4.4-2) (GCC) ) #1 SMP Fri Jun 11 09:42:24 UTC 2010

--
Regards,

Frank Murphy
UTF_8 Encoded
Friend of Fedora
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 07-01-2010, 05:07 PM
Patrick O'Callaghan
 
Default more on identifying the system a program is running on...

On Thu, 2010-07-01 at 17:02 +0100, Frank Murphy wrote:
> My mistake:
> $ cd /proc |cat version

Or just 'cat proc/version'

poc

--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 07-01-2010, 05:20 PM
g
 
Default more on identifying the system a program is running on...

Patrick O'Callaghan wrote:
> On Thu, 2010-07-01 at 17:02 +0100, Frank Murphy wrote:
>> My mistake:
>> $ cd /proc |cat version
>
> Or just 'cat proc/version'

better yet 'cat /proc/version'.


--

peace out.

tc,hago.

g
.

****
in a free world without fences, who needs gates.
**
help microsoft stamp out piracy - give linux to a friend today.
**
to mess up a linux box, you need to work at it.
to mess up an ms windows box, you just need to *look* at it.
**
learn linux:
'Rute User's Tutorial and Exposition' http://rute.2038bug.com/index.html
'The Linux Documentation Project' http://www.tldp.org/
'LDP HOWTO-index' http://www.tldp.org/HOWTO/HOWTO-INDEX/index.html
'HowtoForge' http://howtoforge.com/
****

--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 07-01-2010, 05:32 PM
Patrick O'Callaghan
 
Default more on identifying the system a program is running on...

On Thu, 2010-07-01 at 17:20 +0000, g wrote:
> Patrick O'Callaghan wrote:
> > On Thu, 2010-07-01 at 17:02 +0100, Frank Murphy wrote:
> >> My mistake:
> >> $ cd /proc |cat version
> >
> > Or just 'cat proc/version'
>
> better yet 'cat /proc/version'.

Of course.

poc

--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 

Thread Tools




All times are GMT. The time now is 10:33 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org