1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
Description: redefine_extname sets socket to __xnet_socket,
and "#pragma weak socket _socket" becomes "#pragma __xnet_socket _socket",
and thus __xnet_socket is multiple defined in assembler code. Similar for
other weaks, but "bind" for example is not defined at all.
Put all weak pragmas before headers so redefine_extname is not in action.
Index: b/usr/src/lib/libsocket/socket/socket.c
===================================================================
--- a/usr/src/lib/libsocket/socket/socket.c
+++ b/usr/src/lib/libsocket/socket/socket.c
@@ -35,6 +35,8 @@
* contributors.
*/
+#pragma weak socket = _socket
+
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stropts.h>
@@ -50,8 +52,6 @@ extern int _setsockopt();
int _socket_create(int, int, int, int);
-#pragma weak socket = _socket
-
int
_socket(int family, int type, int protocol)
{
Index: b/usr/src/lib/libsocket/socket/socketpair.c
===================================================================
--- a/usr/src/lib/libsocket/socket/socketpair.c
+++ b/usr/src/lib/libsocket/socket/socketpair.c
@@ -39,6 +39,8 @@
#pragma ident "%Z%%M% %I% %E% SMI"
+#pragma weak socketpair = _socketpair
+
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stropts.h>
@@ -53,8 +55,6 @@ extern int _so_socketpair(int*);
int _socketpair_create(int, int, int, int*, int);
-#pragma weak socketpair = _socketpair
-
int
_socketpair(int family, int type, int protocol, int sv[2])
{
Index: b/usr/src/lib/libsocket/socket/weaks.c
===================================================================
--- a/usr/src/lib/libsocket/socket/weaks.c
+++ b/usr/src/lib/libsocket/socket/weaks.c
@@ -26,21 +26,6 @@
/* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/stropts.h>
-#include <sys/stream.h>
-#include <sys/socketvar.h>
-#include <sys/sockio.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stropts.h>
-#include <stdio.h>
-#include <strings.h>
-#include <netinet/sctp.h>
-
#pragma weak bind = _bind
#pragma weak listen = _listen
#pragma weak accept = _accept
@@ -58,6 +43,21 @@
#pragma weak getsockopt = _getsockopt
#pragma weak setsockopt = _setsockopt
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stropts.h>
+#include <sys/stream.h>
+#include <sys/socketvar.h>
+#include <sys/sockio.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stropts.h>
+#include <stdio.h>
+#include <strings.h>
+#include <netinet/sctp.h>
+
extern int _so_bind();
extern int _so_listen();
extern int _so_accept();
|