Xref: utzoo unix-pc.general:1708 comp.sys.att:4791 Path: utzoo!utgpu!watmath!uunet!xanth!mcnc!rutgers!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!shamash!halcdc!cctb!randy From: randy@cctb.mn.org (Randy Orrison) Newsgroups: unix-pc.general,comp.sys.att Subject: Re: syslocal(2) on 3b1 sick? Keywords: real time clock, perror(2) Message-ID: <142@cctb.mn.org> Date: 23 Nov 88 14:41:15 GMT References: <130@zebra.UUCP> Reply-To: randy@cctb.UUCP (Randy Orrison) Organization: Chemical Computer Thinking Battery, St. Paul, MN Lines: 31 In article <130@zebra.UUCP> vern@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@cctb.mn.org (aka randy@{umn-cs.uucp, ux.acss.umn.edu, umnacvx.bitnet, halcdc.uucp})