Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/runtime/c-libs/smlnj-sockets/getpeername.c
ViewVC logotype

Annotation of /sml/trunk/src/runtime/c-libs/smlnj-sockets/getpeername.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1489 - (view) (download) (as text)

1 : monnier 249 /* getpeername.c
2 :     *
3 :     * COPYRIGHT (c) 1995 AT&T Bell Laboratories.
4 :     */
5 :    
6 :     #include "sockets-osdep.h"
7 :     #include INCLUDE_SOCKET_H
8 :     #include "ml-base.h"
9 :     #include "ml-values.h"
10 :     #include "ml-objects.h"
11 :     #include "ml-c.h"
12 :     #include "cfun-proto-list.h"
13 :     #include "sock-util.h"
14 :    
15 :     /* _ml_Sock_getpeername : sock -> (af * addr)
16 :     */
17 :     ml_val_t _ml_Sock_getpeername (ml_state_t *msp, ml_val_t arg)
18 :     {
19 : jhr 741 char addr[MAX_SOCK_ADDR_SZB];
20 :     int addrLen = MAX_SOCK_ADDR_SZB;
21 : monnier 249
22 : jhr 741 if (getpeername (INT_MLtoC(arg), (struct sockaddr *)addr, &addrLen) < 0)
23 : monnier 249 return RAISE_SYSERR(msp, sts);
24 :     else {
25 :     ml_val_t cdata = ML_CData(msp, addr, addrLen);
26 : jhr 741 ml_val_t res;
27 : monnier 249
28 : jhr 741 SEQHDR_ALLOC (msp, res, DESC_word8vec, cdata, addrLen);
29 : monnier 249 return res;
30 :     }
31 :    
32 :     } /* end of _ml_Sock_getpeername */

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0