syslocal(2) on 3b1 sick?

Randy Orrison randy at cctb.mn.org
Thu Nov 24 00:41:15 AEST 1988


In article <130 at zebra.UUCP> vern at zebra.UUCP (Vernon C. Hoxie) writes:
|	I'm trying to write a program to reset the clock on the 3b1.
|First, I want to be able to read the clock to see if things work. 
|This has to be done in the quickest time possible, so I am trying the
|syslocal(2) call special to the 3b1.  It has the form:
|		int syslocal(cmd, [, arg]
|From the manual (ugh) and the syslocal.h file, I get the command to be
|"SYSL_RDRTC" and the argument to be of struct rtc *x_rtc.  Now:
|		int x = syslocal(SYSL_RDRTC, x_rtc);
|gives x = -1.  So I added perror("Error id"); as the next instruction
|and got a "Bad address" response.
|	How does a system function provide a bad address. [?]

It's not giving you a bad address - it's complaining that YOU've given
IT a bad address.  You're giving it a pointer to nothing, and it wants
to store the information there.  You have to actually allocate a 'struct
rtc' for it to place the time into, and then give the address of that to
the syslocal call:

	struct rtc	x_rtc;
	int		err;

	err = syslocal (SYSL_RDRTC, &x_rtc);

should do what you want.

	-randy

-- 
Randy Orrison - Chemical Computer Thinking Battery - randy at cctb.mn.org
(aka randy@{umn-cs.uucp, ux.acss.umn.edu, umnacvx.bitnet, halcdc.uucp})



More information about the Comp.sys.att mailing list