diff options
author | No author <no_author@ocaml.org> | 1995-06-15 16:08:54 +0000 |
---|---|---|
committer | No author <no_author@ocaml.org> | 1995-06-15 16:08:54 +0000 |
commit | 77b1c8b89fd8940a63b17c41eb37161e5d159831 (patch) | |
tree | 43dbfb3982d9166b717199cb8faa97bdce30add7 /otherlibs/unix/sendrecv.c | |
parent | ba79d4bd1f01a70b892c69f6a5e6e86714a023d6 (diff) | |
download | ocaml-unlabeled-1.2.2.tar.gz |
This commit was manufactured by cvs2svn to create branchunlabeled-1.2.2
'unlabeled-1.2.2'.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/unlabeled-1.2.2@37 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/unix/sendrecv.c')
-rw-r--r-- | otherlibs/unix/sendrecv.c | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/otherlibs/unix/sendrecv.c b/otherlibs/unix/sendrecv.c deleted file mode 100644 index 82f7ebf1d3..0000000000 --- a/otherlibs/unix/sendrecv.c +++ /dev/null @@ -1,87 +0,0 @@ -#include <mlvalues.h> -#include <alloc.h> -#include <memory.h> -#include "unix.h" - -#ifdef HAS_SOCKETS -#include "socketaddr.h" -#endif - -#if defined(HAS_SOCKETS) && defined(MSG_OOB) && defined(MSG_DONTROUTE) && defined(MSG_PEEK) - -static int msg_flag_table[] = { - MSG_OOB, MSG_DONTROUTE, MSG_PEEK -}; - -value unix_recv(sock, buff, ofs, len, flags) /* ML */ - value sock, buff, ofs, len, flags; -{ - int ret; - enter_blocking_section(); - ret = recv(Int_val(sock), &Byte(buff, Long_val(ofs)), Int_val(len), - convert_flag_list(flags, msg_flag_table)); - leave_blocking_section(); - if (ret == -1) uerror("recv", Nothing); - return Val_int(ret); -} - -value unix_recvfrom(sock, buff, ofs, len, flags) /* ML */ - value sock, buff, ofs, len, flags; -{ - int retcode; - value res; - Push_roots(a, 1); - - sock_addr_len = sizeof(sock_addr); - enter_blocking_section(); - retcode = recvfrom(Int_val(sock), &Byte(buff, Long_val(ofs)), Int_val(len), - convert_flag_list(flags, msg_flag_table), - &sock_addr.s_gen, &sock_addr_len); - leave_blocking_section(); - if (retcode == -1) uerror("recvfrom", Nothing); - a[0] = alloc_sockaddr(); - res = alloc_tuple(2); - Field(res, 0) = Val_int(retcode); - Field(res, 1) = a[0]; - Pop_roots(); - return res; -} - -value unix_send(sock, buff, ofs, len, flags) /* ML */ - value sock, buff, ofs, len, flags; -{ - int ret; - enter_blocking_section(); - ret = send(Int_val(sock), &Byte(buff, Long_val(ofs)), Int_val(len), - convert_flag_list(flags, msg_flag_table)); - leave_blocking_section(); - if (ret == -1) uerror("send", Nothing); - return Val_int(ret); -} - -value unix_sendto(argv, argc) /* ML */ - value * argv; - int argc; -{ - int ret; - get_sockaddr(argv[5]); - enter_blocking_section(); - ret = sendto(Int_val(argv[0]), &Byte(argv[1], Long_val(argv[2])), - Int_val(argv[3]), convert_flag_list(argv[4], msg_flag_table), - &sock_addr.s_gen, sock_addr_len); - leave_blocking_section(); - if (ret == -1) uerror("sendto", Nothing); - return Val_int(ret); -} - -#else - -value unix_recv() { invalid_argument("recv not implemented"); } - -value unix_recvfrom() { invalid_argument("recvfrom not implemented"); } - -value unix_send() { invalid_argument("send not implemented"); } - -value unix_sendto() { invalid_argument("sendto not implemented"); } - -#endif |