[comp.sys.sgi] problem with struct user in user.h

psomu@pilot.njin.net (Prabhakar Somu) (02/18/91)

Hi,

	I am trying to recompile a device driver on Irix 3.3.1 (4D70GT)
which used to compile and work just fine on Irix 3.2. I have the 
following problems:

i) One of the modules in the driver uses the user structure
   "u" defined in /usr/include/sys/user.h as : (beginning line 205)

#ifdef _KERNEL
/* comments */
#define u	(*(struct user *)UADDR)
/* comments */
struct user *up;
#endif

The same structure was defined in the 3.2 include file 
/usr/include/sys/user.h similarly except that "_KERNEL"
was "KERNEL" and the actual address was used instead of UADDR.
When I tried to compile this module the C compiler says u 
is undefined:
ccom: Error: ./axioctl.c, line 199: u undefined
      	{ u.u_error = 22	; return(22	); }	
      -----^
Can I can explicitly define u in my source ? Do I have to explicitly
#define _KERNEL ? I didn't have to do either in Irix 3.2 . 

ii) There also seems to be a name clash in the following two files
on Irix 3.3.1

In the file "/usr/include/sys/systm.h" line 34 reads:
extern time_t time;
and in the file "/usr/include/time.h" line 63 reads:
extern time_t time(time_t *);

Is that a bug/Feature ? Were the two files not supposed to be 
used in conjuntion with each other ? Or, am I misunderstanding 
something? 

Any help/suggestions will be greatly appreciated.
Thanks,
/somu	somu@mirage.umdnj.edu
			or
	psomu@pilot.njin.net
-- 
  ()     __   _ _ _   _    __
  /\    / ') ' ) ) ) ' )  /
 /  )  /  /   / / /   /  /
/__/_ (__/   / ' (_  (__/

olson@anchor.esd.sgi.com (Dave Olson) (02/19/91)

In <Feb.17.19.52.27.1991.19030@pilot.njin.net> psomu@pilot.njin.net (Prabhakar Somu) writes:

| Hi,
| 
| 	I am trying to recompile a device driver on Irix 3.3.1 (4D70GT)
| which used to compile and work just fine on Irix 3.2. I have the 
| following problems:
| 
| i) One of the modules in the driver uses the user structure
|    "u" defined in /usr/include/sys/user.h as : (beginning line 205)

| Can I can explicitly define u in my source ? Do I have to explicitly
| #define _KERNEL ? I didn't have to do either in Irix 3.2 . 

Do not redefine u if you expect your driver to keep working, as
it may change in future releases...  You should be defining _KERNEL,
instead of KERNEL.  3.2 had KERNEL in some places, INKERNEL in
others.  To reduce name space pollution, it was changed to _KERNEL.
Given the __ rules for ANSI C, we probably should have made it
__KERNEL, and may in some future release.  This might have made
it into the release notes, I'm not sure.

| ii) There also seems to be a name clash in the following two files
| on Irix 3.3.1
| 
| In the file "/usr/include/sys/systm.h" line 34 reads:
| extern time_t time;
| and in the file "/usr/include/time.h" line 63 reads:
| extern time_t time(time_t *);

No problem here either, once you get your defines right.  systm.h
should be used in the kernel only.  include/sys/time.h only
includes <time.h> if _KERNEL is not defined.
--

	Dave Olson

Life would be so much easier if we could just look at the source code.