2 % (c) The GRASP/AQUA Project, Glasgow University, 1996
4 \subsection[getSockName.lc]{Return name of process assoc with socket}
11 #ifdef HAVE_SYS_TYPES_H
12 #include <sys/types.h>
15 #ifdef HAVE_SYS_SOCKET_H
16 #include <sys/socket.h>
21 getSockName(int sockfd, struct sockaddr *peer, int *namelen)
25 while ((name = getsockname(sockfd, peer, namelen)) < 0) {
33 ghc_errtype = ERR_INVALIDARGUMENT;
34 ghc_errstr = "Not a valid write descriptor";
37 ghc_errtype = ERR_INVALIDARGUMENT;
38 ghc_errstr = "Data not in writeable part of user address space";
41 ghc_errtype = ERR_RESOURCEEXHAUSTED;
42 ghc_errstr = "Insuffcient resources";
45 ghc_errtype = ERR_INVALIDARGUMENT;
46 ghc_errstr = "Descriptor is not a socket";