From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,798b134949f679fd X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-11-22 16:16:14 PST Newsgroups: comp.unix.osf.osf1 Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!swrinde!news.uh.edu!uuneo.neosoft.com!nmtigw!peter From: peter@nmti.com (Peter da Silva) Subject: Re: 64-bit FILE* pointer problem in OSF1 Message-ID: Sender: peter@nmti.com (peter da silva) Organization: Network/development platform support, NMTI References: Date: Tue, 22 Nov 1994 17:22:07 GMT In article , Jan A. Duha wrote: > I'm trying to port a file server program (the "iserver" protocol, for > Transputer processors, for those who know) to a DEC Alpha running > OSF1 v.2.1. Part of the protocol involves a remote device requesting the > server to open a file. The server does this, and returns a FILE* > pointer (fp). Whenever the remote device subsequently wants to access > the file, it passes the server its fp. ICK! Treating the local address of dynamically allocated memory as a token is pretty evil. Well, since the client only uses this as an open file token, add a level of indirection. Create a table of open files in the server, and stick the file pointer in there and return the index. [use the low 32 bits as the token] > My question, then: is this a valid method? There's no guarantee that the top 32 bits will always be 0x3FF. In fact, it's likely to change. > A longer version of the > question is: how exactly are fp's implemented in OSF1, You don't want to know. Seriously... a file pointer should be treated as an opaque token. You shouldn't know about its structure nor how it's allocated. > and what is the > significance of moving from 32-bit to 64-bit pointers for FILE > structures? Same as going from 32-bit to 64-bit pointers in any other context. > Can I have it guaranteed that the OS will place the > pointers in known (constant) locations? No. It's reasonable to *assume* that a straightforward implementation will use a static table, since that's what V7 did, but it's unreasonable to expect that. There are implementations of stdio that don't have an _iob array (the usual name of this array) anywhere. > i appreciate any help (as soon as possible, please), See above. Build your own table and pass an index into it. I wouldn't for a minute consider any other solution. If you can, get this change incorporated in the original version of the server. This is a really nasty design. -- Peter da Silva `-_-' Network Management Technology Incorporated 'U` 1601 Industrial Blvd. Sugar Land, TX 77478 USA +1 713 274 5180 "Hast Du heute schon Deinen Wolf umarmt?"