[TUHS] Introduction

Oliver Lehmann lehmann at ans-netz.de
Wed Jul 2 04:35:41 AEST 2008


Jose R. Valverde wrote:

> 	u.u_dirp.l = (caddr_t) ((long) (((saddr_t) (uap->linkname).l) & 0x7F00FFFF);

I've added a missing ) behind .l:

 	u.u_dirp.l = (caddr_t) ((long) (((saddr_t) (uap->linkname).l)) &
0x7F00FFFF);

And I've got:

"sys2.c":305: warning: struct/union or struct/union pointer required
"sys2.c":305: operands of CAST have incompatible types

> 	saddr_t aux;
> 
> 	aux.l = (caddr_t) uap->linkname;
> 	u.u_dirp.l = (caddr_t) ((long) aux.l & 0x7F00FFFF);

ldl	rr2,rr8(#4)
ldl	|_stkseg+~L1|(fp),rr2
and	r2,#32512
ldl	_u+78,rr2

> they actually had the original code
> 
> 	register struct a {
> 		char	*target;
> 		saddr_t	*linkname;
> 	} *uap;
> 	...
> 	u.u_dirp.l = (caddr_t)(((long)uap->linkname.l & 0x7F00FFFF);

Hm - my man page states, that link() needs a char * as 2nd parameter, but
I've tested it:

"sys2.c":305: operands of "&" have incompatible types
"sys2.c":305: illegal combination of pointer and integer
"sys2.c":305: syntax error

I also tried 

u.u_dirp.l = (caddr_t)(((long)((uap->linkname).l) & 0x7F00FFFF);

-- 
 Oliver Lehmann
  http://www.pofo.de/
  http://wishlist.ans-netz.de/



More information about the TUHS mailing list