[comp.unix.internals] The definition/size of click anyone?

rom@mvsun.ericsson.se (Robert Malmgren TK/DG) (09/18/90)

I use a Sun 3/80 running SunOS 4.1 and need to know the size/definition
of a "click" for a program I'm working on.

In the process structure the definition of p_tsize et. al is specified in 
clicks, and I cannot find any definition of a click:

size_t  p_tsize;        /* size of text (clicks) */

I have grep:ed the header-files, rtfm, searched the SunOS docs global index,
looked in "The Design and Implementation of the 4.3 BSD..." with no success.
The only reference to click I've found is in Tanenbaum's "Operating systems.."
and the definition he uses (1 click == 16 bytes) do not seem to fit into the
one used in SunOS, since the results of my program are way out of order.

Can someone please enlighten me?
Robert Malmgren    ! Phone: +46 8 7197937 ! Internet: RoM@Miranda.ericsson.se
MV/ETX/TK/DG       ! Fax  : +46 8 7196443 ! SUNET   : MINDA::ROBERT
Ericsson Telecom   ! Home : +46 8 933733  ! UUCP: ..uunet!mvsun.ericsson.se!rom
S-126 25 STOCKHOLM ! "Virgins and parachuters can never undo their mistakes"

bzs@world.std.com (Barry Shein) (09/18/90)

From: rom@mvsun.ericsson.se (Robert Malmgren TK/DG)
>I use a Sun 3/80 running SunOS 4.1 and need to know the size/definition
>of a "click" for a program I'm working on.

The following is from <machine/param.h>:

	/* Clicks (MMU PAGES) to bytes, and back (with rounding) */
	#define ctob(x)         mmu_ptob(x)
	#define btoc(x)         mmu_btopr(x)

tracing back those defs we find...

 /*
  * MMU pages to bytes, and back (with and without rounding)
  */
 #define mmu_ptob(x)     ((x) << MMU_PAGESHIFT)
 #define mmu_btopr(x)    ((((unsigned)(x) + MMU_PAGEOFFSET) >> MMU_PAGESHIFT))

And tracing that back we find...

 #define MMU_PAGESIZE    0x2000          /* 8192 bytes */
 #define MMU_PAGESHIFT   13              /* log2(MMU_PAGESIZE) */
 #define MMU_PAGEOFFSET  (MMU_PAGESIZE-1)/* Mask of address bits in page */

So, in this case a "click" is 8192 (0x2000) bytes.

On a Vax it's 512 bytes (on 4.3 that's in <machine/machparam.h>).

Obviously, this is machine dependant, but look in <machine/param.h>
and don't give up so easily :-)

I suppose a definition would be: The pagesize in bytes defined by a
single MMU slot (hardware dependent.)
-- 
        -Barry Shein

Software Tool & Die    | {xylogics,uunet}!world!bzs | bzs@world.std.com
Purveyors to the Trade | Voice: 617-739-0202        | Login: 617-739-WRLD

md (Michael Davidson) (09/19/90)

rom@mvsun.ericsson.se (Robert Malmgren TK/DG) writes:


>I use a Sun 3/80 running SunOS 4.1 and need to know the size/definition
>of a "click" for a program I'm working on.
>In the process structure the definition of p_tsize et. al is specified in 
>clicks, and I cannot find any definition of a click:

>size_t  p_tsize;        /* size of text (clicks) */

The size of a "click" is machine dependent - depends on the MMU.
On a PDP-11 it was 64 bytes, on an 80386 it is 4k ....

There should be conversion macros for "bytes-to-clicks" - btoc()
and "clicks-to-bytes" ctob() around somewhere - try sys/sysmacros.h ...

(btw does anyone know *why* the term "click" was used? Did this
terminology come from Multics originally? I know that it does
*not* appear to be DEC PDP-11 terminology ..... Please only reply
if you actually *know* the answer to this!)