🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #281

A Lesson to be Learned (was Re: How to do a filesystem link to a file of which I only have an fd?)

#281
From: Kevin Darcy
Date: Tue, 07 Apr 1992 21:19
54 lines
2217 bytes
---

From: federico@heinz.in-berlin.de (Federico Heinz)
Message-ID: <1992Apr2.132737.17286@heinz.in-berlin.de>
Date: 2 Apr 92 13:27:37 GMT

"...there's this ``insanely great'' feature of the NeXT environment that 
 allows mapping a file into memory, which would greatly reduce the complexity 
 of my code. The caveat: I must have the file's name in order to map it, but 
 I don't know the name.

"No sweat, I think: just use fstat() to get the file's inode number, and ask  
 the file system to make a link to it under a name I like (let's assume I know  
 is on the same device), and voila, there's a file I can map... only I haven't  
 found any way to set up a link to a particular inode..."

---

From: jfw@ksr.com (John F. Woods)
Message-ID: <11173@ksr.com>
Date: 2 Apr 92 21:20:37 GMT

"The answer is that you cannot do this (in general)."

---

From: byer@adobe.com (Scott Byer)
Message-ID: <1992Apr3.001624.23736@adobe.com>
Date: 3 Apr 92 00:16:24 GMT

"Search the NextDev docs for map_fd:

"#include <mach.h>

"kern_return_t map_fd(int fd, vm_offset_t offset, vm_offset_t *address,  
 boolean_t find_space, vm_size_t size)"

---

From: jml@taco.visus.com (Jim Large)
Message-ID: <1992Apr4.013717.17114@visus.com>
Date: 4 Apr 92 01:37:17 GMT

"Fire up DigitalLibrarian and search the NeXT Developer docs for "map_fd".
 It does exactly what you want."

--

Moral of the story: us Unix generalists shouldn't make hasty assumptions 
about SPECIFIC implementations of modern Unix and Unix-like OSes. The 
environments out there today are richer and more developer-friendly than they 
were say 5 or 10 years ago. Live and learn...

								- Kevin
Technical Details
Message-ID: <1992Apr7.211911.9866@cfctech.cfc.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!mips!news.cs.indiana.edu!rsg1.er.usgs.gov!fmsrl7!cfctech!kevin
References: <1992Apr2.132737.17286@heinz.in-berlin.de>

Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!mips!news.cs.indiana.edu!rsg1.er.usgs.gov!fmsrl7!cfctech!kevin
From: kevin@cfctech.cfc.com (Kevin Darcy)
Subject: A Lesson to be Learned (was Re: How to do a filesystem link to a file of which I only have an fd?)
Message-ID: <1992Apr7.211911.9866@cfctech.cfc.com>
Organization: Chrysler Financial Corp., Southfield, MI
References: <1992Apr2.132737.17286@heinz.in-berlin.de>
Date: Tue, 7 Apr 1992 21:19:11 GMT
Lines: 54