socketcalls.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. /*
  2. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  3. *
  4. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  5. */
  6. #include <errno.h>
  7. #include <syscall.h>
  8. #include <sys/socket.h>
  9. #ifdef __NR_socketcall
  10. extern int __socketcall(int call, unsigned long *args) attribute_hidden;
  11. /* Various socketcall numbers */
  12. #define SYS_SOCKET 1
  13. #define SYS_BIND 2
  14. #define SYS_CONNECT 3
  15. #define SYS_LISTEN 4
  16. #define SYS_ACCEPT 5
  17. #define SYS_GETSOCKNAME 6
  18. #define SYS_GETPEERNAME 7
  19. #define SYS_SOCKETPAIR 8
  20. #define SYS_SEND 9
  21. #define SYS_RECV 10
  22. #define SYS_SENDTO 11
  23. #define SYS_RECVFROM 12
  24. #define SYS_SHUTDOWN 13
  25. #define SYS_SETSOCKOPT 14
  26. #define SYS_GETSOCKOPT 15
  27. #define SYS_SENDMSG 16
  28. #define SYS_RECVMSG 17
  29. #define SYS_ACCEPT4 18
  30. #endif
  31. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  32. #include <sysdep-cancel.h>
  33. #include <pthreadP.h>
  34. #else
  35. #define SINGLE_THREAD_P 1
  36. #endif
  37. #ifdef L_accept
  38. extern __typeof(accept) __libc_accept;
  39. #ifdef __NR_accept
  40. #define __NR___sys_accept __NR_accept
  41. static
  42. _syscall3(int, __sys_accept, int, call, struct sockaddr *, addr, socklen_t *,addrlen)
  43. int __libc_accept(int s, struct sockaddr *addr, socklen_t * addrlen)
  44. {
  45. if (SINGLE_THREAD_P)
  46. return __sys_accept(s, addr, addrlen);
  47. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  48. int oldtype = LIBC_CANCEL_ASYNC ();
  49. int result = __sys_accept(s, addr, addrlen);
  50. LIBC_CANCEL_RESET (oldtype);
  51. return result;
  52. #endif
  53. }
  54. #elif defined(__NR_socketcall)
  55. int __libc_accept(int s, struct sockaddr *addr, socklen_t * addrlen)
  56. {
  57. unsigned long args[3];
  58. args[0] = s;
  59. args[1] = (unsigned long) addr;
  60. args[2] = (unsigned long) addrlen;
  61. if (SINGLE_THREAD_P)
  62. return __socketcall(SYS_ACCEPT, args);
  63. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  64. int oldtype = LIBC_CANCEL_ASYNC ();
  65. int result = __socketcall(SYS_ACCEPT, args);
  66. LIBC_CANCEL_RESET (oldtype);
  67. return result;
  68. #endif
  69. }
  70. #endif
  71. weak_alias(__libc_accept,accept)
  72. libc_hidden_weak(accept)
  73. #endif
  74. #ifdef L_accept4
  75. #ifdef __NR_accept4
  76. # define __NR___sys_accept4 __NR_accept4
  77. static _syscall4(int, __sys_accept4, int, fd, struct sockaddr *, addr, socklen_t *, addrlen, int, flags)
  78. int accept4(int fd, struct sockaddr *addr, socklen_t * addrlen, int flags)
  79. {
  80. if (SINGLE_THREAD_P)
  81. return __sys_accept4(fd, addr, addrlen, flags);
  82. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  83. else {
  84. int oldtype = LIBC_CANCEL_ASYNC ();
  85. int result = __sys_accept4(fd, addr, addrlen, flags);
  86. LIBC_CANCEL_RESET (oldtype);
  87. return result;
  88. }
  89. #endif
  90. }
  91. #elif defined(__NR_socketcall)
  92. int accept4(int fd, struct sockaddr *addr, socklen_t *addrlen, int flags)
  93. {
  94. unsigned long args[4];
  95. args[0] = fd;
  96. args[1] = (unsigned long) addr;
  97. args[2] = (unsigned long) addrlen;
  98. args[3] = flags;
  99. if (SINGLE_THREAD_P)
  100. return __socketcall(SYS_ACCEPT4, args);
  101. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  102. else {
  103. int oldtype = LIBC_CANCEL_ASYNC ();
  104. int result = __socketcall(SYS_ACCEPT4, args);
  105. LIBC_CANCEL_RESET (oldtype);
  106. return result;
  107. }
  108. #endif
  109. }
  110. #endif
  111. #endif
  112. #ifdef L_bind
  113. #ifdef __NR_bind
  114. _syscall3(int, bind, int, sockfd, const struct sockaddr *, myaddr, socklen_t, addrlen)
  115. #elif defined(__NR_socketcall)
  116. int bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen)
  117. {
  118. unsigned long args[3];
  119. args[0] = sockfd;
  120. args[1] = (unsigned long) myaddr;
  121. args[2] = addrlen;
  122. return __socketcall(SYS_BIND, args);
  123. }
  124. #endif
  125. libc_hidden_def(bind)
  126. #endif
  127. #ifdef L_connect
  128. extern __typeof(connect) __libc_connect;
  129. #ifdef __NR_connect
  130. #define __NR___sys_connect __NR_connect
  131. static
  132. _syscall3(int, __sys_connect, int, sockfd, const struct sockaddr *, saddr, socklen_t, addrlen)
  133. int __libc_connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen)
  134. {
  135. if (SINGLE_THREAD_P)
  136. return __sys_connect(sockfd, saddr, addrlen);
  137. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  138. int oldtype = LIBC_CANCEL_ASYNC ();
  139. int result = __sys_connect(sockfd, saddr, addrlen);
  140. LIBC_CANCEL_RESET (oldtype);
  141. return result;
  142. #endif
  143. }
  144. #elif defined(__NR_socketcall)
  145. int __libc_connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen)
  146. {
  147. unsigned long args[3];
  148. args[0] = sockfd;
  149. args[1] = (unsigned long) saddr;
  150. args[2] = addrlen;
  151. if (SINGLE_THREAD_P)
  152. return __socketcall(SYS_CONNECT, args);
  153. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  154. int oldtype = LIBC_CANCEL_ASYNC ();
  155. int result = __socketcall(SYS_CONNECT, args);
  156. LIBC_CANCEL_RESET (oldtype);
  157. return result;
  158. #endif
  159. }
  160. #endif
  161. weak_alias(__libc_connect,connect)
  162. libc_hidden_weak(connect)
  163. #endif
  164. #ifdef L_getpeername
  165. #ifdef __NR_getpeername
  166. _syscall3(int, getpeername, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen)
  167. #elif defined(__NR_socketcall)
  168. int getpeername(int sockfd, struct sockaddr *addr, socklen_t * paddrlen)
  169. {
  170. unsigned long args[3];
  171. args[0] = sockfd;
  172. args[1] = (unsigned long) addr;
  173. args[2] = (unsigned long) paddrlen;
  174. return __socketcall(SYS_GETPEERNAME, args);
  175. }
  176. #endif
  177. #endif
  178. #ifdef L_getsockname
  179. #ifdef __NR_getsockname
  180. _syscall3(int, getsockname, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen)
  181. #elif defined(__NR_socketcall)
  182. int getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen)
  183. {
  184. unsigned long args[3];
  185. args[0] = sockfd;
  186. args[1] = (unsigned long) addr;
  187. args[2] = (unsigned long) paddrlen;
  188. return __socketcall(SYS_GETSOCKNAME, args);
  189. }
  190. #endif
  191. libc_hidden_def(getsockname)
  192. #endif
  193. #ifdef L_getsockopt
  194. #ifdef __NR_getsockopt
  195. _syscall5(int, getsockopt, int, fd, int, level, int, optname, __ptr_t, optval, socklen_t *, optlen)
  196. #elif defined(__NR_socketcall)
  197. int getsockopt(int fd, int level, int optname, __ptr_t optval,
  198. socklen_t * optlen)
  199. {
  200. unsigned long args[5];
  201. args[0] = fd;
  202. args[1] = level;
  203. args[2] = optname;
  204. args[3] = (unsigned long) optval;
  205. args[4] = (unsigned long) optlen;
  206. return (__socketcall(SYS_GETSOCKOPT, args));
  207. }
  208. #endif
  209. #endif
  210. #ifdef L_listen
  211. #ifdef __NR_listen
  212. _syscall2(int, listen, int, sockfd, int, backlog)
  213. #elif defined(__NR_socketcall)
  214. int listen(int sockfd, int backlog)
  215. {
  216. unsigned long args[2];
  217. args[0] = sockfd;
  218. args[1] = backlog;
  219. return __socketcall(SYS_LISTEN, args);
  220. }
  221. #endif
  222. libc_hidden_def(listen)
  223. #endif
  224. #ifdef L_recv
  225. extern __typeof(recv) __libc_recv;
  226. #ifdef __NR_recv
  227. #define __NR___sys_recv __NR_recv
  228. static
  229. _syscall4(ssize_t, __sys_recv, int, sockfd, __ptr_t, buffer, size_t, len,
  230. int, flags)
  231. ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags)
  232. {
  233. if (SINGLE_THREAD_P)
  234. return __sys_recv(sockfd, buffer, len, flags);
  235. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  236. int oldtype = LIBC_CANCEL_ASYNC ();
  237. int result = __sys_recv(sockfd, buffer, len, flags);
  238. LIBC_CANCEL_RESET (oldtype);
  239. return result;
  240. #endif
  241. }
  242. #elif defined(__NR_socketcall)
  243. /* recv, recvfrom added by bir7@leland.stanford.edu */
  244. ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags)
  245. {
  246. unsigned long args[4];
  247. args[0] = sockfd;
  248. args[1] = (unsigned long) buffer;
  249. args[2] = len;
  250. args[3] = flags;
  251. if (SINGLE_THREAD_P)
  252. return (__socketcall(SYS_RECV, args));
  253. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  254. int oldtype = LIBC_CANCEL_ASYNC ();
  255. int result = __socketcall(SYS_RECV, args);
  256. LIBC_CANCEL_RESET (oldtype);
  257. return result;
  258. #endif
  259. }
  260. #elif defined(__NR_recvfrom)
  261. ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags)
  262. {
  263. return (recvfrom(sockfd, buffer, len, flags, NULL, NULL));
  264. }
  265. #endif
  266. weak_alias(__libc_recv,recv)
  267. libc_hidden_weak(recv)
  268. #endif
  269. #ifdef L_recvfrom
  270. extern __typeof(recvfrom) __libc_recvfrom;
  271. #ifdef __NR_recvfrom
  272. #define __NR___sys_recvfrom __NR_recvfrom
  273. static
  274. _syscall6(ssize_t, __sys_recvfrom, int, sockfd, __ptr_t, buffer, size_t, len,
  275. int, flags, struct sockaddr *, to, socklen_t *, tolen)
  276. ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags,
  277. struct sockaddr *to, socklen_t * tolen)
  278. {
  279. if (SINGLE_THREAD_P)
  280. return __sys_recvfrom(sockfd, buffer, len, flags, to, tolen);
  281. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  282. int oldtype = LIBC_CANCEL_ASYNC ();
  283. int result = __sys_recvfrom(sockfd, buffer, len, flags, to, tolen);
  284. LIBC_CANCEL_RESET (oldtype);
  285. return result;
  286. #endif
  287. }
  288. #elif defined(__NR_socketcall)
  289. /* recv, recvfrom added by bir7@leland.stanford.edu */
  290. ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags,
  291. struct sockaddr *to, socklen_t * tolen)
  292. {
  293. unsigned long args[6];
  294. args[0] = sockfd;
  295. args[1] = (unsigned long) buffer;
  296. args[2] = len;
  297. args[3] = flags;
  298. args[4] = (unsigned long) to;
  299. args[5] = (unsigned long) tolen;
  300. if (SINGLE_THREAD_P)
  301. return (__socketcall(SYS_RECVFROM, args));
  302. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  303. int oldtype = LIBC_CANCEL_ASYNC ();
  304. int result = __socketcall(SYS_RECVFROM, args);
  305. LIBC_CANCEL_RESET (oldtype);
  306. return result;
  307. #endif
  308. }
  309. #endif
  310. weak_alias(__libc_recvfrom,recvfrom)
  311. libc_hidden_weak(recvfrom)
  312. #endif
  313. #ifdef L_recvmsg
  314. extern __typeof(recvmsg) __libc_recvmsg;
  315. #ifdef __NR_recvmsg
  316. #define __NR___sys_recvmsg __NR_recvmsg
  317. static
  318. _syscall3(ssize_t, __sys_recvmsg, int, sockfd, struct msghdr *, msg, int, flags)
  319. ssize_t __libc_recvmsg(int sockfd, struct msghdr *msg, int flags)
  320. {
  321. if (SINGLE_THREAD_P)
  322. return __sys_recvmsg(sockfd, msg, flags);
  323. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  324. int oldtype = LIBC_CANCEL_ASYNC ();
  325. int result = __sys_recvmsg(sockfd, msg, flags);
  326. LIBC_CANCEL_RESET (oldtype);
  327. return result;
  328. #endif
  329. }
  330. #elif defined(__NR_socketcall)
  331. ssize_t __libc_recvmsg(int sockfd, struct msghdr *msg, int flags)
  332. {
  333. unsigned long args[3];
  334. args[0] = sockfd;
  335. args[1] = (unsigned long) msg;
  336. args[2] = flags;
  337. if (SINGLE_THREAD_P)
  338. return (__socketcall(SYS_RECVMSG, args));
  339. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  340. int oldtype = LIBC_CANCEL_ASYNC ();
  341. int result = __socketcall(SYS_RECVMSG, args);
  342. LIBC_CANCEL_RESET (oldtype);
  343. return result;
  344. #endif
  345. }
  346. #endif
  347. weak_alias(__libc_recvmsg,recvmsg)
  348. libc_hidden_weak(recvmsg)
  349. #endif
  350. #ifdef L_send
  351. extern __typeof(send) __libc_send;
  352. #ifdef __NR_send
  353. #define __NR___sys_send __NR_send
  354. static
  355. _syscall4(ssize_t, __sys_send, int, sockfd, const void *, buffer, size_t, len, int, flags)
  356. ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags)
  357. {
  358. if (SINGLE_THREAD_P)
  359. return __sys_send(sockfd, buffer, len, flags);
  360. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  361. int oldtype = LIBC_CANCEL_ASYNC ();
  362. int result = __sys_send(sockfd, buffer, len, flags);
  363. LIBC_CANCEL_RESET (oldtype);
  364. return result;
  365. #endif
  366. }
  367. #elif defined(__NR_socketcall)
  368. /* send, sendto added by bir7@leland.stanford.edu */
  369. ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags)
  370. {
  371. unsigned long args[4];
  372. args[0] = sockfd;
  373. args[1] = (unsigned long) buffer;
  374. args[2] = len;
  375. args[3] = flags;
  376. if (SINGLE_THREAD_P)
  377. return (__socketcall(SYS_SEND, args));
  378. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  379. int oldtype = LIBC_CANCEL_ASYNC ();
  380. int result = __socketcall(SYS_SEND, args);
  381. LIBC_CANCEL_RESET (oldtype);
  382. return result;
  383. #endif
  384. }
  385. #elif defined(__NR_sendto)
  386. ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags)
  387. {
  388. return (sendto(sockfd, buffer, len, flags, NULL, 0));
  389. }
  390. #endif
  391. weak_alias(__libc_send,send)
  392. libc_hidden_weak(send)
  393. #endif
  394. #ifdef L_sendmsg
  395. extern __typeof(sendmsg) __libc_sendmsg;
  396. #ifdef __NR_sendmsg
  397. #define __NR___sys_sendmsg __NR_sendmsg
  398. static
  399. _syscall3(ssize_t, __sys_sendmsg, int, sockfd, const struct msghdr *, msg, int, flags)
  400. ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags)
  401. {
  402. if (SINGLE_THREAD_P)
  403. return __sys_sendmsg(sockfd, msg, flags);
  404. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  405. int oldtype = LIBC_CANCEL_ASYNC ();
  406. int result = __sys_sendmsg(sockfd, msg, flags);
  407. LIBC_CANCEL_RESET (oldtype);
  408. return result;
  409. #endif
  410. }
  411. #elif defined(__NR_socketcall)
  412. ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags)
  413. {
  414. unsigned long args[3];
  415. args[0] = sockfd;
  416. args[1] = (unsigned long) msg;
  417. args[2] = flags;
  418. if (SINGLE_THREAD_P)
  419. return (__socketcall(SYS_SENDMSG, args));
  420. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  421. int oldtype = LIBC_CANCEL_ASYNC ();
  422. int result = __socketcall(SYS_SENDMSG, args);
  423. LIBC_CANCEL_RESET (oldtype);
  424. return result;
  425. #endif
  426. }
  427. #endif
  428. weak_alias(__libc_sendmsg,sendmsg)
  429. libc_hidden_weak(sendmsg)
  430. #endif
  431. #ifdef L_sendto
  432. extern __typeof(sendto) __libc_sendto;
  433. #ifdef __NR_sendto
  434. #define __NR___sys_sendto __NR_sendto
  435. static
  436. _syscall6(ssize_t, __sys_sendto, int, sockfd, const void *, buffer,
  437. size_t, len, int, flags, const struct sockaddr *, to, socklen_t, tolen)
  438. ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags,const struct sockaddr *to, socklen_t tolen)
  439. {
  440. if (SINGLE_THREAD_P)
  441. return __sys_sendto(sockfd, buffer, len, flags, to, tolen);
  442. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  443. int oldtype = LIBC_CANCEL_ASYNC ();
  444. int result = __sys_sendto(sockfd, buffer, len, flags, to, tolen);
  445. LIBC_CANCEL_RESET (oldtype);
  446. return result;
  447. #endif
  448. }
  449. #elif defined(__NR_socketcall)
  450. /* send, sendto added by bir7@leland.stanford.edu */
  451. ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags,
  452. const struct sockaddr *to, socklen_t tolen)
  453. {
  454. unsigned long args[6];
  455. args[0] = sockfd;
  456. args[1] = (unsigned long) buffer;
  457. args[2] = len;
  458. args[3] = flags;
  459. args[4] = (unsigned long) to;
  460. args[5] = tolen;
  461. if (SINGLE_THREAD_P)
  462. return (__socketcall(SYS_SENDTO, args));
  463. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  464. int oldtype = LIBC_CANCEL_ASYNC ();
  465. int result = __socketcall(SYS_SENDTO, args);
  466. LIBC_CANCEL_RESET (oldtype);
  467. return result;
  468. #endif
  469. }
  470. #endif
  471. weak_alias(__libc_sendto,sendto)
  472. libc_hidden_weak(sendto)
  473. #endif
  474. #ifdef L_setsockopt
  475. #ifdef __NR_setsockopt
  476. _syscall5(int, setsockopt, int, fd, int, level, int, optname, const void *, optval, socklen_t, optlen)
  477. #elif defined(__NR_socketcall)
  478. /* [sg]etsockoptions by bir7@leland.stanford.edu */
  479. int setsockopt(int fd, int level, int optname, const void *optval,
  480. socklen_t optlen)
  481. {
  482. unsigned long args[5];
  483. args[0] = fd;
  484. args[1] = level;
  485. args[2] = optname;
  486. args[3] = (unsigned long) optval;
  487. args[4] = optlen;
  488. return (__socketcall(SYS_SETSOCKOPT, args));
  489. }
  490. #endif
  491. libc_hidden_def(setsockopt)
  492. #endif
  493. #ifdef L_shutdown
  494. #ifdef __NR_shutdown
  495. _syscall2(int, shutdown, int, sockfd, int, how)
  496. #elif defined(__NR_socketcall)
  497. /* shutdown by bir7@leland.stanford.edu */
  498. int shutdown(int sockfd, int how)
  499. {
  500. unsigned long args[2];
  501. args[0] = sockfd;
  502. args[1] = how;
  503. return (__socketcall(SYS_SHUTDOWN, args));
  504. }
  505. #endif
  506. #endif
  507. #ifdef L_socket
  508. #ifdef __NR_socket
  509. _syscall3(int, socket, int, family, int, type, int, protocol)
  510. #elif defined(__NR_socketcall)
  511. int socket(int family, int type, int protocol)
  512. {
  513. unsigned long args[3];
  514. args[0] = family;
  515. args[1] = type;
  516. args[2] = (unsigned long) protocol;
  517. return __socketcall(SYS_SOCKET, args);
  518. }
  519. #endif
  520. libc_hidden_def(socket)
  521. #endif
  522. #ifdef L_socketpair
  523. #ifdef __NR_socketpair
  524. _syscall4(int, socketpair, int, family, int, type, int, protocol, int *, sockvec)
  525. #elif defined(__NR_socketcall)
  526. int socketpair(int family, int type, int protocol, int sockvec[2])
  527. {
  528. unsigned long args[4];
  529. args[0] = family;
  530. args[1] = type;
  531. args[2] = protocol;
  532. args[3] = (unsigned long) sockvec;
  533. return __socketcall(SYS_SOCKETPAIR, args);
  534. }
  535. #endif
  536. #endif