From c4ad3f73033c7e0511c3e7df961e1232cc503478 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 26 Feb 2014 12:32:06 +0100 Subject: IRC. --- .../mach/gnumach/interface/device/time.mdwn | 88 +++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) (limited to 'microkernel/mach/gnumach/interface/device') diff --git a/microkernel/mach/gnumach/interface/device/time.mdwn b/microkernel/mach/gnumach/interface/device/time.mdwn index d1e9a488..18681f21 100644 --- a/microkernel/mach/gnumach/interface/device/time.mdwn +++ b/microkernel/mach/gnumach/interface/device/time.mdwn @@ -1,4 +1,4 @@ -[[!meta copyright="Copyright © 2013 Free Software Foundation, Inc."]] +[[!meta copyright="Copyright © 2013, 2014 Free Software Foundation, Inc."]] [[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable id="license" text="Permission is granted to copy, distribute and/or modify this @@ -16,3 +16,89 @@ Typically available as `/dev/time`, [[hurd/translator/storeio]]. Using that, [[hurd/libshouldbeinlibc]]'s `` provides `maptime_map` and `maptime_read`, see the [[hurd/reference_manual]]. Candidate for replacement with [[open_issues/vDSO]] code? + + +# IRC, freenode, #hurd, 2013-11-20 + + braunr: about the mach device interface, if i open a device, and + then create a memory mapping using device_map, does that increment the + open count of the device ? + can i call device_close w/o destroying the mapping directly + after mapping it ? + teythoon: I have a vague recollection that the mapping (or more + precisely, the memory object) is not bound to the open once + established... but don't take my word on it -- it's been some years since + I played with that stuff :-) + antrik: yes, that would actually match my expectation + hum + normally, mapping increments the usage count of the resource + mapped, but not the open count + i don't know if that's the case for mach devices + teythoon: which mach device btw ? + time + libshouldbeinlibc/maptime.c line ~53 + the device is opened but never closed + is that a problem ? + not sure, but I'd think so, yes + why ? + the open count is incremented each time + at map time ? + ah no, since that's your question + the open count is normally decremented when the send right for the + device is destroyed, which occurs when tasks exit + hm + but wouldn't only important long running servers use the mach + device ? + all tasks do + a simple call to gettimeofday will use it + well, but only privileged processes may get teh device master + port + the device is probably accessible through some other method + yes. /dev/time + err, have you looked at the function ? ;) + no + which one ? + maptime_map + i did once but quickly + if use_mach_dev, the mach device is used, /dev/time otherwise + gettimeofday apparently uses __host_get_time + mhmm + ok so i was wrong + the time device, whether it is the mach or the hurd one, seems to + be mapped only by translators + 14:10 < teythoon> but wouldn't only important long running servers + use the mach device ? + so yes :) + so we should close the device + why ? + to prevent an overflow in the open count + when is it open multiple times ? + isn't it ? maybe /me lacks some context ;) + it's called once at init time + well, ok then + gettimeofday-like functions then only read the mapped memory + at least, that's how it's done in the servers i've looked at such + as pfinet + makes sense, yes + something i learnt from experience and failures: check the problem + actually exists before fixing it :p + well, if the memory mapping is independent of the device, then + there is a problem + the device is kept open for no reason + teythoon: if you can determine that the device doesn't need to + stay open for the mapping to remain, then you can close it + otherwise, it's such a minor leak that we don't care at all + i wouldn't even consider it a leak more than a small static + variable used at init time only + looks like, yes + also, it's only in the rootfs translator + ? + only the root filesystem uses the mach device directly + ok + well, /dev/time too right ? + yes, but that is a storeio translator that does not use this + code + yes + hm + only the root filesystem uses the mach device directly *using + this function* -- cgit v1.2.3