<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation"> <title>sethostid()--Set Host ID</title> <!-- 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. --> <!-- Begin Header Records ========================================== --> <!-- Unix8 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 --> <!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 --> <!--End Header Records --> <!-- Edited by Kersten Feb 02 --> <link rel="stylesheet" type="text/css" href="../rzahg/ic.css"> </head> <body> <a name="Top_Of_Page"></a> <!-- Java sync-link --> <script type="text/javascript" language="Javascript" src="../rzahg/synch.js"> </script> <h2>sethostid()--Set Host ID</h2> <div class="box" style="width: 50%;"> <br> Syntax<br> <pre> #include <sys/types.h> #include <sys/socket.h> int sethostid(int <em>host_id</em>) </pre> <br> Service Program Name: QSOSRV1<br> <!-- iddvc RMBR --> <br> Default Public Authority: *USE<br> <!-- iddvc RMBR --> <br> Threadsafe: Yes<br> <!-- iddvc RMBR --> <br> </div> <p>The <em>sethostid()</em> function is used to set a host ID.</p> <br> <h3>Parameters</h3> <dl> <dt><strong>host_id</strong></dt> <dd>(Input) The 32-bit <em>host_id</em></dd> </dl> <br> <h3>Authorities</h3> <p>No authorization is required.</p> <br> <h3>Return Value</h3> <p><em>sethostid()</em> returns an integer. Possible values are:</p> <ul> <li>-1 (unsuccessful)<br> <br> </li> <li>0 (successful)</li> </ul> <br> <h3>Error Conditions</h3> <p>When <em>sethostid()</em> fails, <em>errno</em> can be set to one of the following:</p> <table cellpadding="5"> <!-- cols="15 85" --> <tr> <td align="left" valign="top"><em>[EIO]</em></td> <td align="left" valign="top">Input/output error.<br> <br> </td> </tr> <tr> <td align="left" valign="top"><em>[EPERM]</em></td> <td align="left" valign="top">Operation not permitted. <p>The process does not have the appropriate privileges to use <em>sethostid()</em>.</p> </td> </tr> <tr> <td align="left" valign="top"><em>[EUNKNOWN]</em></td> <td align="left" valign="top">Unknown system state.</td> </tr> </table> <br> <br> <h3>Error Messages</h3> <table width="100%" cellpadding="5"> <!-- cols="15 85" --> <tr> <th align="left" valign="top">Message ID</th> <th align="left" valign="top">Error Message Text</th> </tr> <tr> <td width="15%" valign="top">CPE3418 E</td> <td width="85%" valign="top">Possible APAR condition or hardware failure.</td> </tr> <tr> <td align="left" valign="top">CPF9872 E</td> <td align="left" valign="top">Program or service program &1 in library &2 ended. Reason code &3.</td> </tr> <tr> <td align="left" valign="top">CPFA081 E</td> <td align="left" valign="top">Unable to set return value or error code.</td> </tr> </table> <br> <br> <h3>Usage Notes</h3> <ol> <li>A process must have the <samp>*iosyscfg</samp> special authority to use the <em>sethostid()</em>.<br> <br> </li> <li>When a process issues a <em>sethostid()</em>, the <em>host_id</em> can be accessed by ANY process that issues a <em>gethostid()</em>.<br> <br> </li> <li>While many socket implementations refer to the <em>host_id</em> as the IP address of the machine, this is not necessarily the case. Many machines that support the TCP/IP protocol suite support multiple local IP addresses. The value contained in <em>host_id</em> is <strong>not</strong> used by TCP in any manner.<br> <br> </li> <li>The <em>host_id</em> is reset to zero when an initial program load is performed.<br> <br> </li> <li>The <em>host_id</em> is a signed integer. Therefore, a user should be careful to not confuse a return value of -1 from a <em>gethostid()</em> with an error return value. <em>gethostid()</em> never returns an error.</li> </ol> <br> <h3>Related Information</h3> <p><a href="ghosti.htm">gethostid()</a>--Retrieve Host ID Address</p> <br> <hr> API introduced: V3R1 <hr> <center> <table cellpadding="2" cellspacing="2"> <tr align="center"> <td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href="unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a> </td> </tr> </table> </center> </body> </html>