[PATCH 083/114] Add <sys/socket.h> header for Phoenix.

Jakub Sejdak jakub.sejdak@phoesys.com
Mon Apr 11 10:27:00 GMT 2016


From: Kuba Sejdak <jakub.sejdak@phoesys.com>

---
 newlib/libc/sys/phoenix/sys/socket.h | 57 ++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 newlib/libc/sys/phoenix/sys/socket.h

diff --git a/newlib/libc/sys/phoenix/sys/socket.h b/newlib/libc/sys/phoenix/sys/socket.h
new file mode 100644
index 0000000..8b4c802
--- /dev/null
+++ b/newlib/libc/sys/phoenix/sys/socket.h
@@ -0,0 +1,57 @@
+/* Copyright (C) 2012-2016 Phoenix Systems (http://www.phoesys.com/).
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_SOCKET_H
+#define	_SYS_SOCKET_H
+
+#include <phoenix/socket.h>
+#include <sys/types.h>
+
+#define	_SS_MAXSIZE		128U
+#define	_SS_ALIGNSIZE	(sizeof(int64_t))
+#define	_SS_PAD1SIZE	(_SS_ALIGNSIZE - sizeof(unsigned char) - sizeof(sa_family_t))
+#define	_SS_PAD2SIZE	(_SS_MAXSIZE - sizeof(unsigned char) - sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE)
+
+struct sockaddr_storage {
+	unsigned char ss_len;			/* Aaddress length */
+	sa_family_t	ss_family;			/* Address family */
+	char __ss_pad1[_SS_PAD1SIZE];
+	int64_t __ss_align;				/* Force desired structure storage alignment */
+	char __ss_pad2[_SS_PAD2SIZE];
+};
+
+int socket(int domain, int type, int protocol);
+int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
+int listen(int sockfd, int backlog);
+int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
+int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
+int sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen);
+int send(int sockfd, const void *buf, size_t len, int flags);
+int recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen);
+int recv(int sockfd, void *buf, size_t len, int flags);
+
+int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
+int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
+int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
+
+int	shutdown(int, int);
+int	socketpair(int, int, int, int *);
+
+int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
+
+#endif
-- 
2.5.0



More information about the Newlib mailing list