[comp.unix.i386] a bug in u386mon & what is sys3b

src@scuzzy.uucp (Heiko Blume) (07/17/90)

this is under interactive 2.0.2:
i have discovered sort of a bug in the recently posted u386mon program
(version 1.2). if you have more than one device 'in' /dev/swap, then you'll
get funny numbers in the 'swap free' percentage, i.e. -278%. this is caused
by the kernel variable nswap. it is initialized after the root partition is
mounted to the *then* available swap space. however if there is more swap
space added later (with /etc/swap) nswap will *not* be updated. the funny part
is that the swap free variable (don't know it's name now) *does* contain the
correct data. so you get 5MB total swap space an 19MB free swap space, which
of course yields the funny percentage.
now for the weird part. i grep'ed around and found <sys/swap.h> which says:


/*	The following struct is used by the sys3b system call.
                                            ^^^^^^^^^^^^^^^^^
 *	If the first argument to the sys3b system call is 3,
 *	then the call pertains to the swap file.  In this case,
 *	the second argument is a pointer to a structure of the
 *	following format which contains the parameters for the
 *	operation to be performed.
 */
[........]

huh?! what system call ? of course that call isn't in any manuals i have
and, needless to say, of course i wrote a little program saying
sys3b(3,&swapinfo), which gave me 'unresolved external' on linking.
it's also isn't in any library. well, i could lseek in the kernel
to find the table where the info for all the swap files is (swaptab[MSFILES])
but i'd prefer a clean way of course. also i can't image /etc/swap to munge
around in the kernel to add swap space (it's much too fast for that, and that
would be *dirty* as it could be).

in this context i'd like to know: how can i find which system calls a given
kernel has ???
-- 
Heiko Blume c/o Diakite   blume@scuzzy.mbx.sub.org    FAX   (+49 30) 882 50 65
Kottbusser Damm 28        blume@netmbx.UUCP           VOICE (+49 30) 691 88 93
D-1000 Berlin 61          blume@netmbx.de             TELEX 184174 intro d
                    "Have you bugged your source today?"

jag@aix.aix.kingston.ibm.com (Jay Goldberg) (07/20/90)

In article <1990Jul16.231429.1592@scuzzy.uucp> src@scuzzy.uucp (Heiko Blume) writes:
>now for the weird part. i grep'ed around and found <sys/swap.h> which says:
[...]
>/*	The following struct is used by the sys3b system call.
[...]
>huh?! what system call ? of course that call isn't in any manuals i have
>and, needless to say, of course i wrote a little program saying
>sys3b(3,&swapinfo), which gave me 'unresolved external' on linking.

sys3b(2) is a system call specific to 3b architecture.  It allows you
to do interesting things to the 3b such as make the green LED flash,
determine the CPU ID, etc etc.

I run a flavor of 386 UN*X that has has archived in libc.a a function
named sysi86() that is a similar interface to the Intel xxx86 line.
Check your docs; they (hopefully) tell you what you can make this call do.

To find out the functions that are included in a given kernel, you can do 
some of the following:

	ar -t libc.a (table of contents of what files are archived in libc)
	nm libc.a (namelist of symbols defined in libc)
	nm /unix (namelist of symbols defined in /unix)

Hope this helps!

	TTFN,

		jag
------
Jay A. Goldberg 	| Email inside IBM:    KGNAIX(JAG)
Software Contractor	|		or     jag@aix.aix.kingston.ibm.com
Resource One Inc. 	| Email outside IBM:   uunet!ibmsupt!jag
Phone: (914) 336 7207	| Phone: (914) 385 3384 or 8+695 3384
		**	Who is John Galt?	**
 > The opinions expressed above are those of the employee, not the Company <

jrh@mustang.dell.com (James Howard) (07/21/90)

In article <1990Jul16.231429.1592@scuzzy.uucp>, src@scuzzy.uucp (Heiko
Blume) writes:

[ u386mon bug description deleted ]

 > now for the weird part. i grep'ed around and found <sys/swap.h> which says:
 > 
 > 
 > /*	The following struct is used by the sys3b system call.
 >                                             ^^^^^^^^^^^^^^^^^
 >  *	If the first argument to the sys3b system call is 3,
 >  *	then the call pertains to the swap file.  In this case,
 >  *	the second argument is a pointer to a structure of the
 >  *	following format which contains the parameters for the
 >  *	operation to be performed.
 >  */
 > [........]
 > 
 > huh?! what system call ? of course that call isn't in any manuals i have
 > and, needless to say, of course i wrote a little program saying
 > sys3b(3,&swapinfo), which gave me 'unresolved external' on linking.
 > it's also isn't in any library. well, i could lseek in the kernel
 > to find the table where the info for all the swap files is
(swaptab[MSFILES])
 > but i'd prefer a clean way of course. also i can't image /etc/swap to munge
 > around in the kernel to add swap space (it's much too fast for that,
and that
 > would be *dirty* as it could be).

Well it looks like ISC forgot to edit the machine specific stuff in 
<sys/swap.h>.  The sys3b(2) call is for AT&T 3B series computers.  It is 
a machine specific call, there is an analogous sysi86(2) call under ISC.  
Look up the sysi86 call instead, and you will see how the structure 
declaration immediately following the text quoted above correlates with 
the man page information.  The parameters are slightly different, but ISC 
has a way to get to the swap areas also.  Look in the header <sys/sysi86.h>
for more info.



James Howard        Dell Computer Corp.        !'s:uunet!dell!mustang!jrh
(512) 343-3480      9505 Arboretum Blvd        @'s:jrh@mustang.dell.com
                    Austin, TX 78759-7299   

guy@auspex.auspex.com (Guy Harris) (07/22/90)

>>sys3b(3,&swapinfo), which gave me 'unresolved external' on linking.
>
>sys3b(2) is a system call specific to 3b architecture.  It allows you
>to do interesting things to the 3b such as make the green LED flash,
>determine the CPU ID, etc etc.

Unfortunately, somebody at AT&T got confused and put some calls *not*
specific to the 3B architecture into "sys3b()", like the calls to
manipulate swapping areas.  They may have moved them into some more
sensible (i.e., machine-independent) place in S5R4.

beser@tron.UUCP (Eric Beser) (07/22/90)

I was unable to get the version of u386mon from the net to compile
under ESIX. It seems that there is a panel.h file not in the
include library. I have no idea what this is, or what this does,
and no other routines with similar functions appear. Can
someone please clarify what this file does? What similar library
on ESIX (TAM????) does the same things. This looks like an
interface to the forms library. If it is, I think I have it
not installed somewhere?

Advice please ?

Eric Beser         beser@tron.bwi.wec.com
(301)-765-1010

"Captain I think we can do it!"
"Make it so, number one!"

john@jwt.UUCP (John Temples) (07/23/90)

In article <618@tron.UUCP> beser@tron.UUCP (Eric Beser) writes:
>
>I was unable to get the version of u386mon from the net to compile
>under ESIX. It seems that there is a panel.h file not in the
>include library.

I "borrowed" a copy of panel.h from a neighbor running SCO UNIX and installed
it on my ESIX rev. D system.  u386mon compiled and ran without a hitch.
Interestingly, libpanel.a is present on ESIX, but the include file is not.
-- 
John W. Temples -- john@jwt.UUCP (uunet!jwt!john)