ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzab6_5.4.0.1/cunix98.htm

404 lines
21 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="UNIX 98 compatibility" />
<meta name="abstract" content="Created by The Open Group, a consortium of developers and venders, UNIX 98 improved the inter-operability of the UNIX operating system while incorporating much of the Internet-related function for which UNIX had become known." />
<meta name="description" content="Created by The Open Group, a consortium of developers and venders, UNIX 98 improved the inter-operability of the UNIX operating system while incorporating much of the Internet-related function for which UNIX had become known." />
<meta name="DC.Relation" scheme="URI" content="aconcepts.htm" />
<meta name="DC.Relation" scheme="URI" content="howdosockets.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/accept.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/acceptr.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/connec.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/sendms.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/connec.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/recvfr.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/recvms.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/rbind.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/recv.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/bind.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/gsockn.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/socket.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/socketp.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/listen.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/ioctl.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/gpeern.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/close.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/ehostnt.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/enetnt.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/eprotnt.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/esrvnt.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/ghostnm.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/getaddrinfo.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/ghosta.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/getnameinfo.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/tsghosta.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/ghostn.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/ghostnt.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/gnetadr.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/gnetnm.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/gnetnt.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/gprotnm.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/gprotnu.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/gprotnt.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/gsocko.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/gsrvnm.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/gsrvprt.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/gsrvnt.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/inaddr.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/inlnao.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/inmaka.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/inneto.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/innetw.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/send.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/sendto.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/shostnt.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/snetnt.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/sprotnt.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/ssrvnt.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/ssocko.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2001, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2001, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="cunix98" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>UNIX 98
compatibility</title>
</head>
<body id="cunix98"><a name="cunix98"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">UNIX 98
compatibility</h1>
<div><p>Created by The Open Group, a consortium of developers and venders, UNIX<sup>®</sup> 98
improved the inter-operability of the UNIX operating system while incorporating
much of the Internet-related function for which UNIX had become known.</p>
<div class="section"><p>i5/OS™ sockets provide programmers the ability to write
socket applications that are compatible with UNIX 98 operating environment. Currently, IBM<sup>®</sup> supports
two versions of most sockets APIs. The base i5/OS API uses Berkeley Socket Distribution
(BSD) 4.3 structures and syntax. The other uses syntax and structures compatible
with BSD 4.4 and the UNIX 98 programming interface specifications. You can
select the UNIX 98
compatible interface by defining the _XOPEN_SOURCE macro to a value of 520
or greater.</p>
</div>
<div class="section"><h4 class="sectiontitle">Differences in address structure for UNIX 98 compatible
applications</h4><p>When you specify the _XOPEN_OPEN macro, you can write
UNIX 98
compatible applications with the same address families that are used in default i5/OS implementations;
however, there are differences in the <strong>sockaddr</strong> address structure. The
table compares the BSD 4.3<strong> sockaddr </strong> address structure with the UNIX 98
compatible address structure:</p>
</div>
<div class="section">
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><caption>Table 1. Comparison of BSD 4.3 and UNIX 98/BSD 4.4 socket address structure</caption><thead align="left"><tr><th valign="top" id="d0e84">BSD 4.3 structure</th>
<th valign="top" id="d0e86">BSD 4.4/ UNIX 98 compatible structure</th>
</tr>
</thead>
<tbody><tr><td colspan="2" valign="top" headers="d0e84 d0e86 "><strong>sockaddr address structure</strong></td>
</tr>
<tr><td valign="top" headers="d0e84 "> <pre>struct sockaddr {
u_short sa_family;
char sa_data[14];
};</pre>
</td>
<td valign="top" headers="d0e86 "> <pre>struct sockaddr {
uint8_t sa_len;
sa_family_t sa_family
char sa_data[14];
};</pre>
</td>
</tr>
<tr><td colspan="2" valign="top" headers="d0e84 d0e86 "><strong>sockaddr_in address structure</strong></td>
</tr>
<tr><td valign="top" headers="d0e84 "> <pre>struct sockaddr_in {
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};</pre>
</td>
<td valign="top" headers="d0e86 "> <pre> struct sockaddr_in {
uint8_t sin_len;
sa_family_t sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};</pre>
</td>
</tr>
<tr><td colspan="2" valign="top" headers="d0e84 d0e86 "><strong>sockaddr_in6 address structure</strong></td>
</tr>
<tr><td valign="top" headers="d0e84 "> <pre> struct sockaddr_in6 {
sa_family_t sin6_family;
in_port_t sin6_port;
uint32_t sin6_flowinfo;
struct in6_addr sin6_addr;
uint32_t sin6_scope_id;
};</pre>
</td>
<td valign="top" headers="d0e86 "> <pre> struct sockaddr_in6 {
uint8_t sin6_len;
sa_family_t sin6_family;
in_port_t sin6_port;
uint32_t sin6_flowinfo;
struct in6_addr sin6_addr;
uint32_t sin6_scope_id;
};</pre>
</td>
</tr>
<tr><td colspan="2" valign="top" headers="d0e84 d0e86 "> <strong>sockaddr_un address structure</strong></td>
</tr>
<tr><td valign="top" headers="d0e84 "> <pre>struct sockaddr_un {
short sun_family;
char sun_path[126];
}; </pre>
</td>
<td valign="top" headers="d0e86 "> <pre>struct sockaddr_un {
uint8_t sun_len;
sa_family_t sun_family;
char sun_path[126]
};</pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><h4 class="sectiontitle">API differences</h4><p>When you develop in ILE-based languages
and an application is compiled with the _XOPEN_SOURCE macro, some sockets
APIs are mapped to internal names. These internal names provide the same function
as the original API. The table lists these affected APIs. If you are writing
socket applications in some other C-based language, you can write directly
to the internal name of these APIs. Use the link to the original API to see
usage notes and details for both versions of these APIs.</p>
</div>
<div class="section">
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><caption>Table 2. API and UNIX 98 equivelant name</caption><thead align="left"><tr><th valign="top" id="d0e162">API name</th>
<th valign="top" id="d0e164">Internal name</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e162 "><span class="apiname">accept()</span></td>
<td valign="top" headers="d0e164 ">qso_accept98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">accept_and_recv()</span></td>
<td valign="top" headers="d0e164 ">qso_accept_and_recv98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">bind()</span></td>
<td valign="top" headers="d0e164 ">qso_bind98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">connect()</span></td>
<td valign="top" headers="d0e164 ">qso_connect98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">endhostent()</span></td>
<td valign="top" headers="d0e164 ">qso_endhostent98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">endnetent()</span></td>
<td valign="top" headers="d0e164 ">qso_endnetent98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">endprotoent()</span></td>
<td valign="top" headers="d0e164 ">qso_endprotoent98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">endservent()</span></td>
<td valign="top" headers="d0e164 ">qso_endservent98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getaddrinfo()</span></td>
<td valign="top" headers="d0e164 ">qso_getaddrinfo98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">gethostbyaddr()</span></td>
<td valign="top" headers="d0e164 ">qso_gethostbyaddr98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">gethostbyaddr_r()</span></td>
<td valign="top" headers="d0e164 ">qso_gethostbyaddr_r98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">gethostname()</span></td>
<td valign="top" headers="d0e164 ">qso_gethostname98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">gethostname_r()</span></td>
<td valign="top" headers="d0e164 ">qso_gethostname_r98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">gethostbyname()</span></td>
<td valign="top" headers="d0e164 ">qso_gethostbyname98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">gethostent()</span></td>
<td valign="top" headers="d0e164 ">qso_gethostent98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getnameinfo()</span></td>
<td valign="top" headers="d0e164 ">qso_getnameinfo98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getnetbyaddr()</span></td>
<td valign="top" headers="d0e164 ">qso_getnetbyaddr98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getnetbyname()</span></td>
<td valign="top" headers="d0e164 ">qso_getnetbyname98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getnetent()</span></td>
<td valign="top" headers="d0e164 ">qso_getnetent98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getpeername()</span></td>
<td valign="top" headers="d0e164 ">qso_getpeername98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getprotobyname()</span></td>
<td valign="top" headers="d0e164 ">qso_getprotobyname98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getprotobynumber()</span></td>
<td valign="top" headers="d0e164 ">qso_getprotobynumber98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getprotoent()</span></td>
<td valign="top" headers="d0e164 ">qso_getprotoent98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getsockname()</span></td>
<td valign="top" headers="d0e164 ">qso_getsockname98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getsockopt()</span></td>
<td valign="top" headers="d0e164 ">qso_getsockopt98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getservbyname()</span></td>
<td valign="top" headers="d0e164 ">qso_getservbyname98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getservbyport()</span></td>
<td valign="top" headers="d0e164 ">qso_getservbyport98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">getservent()</span></td>
<td valign="top" headers="d0e164 ">qso_getservent98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">inet_addr()</span></td>
<td valign="top" headers="d0e164 ">qso_inet_addr98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">inet_lnaof()</span></td>
<td valign="top" headers="d0e164 ">qso_inet_lnaof98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">inet_makeaddr()</span></td>
<td valign="top" headers="d0e164 ">qso_inet_makeaddr98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">inet_netof()</span></td>
<td valign="top" headers="d0e164 ">qso_inet_netof98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">inet_network()</span></td>
<td valign="top" headers="d0e164 ">qso_inet_network98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">listen()</span></td>
<td valign="top" headers="d0e164 ">qso_listen98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">Rbind()</span></td>
<td valign="top" headers="d0e164 ">qso_Rbind98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">recv()</span></td>
<td valign="top" headers="d0e164 ">qso_recv98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">recvfrom()</span></td>
<td valign="top" headers="d0e164 ">qso_recvfrom98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">recvmsg()</span></td>
<td valign="top" headers="d0e164 ">qso_recvmsg98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">send()</span></td>
<td valign="top" headers="d0e164 ">qso_send98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">sendmsg()</span></td>
<td valign="top" headers="d0e164 ">qso_sendmsg98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">sendto()</span></td>
<td valign="top" headers="d0e164 ">qso_sendto98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">sethostent()</span></td>
<td valign="top" headers="d0e164 ">qso_sethostent98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">setnetent()</span></td>
<td valign="top" headers="d0e164 ">qso_setnetent98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">setprotoent()</span></td>
<td valign="top" headers="d0e164 ">qso_setprotoent98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">setservent()</span></td>
<td valign="top" headers="d0e164 ">qso_setprotoent98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">setsockopt()</span></td>
<td valign="top" headers="d0e164 ">qso_setsockopt98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">shutdown()</span></td>
<td valign="top" headers="d0e164 ">qso_shutdown98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">socket()</span></td>
<td valign="top" headers="d0e164 ">qso_socket98()</td>
</tr>
<tr><td valign="top" headers="d0e162 "><span class="apiname">socketpair()</span></td>
<td valign="top" headers="d0e164 ">qso_socketpair98()</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="aconcepts.htm" title="Advanced socket concepts go beyond a general discussion of what sockets are and how they work. They provide ways to design socket applications for larger and more complex networks.">Advanced socket concepts</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="howdosockets.htm" title="Sockets are commonly used for client/server interaction. Typical system configuration places the server on one machine, with the clients on other machines. The clients connect to the server, exchange information, and then disconnect.">How sockets work</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../apis/accept.htm">accept()</a></div>
<div><a href="../apis/acceptr.htm">accept_and_recv()</a></div>
<div><a href="../apis/connec.htm">connect()</a></div>
<div><a href="../apis/sendms.htm">sendmsg()</a></div>
<div><a href="../apis/recvfr.htm">recvfrom()</a></div>
<div><a href="../apis/recvms.htm">recvmsg()</a></div>
<div><a href="../apis/rbind.htm">Rbind()</a></div>
<div><a href="../apis/recv.htm">recv()</a></div>
<div><a href="../apis/bind.htm">bind()</a></div>
<div><a href="../apis/gsockn.htm">getsockname()</a></div>
<div><a href="../apis/socket.htm">socket()</a></div>
<div><a href="../apis/socketp.htm">socketpair()</a></div>
<div><a href="../apis/listen.htm">listen()</a></div>
<div><a href="../apis/ioctl.htm">ioctl()</a></div>
<div><a href="../apis/gpeern.htm">getpeername()</a></div>
<div><a href="../apis/close.htm">close()</a></div>
<div><a href="../apis/ehostnt.htm">endhostent()</a></div>
<div><a href="../apis/enetnt.htm">endnetent()</a></div>
<div><a href="../apis/eprotnt.htm">endprotoent()</a></div>
<div><a href="../apis/esrvnt.htm">endservent()</a></div>
<div><a href="../apis/ghostnm.htm">gethostbyname()</a></div>
<div><a href="../apis/getaddrinfo.htm">getaddrinfo()</a></div>
<div><a href="../apis/ghosta.htm">gethostbyaddr()</a></div>
<div><a href="../apis/getnameinfo.htm">getnameinfo()</a></div>
<div><a href="../apis/tsghosta.htm">gethostbyaddr_r()</a></div>
<div><a href="../apis/ghostn.htm">gethostname()</a></div>
<div><a href="../apis/ghostnt.htm">gethostent()</a></div>
<div><a href="../apis/gnetadr.htm">getnetbyaddr()</a></div>
<div><a href="../apis/gnetnm.htm">getnetbyname()</a></div>
<div><a href="../apis/gnetnt.htm">getnetent()</a></div>
<div><a href="../apis/gprotnm.htm">getprotobyname()</a></div>
<div><a href="../apis/gprotnu.htm">getprotobynumber()</a></div>
<div><a href="../apis/gprotnt.htm">getprotoent()</a></div>
<div><a href="../apis/gsocko.htm">getsockopt()</a></div>
<div><a href="../apis/gsrvnm.htm">getservbyname()</a></div>
<div><a href="../apis/gsrvprt.htm">getservbyport()</a></div>
<div><a href="../apis/gsrvnt.htm">getservent()</a></div>
<div><a href="../apis/inaddr.htm">inet_addr()</a></div>
<div><a href="../apis/inlnao.htm">inet_1naof()</a></div>
<div><a href="../apis/inmaka.htm">inet_makeaddr()</a></div>
<div><a href="../apis/inneto.htm">inet_netof()</a></div>
<div><a href="../apis/innetw.htm">inet_network()</a></div>
<div><a href="../apis/send.htm">send()</a></div>
<div><a href="../apis/sendto.htm">sendto()</a></div>
<div><a href="../apis/shostnt.htm">sethostent()</a></div>
<div><a href="../apis/snetnt.htm">setnetent()</a></div>
<div><a href="../apis/sprotnt.htm">setprotoent()</a></div>
<div><a href="../apis/ssrvnt.htm">setservent()</a></div>
<div><a href="../apis/ssocko.htm">setsockopt()</a></div>
</div>
</div>
</body>
</html>