public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: setup ChangeLog win32.h
       [not found] <20130702161048.12696.qmail@sourceware.org>
@ 2013-07-03  8:42 ` Václav Zeman
  2013-07-03 12:30   ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Václav Zeman @ 2013-07-03  8:42 UTC (permalink / raw)
  To: corinna; +Cc: cygwin

On 2 July 2013 18:10,  wrote:
>
> CVSROOT:        /cvs/cygwin-apps
> Module name:    setup
> Changes by:     XXXX  2013-07-02 16:10:48
>
> Modified files:
>         .              : ChangeLog win32.h
>
> Log message:
>         * win32.h (struct acl_t): Make sure struct is 4 byte aligned.
>
> Patches:
> http://sourceware.org/cgi-bin/cvsweb.cgi/setup/ChangeLog.diff?cvsroot=cygwin-apps&r1=2.807&r2=2.808
> http://sourceware.org/cgi-bin/cvsweb.cgi/setup/win32.h.diff?cvsroot=cygwin-apps&r1=2.29&r2=2.30
>
Why not using the union trick?

 struct acl_t {
  union {
    LONG __align; /* Make sure &acl is 4-byte aligned. */
    ACL acl;
  };
  char aclbuf[TOKEN_ACL_SIZE (7)];
 };

Same effect, AFAIK, and no size overhead.

--
VZ

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: setup ChangeLog win32.h
  2013-07-03  8:42 ` setup ChangeLog win32.h Václav Zeman
@ 2013-07-03 12:30   ` Corinna Vinschen
  2013-07-03 19:15     ` Christopher Faylor
  0 siblings, 1 reply; 4+ messages in thread
From: Corinna Vinschen @ 2013-07-03 12:30 UTC (permalink / raw)
  To: cygwin

On Jul  3 10:42, Václav Zeman wrote:
> On 2 July 2013 18:10,  wrote:
> >
> > CVSROOT:        /cvs/cygwin-apps
> > Module name:    setup
> > Changes by:     XXXX  2013-07-02 16:10:48
> >
> > Modified files:
> >         .              : ChangeLog win32.h
> >
> > Log message:
> >         * win32.h (struct acl_t): Make sure struct is 4 byte aligned.
> >
> > Patches:
> > http://sourceware.org/cgi-bin/cvsweb.cgi/setup/ChangeLog.diff?cvsroot=cygwin-apps&r1=2.807&r2=2.808
> > http://sourceware.org/cgi-bin/cvsweb.cgi/setup/win32.h.diff?cvsroot=cygwin-apps&r1=2.29&r2=2.30
> >
> Why not using the union trick?
> 
>  struct acl_t {
>   union {
>     LONG __align; /* Make sure &acl is 4-byte aligned. */
>     ACL acl;
>   };
>   char aclbuf[TOKEN_ACL_SIZE (7)];
>  };
> 
> Same effect, AFAIK, and no size overhead.

Yep, done.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: setup ChangeLog win32.h
  2013-07-03 12:30   ` Corinna Vinschen
@ 2013-07-03 19:15     ` Christopher Faylor
  2013-07-03 19:48       ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Christopher Faylor @ 2013-07-03 19:15 UTC (permalink / raw)
  To: cygwin

On Wed, Jul 03, 2013 at 02:30:10PM +0200, Corinna Vinschen wrote:
>On Jul  3 10:42, V??clav Zeman wrote:
>> On 2 July 2013 18:10,  wrote:
>> >
>> > CVSROOT:        /cvs/cygwin-apps
>> > Module name:    setup
>> > Changes by:     XXXX  2013-07-02 16:10:48
>> >
>> > Modified files:
>> >         .              : ChangeLog win32.h
>> >
>> > Log message:
>> >         * win32.h (struct acl_t): Make sure struct is 4 byte aligned.
>> >
>> > Patches:
>> > http://sourceware.org/cgi-bin/cvsweb.cgi/setup/ChangeLog.diff?cvsroot=cygwin-apps&r1=2.807&r2=2.808
>> > http://sourceware.org/cgi-bin/cvsweb.cgi/setup/win32.h.diff?cvsroot=cygwin-apps&r1=2.29&r2=2.30
>> >
>> Why not using the union trick?
>> 
>>  struct acl_t {
>>   union {
>>     LONG __align; /* Make sure &acl is 4-byte aligned. */
>>     ACL acl;
>>   };
>>   char aclbuf[TOKEN_ACL_SIZE (7)];
>>  };
>> 
>> Same effect, AFAIK, and no size overhead.
>
>Yep, done.

Shouldn't we really explicitly specify the alignment rather than just
assuming that LONG is aligned?

The below works.

cgf

RCS file: /cvs/cygwin-apps/setup/win32.h,v
retrieving revision 2.31
diff -d -u -p -r2.31 win32.h
--- win32.h	3 Jul 2013 12:30:04 -0000	2.31
+++ win32.h	3 Jul 2013 19:14:46 -0000
@@ -75,10 +75,7 @@
 			     (cnt) * (sizeof (ACCESS_ALLOWED_ACE) + MAX_SID_LEN))
 
 struct acl_t {
-  union {
-    LONG __align;	/* Make sure &acl is 4-byte aligned. */
-    ACL acl;
-  };
+  ACL acl __attribute__ ((aligned (4)));


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: setup ChangeLog win32.h
  2013-07-03 19:15     ` Christopher Faylor
@ 2013-07-03 19:48       ` Corinna Vinschen
  0 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2013-07-03 19:48 UTC (permalink / raw)
  To: cygwin

On Jul  3 15:15, Christopher Faylor wrote:
> On Wed, Jul 03, 2013 at 02:30:10PM +0200, Corinna Vinschen wrote:
> >On Jul  3 10:42, V??clav Zeman wrote:
> >> On 2 July 2013 18:10,  wrote:
> >> >
> >> > CVSROOT:        /cvs/cygwin-apps
> >> > Module name:    setup
> >> > Changes by:     XXXX  2013-07-02 16:10:48
> >> >
> >> > Modified files:
> >> >         .              : ChangeLog win32.h
> >> >
> >> > Log message:
> >> >         * win32.h (struct acl_t): Make sure struct is 4 byte aligned.
> >> >
> >> > Patches:
> >> > http://sourceware.org/cgi-bin/cvsweb.cgi/setup/ChangeLog.diff?cvsroot=cygwin-apps&r1=2.807&r2=2.808
> >> > http://sourceware.org/cgi-bin/cvsweb.cgi/setup/win32.h.diff?cvsroot=cygwin-apps&r1=2.29&r2=2.30
> >> >
> >> Why not using the union trick?
> >> 
> >>  struct acl_t {
> >>   union {
> >>     LONG __align; /* Make sure &acl is 4-byte aligned. */
> >>     ACL acl;
> >>   };
> >>   char aclbuf[TOKEN_ACL_SIZE (7)];
> >>  };
> >> 
> >> Same effect, AFAIK, and no size overhead.
> >
> >Yep, done.
> 
> Shouldn't we really explicitly specify the alignment rather than just
> assuming that LONG is aligned?
> 
> The below works.
> 
> cgf
> 
> RCS file: /cvs/cygwin-apps/setup/win32.h,v
> retrieving revision 2.31
> diff -d -u -p -r2.31 win32.h
> --- win32.h	3 Jul 2013 12:30:04 -0000	2.31
> +++ win32.h	3 Jul 2013 19:14:46 -0000
> @@ -75,10 +75,7 @@
>  			     (cnt) * (sizeof (ACCESS_ALLOWED_ACE) + MAX_SID_LEN))
>  
>  struct acl_t {
> -  union {
> -    LONG __align;	/* Make sure &acl is 4-byte aligned. */
> -    ACL acl;
> -  };
> +  ACL acl __attribute__ ((aligned (4)));

That's even better.  Applied.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-03 19:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20130702161048.12696.qmail@sourceware.org>
2013-07-03  8:42 ` setup ChangeLog win32.h Václav Zeman
2013-07-03 12:30   ` Corinna Vinschen
2013-07-03 19:15     ` Christopher Faylor
2013-07-03 19:48       ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).