Re: [libvirt] PATCH: Latest MinGW patches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 04, 2008 at 11:56:44AM +0200, Jim Meyering wrote:
> "Richard W.M. Jones" <rjones@xxxxxxxxxx> wrote:
> > On Thu, Sep 04, 2008 at 08:24:14AM +0200, Jim Meyering wrote:
> >> Instead of adding the #if/else blocks above,
> >> how about adding these in some header file?
> >>
> >> #ifndef HAVE_GETGID
> >> static inline gid_t getgid (void) { return 0; }
> >> #endif
> >>
> >> #ifndef HAVE_GETUID
> >> static inline uid_t getuid (void) { return 0; }
> >> #endif
> >
> > Hmmm ...
> >
> > It's a bit unexpected to have fundamental syscalls like getuid()
> > implemented as macros which can return 0 ...
> 
> Why?
> If those functions don't exist, this supplies replacements
> (functions) that have the same semantics as the code in
> Dan's patch: i.e. pretend UID==0 and GID==0.
> 
> but with far fewer cpp directives.
> 
> Doesn't it do the right thing?

It's just a bit worrying that people might use getuid/getgid expecting
them to return useful values under Windows, whereas in fact they would
be 'silently' returning 0.

In earlier versions of libvirt we made all sorts of assumptions about
things like read-only connections based on UIDs.  When I started the
first port to MinGW I found it was useful to flag those and eventually
completely remove them:

http://www.redhat.com/archives/libvir-list/2007-December/msg00168.html
http://www.redhat.com/archives/libvir-list/2008-April/msg00194.html

I'm not convinced that we should always be removing #ifdefs at all
costs, if in fact those serve to remind us of non-portable code or
code which is making unwarranted assumptions.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]