Re: How to read cmos clock - what is gettimeofday reading?
>To further confuse matters there appears to be a common misconception on the >web >that the cmos time is automatically synced to system time on FreeBSD. This is >incorrect: see msg03414 on freebsd-hardware at freebsd.org. The situation has changed in 8-STABLE and 9-CURRENT since the above message was written. The timekeeping code was changed (by the person who wrote the message that you cited) to periodically (every machdep.rtc_save_period seconds) adjust the value of the rtc if ntp is used to update the system time, machdep.disable_rtc_set=0, and the rtc driver hasn't been disabled: http://svnweb.freebsd.org/viewvc/base?view=revision&revision=207360 http://svnweb.freebsd.org/viewvc/base?view=revision&revision=208297 atrtc_{get,set}time, now in /usr/src/sys/x86/isa/atrtc.c, could serve as a basis for your own code: http://svn.freebsd.org/viewvc/base/head/sys/x86/isa/atrtc.c?view=markup There are of course *_rtc_{get,set}time variants for other architectures as well. b. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: Data truncation on ptys
Hello Michael, * Michael Sperber wrote: > I'm one of the maintainers of XEmacs, and I've been running into a > persistent problem with subprocesses / ptys since at least 5.x. (If this > is not the right list, I'd appreciate a pointer to a more appropriate > forum.) Very quick question. Does this problem still occur on FreeBSD 8.x? FreeBSD 8.x has an entirely new TTY layer, which includes a new pseudo-terminal driver. Greetings, -- Ed Schouten WWW: http://80386.nl/ pgpR8RWIRgJks.pgp Description: PGP signature
Re: Modules and Buses
On Thu, 19 Aug 2010 09:18:46 -0400 John Baldwin wrote: >> On Thursday, August 19, 2010 8:38:05 am Alexandr Rybalko wrote: >> > Hi all, >> > >> > Can someone say, how `make` in sys/modules dir can obtain available buses. >> > I try to make clean version of bfe, that can be for PCI bus or can be part >> of SoC (like BCM5354) on SSB bus. >> > So for proper module building I need to know what bus interface I must >> > build >> if_bfe_pci.c, or if_bfe_siba.c, or both? >> >> You can always include both buses. If a bus driver isn't present in the >> kernel the attachment will just never be invoked. I was afraid of such response. Now I have to rewrite siba implementation to newbus :) Thanks you for answer! >> >> -- >> John Baldwin -- Alexandr Rybalko aka Alex RAY ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Data truncation on ptys
I'm one of the maintainers of XEmacs, and I've been running into a persistent problem with subprocesses / ptys since at least 5.x. (If this is not the right list, I'd appreciate a pointer to a more appropriate forum.) Here's the basic issue: Whenever XEmacs tries to send a larger chunk of data to a subprocess over a pty, only part of the data arrives at the other end of the pty. XEmacs tries very hard to chop up the data into (245-byte) pieces, terminating the pieces with NL or EOF as appropriate. Still, when around 7.5 kilobyte is sent rapidly, I see this pattern: master truss: write(7," 1692 1693 1694 1695 1696 1697 1"...,245) = 245 (0xf5) write(7,"\^D",1) = 1 (0x1) slave/subprocess truss ("cat" in this case): read(0," 1692 1693 1694 1695 1696 1697 1"...,4096) = 144 (0x90) Subsequent writes from the master do not get seen *at all* on the slave, i.e. the next read blocks. If anybody could shed some light on this issue, help would be much appreciated! -- Regards, Mike ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: Modules and Buses
On Thursday, August 19, 2010 8:38:05 am Alexandr Rybalko wrote: > Hi all, > > Can someone say, how `make` in sys/modules dir can obtain available buses. > I try to make clean version of bfe, that can be for PCI bus or can be part of SoC (like BCM5354) on SSB bus. > So for proper module building I need to know what bus interface I must build if_bfe_pci.c, or if_bfe_siba.c, or both? You can always include both buses. If a bus driver isn't present in the kernel the attachment will just never be invoked. -- John Baldwin ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Modules and Buses
Hi all, Can someone say, how `make` in sys/modules dir can obtain available buses. I try to make clean version of bfe, that can be for PCI bus or can be part of SoC (like BCM5354) on SSB bus. So for proper module building I need to know what bus interface I must build if_bfe_pci.c, or if_bfe_siba.c, or both? -- Alexandr Rybalko aka Alex RAY ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: Reading rtc on FreeBSD
On Thu, Aug 19, 2010 at 2:38 PM, Peter Jeremy wrote: > Repeating your question will not encourage an answer. > I realize that - it was inadvertent and sloppy. I assumed the yahoo post hadn't gone through when I posted from gmail. Again I apologize for the bad netiquette. > > On 2010-Aug-19 13:09:46 +0300, phil hefferan wrote: > >I've been looking around for how to read the cmos/rtc on FreeBSD. There is > >no hwclock utility in FreeBSD that I can read sources for to see how it is > >done. > > The RTC is only accessed within the kernel (/sys/isa/atrtc.c for > i386 and amd64) and read in /sys/kern/subr_rtc.c::inittodr() > > Thanks. No equivalent to an ioctl on /dev/rtc/ > > >implies that, on FreeBSD, gettimeofday reads the software time and > >settimeofday sets the cmos clock. I read here > >http://www.mail-archive.com/freebsd-hardw...@freebsd.org/msg03414.htmlthat > >settimeofday in fact sets both rtc and system time together. > > gettimeofday(2) reads the software clock only. > settimeofday(2) writes both the software clock and RTC. > > This might explain why some people assume the RTC is automatically synced to software time. If they change the software time, presumably this is most likely done through settimeofday()? This suggests also that comparing software time and RTC won't be useful for what I want to do (detect if software time has been changed) since settimeofday will have synced these if it has been changed. Is there any other clock that can be read in userspace which does not change immediately if software time is changed? > >BUT the source to adjkerntz.c for FreeBSD seems to say that gettimeofday > >reads the CMOS clock not the system time: > > > >/* get local CMOS clock and possible kernel offset */ > >if (gettimeofday(&tv, &tz)) { > >syslog(LOG_ERR, "gettimeofday: %m"); > >return 1; > >} > > That comment is incorrect. > > Maybe worth a bug report? Also - wondering then if adjkerntz is actually working as advertised. > >Which is it? Does gettimeofday read the cmos clock/rtc on FreeBSD? If not, > >how do I read the battery-backed clock on FreeBSD? > > There is no managed access to the RTC in FreeBSD. Your only option to > read the RTC is to directly access its IO port registers via io(4) or > i386_set_ioperm(2) > > Thanks Peter. -phil ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: Reading rtc on FreeBSD
Repeating your question will not encourage an answer. On 2010-Aug-19 13:09:46 +0300, phil hefferan wrote: >I've been looking around for how to read the cmos/rtc on FreeBSD. There is >no hwclock utility in FreeBSD that I can read sources for to see how it is >done. The RTC is only accessed within the kernel (/sys/isa/atrtc.c for i386 and amd64) and read in /sys/kern/subr_rtc.c::inittodr() >implies that, on FreeBSD, gettimeofday reads the software time and >settimeofday sets the cmos clock. I read here >http://www.mail-archive.com/freebsd-hardw...@freebsd.org/msg03414.html that >settimeofday in fact sets both rtc and system time together. gettimeofday(2) reads the software clock only. settimeofday(2) writes both the software clock and RTC. >BUT the source to adjkerntz.c for FreeBSD seems to say that gettimeofday >reads the CMOS clock not the system time: > >/* get local CMOS clock and possible kernel offset */ >if (gettimeofday(&tv, &tz)) { >syslog(LOG_ERR, "gettimeofday: %m"); >return 1; >} That comment is incorrect. >Which is it? Does gettimeofday read the cmos clock/rtc on FreeBSD? If not, >how do I read the battery-backed clock on FreeBSD? There is no managed access to the RTC in FreeBSD. Your only option to read the RTC is to directly access its IO port registers via io(4) or i386_set_ioperm(2) -- Peter Jeremy pgpi50bk1nXdH.pgp Description: PGP signature
Re: Reading rtc on FreeBSD
My apologies for the multiple posts on this - please ignore the earlier similar post by my alter ego from a yahoo account. What happened: I tried to subscribe from a yahoo account and nothing happened. Meanwhile I posted to the list from the yahoo account. Got a 'waiting moderator approval message' but nothing happened. Got impatient and tried to subscribe from a gmail account - that worked so I posted from there Meanwhile moderator had approved the yahoo message. Oops. Won't happen again. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Reading rtc on FreeBSD
I have C code for Linux that, among other things, caches the difference between the rtc and system time, so that the program can detect if the system time has changed more than a threshold between runs. I want to port this code to FreeBSD/Mac. I'm trying to clarify the relationship between rtc and system time on FreeBSD and how the rtc is read. Linux has the utility hwclock which reads /dev/rtc and anyway getting the cmos clock time directly from this interface can be done in a few lines of code. I've been looking around for how to read the cmos/rtc on FreeBSD. There is no hwclock utility in FreeBSD that I can read sources for to see how it is done. http://www.wraith.sf.ca.us/ntp/not-hwclock.c.txt is supposed to be C code to read the software time and then set the cmos clock to match. This code implies that, on FreeBSD, gettimeofday reads the software time and settimeofday sets the cmos clock. I read here http://www.mail-archive.com/freebsd-hardw...@freebsd.org/msg03414.html that settimeofday in fact sets both rtc and system time together. On Linux both gettimeofday and settimeofday apply to the software time only. BUT the source to adjkerntz.c for FreeBSD seems to say that gettimeofday reads the CMOS clock not the system time: /* get local CMOS clock and possible kernel offset */ if (gettimeofday(&tv, &tz)) { syslog(LOG_ERR, "gettimeofday: %m"); return 1; } Which is it? Does gettimeofday read the cmos clock/rtc on FreeBSD? If not, how do I read the battery-backed clock on FreeBSD? ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"