socketcalls.c 15 KB

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