[LLVMdev] misc CVS patches

Jeff Cohen
Thu, 21 Apr 2005 15:52:29 -0000

Nope.  Win32 is not (and does not pretend to be) POSIX compliant.  These
functions cannot be used outside of lib/System/Unix.  New methods need
to be added to class llvm::sys::Process.

Markus F.X.J. Oberhumer wrote:

> Jeff Cohen wrote:
>
>> Misha Brukman wrote:
>>
>>>> I didn't use get{u,g}id() because that's not portable -
I think we
>>>> need another abstraction in the System library for these.
>>>>
>>>
>>>
>>>
>>> Hmm, seems like it's available on the Unices that we support:
Linux, OS
>>> X, and SunOS.  Man page lists getgid() as conforming to POSIX and
BSD
>>> 4.3, so I'm assuming *BSD has them too (can't confirm for
lack of a
>>> *BSD
>>> system).  As soon as we run into a Unix system that we want to
support,
>>> we might have to go the abstraction route, but it seems to work for
our
>>> currently-supported platforms.
>>>
>>>
>> FreeBSD has them.  According to its man pages, getuid was introduced
>> in Version 7 AT&T Unix.  Ancient history.  It doesn't say when
getgid
>> was introduced, but it's just as old as it's documented in my
1980
>> edition Berkeley VAX UNIX manual, and in any case both are in POSIX.1
>> and therefore ought to be portable by definition.
>
>
> Does windows have these ?
>
> In any case, below is another small patch for lib/Bytecode/Archive.
>
> ~Markus
>
>------------------------------------------------------------------------
>
>Index: Archive.cpp
>==================================================================>RCS
file: /var/cvs/llvm/llvm/lib/Bytecode/Archive/Archive.cpp,v
>retrieving revision 1.6
>diff -u -r1.6 Archive.cpp
>--- Archive.cpp	28 Jan 2005 01:17:07 -0000	1.6
>+++ Archive.cpp	21 Apr 2005 15:13:24 -0000
>@@ -40,8 +40,8 @@
> ArchiveMember::ArchiveMember()
>   : next(0), prev(0), parent(0), path("<invalid>"),
flags(0), data(0)
> {
>-  info.user = 1000;
>-  info.group = 1000;
>+  info.user = getuid();
>+  info.group = getgid();
>   info.mode = 0777;
>   info.fileSize = 0;
>   info.modTime = sys::TimeValue::now();
>
>