Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

Looking for SFU equivalents for various SUN functions

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> Looking for SFU equivalents for various SUN functions Page: [1]
Login
Message << Older Topic   Newer Topic >>
Looking for SFU equivalents for various SUN functions - Mar. 24, '05, 5:32:45 AM   
Graham_Pursey

 

Posts: 6
Joined: Mar. 23, '05,
Status: offline
I have a number of porting issues where I'm trying to find equivalents in SFU.

1. To get the c drive serial number. On Sun gethostid is used and in dev studio GetVolumeInformation.

2. Get available memory. On Sun /usr/sbin/prtconf | grep Memory

3. Get available swap. On Sun /usr/sbin/swap -s. Does SFU even have a concept of swap (I'm guessing pagefile??). If so what can be used to get to the information?
Post #: 1
RE: Looking for SFU equivalents for various SUN functions - Mar. 24, '05, 7:16:08 AM   
cortez_

 

Posts: 330
Joined: Mar. 27, '04,
From: Poland
Status: offline
the swap and memory sizes can be retrieved only by interfacing to a win32 api (as far as I know) see the postings here: http://www.interopsystems.com/tools/forum/tm.aspx?m=4356&mpage=1&key=&

(in reply to Graham_Pursey)
Post #: 2
RE: Looking for SFU equivalents for various SUN functions - Mar. 24, '05, 7:24:46 AM   
Graham_Pursey

 

Posts: 6
Joined: Mar. 23, '05,
Status: offline
Great thanks. That just leaves the serial number to locate.

(in reply to Graham_Pursey)
Post #: 3
RE: Looking for SFU equivalents for various SUN functions - Mar. 24, '05, 9:34:12 AM   
markfunk

 

Posts: 670
Joined: Mar. 31, '03,
Status: offline
statvfs(2) returns a file system id in f_fsid member.

(in reply to Graham_Pursey)
Post #: 4
RE: Looking for SFU equivalents for various SUN functions - Mar. 24, '05, 12:17:07 PM   
jonsmi

 

Posts: 168
Joined: Aug. 12, '03,
From: Oslo, Norway
Status: offline
quote:

the swap and memory sizes can be retrieved only by interfacing to a Win32 API (as far as I know) see the postings here: http://www.interopsystems.com/tools/forum/tm.aspx?m=4356&mpage=1&key=&

Here you state:

"Is there any tool to report the free and available and total memory for Inter ix? Just the same information that the top.exe displays? Are they available somewhere in Interix or just in Win32?"

This is actually not quite correct. top.exe is of course in many matters
an Win32 image, but of a special kind. It needs access to the kernel.
The kernel has a mostly undocumented interface and calls, exported by
ntdll.dll. Apps using soley this interface, are called native apps.

For a further discussion, consult "Inside the Native API" by Mark Russinovich.
That's how micro-kernel systems, supporting different OSs, often work (Mach
for instance).

top.exe acquires its basic information from the native API.
Take a look at the file with "C:\Program Files\Microsoft SDK\Bin\Depends.Exe",
also known as "Dependency Walker".

If you have a newer version of MSDN Library, you can look up the functions.

One -- of many -- is NtQuerySystemInformation, supplying a lot of information,
among them SystemProcessInformation. Here the MSDN Help Library states:

quote:

Returns an array of SYSTEM_PROCESS_INFORMATION structures, one for each process running in the system.

These structures contain information about the resource usage of each process, including the number of handles used by the process, the peak page-file usage, and the number of memory pages that the process has allocated


top.exe resides in /common or C:\SFU\common -- either way you see it.
There's even a man page for top.exe. It can be invoked by just "top"
(is in the Interix path).

Just start it from the glass, rxvt or through ssh to another machine.

For clarity: top.exe uses the Win32 API to run, but _not_ to retrieve its
information. ntdll.dll provides the window into the kernel with its managers:
memory, cache, processes etc.

(in reply to cortez_)
Post #: 5
RE: Looking for SFU equivalents for various SUN functions - Mar. 24, '05, 12:30:23 PM   
jonsmi

 

Posts: 168
Joined: Aug. 12, '03,
From: Oslo, Norway
Status: offline
quote:

2. Get available memory. On Sun /usr/sbin/prtconf | grep Memory

$ top | grep Mem
Mem:   1310188K av,  599268K used,  710920K free
Mem:   1310188K av,  599300K used,  710888K free
Mem:   1310188K av,  599324K used,  710864K free
^C
$ top | grep Swap
Swap:  4194303K av,       0K used,  4194303K free  105740K  cached
Swap:  4194303K av,       0K used,  4194303K free  105756K  cached
Swap:  4194303K av,       0K used,  4194303K free  105756K  cached
^C
$

Would this solve at least this issue?

(in reply to Graham_Pursey)
Post #: 6
RE: Looking for SFU equivalents for various SUN functions - Mar. 24, '05, 12:46:21 PM   
jonsmi

 

Posts: 168
Joined: Aug. 12, '03,
From: Oslo, Norway
Status: offline
Missing link to Inside the Native API" by Mark Russinovich:
http://www.sysinternals.com/ntw2k/info/ntdll.shtml

quote:

3. Get available swap. On Sun /usr/sbin/swap -s. Does SFU even have a concept of swap (I'm guessing pagefile??). If so what can be used to get to the information?


It's pagefile.sys, unfortunately not a raw partition. Question should have
been handled by: top | grep Swap.

Sorry, dogs, cats, babies, wifes, aging mothers and so on.

(in reply to jonsmi)
Post #: 7
RE: Looking for SFU equivalents for various SUN functions - Mar. 24, '05, 11:48:26 PM   
jonsmi

 

Posts: 168
Joined: Aug. 12, '03,
From: Oslo, Norway
Status: offline
quote:

I have a number of porting issues where I'm trying to find equivalents in SFU.

1. To get the c drive serial number. On Sun gethostid is used and in dev studio GetVolumeInformation


Guess you don't want to retrieve the real hard drive serial number
(wouldn't make sense anyhow on RAID controllers).

So whats left is _not_ to obtain the Hardware Serial Number set by the
manufacturer, but the Volume Serial Number that changes after you format
a hard drive.

Since the days of DOS 4.0 the vol command has been around for this purpose,
now with NT a Win32 console (contained in cmd.exe). There's as well a script
in /usr/contrib/win32/bin/vol.

Example (local on XP and remote on Win 2003):
Welcome to the Interix UNIX utilities.

DISPLAY=localhost:0.0
$ vol
 Volume in drive C is WinXP
 Volume Serial Number is 64B2-C06F
$ ssh -l administrator dc-1.smith.local
administrator@dc-1.smith.local's password:
Welcome to the Interix UNIX utilities.

DISPLAY=localhost:0.0
$ vol
 Volume in drive C is DC-1
 Volume Serial Number is F0FA-AF4C
$ vol d:
 Volume in drive D is Data
 Volume Serial Number is D4C0-1792


Hope this helps.

(in reply to Graham_Pursey)
Post #: 8
RE: Looking for SFU equivalents for various SUN functions - Mar. 25, '05, 12:49:07 AM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
As Mark already pointed out, the volume's serial number is returned by statvfs().

(in reply to jonsmi)
Post #: 9
RE: Looking for SFU equivalents for various SUN functions - Mar. 25, '05, 3:23:09 AM   
cortez_

 

Posts: 330
Joined: Mar. 27, '04,
From: Poland
Status: offline
jonsmi, have you tried to use top.exe over ssh? If not have a try, makes a nice mess over the screen. That's not the solution.

(in reply to Rodney)
Post #: 10
RE: Looking for SFU equivalents for various SUN functions - Mar. 25, '05, 7:04:26 AM   
jonsmi

 

Posts: 168
Joined: Aug. 12, '03,
From: Oslo, Norway
Status: offline
quote:

jonsmi, have you tried to use top.exe over ssh? If not have a try, makes a nice mess over the screen. That's not the solution.

I see no problem here, whatsoever, no garbled screen. Am running top
locally on the glass monitor, right now, and three remote connections
through Brian's rxvt 2.6.4 (one to SuSE Pro 9.2, the rest to my two DCs).
Have done so now for an hour or so, while trying to wake up (night belongs
to lovers, I mean programmers ...).

This said, I prefer the Linux top utility, a lot more options, color support,
the main top line always staying on top. But the Win32/native top.exe
works fine (still a native Interix port would not be out off the way).

BTW, I was surprised to see how it works (native API), not through
HKEY_PERFORMANCE_DATA (which is the usual window into the kernel, just
as the virtual directory /proc on Linux).

Used it a lot more before for monitoring a server running SQL Server and
Exchange (not quite optimal), now separated on two servers. My former ISA
server also has sever memory constraints (nice way to find out, when a
restart of services or reboot was needed.

While we're at it, systeminfo works fine as well from within Interix. A path
needs to be established to framedyn.dll (C:\WINDOWS\system32\wbem).
Have this on all machines: C:\SFU\usr\contrib\win32\bin\systeminfo,
with a lot of the new command line utilities in Win 2003 for remote
admin, still through ssh and Interix.

(in reply to cortez_)
Post #: 11
RE: Looking for SFU equivalents for various SUN functions - Mar. 25, '05, 7:16:01 AM   
jonsmi

 

Posts: 168
Joined: Aug. 12, '03,
From: Oslo, Norway
Status: offline
quote:

Have this on all machines: C:\SFU\usr\contrib\win32\bin\systeminfo

More coffee needed: Should have been: /usr/contrib/win32/bin\systeminfo.

systeminfo is a shell script exporting the path C:\WINDOWS\system32\wbem:
_WBEM=$(ntpath2posix -c "C:\WINDOWS\system32\wbem")

Later:
export PATH="$PATH:${_SYS32}:${_WBEM}"

and adding the command:
__CMDNAME=systeminfo


This gives a marvelous integration with Interix -- Win32 commands invoked
.exe extension, seems almost as UNIX commands!

(in reply to jonsmi)
Post #: 12
RE: Looking for SFU equivalents for various SUN functions - Mar. 25, '05, 7:22:41 AM   
jonsmi

 

Posts: 168
Joined: Aug. 12, '03,
From: Oslo, Norway
Status: offline
... /usr/contrib/win32/bin/systeminfo
... Win32 commands invoked WITHOUT .exe extension,
seems almost as UNIX commands!

"Diem perdidi", so far, as Emperor Titus would have put it.

(in reply to jonsmi)
Post #: 13
RE: Looking for SFU equivalents for various SUN functions - Mar. 25, '05, 8:13:44 AM   
cortez_

 

Posts: 330
Joined: Mar. 27, '04,
From: Poland
Status: offline
coming back to top.exe please describe more precisely how did you run win32 top.exe through a remote connection from a remote non_win32 machine to a win32 maqchune through SSH and where there is the place for Brian's RXVT (on which side) which SSH are you using.

I've been trying to use top.exe over ssh for some time but it messed up with screen refreshing, so I gave up. That's why I'm asking

(in reply to jonsmi)
Post #: 14
RE: Looking for SFU equivalents for various SUN functions - Mar. 25, '05, 8:56:12 AM   
jonsmi

 

Posts: 168
Joined: Aug. 12, '03,
From: Oslo, Norway
Status: offline
quote:

coming back to top.exe please describe more precisely how did you run win32 top.exe through a remote connection from a remote non_win32 machine to a win32 machine through SSH and where there is the place for Brian's RXVT (on which side) which SSH are you using.

Just in short (my folks are calling, Easter time -- details later):

Every ssh connection is running from an XP Pro/SP2 portable.
Installed everything from the Interix Tools 1.7 and upgraded any
missing/new utilities/apps and versions to the latest available on
this Interop site.

ssh connection established first:
ssh -l administrator (on Linux user name) <machine name>
Then give the command top.

For many remote tasks a fully working DNS implementation is required,
including PTR records (hosts might also work).

Brian's rxvt is the default from the Interix Tools 1.7, and
he has later pointed out some problems with my rxvt implementation.

Believe me: It works like a charm.

(in reply to cortez_)
Post #: 15
RE: Looking for SFU equivalents for various SUN functions - Mar. 26, '05, 11:07:39 AM   
cortez_

 

Posts: 330
Joined: Mar. 27, '04,
From: Poland
Status: offline
Do I take it correctly that you are making an ssh connection from a wniXP+Interix machine o a remote machine with "one to SuSE Pro 9.2, the rest to my two DCs"? Are you running top.exe locally? Youre using the 'top' from the remote machines.

I've been talking about such a case: sit in front of your SUSE machne, connect via ssh to the WINXP+INTERIX one, and run top.exe - what can you see on the terminal screen?

(in reply to jonsmi)
Post #: 16
RE: Looking for SFU equivalents for various SUN functions - Mar. 27, '05, 6:36:48 AM   
jonsmi

 

Posts: 168
Joined: Aug. 12, '03,
From: Oslo, Norway
Status: offline
quote:

Do I take it correctly that you are making an ssh connection from a WinXP+Interix machine o a remote machine with "one to SuSE Pro 9.2, the rest to my two DCs"?

That is right. The connection is established first.
quote:

Are you running top.exe locally? You're using the 'top' from the remote machines.

Yes, top is launched from and running on SuSE, the two DCs here. However, the
output is displayed on an XP Pro machine, either on rxvt or the glass monitor.
quote:

I've been talking about such a case: sit in front of your SUSE machine, connect via ssh to the WINXP+INTERIX one, and run top.exe - what can you see on the terminal screen?

The same result. Works marvelously. Just established an XDMCP connection to the SuSE
box, established a ssh connection to a Win 2003 server with Interix (and all updates).

To be completely clear: the client (for instance top.exe) is running locally on
each machine, the X server or just the console displays this on the machine I'm
working on (be it Linux or Windows/Interix).

There are _no_ problems whatsoever. Why should there be any?
I so as well with Emacs (as the Interix Emacs is crippled). I also do a
lot of Windows administration with Win32 commands (there are a lot of new
ones with Win 2003 (requires that the /usr/contrib/win32/bin/<files> are
in place).

This is done either from Interix or from SuSE. (Last resort is of course RDP.)

(in reply to cortez_)
Post #: 17
Page:   [1]
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> Looking for SFU equivalents for various SUN functions Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.078