the jdk117 for Redhat Alpha/Linux
by Uncle George ( gatgul@voicenet.com, www.voicenet.com/~gatgul/JDK )
November 11, 1998

*** NOTE: I Tried to get the JDK 1.1.7A from the JavaSoft folks, but their
fax machine is not answering. I tried on November 10, 1998.  ;-(


Here is the jdk117 from Sun/Javasoft sources. You need 2 files from
this distribution, and 1 optional file  - 
	1) a class .tgz file, and
	2) a bin .tgz file, and
	3) the demo program .tgz file

There is only one class file, so everyone need that. There are 3
different bin files. YOU ONLY NEED ONE, so pick the one that best
fits the machine you are using. The alpha21064 should support all alpha 
processors that have a 21064 (and better) type processor in them - like the 
axppci33/noname systems. The alpha21064 should also support the newer,
and more modern alpha chips, as all the newer chips are backward
compatable. The alpha21164 supports the next generation
of alpha processors which were the 21164 ( not the 21164a, 21164pc ) 
type processors. I do not know what the difference is, but the size
of the binaries decreased by 5 (compressed) blocks from that of the
21064 processor. The alpha21164a supports the 21164a processor ( and 
I think the 21164PC processor ). It is the processor that supports 
short, and byte stores/load on a machine instruction - ergo should be
faster. It also has a smaller binary footprint. 
The demo file is optional, and is used to demonstrate how java can
be used.

All binaries were produced on:
1) alpha 21164LX computer, that uses the 21164a alpha processor
2) redhat 5.0, with updates to glibc 
	version 2.0.7-19
3) egcs 1.1a, using the compile switch
	-mcpu=21064, -mcpu=21164, and -mcpu21164a
   to build each of the binary versions.



The sum of the files are:

45046  3767 jdk117_alpha_classes_v1.tgz
03448  1368 jdk117_alpha21064_bin_v2.tgz
41359  1362 jdk117_alpha21164_bin_v2.tgz
34192  1332 jdk117_alpha21164a_bin_v2.tgz
26482  1486 jdk117_alpha_demo.tgz



Installation

1)	make a directory of where u would like to place the files
	ie mkdir jdk117
2)	move the binaries, and classes to the jdk117 directory,
	and untar them there. ie tar xvzf jdk117_alpha_classes_v1.tgz 
				 tar xvzf jdk117_alphaxxxxx_bin_v1.tgz
3)	Alter your PATH shell variable to point to that jdk117 directory
	ie export PATH=$PATH:/usr/local/jdk117
4)	If you use the awt then you also have to point to the place
	where libXm.so ( motif libraries ) are stashed.
	ie. export LD_LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib

This should start you off with java,javac,javah,appletviewer. The jre
( i think ) requires a classes.zip file in the jdk117/lib 
directory. You can build the .zip file yourself using pkzip 
( shiped with redhat ) without any compression ( i think its the -0 option )
You should be in the classes directory when you use pkzip to build the
.zip directory.

Motif
	I use lesstif- a free motif lookalike, and built the 
appletviewer/awt against the libXm.so produced by the 
lesstif build. Lesstif can be found at www.lesstif.org . It works
fairly well, but it is still a work in progress - as the folks
at lesstif are trying to reproduce all the functionallity of motif
without the assistance of the organization that supports motif. If
there is a problem with java & lesstif, I will try to fix, or annoy
the lesstif folks into looking more closely at where the problem
is occuring. I have the source for both products, and so it is
easier for me to do this.

	There is also a commercial version of motif available for
the alpha for the sum of $39 from www.metrowerk.com . This is not a
bad price, considering that previous versions have costed at
least $200, and as high as $300. And you have the distinct pleasure
of having supported one of the few vendors that have ported anything
to the alpha processor. I have not tested against this motif. I do
not yet have a copy of this motif to try out. BUT IT SHOULD WORK.


Bugs & boo-boo's

SIGIO
	There has been a long time kernel problem with the presentation
of the SIGIO signal, and a tcp connection. The SIGIO is sent before the
connection is complete, and the ( java ) process has no idea as to which
I/O channel sent the signal. The java thread that is waiting 
never wake up and appears hung to the user/developer. My solution
was to fix the kernel for this problem, and have provided a 
( temporary ) fix to the 2.0.xx kernels.  A permanent solution 
should be in the 2.2.xx series, but I will not know
that for sure until it is released ( which has a real-soon-now feeling )
. The 2.1.xxx series dont provide any 
better solution. see appendix A.
	One should also note that there may be more SIGIO problems,
that are not remidied by this patch.

SHARED MEMORY
	Recently i found that there is an inconsistency between the
kernel ( 2.0.33 + patches ), and that of glibc-2.0.7-19 that would 
cause shm or shared memory problems. You can run the ipcs program 
( as root ), and if the "bytes" field has 0, then you have a problem
kernel. If you run the demo/Moleculeviewer java program, and you 
get a blank window ( ie no view of the molecule ), then it is most
likely you have this problem.
	The remedy is to fix one of the kernel structures, and rebuild
the whole kernel again - ie make clean, make boot. It is fairly a simple
fix, and have been assured by the lib folks, that the items in the
structure should be integers, rather than short integers. See Appendix
B.


BUGS:
	There aren't any - after all this is the final release of the 
java 1.1 series ( just kidding :)))  ). Please post the problems,
scenarios, and or packages that cause the error on the 
java-linux@java.blackdown.org mail list. Or failing that u can mail me at 
gatgul@voicenet.com, but i prefer all posts to be made public, in case
it can be answered easily by someone else.



APPENDIX A
	Insert all the lines that have "ADD THIS LINE" into their 
respective file.

*************** include/net/sock.h *************************************
*********************** approx line 344 ********************************
  /*
   *	Callbacks 
   */
   
	void			(*state_change)(struct sock *sk);
	void			(*data_ready)(struct sock *sk,int bytes);
	void			(*write_space)(struct sock *sk);
	void			(*error_report)(struct sock *sk);
  
	struct sock	*sk_listen;	/* ADD THIS LINE */
};

/*
 *	IP protocol blocks we attach to sockets.
 */

************** net/ipv4/tcp_input.c ********************************
************** Approx line 829      ********************************
	/* Set up the right sequence numbers */
	newsk->write_seq = seq; 
	newsk->window_seq = newsk->write_seq;
	newsk->rcv_ack_seq = newsk->write_seq;
	
	if (sk->state == TCP_LISTEN )		/* ADD THIS LINE */
	   newsk->sk_listen = sk;		/* ADD THIS LINE */
	else 					/* ADD THIS LINE */
	   newsk->sk_listen = (void*)0;		/* ADD THIS LINE */

************** net/ipv4/tcp_input.c ********************************
************** Approx line 1514     ********************************
	/*
	 *	Final ack of a three way shake 
	 */
	 
	if (sk->state==TCP_SYN_RECV)
	{
		tcp_set_state(sk, TCP_ESTABLISHED);
  		if ( sk->sk_listen ) {			/* ADD THIS LINE */
		   sk->data_ready(sk->sk_listen,0);	/* ADD THIS LINE */
		   sk->sk_listen = 0;			/* ADD THIS LINE */
		}					/* ADD THIS LINE */
		/* Must check for peer advertising zero sized window
		 * or else we get a sk->{mtu,mss} of zero and thus bomb out
		 * in tcp_do_sendmsg. -DaveM
		 */
		if(sk->max_window == 0)






APPENDIX B:
In linux/include/linux/ipc.h you have to edit the ipc_perm structure
to remove the "ushort", and replace them with "unsigned int". as an
example it should, but not necessarily look like this segment. Be 
careful, the member seq is still ushort.

typedef int key_t; 		/* should go in <types.h> type for IPC key */
#define IPC_PRIVATE ((key_t) 0)  

#if 0
struct ipc_perm
{
  key_t  key;
  ushort uid;   /* owner euid and egid */
  ushort gid;
  ushort cuid;  /* creator euid and egid */
  ushort cgid;
  ushort mode;  /* access modes see mode flags below */
  ushort seq;   /* sequence number */
};
#else
struct ipc_perm
{
  key_t  key;
  unsigned int uid;		/* owner euid and egid */
  unsigned int gid;
  unsigned int cuid;		/* creator euid and egid */
  unsigned int cgid;
  unsigned int mode;		/* access modes see mode flags below */
  unsigned short int seq;	/* sequence number */
};
#endif


/* resource get request flags */
#define IPC_CREAT  00001000   /* create if key is nonexistent */
