mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] socket.h: fix SO_* for mips
@ 2015-07-01 16:27 Roman Yeryomin
  2015-07-01 19:41 ` Rich Felker
  2015-07-01 20:16 ` Szabolcs Nagy
  0 siblings, 2 replies; 6+ messages in thread
From: Roman Yeryomin @ 2015-07-01 16:27 UTC (permalink / raw)
  To: musl

Signed-off-by: Roman Yeryomin <roman@ubnt.com>
---
 arch/mips/bits/socket.h    | 31 ++++++++++++++++++-------------
 arch/powerpc/bits/socket.h |  9 ++++++---
 include/sys/socket.h       |  6 +++---
 3 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/arch/mips/bits/socket.h b/arch/mips/bits/socket.h
index fe5bad9..cc72dcf 100644
--- a/arch/mips/bits/socket.h
+++ b/arch/mips/bits/socket.h
@@ -22,26 +22,31 @@ struct cmsghdr
 #define SOL_SOCKET     65535
 
 #define SO_DEBUG        1
-#define SO_REUSEADDR    4
-#define SO_TYPE         0x1008
-#define SO_ERROR        0x1007
-#define SO_DONTROUTE    16
-#define SO_BROADCAST    32
+
+#define SO_REUSEADDR    0x0004
+#define SO_KEEPALIVE    0x0008
+#define SO_DONTROUTE    0x0010
+#define SO_BROADCAST    0x0020
+#define SO_LINGER       0x0080
+#define SO_OOBINLINE    0x0100
+#define SO_REUSEPORT    0x0200
 #define SO_SNDBUF       0x1001
 #define SO_RCVBUF       0x1002
-#define SO_KEEPALIVE    8
-#define SO_OOBINLINE    256
+#define SO_SNDLOWAT     0x1003
+#define SO_RCVLOWAT     0x1004
+#define SO_RCVTIMEO     0x1006
+#define SO_SNDTIMEO     0x1005
+#define SO_ERROR        0x1007
+#define SO_TYPE         0x1008
+#define SO_ACCEPTCONN   0x1009
+#define SO_PROTOCOL     0x1028
+#define SO_DOMAIN       0x1029
+
 #define SO_NO_CHECK     11
 #define SO_PRIORITY     12
-#define SO_LINGER       128
 #define SO_BSDCOMPAT    14
-#define SO_REUSEPORT    512
 #define SO_PASSCRED     17
 #define SO_PEERCRED     18
-#define SO_RCVLOWAT     0x1004
-#define SO_SNDLOWAT     0x1003
-#define SO_RCVTIMEO     0x1006
-#define SO_SNDTIMEO     0x1005
 #define SO_SNDBUFFORCE  31
 #define SO_RCVBUFFORCE  33
 
diff --git a/arch/powerpc/bits/socket.h b/arch/powerpc/bits/socket.h
index 4ed04d3..8eb19f4 100644
--- a/arch/powerpc/bits/socket.h
+++ b/arch/powerpc/bits/socket.h
@@ -17,6 +17,7 @@ struct cmsghdr
 };
 
 #define SO_DEBUG        1
+
 #define SO_REUSEADDR    2
 #define SO_TYPE         3
 #define SO_ERROR        4
@@ -24,8 +25,6 @@ struct cmsghdr
 #define SO_BROADCAST    6
 #define SO_SNDBUF       7
 #define SO_RCVBUF       8
-#define SO_SNDBUFFORCE  32
-#define SO_RCVBUFFORCE  33
 #define SO_KEEPALIVE    9
 #define SO_OOBINLINE    10
 #define SO_NO_CHECK     11
@@ -39,4 +38,8 @@ struct cmsghdr
 #define SO_SNDTIMEO     19
 #define SO_PASSCRED     20
 #define SO_PEERCRED     21
- 
+#define SO_ACCEPTCONN   30
+#define SO_SNDBUFFORCE  32
+#define SO_RCVBUFFORCE  33
+#define SO_PROTOCOL     38
+#define SO_DOMAIN       39
diff --git a/include/sys/socket.h b/include/sys/socket.h
index 077fb3f..40de336 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -177,8 +177,11 @@ struct linger
 #define SO_SNDLOWAT     19
 #define SO_RCVTIMEO     20
 #define SO_SNDTIMEO     21
+#define SO_ACCEPTCONN   30
 #define SO_SNDBUFFORCE  32
 #define SO_RCVBUFFORCE  33
+#define SO_PROTOCOL     38
+#define SO_DOMAIN       39
 #endif
 
 #define SO_SECURITY_AUTHENTICATION              22
@@ -195,7 +198,6 @@ struct linger
 #define SO_TIMESTAMP            29
 #define SCM_TIMESTAMP           SO_TIMESTAMP
 
-#define SO_ACCEPTCONN           30
 #define SO_PEERSEC              31
 #define SO_PASSSEC              34
 #define SO_TIMESTAMPNS          35
@@ -203,8 +205,6 @@ struct linger
 #define SO_MARK                 36
 #define SO_TIMESTAMPING         37
 #define SCM_TIMESTAMPING        SO_TIMESTAMPING
-#define SO_PROTOCOL             38
-#define SO_DOMAIN               39
 #define SO_RXQ_OVFL             40
 #define SO_WIFI_STATUS          41
 #define SCM_WIFI_STATUS         SO_WIFI_STATUS
-- 
2.1.4



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

* Re: [PATCH] socket.h: fix SO_* for mips
  2015-07-01 16:27 [PATCH] socket.h: fix SO_* for mips Roman Yeryomin
@ 2015-07-01 19:41 ` Rich Felker
  2015-07-01 20:16 ` Szabolcs Nagy
  1 sibling, 0 replies; 6+ messages in thread
From: Rich Felker @ 2015-07-01 19:41 UTC (permalink / raw)
  To: musl

On Wed, Jul 01, 2015 at 07:27:08PM +0300, Roman Yeryomin wrote:
> Signed-off-by: Roman Yeryomin <roman@ubnt.com>
> ---
>  arch/mips/bits/socket.h    | 31 ++++++++++++++++++-------------
>  arch/powerpc/bits/socket.h |  9 ++++++---
>  include/sys/socket.h       |  6 +++---
>  3 files changed, 27 insertions(+), 19 deletions(-)

As written, the patch makes a lot of reorderings and 'gratuitous'
changes (like 8 -> 0x0008) that make it hard to understand what's
actually wrong. Could you provide a list of the values that were wrong
before and what they should be?

And is the powerpc part just adding copies of the default definitions
since some defaults in sys/socket.h are moved inside #if... ?

Rich


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

* Re: [PATCH] socket.h: fix SO_* for mips
  2015-07-01 16:27 [PATCH] socket.h: fix SO_* for mips Roman Yeryomin
  2015-07-01 19:41 ` Rich Felker
@ 2015-07-01 20:16 ` Szabolcs Nagy
  2015-07-01 21:14   ` Roman Yeryomin
  1 sibling, 1 reply; 6+ messages in thread
From: Szabolcs Nagy @ 2015-07-01 20:16 UTC (permalink / raw)
  To: musl

* Roman Yeryomin <roman@ubnt.com> [2015-07-01 19:27:08 +0300]:
> Signed-off-by: Roman Yeryomin <roman@ubnt.com>
> ---
>  arch/mips/bits/socket.h    | 31 ++++++++++++++++++-------------
>  arch/powerpc/bits/socket.h |  9 ++++++---
>  include/sys/socket.h       |  6 +++---
>  3 files changed, 27 insertions(+), 19 deletions(-)
> 
> diff --git a/arch/mips/bits/socket.h b/arch/mips/bits/socket.h
> index fe5bad9..cc72dcf 100644
> --- a/arch/mips/bits/socket.h
> +++ b/arch/mips/bits/socket.h
> @@ -22,26 +22,31 @@ struct cmsghdr
>  #define SOL_SOCKET     65535
>  
>  #define SO_DEBUG        1
> -#define SO_REUSEADDR    4
> -#define SO_TYPE         0x1008
> -#define SO_ERROR        0x1007
> -#define SO_DONTROUTE    16
> -#define SO_BROADCAST    32
> +
> +#define SO_REUSEADDR    0x0004
> +#define SO_KEEPALIVE    0x0008
> +#define SO_DONTROUTE    0x0010
> +#define SO_BROADCAST    0x0020
> +#define SO_LINGER       0x0080
> +#define SO_OOBINLINE    0x0100
> +#define SO_REUSEPORT    0x0200
>  #define SO_SNDBUF       0x1001
>  #define SO_RCVBUF       0x1002
> -#define SO_KEEPALIVE    8
> -#define SO_OOBINLINE    256
> +#define SO_SNDLOWAT     0x1003
> +#define SO_RCVLOWAT     0x1004
> +#define SO_RCVTIMEO     0x1006
> +#define SO_SNDTIMEO     0x1005
> +#define SO_ERROR        0x1007
> +#define SO_TYPE         0x1008

> +#define SO_ACCEPTCONN   0x1009
> +#define SO_PROTOCOL     0x1028
> +#define SO_DOMAIN       0x1029

i assume these 3 were wrong in generic sys/socket.h
and eveything else is ok, just reordered

> +
>  #define SO_NO_CHECK     11
>  #define SO_PRIORITY     12
> -#define SO_LINGER       128
>  #define SO_BSDCOMPAT    14
> -#define SO_REUSEPORT    512
>  #define SO_PASSCRED     17
>  #define SO_PEERCRED     18
> -#define SO_RCVLOWAT     0x1004
> -#define SO_SNDLOWAT     0x1003
> -#define SO_RCVTIMEO     0x1006
> -#define SO_SNDTIMEO     0x1005
>  #define SO_SNDBUFFORCE  31
>  #define SO_RCVBUFFORCE  33
>  
> diff --git a/arch/powerpc/bits/socket.h b/arch/powerpc/bits/socket.h
> index 4ed04d3..8eb19f4 100644
> --- a/arch/powerpc/bits/socket.h
> +++ b/arch/powerpc/bits/socket.h
> @@ -17,6 +17,7 @@ struct cmsghdr
>  };
>  
>  #define SO_DEBUG        1
> +
>  #define SO_REUSEADDR    2
>  #define SO_TYPE         3
>  #define SO_ERROR        4
> @@ -24,8 +25,6 @@ struct cmsghdr
>  #define SO_BROADCAST    6
>  #define SO_SNDBUF       7
>  #define SO_RCVBUF       8
> -#define SO_SNDBUFFORCE  32
> -#define SO_RCVBUFFORCE  33
>  #define SO_KEEPALIVE    9
>  #define SO_OOBINLINE    10
>  #define SO_NO_CHECK     11
> @@ -39,4 +38,8 @@ struct cmsghdr
>  #define SO_SNDTIMEO     19
>  #define SO_PASSCRED     20
>  #define SO_PEERCRED     21
> - 
> +#define SO_ACCEPTCONN   30
> +#define SO_SNDBUFFORCE  32
> +#define SO_RCVBUFFORCE  33
> +#define SO_PROTOCOL     38
> +#define SO_DOMAIN       39
> diff --git a/include/sys/socket.h b/include/sys/socket.h
> index 077fb3f..40de336 100644
> --- a/include/sys/socket.h
> +++ b/include/sys/socket.h
> @@ -177,8 +177,11 @@ struct linger
>  #define SO_SNDLOWAT     19
>  #define SO_RCVTIMEO     20
>  #define SO_SNDTIMEO     21
> +#define SO_ACCEPTCONN   30
>  #define SO_SNDBUFFORCE  32
>  #define SO_RCVBUFFORCE  33
> +#define SO_PROTOCOL     38
> +#define SO_DOMAIN       39
>  #endif
>  
>  #define SO_SECURITY_AUTHENTICATION              22
> @@ -195,7 +198,6 @@ struct linger
>  #define SO_TIMESTAMP            29
>  #define SCM_TIMESTAMP           SO_TIMESTAMP
>  
> -#define SO_ACCEPTCONN           30
>  #define SO_PEERSEC              31
>  #define SO_PASSSEC              34
>  #define SO_TIMESTAMPNS          35
> @@ -203,8 +205,6 @@ struct linger
>  #define SO_MARK                 36
>  #define SO_TIMESTAMPING         37
>  #define SCM_TIMESTAMPING        SO_TIMESTAMPING
> -#define SO_PROTOCOL             38
> -#define SO_DOMAIN               39
>  #define SO_RXQ_OVFL             40
>  #define SO_WIFI_STATUS          41
>  #define SCM_WIFI_STATUS         SO_WIFI_STATUS
> -- 
> 2.1.4


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

* Re: [PATCH] socket.h: fix SO_* for mips
  2015-07-01 20:16 ` Szabolcs Nagy
@ 2015-07-01 21:14   ` Roman Yeryomin
  2015-07-01 23:04     ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Roman Yeryomin @ 2015-07-01 21:14 UTC (permalink / raw)
  To: musl

On Wed, Jul 1, 2015 at 11:16 PM, Szabolcs Nagy <nsz@port70.net> wrote:
> * Roman Yeryomin <roman@ubnt.com> [2015-07-01 19:27:08 +0300]:
>> Signed-off-by: Roman Yeryomin <roman@ubnt.com>
>> ---
>>  arch/mips/bits/socket.h    | 31 ++++++++++++++++++-------------
>>  arch/powerpc/bits/socket.h |  9 ++++++---
>>  include/sys/socket.h       |  6 +++---
>>  3 files changed, 27 insertions(+), 19 deletions(-)
>>
>
>> +#define SO_ACCEPTCONN   0x1009
>> +#define SO_PROTOCOL     0x1028
>> +#define SO_DOMAIN       0x1029
>
> i assume these 3 were wrong in generic sys/socket.h
> and eveything else is ok, just reordered
>

Yes, these 3 are added to mips, powerpc and put under ifdef in
sys/socket.h to avoid redefines.
Other changes in mips bits/socket.h is reordering and rewriting in hex
to be somewhat consistent and easily comparable with asm/socket.h


Regards,
Roman


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

* Re: [PATCH] socket.h: fix SO_* for mips
  2015-07-01 21:14   ` Roman Yeryomin
@ 2015-07-01 23:04     ` Rich Felker
  2015-07-02  9:02       ` Roman Yeryomin
  0 siblings, 1 reply; 6+ messages in thread
From: Rich Felker @ 2015-07-01 23:04 UTC (permalink / raw)
  To: musl

On Thu, Jul 02, 2015 at 12:14:58AM +0300, Roman Yeryomin wrote:
> On Wed, Jul 1, 2015 at 11:16 PM, Szabolcs Nagy <nsz@port70.net> wrote:
> > * Roman Yeryomin <roman@ubnt.com> [2015-07-01 19:27:08 +0300]:
> >> Signed-off-by: Roman Yeryomin <roman@ubnt.com>
> >> ---
> >>  arch/mips/bits/socket.h    | 31 ++++++++++++++++++-------------
> >>  arch/powerpc/bits/socket.h |  9 ++++++---
> >>  include/sys/socket.h       |  6 +++---
> >>  3 files changed, 27 insertions(+), 19 deletions(-)
> >>
> >
> >> +#define SO_ACCEPTCONN   0x1009
> >> +#define SO_PROTOCOL     0x1028
> >> +#define SO_DOMAIN       0x1029
> >
> > i assume these 3 were wrong in generic sys/socket.h
> > and eveything else is ok, just reordered
> >
> 
> Yes, these 3 are added to mips, powerpc and put under ifdef in
> sys/socket.h to avoid redefines.
> Other changes in mips bits/socket.h is reordering and rewriting in hex
> to be somewhat consistent and easily comparable with asm/socket.h

OK. I think it would be good to factor this into two patches then: one
that makes the minimal change to fix the values, and another that's
pure cleanup for consistency and reordering.

I'm somewhat skeptical of the value of cleanup since this is all
scheduled for overhaul soon, but "soon" keeps getting pushed back so
in the mean time maybe it's nice to have some cleanup anyway. :-)

Rich


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

* Re: [PATCH] socket.h: fix SO_* for mips
  2015-07-01 23:04     ` Rich Felker
@ 2015-07-02  9:02       ` Roman Yeryomin
  0 siblings, 0 replies; 6+ messages in thread
From: Roman Yeryomin @ 2015-07-02  9:02 UTC (permalink / raw)
  To: musl

On Thu, Jul 2, 2015 at 2:04 AM, Rich Felker <dalias@libc.org> wrote:
> On Thu, Jul 02, 2015 at 12:14:58AM +0300, Roman Yeryomin wrote:
>> On Wed, Jul 1, 2015 at 11:16 PM, Szabolcs Nagy <nsz@port70.net> wrote:
>> > * Roman Yeryomin <roman@ubnt.com> [2015-07-01 19:27:08 +0300]:
>> >> Signed-off-by: Roman Yeryomin <roman@ubnt.com>
>> >> ---
>> >>  arch/mips/bits/socket.h    | 31 ++++++++++++++++++-------------
>> >>  arch/powerpc/bits/socket.h |  9 ++++++---
>> >>  include/sys/socket.h       |  6 +++---
>> >>  3 files changed, 27 insertions(+), 19 deletions(-)
>> >>
>> >
>> >> +#define SO_ACCEPTCONN   0x1009
>> >> +#define SO_PROTOCOL     0x1028
>> >> +#define SO_DOMAIN       0x1029
>> >
>> > i assume these 3 were wrong in generic sys/socket.h
>> > and eveything else is ok, just reordered
>> >
>>
>> Yes, these 3 are added to mips, powerpc and put under ifdef in
>> sys/socket.h to avoid redefines.
>> Other changes in mips bits/socket.h is reordering and rewriting in hex
>> to be somewhat consistent and easily comparable with asm/socket.h
>
> OK. I think it would be good to factor this into two patches then: one
> that makes the minimal change to fix the values, and another that's
> pure cleanup for consistency and reordering.

NP, will submit v2

> I'm somewhat skeptical of the value of cleanup since this is all
> scheduled for overhaul soon, but "soon" keeps getting pushed back so
> in the mean time maybe it's nice to have some cleanup anyway. :-)

right :)


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

end of thread, other threads:[~2015-07-02  9:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-01 16:27 [PATCH] socket.h: fix SO_* for mips Roman Yeryomin
2015-07-01 19:41 ` Rich Felker
2015-07-01 20:16 ` Szabolcs Nagy
2015-07-01 21:14   ` Roman Yeryomin
2015-07-01 23:04     ` Rich Felker
2015-07-02  9:02       ` Roman Yeryomin

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).