Using sys/types.h types in sys/socket.h

Adrian Chadd adrian at freebsd.org
Thu Dec 19 20:13:23 UTC 2013


On 18 December 2013 21:20, Bruce Evans <brde at optusnet.com.au> wrote:
> On Wed, 18 Dec 2013, Adrian Chadd wrote:
>
>> Ok, how about this:
>>
>> Index: sys/sys/socket.h
>> ===================================================================
>> --- sys/sys/socket.h    (revision 259475)
>> +++ sys/sys/socket.h    (working copy)
>> @@ -84,6 +84,16 @@
>> #endif
>> #endif
>>
>> +#ifndef _UINT32_T_DECLARED
>> +#define        _UINT32_T_DECLARED
>> +typedef __uint32_t     uint32_t;
>> +#endif
>> +
>> +#ifndef _UINTPTR_T_DECLARED
>> +#define _UINTPTR_T_DECLARED
>> +typedef __uintptr_t    uintptr_t;
>> +#endif
>> +
>> /*
>>  * Types
>>  */
>
>
> This seems to be correct, except the tab after the second #define is
> corrupt.  Actually, all the tabs are corrupt, but the first #define
> apparently started with a tab whose corruption made a larger mess.

I can tidy them up in a follow-up commit.

> imp@ said, in a message that should have been killfiled due to top posting,
> that this should be under __BSD_VISIBLE.  That isn't strictly necessary,
> since POSIX allows names ending with _t, and it isn't very important for
> avoiding pollution since there aren't very many of them.

Ok, so just to be clear - uintptr_t and uint32_t should both be within
__BSD_VISIBLE blocks?

Just for my own personal information - why are these and not others
within blocks?

>
>> @@ -577,11 +587,27 @@
>> };
>>
>> /*
>> + * sendfile(2) kqueue information
>> + */
>> +struct sf_hdtr_kq {
>> +       int kq_fd;              /* kq fd to post completion events on */
>> +       int kq_fd;              /* kq fd to post completion events on */
>> +       uint32_t kq_flags;      /* extra flags to pass in */
>> +       void *kq_udata;         /* user data pointer */
>> +       uintptr_t kq_ident;     /* ident (from userland?) */
>> +};
>
>
> kq_fd is duplicated.

Mis-merge; I'll fix this later.

> All of the indentation is wrong and has corrupt tabs, except the first
> level only has corrupt tabs.
>
> This should be:
>
> struct sf_hdtr_kq {
>
>         int     kq_fd;          /* kq fd to post completion events on */
>         uint32_t kq_flags;      /* extra flags to pass in */
>         void    *kq_udata;      /* user data pointer */
>         uintptr_t kq_ident;     /* ident (from userland?) */
> };
>
> I strongly disagree with indenting everything N extra levels (where N > 1;
> N = 2 here for the name fields) to line up the fields.  I disagree with
> indenting the name fields by 1 space extra to line them up after adding
> a '*' before a few fields.  It's hard enough to keep the style consistent
> without following this fancy style.

Ok, I'll attempt to correct all this stuff in a follow-up email.

Thanks!



-a


More information about the freebsd-arch mailing list