From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,1959207bcdf7952d X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-11-28 04:47:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!news.gtei.net!news.compaq.com!news.cpqcorp.net!not-for-mail Message-ID: <3C04DD4B.59C9A5E7@zk3.dec.com> From: John Ferlan X-Mailer: Mozilla 4.78 [en] (WinNT; U) X-Accept-Language: en,pdf MIME-Version: 1.0 Newsgroups: comp.unix.tru64 Subject: Re: Compilation with gcc 2.95.3: cuserid redefined References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 28 Nov 2001 07:49:15 -0500 NNTP-Posting-Host: 16.140.16.90 X-Complaints-To: abuse@Compaq.com X-Trace: news.cpqcorp.net 1006951657 16.140.16.90 (Wed, 28 Nov 2001 04:47:37 PST) NNTP-Posting-Date: Wed, 28 Nov 2001 04:47:37 PST Organization: Compaq Computer Corporation Xref: archiver1.google.com comp.unix.tru64:5914 Stano wrote: > Hi there, > > I have been trying to recompile the source code on > Tru64 UNIX V5.1 (Rev. 732) with the gcc 2.95.3. > Though it compiles, I am getting the following warnings: > > /usr/local/gcc-2.95.3/lib/gcc-lib/alphaev56-dec-osf5.1/2.95.3/include/unistd.h:608: > warning: `cuserid' redefined > /usr/local/gcc-2.95.3/lib/gcc-lib/alphaev56-dec-osf5.1/2.95.3/include/stdio.h:457: > warning: this is the location of the previous definition > > I have searched all the newsgroups about this problem and it seems it > was already mentioned few times, but without any response. The only > clue is to define the symbol _LIBC_POLLUTION_H_ which in fact helps, > but I could not find any explanation of its purpose. > > Can anybody shed a bit of light on this issue? > > Thanks you very much, > > Stano. The following may or may not answer your question, but hopefully will give you insight as to what/how things are done. Read the include files and check out the __V40_OBJ_COMPAT definition as well as the 'pragma extern_prefix "_E"' statements. Generically speaking - one of the features of the Tru64 UNIX platform is that applications compiled on a V4* release will continue to work on V5* releases without forcing a recompilation of the application. When "something" changes to the arguments, data format, size of return value, etc. of a public interface that make it "impossible" to continue working in an environment where an already compiled application must work, the "standard procedure" has been to create a new interface with the _E prefix - e.g. there's a cuserid() and an _Ecuserid(). Thus apps compiled on v4* will use the cuserid() entry, while those compiled on v5* will use the _Ecuserid(). Starting with some v5* release (I forget exactly which one), the _Ecuserid() interface was created to handle long usernames. At the same time the constant value L_cuserid that is the maximum length of a username was changed from 8 to 64. Because the standard says cuserid() returns a string that is no more than L_cuserid characters in size, there has to be 2 interfaces to support the different sizes. If there wasn't 2 interfaces, then v4 applications would not get a "nul" terminated string that has no more than 8 characters in the username - it may receive a 10 character (or more). Those apps 'may' begin to fail especially if they made assumptions... For example, a strcpy from the returned cuserid() string into a buffer that was defined "char newusername[L_cuserid+1]" could then overflow... Remember, the v4 app wasn't recompiled thus newusername is only 9 characters long - if run a v5 platform where cuserid() may return a 14 character name, there's going to be overflow. Applications compiled in a v5* environment wishing to "keep" the v4 definition, can define "__V40_OBJ_COMPAT" and will use the cuserid() interface that only allows a maximum of 8 characters. Otherwise, the cuserid() will return a character string that is at most 64 characters. And before it's asked - yes, v5* releases can support longer usernames, unfortunately getting the other applications to support the longer names has taken longer than originally planned, so still officially the answer is 8 characters for a maximum username. Perhaps the "answer" to your problem lies in whether or not the compiler can handle the "extern_prefix" pragma - I'm not a compiler guru, so I cannot help you solve that mystery. -- John Ferlan Tru64 UNIX Security Compaq Computer Corporation