Add Socket Libraries.
Add Posix functions for porting compatibility. Fix compliance issues with ISO/IEC 9899:199409 New Functions: setenv(), fparseln(), GetFileNameFromPath(), rename(), realpath(), setprogname(), getprogname(), strlcat(), strlcpy(), strsep(), setitimer(), getitimer(), timegm(), getopt(), basename(), mkstemp(), ffs(), vsnprintf(), snprintf(), getpass(), usleep(), select(), writev(), strcasecmp(), getcwd(), chdir(), tcgetpgrp(), getpgrp(), gettimeofday(), bcopy(), git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12061 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
679
StdLib/Include/Efi/EfiSocketLib.h
Normal file
679
StdLib/Include/Efi/EfiSocketLib.h
Normal file
@@ -0,0 +1,679 @@
|
||||
/** @file
|
||||
Definitions for the EFI Socket layer library.
|
||||
|
||||
Copyright (c) 2011, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_SOCKET_LIB_H_
|
||||
#define _EFI_SOCKET_LIB_H_
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
|
||||
#include <Protocol/EfiSocket.h>
|
||||
#include <Protocol/ServiceBinding.h>
|
||||
#include <Protocol/Tcp4.h>
|
||||
#include <Protocol/Udp4.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Constants
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define DEBUG_TPL 0x40000000 ///< Display TPL change messages
|
||||
|
||||
#define TPL_SOCKETS TPL_CALLBACK ///< TPL for routine synchronization
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Macros
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */
|
||||
#define DBG_ENTER() DEBUG (( DEBUG_INFO, "Entering " __FUNCTION__ "\n" )) ///< Display routine entry
|
||||
#define DBG_EXIT() DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ "\n" )) ///< Display routine exit
|
||||
#define DBG_EXIT_DEC(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", Status: %d\n", Status )) ///< Display routine exit with decimal value
|
||||
#define DBG_EXIT_HEX(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", Status: 0x%08x\n", Status )) ///< Display routine exit with hex value
|
||||
#define DBG_EXIT_STATUS(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", Status: %r\n", Status )) ///< Display routine exit with status value
|
||||
#define DBG_EXIT_TF(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", returning %s\n", (FALSE == Status) ? L"FALSE" : L"TRUE" )) ///< Display routine with TRUE/FALSE value
|
||||
#else // _MSC_VER
|
||||
#define DBG_ENTER()
|
||||
#define DBG_EXIT()
|
||||
#define DBG_EXIT_DEC(Status)
|
||||
#define DBG_EXIT_HEX(Status)
|
||||
#define DBG_EXIT_STATUS(Status)
|
||||
#define DBG_EXIT_TF(Status)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#define DIM(x) ( sizeof ( x ) / sizeof ( x[0] )) ///< Compute the number of entries in an array
|
||||
|
||||
/**
|
||||
Verify new TPL value
|
||||
|
||||
This macro which is enabled when debug is enabled verifies that
|
||||
the new TPL value is >= the current TPL value.
|
||||
**/
|
||||
#ifdef VERIFY_TPL
|
||||
#undef VERIFY_TPL
|
||||
#endif // VERIFY_TPL
|
||||
|
||||
#if !defined(MDEPKG_NDEBUG)
|
||||
|
||||
#define VERIFY_TPL(tpl) \
|
||||
{ \
|
||||
EFI_TPL PreviousTpl; \
|
||||
\
|
||||
PreviousTpl = gBS->RaiseTPL ( TPL_HIGH_LEVEL ); \
|
||||
gBS->RestoreTPL ( PreviousTpl ); \
|
||||
if ( PreviousTpl > tpl ) { \
|
||||
DEBUG (( DEBUG_ERROR | DEBUG_TPL, \
|
||||
"Current TPL: %d, New TPL: %d\r\n", \
|
||||
PreviousTpl, tpl )); \
|
||||
ASSERT ( PreviousTpl <= tpl ); \
|
||||
} \
|
||||
}
|
||||
|
||||
#else // MDEPKG_NDEBUG
|
||||
|
||||
#define VERIFY_TPL(tpl)
|
||||
|
||||
#endif // MDEPKG_NDEBUG
|
||||
|
||||
#define RAISE_TPL(PreviousTpl, tpl) \
|
||||
VERIFY_TPL ( tpl ); \
|
||||
PreviousTpl = gBS->RaiseTPL ( tpl ); \
|
||||
DEBUG (( DEBUG_TPL | DEBUG_TPL, \
|
||||
"%d: TPL\r\n", \
|
||||
tpl ))
|
||||
|
||||
#define RESTORE_TPL(tpl) \
|
||||
gBS->RestoreTPL ( tpl ); \
|
||||
DEBUG (( DEBUG_TPL | DEBUG_TPL, \
|
||||
"%d: TPL\r\n", \
|
||||
tpl ))
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Data Types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
typedef struct _DT_SERVICE DT_SERVICE; ///< Forward delcaration
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_SB_INITIALIZE) (
|
||||
DT_SERVICE * pService
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(* PFN_SB_SHUTDOWN) (
|
||||
DT_SERVICE * pService
|
||||
);
|
||||
|
||||
/**
|
||||
Protocol binding and installation control structure
|
||||
|
||||
The driver uses this structure to simplify the driver binding processing.
|
||||
**/
|
||||
typedef struct {
|
||||
CHAR16 * pName; ///< Protocol name
|
||||
EFI_GUID * pNetworkBinding; ///< Network service binding protocol for socket support
|
||||
CONST EFI_GUID * pTagGuid; ///< Tag to mark protocol in use
|
||||
PFN_SB_INITIALIZE pfnInitialize;///< Routine to initialize the service
|
||||
PFN_SB_SHUTDOWN pfnShutdown; ///< Routine to shutdown the service
|
||||
} DT_SOCKET_BINDING;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// GUIDs
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
extern CONST EFI_GUID mEslRawServiceGuid;
|
||||
extern CONST EFI_GUID mEslTcp4ServiceGuid;
|
||||
extern CONST EFI_GUID mEslUdp4ServiceGuid;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Data
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
extern CONST DT_SOCKET_BINDING cEslSocketBinding [];
|
||||
extern CONST UINTN cEslSocketBindingEntries;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Service Support Routines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Connect to the network service bindings
|
||||
|
||||
Walk the network service protocols on the controller handle and
|
||||
locate any that are not in use. Create service structures to
|
||||
manage the service binding for the socket driver.
|
||||
|
||||
@param [in] BindingHandle Handle for protocol binding.
|
||||
@param [in] Controller Handle of device to work with.
|
||||
|
||||
@retval EFI_SUCCESS This driver is added to Controller.
|
||||
@retval other This driver does not support this device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EslServiceConnect (
|
||||
IN EFI_HANDLE BindingHandle,
|
||||
IN EFI_HANDLE Controller
|
||||
);
|
||||
|
||||
/**
|
||||
Shutdown the network connections to this controller by removing
|
||||
NetworkInterfaceIdentifier protocol and closing the DevicePath
|
||||
and PciIo protocols on Controller.
|
||||
|
||||
@param [in] BindingHandle Handle for protocol binding.
|
||||
@param [in] Controller Handle of device to stop driver on.
|
||||
|
||||
@retval EFI_SUCCESS This driver is removed Controller.
|
||||
@retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
|
||||
@retval other This driver was not removed from this device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EslServiceDisconnect (
|
||||
IN EFI_HANDLE BindingHandle,
|
||||
IN EFI_HANDLE Controller
|
||||
);
|
||||
|
||||
/**
|
||||
Install the socket service
|
||||
|
||||
@param [in] pImageHandle Address of the image handle
|
||||
|
||||
@retval EFI_SUCCESS Service installed successfully
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EslServiceInstall (
|
||||
IN EFI_HANDLE * pImageHandle
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize the service layer
|
||||
|
||||
@param [in] ImageHandle Handle for the image.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
EslServiceLoad (
|
||||
IN EFI_HANDLE ImageHandle
|
||||
);
|
||||
|
||||
/**
|
||||
Uninstall the socket service
|
||||
|
||||
@param [in] ImageHandle Handle for the image.
|
||||
|
||||
@retval EFI_SUCCESS Service installed successfully
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EslServiceUninstall (
|
||||
IN EFI_HANDLE ImageHandle
|
||||
);
|
||||
|
||||
/**
|
||||
Shutdown the service layer
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
EslServiceUnload (
|
||||
VOID
|
||||
);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Socket Service Binding Protocol Routines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Creates a child handle and installs a protocol.
|
||||
|
||||
The CreateChild() function installs a protocol on ChildHandle.
|
||||
If pChildHandle is a pointer to NULL, then a new handle is created and returned in pChildHandle.
|
||||
If pChildHandle is not a pointer to NULL, then the protocol installs on the existing pChildHandle.
|
||||
|
||||
@param [in] pThis Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
|
||||
@param [in] pChildHandle Pointer to the handle of the child to create. If it is NULL,
|
||||
then a new handle is created. If it is a pointer to an existing UEFI handle,
|
||||
then the protocol is added to the existing UEFI handle.
|
||||
|
||||
@retval EFI_SUCCES The protocol was added to ChildHandle.
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create
|
||||
the child
|
||||
@retval other The child handle was not created
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EslSocketCreateChild (
|
||||
IN EFI_SERVICE_BINDING_PROTOCOL * pThis,
|
||||
IN OUT EFI_HANDLE * pChildHandle
|
||||
);
|
||||
|
||||
/**
|
||||
Destroys a child handle with a protocol installed on it.
|
||||
|
||||
The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
|
||||
that was installed by CreateChild() from ChildHandle. If the removed protocol is the
|
||||
last protocol on ChildHandle, then ChildHandle is destroyed.
|
||||
|
||||
@param [in] pThis Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
|
||||
@param [in] ChildHandle Handle of the child to destroy
|
||||
|
||||
@retval EFI_SUCCES The protocol was removed from ChildHandle.
|
||||
@retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.
|
||||
@retval EFI_INVALID_PARAMETER Child handle is not a valid UEFI Handle.
|
||||
@retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle
|
||||
because its services are being used.
|
||||
@retval other The child handle was not destroyed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EslSocketDestroyChild (
|
||||
IN EFI_SERVICE_BINDING_PROTOCOL * pThis,
|
||||
IN EFI_HANDLE ChildHandle
|
||||
);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Socket Protocol Routines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Bind a name to a socket.
|
||||
|
||||
The ::SocketBind routine connects a name to a socket on the local machine. The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html">POSIX</a>
|
||||
documentation for the bind routine is available online for reference.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] pSockAddr Address of a sockaddr structure that contains the
|
||||
connection point on the local machine. An IPv4 address
|
||||
of INADDR_ANY specifies that the connection is made to
|
||||
all of the network stacks on the platform. Specifying a
|
||||
specific IPv4 address restricts the connection to the
|
||||
network stack supporting that address. Specifying zero
|
||||
for the port causes the network layer to assign a port
|
||||
number from the dynamic range. Specifying a specific
|
||||
port number causes the network layer to use that port.
|
||||
|
||||
@param [in] SockAddrLen Specifies the length in bytes of the sockaddr structure.
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket successfully created
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketBind (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN const struct sockaddr * pSockAddr,
|
||||
IN socklen_t SockAddrLength,
|
||||
OUT int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Determine if the socket is closed
|
||||
|
||||
Reverses the operations of the ::SocketAllocate() routine.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS Socket successfully closed
|
||||
@retval EFI_NOT_READY Close still in progress
|
||||
@retval EFI_ALREADY Close operation already in progress
|
||||
@retval Other Failed to close the socket
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketClosePoll (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Start the close operation on the socket
|
||||
|
||||
Start closing the socket by closing all of the ports. Upon
|
||||
completion, the ::SocketPoll() routine finishes closing the
|
||||
socket.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
@param [in] bCloseNow Boolean to control close behavior
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS Socket successfully closed
|
||||
@retval EFI_NOT_READY Close still in progress
|
||||
@retval EFI_ALREADY Close operation already in progress
|
||||
@retval Other Failed to close the socket
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketCloseStart (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN BOOLEAN bCloseNow,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Connect to a remote system via the network.
|
||||
|
||||
The ::SocketConnect routine attempts to establish a connection to a
|
||||
socket on the local or remote system using the specified address.
|
||||
The POSIX
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html">connect</a>
|
||||
documentation is available online.
|
||||
|
||||
There are three states associated with a connection:
|
||||
<ul>
|
||||
<li>Not connected</li>
|
||||
<li>Connection in progress</li>
|
||||
<li>Connected</li>
|
||||
</ul>
|
||||
In the "Not connected" state, calls to ::connect start the connection
|
||||
processing and update the state to "Connection in progress". During
|
||||
the "Connection in progress" state, connect polls for connection completion
|
||||
and moves the state to "Connected" after the connection is established.
|
||||
Note that these states are only visible when the file descriptor is marked
|
||||
with O_NONBLOCK. Also, the POLL_WRITE bit is set when the connection
|
||||
completes and may be used by poll or select as an indicator to call
|
||||
connect again.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] pSockAddr Network address of the remote system.
|
||||
|
||||
@param [in] SockAddrLength Length in bytes of the network address.
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS The connection was successfully established.
|
||||
@retval EFI_NOT_READY The connection is in progress, call this routine again.
|
||||
@retval Others The connection attempt failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketConnect (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN const struct sockaddr * pSockAddr,
|
||||
IN socklen_t SockAddrLength,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Get the local address.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [out] pAddress Network address to receive the local system address
|
||||
|
||||
@param [in,out] pAddressLength Length of the local network address structure
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Local address successfully returned
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketGetLocalAddress (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
OUT struct sockaddr * pAddress,
|
||||
IN OUT socklen_t * pAddressLength,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Get the peer address.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [out] pAddress Network address to receive the remote system address
|
||||
|
||||
@param [in,out] pAddressLength Length of the remote network address structure
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Remote address successfully returned
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketGetPeerAddress (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
OUT struct sockaddr * pAddress,
|
||||
IN OUT socklen_t * pAddressLength,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Establish the known port to listen for network connections.
|
||||
|
||||
The ::SocketListen routine places the port into a state that enables connection
|
||||
attempts. Connections are placed into FIFO order in a queue to be serviced
|
||||
by the application. The application calls the ::SocketAccept routine to remove
|
||||
the next connection from the queue and get the associated socket. The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html">POSIX</a>
|
||||
documentation for the bind routine is available online for reference.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] Backlog Backlog specifies the maximum FIFO depth for
|
||||
the connections waiting for the application
|
||||
to call accept. Connection attempts received
|
||||
while the queue is full are refused.
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket successfully created
|
||||
@retval Other - Failed to enable the socket for listen
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketListen (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN INT32 Backlog,
|
||||
OUT int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Get the socket options
|
||||
|
||||
Retrieve the socket options one at a time by name. The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html">POSIX</a>
|
||||
documentation is available online.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
@param [in] level Option protocol level
|
||||
@param [in] option_name Name of the option
|
||||
@param [out] option_value Buffer to receive the option value
|
||||
@param [in,out] option_len Length of the buffer in bytes,
|
||||
upon return length of the option value in bytes
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket data successfully received
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketOptionGet (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN int level,
|
||||
IN int option_name,
|
||||
OUT void * __restrict option_value,
|
||||
IN OUT socklen_t * __restrict option_len,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Set the socket options
|
||||
|
||||
Adjust the socket options one at a time by name. The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html">POSIX</a>
|
||||
documentation is available online.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
@param [in] level Option protocol level
|
||||
@param [in] option_name Name of the option
|
||||
@param [in] option_value Buffer containing the option value
|
||||
@param [in] option_len Length of the buffer in bytes
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket data successfully received
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketOptionSet (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN int level,
|
||||
IN int option_name,
|
||||
IN CONST void * option_value,
|
||||
IN socklen_t option_len,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Poll a socket for pending activity.
|
||||
|
||||
The SocketPoll routine checks a socket for pending activity associated
|
||||
with the event mask. Activity is returned in the detected event buffer.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] Events Events of interest for this socket
|
||||
|
||||
@param [in] pEvents Address to receive the detected events
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket successfully polled
|
||||
@retval EFI_INVALID_PARAMETER - When pEvents is NULL
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketPoll (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN short Events,
|
||||
IN short * pEvents,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Receive data from a network connection.
|
||||
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] Flags Message control flags
|
||||
|
||||
@param [in] BufferLength Length of the the buffer
|
||||
|
||||
@param [in] pBuffer Address of a buffer to receive the data.
|
||||
|
||||
@param [in] pDataLength Number of received data bytes in the buffer.
|
||||
|
||||
@param [out] pAddress Network address to receive the remote system address
|
||||
|
||||
@param [in,out] pAddressLength Length of the remote network address structure
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket data successfully received
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketReceive (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN INT32 Flags,
|
||||
IN size_t BufferLength,
|
||||
IN UINT8 * pBuffer,
|
||||
OUT size_t * pDataLength,
|
||||
OUT struct sockaddr * pAddress,
|
||||
IN OUT socklen_t * pAddressLength,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Shutdown the socket receive and transmit operations
|
||||
|
||||
The SocketShutdown routine stops the socket receive and transmit
|
||||
operations.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] How Which operations to stop
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket operations successfully shutdown
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketShutdown (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN int How,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Send data using a network connection.
|
||||
|
||||
The SocketTransmit routine queues the data for transmission to the
|
||||
remote network connection.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] Flags Message control flags
|
||||
|
||||
@param [in] BufferLength Length of the the buffer
|
||||
|
||||
@param [in] pBuffer Address of a buffer containing the data to send
|
||||
|
||||
@param [in] pDataLength Address to receive the number of data bytes sent
|
||||
|
||||
@param [in] pAddress Network address of the remote system address
|
||||
|
||||
@param [in] AddressLength Length of the remote network address structure
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket data successfully received
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketTransmit (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN int Flags,
|
||||
IN size_t BufferLength,
|
||||
IN CONST UINT8 * pBuffer,
|
||||
OUT size_t * pDataLength,
|
||||
IN const struct sockaddr * pAddress,
|
||||
IN socklen_t AddressLength,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _EFI_SOCKET_LIB_H_
|
@@ -1,3 +1,14 @@
|
||||
#include <x86/limits.h>
|
||||
|
||||
#define __POINTER_BIT 32
|
||||
#define __LONG_BIT 32
|
||||
|
||||
/** minimum value for an object of type long int **/
|
||||
#define __LONG_MIN (-2147483647L - 1L) // -(2^31 - 1)
|
||||
|
||||
/** maximum value for an object of type long int **/
|
||||
#define __LONG_MAX +2147483647L // 2^31 - 1
|
||||
|
||||
/** maximum value for an object of type unsigned long int **/
|
||||
#define __ULONG_MAX 0xffffffff // 2^32 - 1
|
||||
|
||||
|
606
StdLib/Include/Protocol/EfiSocket.h
Normal file
606
StdLib/Include/Protocol/EfiSocket.h
Normal file
@@ -0,0 +1,606 @@
|
||||
/** @file
|
||||
Definitions for the EFI Socket protocol.
|
||||
|
||||
Copyright (c) 2011, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_SOCKET_H_
|
||||
#define _EFI_SOCKET_H_
|
||||
|
||||
#include <errno.h>
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <sys/poll.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Data Types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
typedef struct _EFI_SOCKET_PROTOCOL EFI_SOCKET_PROTOCOL;
|
||||
|
||||
/**
|
||||
Constructor/Destructor
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_ESL_xSTRUCTOR) (
|
||||
VOID
|
||||
);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Data
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
extern PFN_ESL_xSTRUCTOR mpfnEslConstructor;
|
||||
extern PFN_ESL_xSTRUCTOR mpfnEslDestructor;
|
||||
|
||||
extern EFI_GUID gEfiSocketProtocolGuid;
|
||||
extern EFI_GUID gEfiSocketServiceBindingProtocolGuid;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Socket API
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Accept a network connection.
|
||||
|
||||
The SocketAccept routine waits for a network connection to the socket.
|
||||
It is able to return the remote network address to the caller if
|
||||
requested.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] pSockAddr Address of a buffer to receive the remote
|
||||
network address.
|
||||
|
||||
@param [in, out] pSockAddrLength Length in bytes of the address buffer.
|
||||
On output specifies the length of the
|
||||
remote network address.
|
||||
|
||||
@param [out] ppSocketProtocol Address of a buffer to receive the socket protocol
|
||||
instance associated with the new socket.
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS New connection successfully created
|
||||
@retval EFI_NOT_READY No connection is available
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_ACCEPT) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN struct sockaddr * pSockAddr,
|
||||
IN OUT socklen_t * pSockAddrLength,
|
||||
IN EFI_SOCKET_PROTOCOL ** ppSocketProtocol,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Bind a name to a socket.
|
||||
|
||||
The ::SocketBind routine connects a name to a socket on the local machine. The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html">POSIX</a>
|
||||
documentation for the bind routine is available online for reference.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] pSockAddr Address of a sockaddr structure that contains the
|
||||
connection point on the local machine. An IPv4 address
|
||||
of INADDR_ANY specifies that the connection is made to
|
||||
all of the network stacks on the platform. Specifying a
|
||||
specific IPv4 address restricts the connection to the
|
||||
network stack supporting that address. Specifying zero
|
||||
for the port causes the network layer to assign a port
|
||||
number from the dynamic range. Specifying a specific
|
||||
port number causes the network layer to use that port.
|
||||
|
||||
@param [in] SockAddrLen Specifies the length in bytes of the sockaddr structure.
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket successfully created
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_BIND) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN const struct sockaddr * pSockAddr,
|
||||
IN socklen_t SockAddrLength,
|
||||
OUT int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Determine if the socket is closed
|
||||
|
||||
Reverses the operations of the ::SocketAllocate() routine.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS Socket successfully closed
|
||||
@retval EFI_NOT_READY Close still in progress
|
||||
@retval EFI_ALREADY Close operation already in progress
|
||||
@retval Other Failed to close the socket
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_CLOSE_POLL) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Start the close operation on the socket
|
||||
|
||||
Start closing the socket by closing all of the ports. Upon
|
||||
completion, the ::pfnClosePoll() routine finishes closing the
|
||||
socket.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
@param [in] bCloseNow Boolean to control close behavior
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS Socket successfully closed
|
||||
@retval EFI_NOT_READY Close still in progress
|
||||
@retval EFI_ALREADY Close operation already in progress
|
||||
@retval Other Failed to close the socket
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_CLOSE_START) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN BOOLEAN bCloseNow,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Connect to a remote system via the network.
|
||||
|
||||
The ::Connect routine attempts to establish a connection to a
|
||||
socket on the local or remote system using the specified address.
|
||||
The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html">POSIX</a>
|
||||
documentation is available online.
|
||||
|
||||
There are three states associated with a connection:
|
||||
<ul>
|
||||
<li>Not connected</li>
|
||||
<li>Connection in progress</li>
|
||||
<li>Connected</li>
|
||||
</ul>
|
||||
In the "Not connected" state, calls to ::connect start the connection
|
||||
processing and update the state to "Connection in progress". During
|
||||
the "Connection in progress" state, connect polls for connection completion
|
||||
and moves the state to "Connected" after the connection is established.
|
||||
Note that these states are only visible when the file descriptor is marked
|
||||
with O_NONBLOCK. Also, the POLL_WRITE bit is set when the connection
|
||||
completes and may be used by poll or select as an indicator to call
|
||||
connect again.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] pSockAddr Network address of the remote system.
|
||||
|
||||
@param [in] SockAddrLength Length in bytes of the network address.
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS The connection was successfully established.
|
||||
@retval EFI_NOT_READY The connection is in progress, call this routine again.
|
||||
@retval Others The connection attempt failed.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_CONNECT) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN const struct sockaddr * pSockAddr,
|
||||
IN socklen_t SockAddrLength,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Get the local address.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [out] pAddress Network address to receive the local system address
|
||||
|
||||
@param [in,out] pAddressLength Length of the local network address structure
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Local address successfully returned
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_GET_LOCAL) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
OUT struct sockaddr * pAddress,
|
||||
IN OUT socklen_t * pAddressLength,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Get the peer address.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [out] pAddress Network address to receive the remote system address
|
||||
|
||||
@param [in,out] pAddressLength Length of the remote network address structure
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Remote address successfully returned
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_GET_PEER) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
OUT struct sockaddr * pAddress,
|
||||
IN OUT socklen_t * pAddressLength,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Establish the known port to listen for network connections.
|
||||
|
||||
The ::SocketAisten routine places the port into a state that enables connection
|
||||
attempts. Connections are placed into FIFO order in a queue to be serviced
|
||||
by the application. The application calls the ::SocketAccept routine to remove
|
||||
the next connection from the queue and get the associated socket. The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html">POSIX</a>
|
||||
documentation for the bind routine is available online for reference.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] Backlog Backlog specifies the maximum FIFO depth for
|
||||
the connections waiting for the application
|
||||
to call accept. Connection attempts received
|
||||
while the queue is full are refused.
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket successfully created
|
||||
@retval Other - Failed to enable the socket for listen
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_LISTEN) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN INT32 Backlog,
|
||||
OUT int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Get the socket options
|
||||
|
||||
Retrieve the socket options one at a time by name. The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html">POSIX</a>
|
||||
documentation is available online.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
@param [in] level Option protocol level
|
||||
@param [in] OptionName Name of the option
|
||||
@param [out] pOptionValue Buffer to receive the option value
|
||||
@param [in,out] pOptionLength Length of the buffer in bytes,
|
||||
upon return length of the option value in bytes
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket data successfully received
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_OPTION_GET) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN int level,
|
||||
IN int OptionName,
|
||||
OUT void * __restrict pOptionValue,
|
||||
IN OUT socklen_t * __restrict pOptionLength,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Set the socket options
|
||||
|
||||
Adjust the socket options one at a time by name. The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html">POSIX</a>
|
||||
documentation is available online.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
@param [in] level Option protocol level
|
||||
@param [in] OptionName Name of the option
|
||||
@param [in] pOptionValue Buffer containing the option value
|
||||
@param [in] OptionLength Length of the buffer in bytes
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket data successfully received
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_OPTION_SET) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN int level,
|
||||
IN int OptionName,
|
||||
IN CONST void * pOptionValue,
|
||||
IN socklen_t OptionLength,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Poll a socket for pending activity.
|
||||
|
||||
The SocketPoll routine checks a socket for pending activity associated
|
||||
with the event mask. Activity is returned in the detected event buffer.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] Events Events of interest for this socket
|
||||
|
||||
@param [in] pEvents Address to receive the detected events
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket successfully polled
|
||||
@retval EFI_INVALID_PARAMETER - When pEvents is NULL
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_POLL) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN short Events,
|
||||
IN short * pEvents,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Receive data from a network connection.
|
||||
|
||||
The ::recv routine waits for receive data from a remote network
|
||||
connection. The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html">POSIX</a>
|
||||
documentation is available online.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] Flags Message control flags
|
||||
|
||||
@param [in] BufferLength Length of the the buffer
|
||||
|
||||
@param [in] pBuffer Address of a buffer to receive the data.
|
||||
|
||||
@param [in] pDataLength Number of received data bytes in the buffer.
|
||||
|
||||
@param [out] pAddress Network address to receive the remote system address
|
||||
|
||||
@param [in,out] pAddressLength Length of the remote network address structure
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket data successfully received
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_RECEIVE) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN int Flags,
|
||||
IN size_t BufferLength,
|
||||
IN UINT8 * pBuffer,
|
||||
OUT size_t * pDataLength,
|
||||
OUT struct sockaddr * pAddress,
|
||||
IN OUT socklen_t * pAddressLength,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Send data using a network connection.
|
||||
|
||||
The SocketTransmit routine queues the data for transmission to the
|
||||
remote network connection.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] Flags Message control flags
|
||||
|
||||
@param [in] BufferLength Length of the the buffer
|
||||
|
||||
@param [in] pBuffer Address of a buffer containing the data to send
|
||||
|
||||
@param [in] pDataLength Address to receive the number of data bytes sent
|
||||
|
||||
@param [in] pAddress Network address of the remote system address
|
||||
|
||||
@param [in] AddressLength Length of the remote network address structure
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket data successfully queued for transmission
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_SEND) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN int Flags,
|
||||
IN size_t BufferLength,
|
||||
IN CONST UINT8 * pBuffer,
|
||||
OUT size_t * pDataLength,
|
||||
IN const struct sockaddr * pAddress,
|
||||
IN socklen_t AddressLength,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Shutdown the socket receive and transmit operations
|
||||
|
||||
The SocketShutdown routine stops the socket receive and transmit
|
||||
operations.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] How Which operations to stop
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket operations successfully shutdown
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* PFN_SHUTDOWN) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN int How,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize an endpoint for network communication.
|
||||
|
||||
The ::Socket routine initializes the communication endpoint by providing
|
||||
the support for the socket library function ::socket. The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html">POSIX</a>
|
||||
documentation for the socket routine is available online for reference.
|
||||
|
||||
@param [in] pSocketProtocol Address of the socket protocol structure.
|
||||
|
||||
@param [in] domain Select the family of protocols for the client or server
|
||||
application.
|
||||
|
||||
@param [in] type Specifies how to make the network connection. The following values
|
||||
are supported:
|
||||
<ul>
|
||||
<li>
|
||||
SOCK_STREAM - Connect to TCP, provides a byte stream
|
||||
that is manipluated by read, recv, send and write.
|
||||
</li>
|
||||
<li>
|
||||
SOCK_SEQPACKET - Connect to TCP, provides sequenced packet stream
|
||||
that is manipulated by read, recv, send and write.
|
||||
</li>
|
||||
<li>
|
||||
SOCK_DGRAM - Connect to UDP, provides a datagram service that is
|
||||
manipulated by recvfrom and sendto.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@param [in] protocol Specifies the lower layer protocol to use. The following
|
||||
values are supported:
|
||||
<ul>
|
||||
<li>IPPROTO_TCP</li> - This value must be combined with SOCK_STREAM.</li>
|
||||
<li>IPPROTO_UDP</li> - This value must be combined with SOCK_DGRAM.</li>
|
||||
</ul>
|
||||
|
||||
@param [out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket successfully created
|
||||
@retval EFI_INVALID_PARAMETER - Invalid domain value, errno = EAFNOSUPPORT
|
||||
@retval EFI_INVALID_PARAMETER - Invalid type value, errno = EINVAL
|
||||
@retval EFI_INVALID_PARAMETER - Invalid protocol value, errno = EINVAL
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*PFN_SOCKET) (
|
||||
IN EFI_SOCKET_PROTOCOL * pSocketProtocol,
|
||||
IN int domain,
|
||||
IN int type,
|
||||
IN int protocol,
|
||||
IN int * pErrno
|
||||
);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Socket Protocol
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Socket protocol declaration
|
||||
**/
|
||||
typedef struct _EFI_SOCKET_PROTOCOL {
|
||||
EFI_HANDLE SocketHandle; ///< Handle for the socket
|
||||
PFN_ACCEPT pfnAccept; ///< Accept a network connection
|
||||
PFN_BIND pfnBind; ///< Bind a local address to the socket
|
||||
PFN_CLOSE_POLL pfnClosePoll; ///< Determine if the socket is closed
|
||||
PFN_CLOSE_START pfnCloseStart; ///< Start the close operation
|
||||
PFN_CONNECT pfnConnect; ///< Connect to a remote system
|
||||
PFN_GET_LOCAL pfnGetLocal; ///< Get local address
|
||||
PFN_GET_PEER pfnGetPeer; ///< Get peer address
|
||||
PFN_LISTEN pfnListen; ///< Enable connection attempts on known port
|
||||
PFN_POLL pfnPoll; ///< Poll for socket activity
|
||||
PFN_OPTION_GET pfnOptionGet; ///< Get socket options
|
||||
PFN_OPTION_SET pfnOptionSet; ///< Set socket options
|
||||
PFN_RECEIVE pfnReceive; ///< Receive data from a socket
|
||||
PFN_SEND pfnSend; ///< Transmit data using the socket
|
||||
PFN_SHUTDOWN pfnShutdown; ///< Shutdown receive and transmit operations
|
||||
PFN_SOCKET pfnSocket; ///< Initialize the socket
|
||||
} GCC_EFI_SOCKET_PROTOCOL;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Non-blocking routines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Non blocking version of accept.
|
||||
|
||||
See ::accept
|
||||
|
||||
@param [in] s Socket file descriptor returned from ::socket.
|
||||
|
||||
@param [in] address Address of a buffer to receive the remote network address.
|
||||
|
||||
@param [in, out] address_len Address of a buffer containing the Length in bytes
|
||||
of the remote network address buffer. Upon return,
|
||||
contains the length of the remote network address.
|
||||
|
||||
@returns This routine returns zero if successful and -1 when an error occurs.
|
||||
In the case of an error, errno contains more details.
|
||||
|
||||
**/
|
||||
int
|
||||
AcceptNB (
|
||||
int s,
|
||||
struct sockaddr * address,
|
||||
socklen_t * address_len
|
||||
);
|
||||
|
||||
/**
|
||||
Connect to the socket driver
|
||||
|
||||
@param [in] ppSocketProtocol Address to receive the socket protocol address
|
||||
|
||||
@retval 0 Successfully returned the socket protocol
|
||||
@retval other Value for errno
|
||||
**/
|
||||
int
|
||||
EslServiceGetProtocol (
|
||||
IN EFI_SOCKET_PROTOCOL ** ppSocketProtocol
|
||||
);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _EFI_SOCKET_H_
|
@@ -1,3 +1,25 @@
|
||||
#include <x86/limits.h>
|
||||
|
||||
#define __POINTER_BIT 64
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define __LONG_BIT 64
|
||||
/** minimum value for an object of type long int **/
|
||||
#define __LONG_MIN (-9223372036854775807L - 1L) // -(2^63 - 1)
|
||||
|
||||
/** maximum value for an object of type long int **/
|
||||
#define __LONG_MAX +9223372036854775807L // 2^63 - 1
|
||||
|
||||
/** maximum value for an object of type unsigned long int **/
|
||||
#define __ULONG_MAX 0xFFFFFFFFFFFFFFFFUL // 2^64 - 1
|
||||
#else
|
||||
#define __LONG_BIT 32
|
||||
/** minimum value for an object of type long int **/
|
||||
#define __LONG_MIN (-2147483647L - 1L) // -(2^31 - 1)
|
||||
|
||||
/** maximum value for an object of type long int **/
|
||||
#define __LONG_MAX +2147483647L // 2^31 - 1
|
||||
|
||||
/** maximum value for an object of type unsigned long int **/
|
||||
#define __ULONG_MAX 0xffffffff // 2^32 - 1
|
||||
#endif
|
||||
|
109
StdLib/Include/arpa/ftp.h
Normal file
109
StdLib/Include/arpa/ftp.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (c) 1983, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ftp.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
#ifndef _ARPA_FTP_H_
|
||||
#define _ARPA_FTP_H_
|
||||
|
||||
/* Definitions for FTP; see RFC-765. */
|
||||
|
||||
/*
|
||||
* Reply codes.
|
||||
*/
|
||||
#define PRELIM 1 /* positive preliminary */
|
||||
#define COMPLETE 2 /* positive completion */
|
||||
#define CONTINUE 3 /* positive intermediate */
|
||||
#define TRANSIENT 4 /* transient negative completion */
|
||||
#define ERROR 5 /* permanent negative completion */
|
||||
|
||||
/*
|
||||
* Type codes
|
||||
*/
|
||||
#define TYPE_A 1 /* ASCII */
|
||||
#define TYPE_E 2 /* EBCDIC */
|
||||
#define TYPE_I 3 /* image */
|
||||
#define TYPE_L 4 /* local byte size */
|
||||
|
||||
#ifdef FTP_NAMES
|
||||
char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" };
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Form codes
|
||||
*/
|
||||
#define FORM_N 1 /* non-print */
|
||||
#define FORM_T 2 /* telnet format effectors */
|
||||
#define FORM_C 3 /* carriage control (ASA) */
|
||||
#ifdef FTP_NAMES
|
||||
char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" };
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure codes
|
||||
*/
|
||||
#define STRU_F 1 /* file (no record structure) */
|
||||
#define STRU_R 2 /* record structure */
|
||||
#define STRU_P 3 /* page structure */
|
||||
#ifdef FTP_NAMES
|
||||
char *strunames[] = {"0", "File", "Record", "Page" };
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Mode types
|
||||
*/
|
||||
#define MODE_S 1 /* stream */
|
||||
#define MODE_B 2 /* block */
|
||||
#define MODE_C 3 /* compressed */
|
||||
#ifdef FTP_NAMES
|
||||
char *modenames[] = {"0", "Stream", "Block", "Compressed" };
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Record Tokens
|
||||
*/
|
||||
#define REC_ESC '\377' /* Record-mode Escape */
|
||||
#define REC_EOR '\001' /* Record-mode End-of-Record */
|
||||
#define REC_EOF '\002' /* Record-mode End-of-File */
|
||||
|
||||
/*
|
||||
* Block Header
|
||||
*/
|
||||
#define BLK_EOR 0x80 /* Block is End-of-Record */
|
||||
#define BLK_EOF 0x40 /* Block is End-of-File */
|
||||
#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
|
||||
#define BLK_RESTART 0x10 /* Block is Restart Marker */
|
||||
|
||||
#define BLK_BYTECOUNT 2 /* Bytes in this block */
|
||||
|
||||
#endif /* !_FTP_H_ */
|
@@ -126,6 +126,10 @@ struct _ns_flagdata { int mask, shift; };
|
||||
extern struct _ns_flagdata _ns_flagdata[];
|
||||
|
||||
/* Accessor macros - this is part of the public interface. */
|
||||
#define ns_msg_getflag(handle, flag) ( \
|
||||
((handle)._flags & _ns_flagdata[flag].mask) \
|
||||
>> _ns_flagdata[flag].shift \
|
||||
)
|
||||
|
||||
#define ns_msg_id(handle) ((handle)._id + 0)
|
||||
#define ns_msg_base(handle) ((handle)._msg + 0)
|
||||
@@ -217,6 +221,28 @@ typedef enum __ns_update_operation {
|
||||
ns_uop_max = 2
|
||||
} ns_update_operation;
|
||||
|
||||
/*
|
||||
* This RR-like structure is particular to UPDATE.
|
||||
*/
|
||||
struct _ns_updrec {
|
||||
struct _ns_updrec *r_prev; /* prev record */
|
||||
struct _ns_updrec *r_next; /* next record */
|
||||
u_int8_t r_section; /* ZONE/PREREQUISITE/UPDATE */
|
||||
char * r_dname; /* owner of the RR */
|
||||
u_int16_t r_class; /* class number */
|
||||
u_int16_t r_type; /* type number */
|
||||
u_int32_t r_ttl; /* time to live */
|
||||
u_char * r_data; /* rdata fields as text string */
|
||||
u_int16_t r_size; /* size of r_data field */
|
||||
int r_opcode; /* type of operation */
|
||||
/* following fields for private use by the resolver/server routines */
|
||||
struct _ns_updrec *r_grpnext; /* next record when grouped */
|
||||
struct databuf *r_dp; /* databuf to process */
|
||||
struct databuf *r_deldp; /* databuf's deleted/overwritten */
|
||||
u_int16_t r_zone; /* zone number on server */
|
||||
};
|
||||
typedef struct _ns_updrec ns_updrec;
|
||||
|
||||
/*%
|
||||
* This structure is used for TSIG authenticated messages
|
||||
*/
|
||||
@@ -456,25 +482,24 @@ typedef enum __ns_cert_types {
|
||||
#define NS_PUT16(s, cp) do { \
|
||||
uint32_t t_s = (uint32_t)(s); \
|
||||
u_char *t_cp = (u_char *)(cp); \
|
||||
*t_cp++ = t_s >> 8; \
|
||||
*t_cp = t_s; \
|
||||
*t_cp++ = (u_char)( t_s >> 8 ); \
|
||||
*t_cp = (u_char)( t_s ); \
|
||||
(cp) += NS_INT16SZ; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define NS_PUT32(l, cp) do { \
|
||||
uint32_t t_l = (uint32_t)(l); \
|
||||
u_char *t_cp = (u_char *)(cp); \
|
||||
*t_cp++ = t_l >> 24; \
|
||||
*t_cp++ = t_l >> 16; \
|
||||
*t_cp++ = t_l >> 8; \
|
||||
*t_cp = t_l; \
|
||||
*t_cp++ = (u_char)( t_l >> 24 ); \
|
||||
*t_cp++ = (u_char)( t_l >> 16 ); \
|
||||
*t_cp++ = (u_char)( t_l >> 8 ); \
|
||||
*t_cp = (u_char)( t_l ); \
|
||||
(cp) += NS_INT32SZ; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
/*%
|
||||
* ANSI C identifier hiding for bind's lib/nameser.
|
||||
*/
|
||||
#define ns_msg_getflag __ns_msg_getflag
|
||||
#define ns_get16 __ns_get16
|
||||
#define ns_get32 __ns_get32
|
||||
#define ns_put16 __ns_put16
|
||||
@@ -511,7 +536,6 @@ typedef enum __ns_cert_types {
|
||||
#define ns_samename __ns_samename
|
||||
|
||||
__BEGIN_DECLS
|
||||
int ns_msg_getflag(ns_msg, int);
|
||||
uint16_t ns_get16(const u_char *);
|
||||
uint32_t ns_get32(const u_char *);
|
||||
void ns_put16(uint16_t, u_char *);
|
||||
|
340
StdLib/Include/arpa/telnet.h
Normal file
340
StdLib/Include/arpa/telnet.h
Normal file
@@ -0,0 +1,340 @@
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)telnet.h 8.2 (Berkeley) 12/15/93
|
||||
*/
|
||||
|
||||
#ifndef _ARPA_TELNET_H_
|
||||
#define _ARPA_TELNET_H_
|
||||
|
||||
/*
|
||||
* Definitions for the TELNET protocol.
|
||||
*/
|
||||
#define IAC 255 /* interpret as command: */
|
||||
#define DONT 254 /* you are not to use option */
|
||||
#define DO 253 /* please, you use option */
|
||||
#define WONT 252 /* I won't use option */
|
||||
#define WILL 251 /* I will use option */
|
||||
#define SB 250 /* interpret as subnegotiation */
|
||||
#define GA 249 /* you may reverse the line */
|
||||
#define EL 248 /* erase the current line */
|
||||
#define EC 247 /* erase the current character */
|
||||
#define AYT 246 /* are you there */
|
||||
#define AO 245 /* abort output--but let prog finish */
|
||||
#define IP 244 /* interrupt process--permanently */
|
||||
#define BREAK 243 /* break */
|
||||
#define DM 242 /* data mark--for connect. cleaning */
|
||||
#define NOP 241 /* nop */
|
||||
#define SE 240 /* end sub negotiation */
|
||||
#define EOR 239 /* end of record (transparent mode) */
|
||||
#define ABORT 238 /* Abort process */
|
||||
#define SUSP 237 /* Suspend process */
|
||||
#define xEOF 236 /* End of file: EOF is already used... */
|
||||
|
||||
#define SYNCH 242 /* for telfunc calls */
|
||||
|
||||
#ifdef TELCMDS
|
||||
char *telcmds[] = {
|
||||
"EOF", "SUSP", "ABORT", "EOR",
|
||||
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
|
||||
"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC",
|
||||
0
|
||||
};
|
||||
#else
|
||||
extern char *telcmds[];
|
||||
#endif
|
||||
|
||||
#define TELCMD_FIRST xEOF
|
||||
#define TELCMD_LAST IAC
|
||||
#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
|
||||
(unsigned int)(x) >= TELCMD_FIRST)
|
||||
#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
|
||||
|
||||
/* telnet options */
|
||||
#define TELOPT_BINARY 0 /* 8-bit data path */
|
||||
#define TELOPT_ECHO 1 /* echo */
|
||||
#define TELOPT_RCP 2 /* prepare to reconnect */
|
||||
#define TELOPT_SGA 3 /* suppress go ahead */
|
||||
#define TELOPT_NAMS 4 /* approximate message size */
|
||||
#define TELOPT_STATUS 5 /* give status */
|
||||
#define TELOPT_TM 6 /* timing mark */
|
||||
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
|
||||
#define TELOPT_NAOL 8 /* negotiate about output line width */
|
||||
#define TELOPT_NAOP 9 /* negotiate about output page size */
|
||||
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
|
||||
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
|
||||
#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
|
||||
#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
|
||||
#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
|
||||
#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
|
||||
#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
|
||||
#define TELOPT_XASCII 17 /* extended ascic character set */
|
||||
#define TELOPT_LOGOUT 18 /* force logout */
|
||||
#define TELOPT_BM 19 /* byte macro */
|
||||
#define TELOPT_DET 20 /* data entry terminal */
|
||||
#define TELOPT_SUPDUP 21 /* supdup protocol */
|
||||
#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
|
||||
#define TELOPT_SNDLOC 23 /* send location */
|
||||
#define TELOPT_TTYPE 24 /* terminal type */
|
||||
#define TELOPT_EOR 25 /* end or record */
|
||||
#define TELOPT_TUID 26 /* TACACS user identification */
|
||||
#define TELOPT_OUTMRK 27 /* output marking */
|
||||
#define TELOPT_TTYLOC 28 /* terminal location number */
|
||||
#define TELOPT_3270REGIME 29 /* 3270 regime */
|
||||
#define TELOPT_X3PAD 30 /* X.3 PAD */
|
||||
#define TELOPT_NAWS 31 /* window size */
|
||||
#define TELOPT_TSPEED 32 /* terminal speed */
|
||||
#define TELOPT_LFLOW 33 /* remote flow control */
|
||||
#define TELOPT_LINEMODE 34 /* Linemode option */
|
||||
#define TELOPT_XDISPLOC 35 /* X Display Location */
|
||||
#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
|
||||
#define TELOPT_AUTHENTICATION 37/* Authenticate */
|
||||
#define TELOPT_ENCRYPT 38 /* Encryption option */
|
||||
#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
|
||||
#define TELOPT_EXOPL 255 /* extended-options-list */
|
||||
|
||||
|
||||
#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
|
||||
#ifdef TELOPTS
|
||||
char *telopts[NTELOPTS+1] = {
|
||||
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
|
||||
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
|
||||
"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
|
||||
"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
|
||||
"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
|
||||
"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
|
||||
"TACACS UID", "OUTPUT MARKING", "TTYLOC",
|
||||
"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
|
||||
"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
|
||||
"ENCRYPT", "NEW-ENVIRON",
|
||||
0
|
||||
};
|
||||
#define TELOPT_FIRST TELOPT_BINARY
|
||||
#define TELOPT_LAST TELOPT_NEW_ENVIRON
|
||||
#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
|
||||
#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
|
||||
#endif
|
||||
|
||||
/* sub-option qualifiers */
|
||||
#define TELQUAL_IS 0 /* option is... */
|
||||
#define TELQUAL_SEND 1 /* send option */
|
||||
#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
|
||||
#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
|
||||
#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
|
||||
|
||||
#define LFLOW_OFF 0 /* Disable remote flow control */
|
||||
#define LFLOW_ON 1 /* Enable remote flow control */
|
||||
#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
|
||||
#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
|
||||
|
||||
/*
|
||||
* LINEMODE suboptions
|
||||
*/
|
||||
|
||||
#define LM_MODE 1
|
||||
#define LM_FORWARDMASK 2
|
||||
#define LM_SLC 3
|
||||
|
||||
#define MODE_EDIT 0x01
|
||||
#define MODE_TRAPSIG 0x02
|
||||
#define MODE_ACK 0x04
|
||||
#define MODE_SOFT_TAB 0x08
|
||||
#define MODE_LIT_ECHO 0x10
|
||||
|
||||
#define MODE_MASK 0x1f
|
||||
|
||||
/* Not part of protocol, but needed to simplify things... */
|
||||
#define MODE_FLOW 0x0100
|
||||
#define MODE_ECHO 0x0200
|
||||
#define MODE_INBIN 0x0400
|
||||
#define MODE_OUTBIN 0x0800
|
||||
#define MODE_FORCE 0x1000
|
||||
|
||||
#define SLC_SYNCH 1
|
||||
#define SLC_BRK 2
|
||||
#define SLC_IP 3
|
||||
#define SLC_AO 4
|
||||
#define SLC_AYT 5
|
||||
#define SLC_EOR 6
|
||||
#define SLC_ABORT 7
|
||||
#define SLC_EOF 8
|
||||
#define SLC_SUSP 9
|
||||
#define SLC_EC 10
|
||||
#define SLC_EL 11
|
||||
#define SLC_EW 12
|
||||
#define SLC_RP 13
|
||||
#define SLC_LNEXT 14
|
||||
#define SLC_XON 15
|
||||
#define SLC_XOFF 16
|
||||
#define SLC_FORW1 17
|
||||
#define SLC_FORW2 18
|
||||
#define SLC_MCL 19
|
||||
#define SLC_MCR 20
|
||||
#define SLC_MCWL 21
|
||||
#define SLC_MCWR 22
|
||||
#define SLC_MCBOL 23
|
||||
#define SLC_MCEOL 24
|
||||
#define SLC_INSRT 25
|
||||
#define SLC_OVER 26
|
||||
#define SLC_ECR 27
|
||||
#define SLC_EWR 28
|
||||
#define SLC_EBOL 29
|
||||
#define SLC_EEOL 30
|
||||
|
||||
#define NSLC 30
|
||||
|
||||
/*
|
||||
* For backwards compatability, we define SLC_NAMES to be the
|
||||
* list of names if SLC_NAMES is not defined.
|
||||
*/
|
||||
#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
|
||||
"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
|
||||
"LNEXT", "XON", "XOFF", "FORW1", "FORW2", \
|
||||
"MCL", "MCR", "MCWL", "MCWR", "MCBOL", \
|
||||
"MCEOL", "INSRT", "OVER", "ECR", "EWR", \
|
||||
"EBOL", "EEOL", \
|
||||
0
|
||||
|
||||
#ifdef SLC_NAMES
|
||||
char *slc_names[] = {
|
||||
SLC_NAMELIST
|
||||
};
|
||||
#else
|
||||
extern char *slc_names[];
|
||||
#define SLC_NAMES SLC_NAMELIST
|
||||
#endif
|
||||
|
||||
#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
|
||||
#define SLC_NAME(x) slc_names[x]
|
||||
|
||||
#define SLC_NOSUPPORT 0
|
||||
#define SLC_CANTCHANGE 1
|
||||
#define SLC_VARIABLE 2
|
||||
#define SLC_DEFAULT 3
|
||||
#define SLC_LEVELBITS 0x03
|
||||
|
||||
#define SLC_FUNC 0
|
||||
#define SLC_FLAGS 1
|
||||
#define SLC_VALUE 2
|
||||
|
||||
#define SLC_ACK 0x80
|
||||
#define SLC_FLUSHIN 0x40
|
||||
#define SLC_FLUSHOUT 0x20
|
||||
|
||||
#define OLD_ENV_VAR 1
|
||||
#define OLD_ENV_VALUE 0
|
||||
#define NEW_ENV_VAR 0
|
||||
#define NEW_ENV_VALUE 1
|
||||
#define ENV_ESC 2
|
||||
#define ENV_USERVAR 3
|
||||
|
||||
/*
|
||||
* AUTHENTICATION suboptions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Who is authenticating who ...
|
||||
*/
|
||||
#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
|
||||
#define AUTH_WHO_SERVER 1 /* Server authenticating client */
|
||||
#define AUTH_WHO_MASK 1
|
||||
|
||||
/*
|
||||
* amount of authentication done
|
||||
*/
|
||||
#define AUTH_HOW_ONE_WAY 0
|
||||
#define AUTH_HOW_MUTUAL 2
|
||||
#define AUTH_HOW_MASK 2
|
||||
|
||||
#define AUTHTYPE_NULL 0
|
||||
#define AUTHTYPE_KERBEROS_V4 1
|
||||
#define AUTHTYPE_KERBEROS_V5 2
|
||||
#define AUTHTYPE_SPX 3
|
||||
#define AUTHTYPE_MINK 4
|
||||
#define AUTHTYPE_CNT 5
|
||||
|
||||
#define AUTHTYPE_TEST 99
|
||||
|
||||
#ifdef AUTH_NAMES
|
||||
char *authtype_names[] = {
|
||||
"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK",
|
||||
0
|
||||
};
|
||||
#else
|
||||
extern char *authtype_names[];
|
||||
#endif
|
||||
|
||||
#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
|
||||
#define AUTHTYPE_NAME(x) authtype_names[x]
|
||||
|
||||
/*
|
||||
* ENCRYPTion suboptions
|
||||
*/
|
||||
#define ENCRYPT_IS 0 /* I pick encryption type ... */
|
||||
#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
|
||||
#define ENCRYPT_REPLY 2 /* Initial setup response */
|
||||
#define ENCRYPT_START 3 /* Am starting to send encrypted */
|
||||
#define ENCRYPT_END 4 /* Am ending encrypted */
|
||||
#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
|
||||
#define ENCRYPT_REQEND 6 /* Request you end encrypting */
|
||||
#define ENCRYPT_ENC_KEYID 7
|
||||
#define ENCRYPT_DEC_KEYID 8
|
||||
#define ENCRYPT_CNT 9
|
||||
|
||||
#define ENCTYPE_ANY 0
|
||||
#define ENCTYPE_DES_CFB64 1
|
||||
#define ENCTYPE_DES_OFB64 2
|
||||
#define ENCTYPE_CNT 3
|
||||
|
||||
#ifdef ENCRYPT_NAMES
|
||||
char *encrypt_names[] = {
|
||||
"IS", "SUPPORT", "REPLY", "START", "END",
|
||||
"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
|
||||
0
|
||||
};
|
||||
char *enctype_names[] = {
|
||||
"ANY", "DES_CFB64", "DES_OFB64",
|
||||
0
|
||||
};
|
||||
#else
|
||||
extern char *encrypt_names[];
|
||||
extern char *enctype_names[];
|
||||
#endif
|
||||
|
||||
|
||||
#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
|
||||
#define ENCRYPT_NAME(x) encrypt_names[x]
|
||||
|
||||
#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
|
||||
#define ENCTYPE_NAME(x) enctype_names[x]
|
||||
|
||||
#endif /* !_TELNET_H_ */
|
25
StdLib/Include/err.h
Normal file
25
StdLib/Include/err.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/** @file error and warning output messages
|
||||
|
||||
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
**/
|
||||
|
||||
#ifndef _ERR_H_
|
||||
#define _ERR_H_
|
||||
|
||||
//
|
||||
// Error and Warning outputs
|
||||
//
|
||||
|
||||
void errx (int eval, const char *fmt, ...);
|
||||
void err (int eval, const char *fmt, ...);
|
||||
void warnx(const char *fmt, ...);
|
||||
void warn (const char *fmt, ...);
|
||||
|
||||
#endif
|
@@ -34,6 +34,8 @@ extern RETURN_STATUS EFIerrno;
|
||||
|
||||
// Define error number in terms of the ENUM in <sys/errno.h>
|
||||
|
||||
#define ERESTART -1 /* restart syscall */
|
||||
|
||||
#define EMINERRORVAL __EMINERRORVAL /* The lowest valid error value */
|
||||
|
||||
#define EPERM __EPERM /* 1 Operation not permitted */
|
||||
|
109
StdLib/Include/glob.h
Normal file
109
StdLib/Include/glob.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/* $NetBSD: glob.h,v 1.24 2008/09/13 17:05:07 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Guido van Rossum.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)glob.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
#ifndef _GLOB_H_
|
||||
#define _GLOB_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/featuretest.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifndef __gl_size_t
|
||||
#define __gl_size_t size_t
|
||||
#endif
|
||||
#ifndef __gl_stat_t
|
||||
#define __gl_stat_t struct stat
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
__gl_size_t gl_pathc; /* Count of total paths so far. */
|
||||
__gl_size_t gl_matchc; /* Count of paths matching pattern. */
|
||||
__gl_size_t gl_offs; /* Reserved at beginning of gl_pathv. */
|
||||
int gl_flags; /* Copy of flags parameter to glob. */
|
||||
char **gl_pathv; /* List of paths matching pattern. */
|
||||
/* Copy of errfunc parameter to glob. */
|
||||
int (*gl_errfunc)(const char *, int);
|
||||
|
||||
/*
|
||||
* Alternate filesystem access methods for glob; replacement
|
||||
* versions of closedir(3), readdir(3), opendir(3), stat(2)
|
||||
* and lstat(2).
|
||||
*/
|
||||
void (*gl_closedir)(void *);
|
||||
struct dirent *(*gl_readdir)(void *);
|
||||
void *(*gl_opendir)(const char *);
|
||||
int (*gl_lstat)(const char *, __gl_stat_t *);
|
||||
int (*gl_stat)(const char *, __gl_stat_t *);
|
||||
} glob_t;
|
||||
|
||||
#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
|
||||
#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
|
||||
#define GLOB_ERR 0x0004 /* Return on error. */
|
||||
#define GLOB_MARK 0x0008 /* Append / to matching directories. */
|
||||
#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
|
||||
#define GLOB_NOSORT 0x0020 /* Don't sort. */
|
||||
#define GLOB_NOESCAPE 0x1000 /* Disable backslash escaping. */
|
||||
|
||||
#define GLOB_NOSPACE (-1) /* Malloc call failed. */
|
||||
#define GLOB_ABORTED (-2) /* Unignored error. */
|
||||
#define GLOB_NOMATCH (-3) /* No match, and GLOB_NOCHECK was not set. */
|
||||
#define GLOB_NOSYS (-4) /* Implementation does not support function. */
|
||||
|
||||
#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
|
||||
#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
|
||||
#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
|
||||
#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
|
||||
#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
|
||||
#define GLOB_LIMIT 0x0400 /* Limit memory used by matches to ARG_MAX */
|
||||
#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
|
||||
/* GLOB_NOESCAPE 0x1000 above */
|
||||
#define GLOB_PERIOD 0x2000 /* Allow metachars to match leading periods. */
|
||||
#define GLOB_NO_DOTDIRS 0x4000 /* Make . and .. vanish from wildcards. */
|
||||
#define GLOB_QUOTE 0 /* source compatibility */
|
||||
|
||||
#define GLOB_ABEND GLOB_ABORTED /* source compatibility */
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
#ifndef __LIBC12_SOURCE__
|
||||
int glob(const char * __restrict, int,
|
||||
int (*)(const char *, int), glob_t * __restrict) __RENAME(__glob30);
|
||||
void globfree(glob_t *) __RENAME(__globfree30);
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_GLOB_H_ */
|
14
StdLib/Include/libgen.h
Normal file
14
StdLib/Include/libgen.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
char *dirname(char *path);
|
227
StdLib/Include/net/if.h
Normal file
227
StdLib/Include/net/if.h
Normal file
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if.h 8.1 (Berkeley) 6/10/93
|
||||
* $Id: if.h,v 1.1.1.1 2006/05/30 06:12:41 hhzhou Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_H_
|
||||
#define _NET_IF_H_
|
||||
|
||||
/*
|
||||
* <net/if.h> does not depend on <sys/time.h> on most other systems. This
|
||||
* helps userland compatability. (struct timeval ifi_lastchange)
|
||||
*/
|
||||
#ifndef KERNEL
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure describing information about an interface
|
||||
* which may be of interest to management entities.
|
||||
*/
|
||||
struct if_data {
|
||||
/* generic interface information */
|
||||
u_char ifi_type; /* ethernet, tokenring, etc */
|
||||
u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */
|
||||
u_char ifi_addrlen; /* media address length */
|
||||
u_char ifi_hdrlen; /* media header length */
|
||||
u_char ifi_recvquota; /* polling quota for receive intrs */
|
||||
u_char ifi_xmitquota; /* polling quota for xmit intrs */
|
||||
u_long ifi_mtu; /* maximum transmission unit */
|
||||
u_long ifi_metric; /* routing metric (external only) */
|
||||
u_long ifi_baudrate; /* linespeed */
|
||||
/* volatile statistics */
|
||||
u_long ifi_ipackets; /* packets received on interface */
|
||||
u_long ifi_ierrors; /* input errors on interface */
|
||||
u_long ifi_opackets; /* packets sent on interface */
|
||||
u_long ifi_oerrors; /* output errors on interface */
|
||||
u_long ifi_collisions; /* collisions on csma interfaces */
|
||||
u_long ifi_ibytes; /* total number of octets received */
|
||||
u_long ifi_obytes; /* total number of octets sent */
|
||||
u_long ifi_imcasts; /* packets received via multicast */
|
||||
u_long ifi_omcasts; /* packets sent via multicast */
|
||||
u_long ifi_iqdrops; /* dropped on input, this interface */
|
||||
u_long ifi_noproto; /* destined for unsupported protocol */
|
||||
u_long ifi_recvtiming; /* usec spent receiving when timing */
|
||||
u_long ifi_xmittiming; /* usec spent xmitting when timing */
|
||||
struct timeval ifi_lastchange; /* time of last administrative change */
|
||||
};
|
||||
|
||||
#define IFF_UP 0x1 /* interface is up */
|
||||
#define IFF_BROADCAST 0x2 /* broadcast address valid */
|
||||
#define IFF_DEBUG 0x4 /* turn on debugging */
|
||||
#define IFF_LOOPBACK 0x8 /* is a loopback net */
|
||||
#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
|
||||
/*#define IFF_NOTRAILERS 0x20 * obsolete: avoid use of trailers */
|
||||
#define IFF_RUNNING 0x40 /* resources allocated */
|
||||
#define IFF_NOARP 0x80 /* no address resolution protocol */
|
||||
#define IFF_PROMISC 0x100 /* receive all packets */
|
||||
#define IFF_ALLMULTI 0x200 /* receive all multicast packets */
|
||||
#define IFF_OACTIVE 0x400 /* transmission in progress */
|
||||
#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */
|
||||
#define IFF_LINK0 0x1000 /* per link layer defined bit */
|
||||
#define IFF_LINK1 0x2000 /* per link layer defined bit */
|
||||
#define IFF_LINK2 0x4000 /* per link layer defined bit */
|
||||
#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */
|
||||
#define IFF_MULTICAST 0x8000 /* supports multicast */
|
||||
|
||||
/* flags set internally only: */
|
||||
#define IFF_CANTCHANGE \
|
||||
(IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\
|
||||
IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI)
|
||||
|
||||
#define IFQ_MAXLEN 50
|
||||
#define IFNET_SLOWHZ 1 /* granularity is 1 second */
|
||||
|
||||
/*
|
||||
* Message format for use in obtaining information about interfaces
|
||||
* from getkerninfo and the routing socket
|
||||
*/
|
||||
struct if_msghdr {
|
||||
u_short ifm_msglen; /* to skip over non-understood messages */
|
||||
u_char ifm_version; /* future binary compatability */
|
||||
u_char ifm_type; /* message type */
|
||||
int ifm_addrs; /* like rtm_addrs */
|
||||
int ifm_flags; /* value of if_flags */
|
||||
u_short ifm_index; /* index for associated ifp */
|
||||
struct if_data ifm_data;/* statistics and other data about if */
|
||||
};
|
||||
|
||||
/*
|
||||
* Message format for use in obtaining information about interface addresses
|
||||
* from getkerninfo and the routing socket
|
||||
*/
|
||||
struct ifa_msghdr {
|
||||
u_short ifam_msglen; /* to skip over non-understood messages */
|
||||
u_char ifam_version; /* future binary compatability */
|
||||
u_char ifam_type; /* message type */
|
||||
int ifam_addrs; /* like rtm_addrs */
|
||||
int ifam_flags; /* value of ifa_flags */
|
||||
u_short ifam_index; /* index for associated ifp */
|
||||
int ifam_metric; /* value of ifa_metric */
|
||||
};
|
||||
|
||||
/*
|
||||
* Message format for use in obtaining information about multicast addresses
|
||||
* from the routing socket
|
||||
*/
|
||||
struct ifma_msghdr {
|
||||
u_short ifmam_msglen; /* to skip over non-understood messages */
|
||||
u_char ifmam_version; /* future binary compatability */
|
||||
u_char ifmam_type; /* message type */
|
||||
int ifmam_addrs; /* like rtm_addrs */
|
||||
int ifmam_flags; /* value of ifa_flags */
|
||||
u_short ifmam_index; /* index for associated ifp */
|
||||
};
|
||||
|
||||
/*
|
||||
* Interface request structure used for socket
|
||||
* ioctl's. All interface ioctl's must have parameter
|
||||
* definitions which begin with ifr_name. The
|
||||
* remainder may be interface specific.
|
||||
*/
|
||||
struct ifreq {
|
||||
#define IFNAMSIZ 16
|
||||
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
union {
|
||||
struct sockaddr ifru_addr;
|
||||
struct sockaddr ifru_dstaddr;
|
||||
struct sockaddr ifru_broadaddr;
|
||||
short ifru_flags;
|
||||
int ifru_metric;
|
||||
int ifru_mtu;
|
||||
int ifru_phys;
|
||||
int ifru_media;
|
||||
caddr_t ifru_data;
|
||||
} ifr_ifru;
|
||||
#define ifr_addr ifr_ifru.ifru_addr /* address */
|
||||
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
|
||||
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
|
||||
#define ifr_flags ifr_ifru.ifru_flags /* flags */
|
||||
#define ifr_metric ifr_ifru.ifru_metric /* metric */
|
||||
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
|
||||
#define ifr_phys ifr_ifru.ifru_phys /* physical wire */
|
||||
#define ifr_media ifr_ifru.ifru_media /* physical media */
|
||||
#define ifr_data ifr_ifru.ifru_data /* for use by interface */
|
||||
};
|
||||
|
||||
#define _SIZEOF_ADDR_IFREQ(ifr) \
|
||||
((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \
|
||||
(sizeof(struct ifreq) - sizeof(struct sockaddr) + \
|
||||
(ifr).ifr_addr.sa_len) : sizeof(struct ifreq))
|
||||
|
||||
struct ifaliasreq {
|
||||
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
struct sockaddr ifra_addr;
|
||||
struct sockaddr ifra_broadaddr;
|
||||
struct sockaddr ifra_mask;
|
||||
};
|
||||
|
||||
struct ifmediareq {
|
||||
char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
int ifm_current; /* current media options */
|
||||
int ifm_mask; /* don't care mask */
|
||||
int ifm_status; /* media status */
|
||||
int ifm_active; /* active options */
|
||||
int ifm_count; /* # entries in ifm_ulist array */
|
||||
int *ifm_ulist; /* media words */
|
||||
};
|
||||
/*
|
||||
* Structure used in SIOCGIFCONF request.
|
||||
* Used to retrieve interface configuration
|
||||
* for machine (useful for programs which
|
||||
* must know all networks accessible).
|
||||
*/
|
||||
struct ifconf {
|
||||
int ifc_len; /* size of associated buffer */
|
||||
union {
|
||||
caddr_t ifcu_buf;
|
||||
struct ifreq *ifcu_req;
|
||||
} ifc_ifcu;
|
||||
#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
|
||||
#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
|
||||
};
|
||||
|
||||
#ifdef KERNEL
|
||||
#ifdef MALLOC_DECLARE
|
||||
MALLOC_DECLARE(M_IFADDR);
|
||||
MALLOC_DECLARE(M_IFMADDR);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* XXX - this should go away soon */
|
||||
#ifdef KERNEL
|
||||
#include <net/if_var.h>
|
||||
#endif
|
||||
|
||||
#endif /* !_NET_IF_H_ */
|
86
StdLib/Include/net/if_dl.h
Normal file
86
StdLib/Include/net/if_dl.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if_dl.h 8.1 (Berkeley) 6/10/93
|
||||
* $Id: if_dl.h,v 1.1.1.1 2006/05/30 06:12:42 hhzhou Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_DL_H_
|
||||
#define _NET_IF_DL_H_
|
||||
|
||||
/*
|
||||
* A Link-Level Sockaddr may specify the interface in one of two
|
||||
* ways: either by means of a system-provided index number (computed
|
||||
* anew and possibly differently on every reboot), or by a human-readable
|
||||
* string such as "il0" (for managerial convenience).
|
||||
*
|
||||
* Census taking actions, such as something akin to SIOCGCONF would return
|
||||
* both the index and the human name.
|
||||
*
|
||||
* High volume transactions (such as giving a link-level ``from'' address
|
||||
* in a recvfrom or recvmsg call) may be likely only to provide the indexed
|
||||
* form, (which requires fewer copy operations and less space).
|
||||
*
|
||||
* The form and interpretation of the link-level address is purely a matter
|
||||
* of convention between the device driver and its consumers; however, it is
|
||||
* expected that all drivers for an interface of a given if_type will agree.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure of a Link-Level sockaddr:
|
||||
*/
|
||||
struct sockaddr_dl {
|
||||
u_char sdl_len; /* Total length of sockaddr */
|
||||
u_char sdl_family; /* AF_DLI */
|
||||
u_short sdl_index; /* if != 0, system given index for interface */
|
||||
u_char sdl_type; /* interface type */
|
||||
u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */
|
||||
u_char sdl_alen; /* link level address length */
|
||||
u_char sdl_slen; /* link layer selector length */
|
||||
char sdl_data[12]; /* minimum work area, can be larger;
|
||||
contains both if name and ll address */
|
||||
};
|
||||
|
||||
#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
|
||||
|
||||
#ifndef KERNEL
|
||||
|
||||
#include <sys/EfiCdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
void link_addr __P((const char *, struct sockaddr_dl *));
|
||||
char *link_ntoa __P((const struct sockaddr_dl *));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !KERNEL */
|
||||
|
||||
#endif
|
170
StdLib/Include/net/radix.h
Normal file
170
StdLib/Include/net/radix.h
Normal file
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)radix.h 8.2 (Berkeley) 10/31/94
|
||||
* $Id: radix.h,v 1.1.1.1 2006/05/30 06:12:46 hhzhou Exp $
|
||||
*/
|
||||
|
||||
#ifndef _RADIX_H_
|
||||
#define _RADIX_H_
|
||||
|
||||
#ifdef MALLOC_DECLARE
|
||||
MALLOC_DECLARE(M_RTABLE);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Radix search tree node layout.
|
||||
*/
|
||||
|
||||
struct radix_node {
|
||||
struct radix_mask *rn_mklist; /* list of masks contained in subtree */
|
||||
struct radix_node *rn_p; /* parent */
|
||||
short rn_b; /* bit offset; -1-index(netmask) */
|
||||
char rn_bmask; /* node: mask for bit test*/
|
||||
u_char rn_flags; /* enumerated next */
|
||||
#define RNF_NORMAL 1 /* leaf contains normal route */
|
||||
#define RNF_ROOT 2 /* leaf is root leaf for tree */
|
||||
#define RNF_ACTIVE 4 /* This node is alive (for rtfree) */
|
||||
union {
|
||||
struct { /* leaf only data: */
|
||||
caddr_t rn_Key; /* object of search */
|
||||
caddr_t rn_Mask; /* netmask, if present */
|
||||
struct radix_node *rn_Dupedkey;
|
||||
} rn_leaf;
|
||||
struct { /* node only data: */
|
||||
int rn_Off; /* where to start compare */
|
||||
struct radix_node *rn_L;/* progeny */
|
||||
struct radix_node *rn_R;/* progeny */
|
||||
} rn_node;
|
||||
} rn_u;
|
||||
#ifdef RN_DEBUG
|
||||
int rn_info;
|
||||
struct radix_node *rn_twin;
|
||||
struct radix_node *rn_ybro;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey
|
||||
#define rn_key rn_u.rn_leaf.rn_Key
|
||||
#define rn_mask rn_u.rn_leaf.rn_Mask
|
||||
#define rn_off rn_u.rn_node.rn_Off
|
||||
#define rn_l rn_u.rn_node.rn_L
|
||||
#define rn_r rn_u.rn_node.rn_R
|
||||
|
||||
/*
|
||||
* Annotations to tree concerning potential routes applying to subtrees.
|
||||
*/
|
||||
|
||||
struct radix_mask {
|
||||
short rm_b; /* bit offset; -1-index(netmask) */
|
||||
char rm_unused; /* cf. rn_bmask */
|
||||
u_char rm_flags; /* cf. rn_flags */
|
||||
struct radix_mask *rm_mklist; /* more masks to try */
|
||||
union {
|
||||
caddr_t rmu_mask; /* the mask */
|
||||
struct radix_node *rmu_leaf; /* for normal routes */
|
||||
} rm_rmu;
|
||||
int rm_refs; /* # of references to this struct */
|
||||
};
|
||||
|
||||
#define rm_mask rm_rmu.rmu_mask
|
||||
#define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */
|
||||
|
||||
#define MKGet(m) {\
|
||||
if (rn_mkfreelist) {\
|
||||
m = rn_mkfreelist; \
|
||||
rn_mkfreelist = (m)->rm_mklist; \
|
||||
} else \
|
||||
R_Malloc(m, struct radix_mask *, sizeof (*(m))); }\
|
||||
|
||||
#define MKFree(m) { (m)->rm_mklist = rn_mkfreelist; rn_mkfreelist = (m);}
|
||||
|
||||
typedef int walktree_f_t __P((struct radix_node *, void *));
|
||||
|
||||
struct radix_node_head {
|
||||
struct radix_node *rnh_treetop;
|
||||
int rnh_addrsize; /* permit, but not require fixed keys */
|
||||
int rnh_pktsize; /* permit, but not require fixed keys */
|
||||
struct radix_node *(*rnh_addaddr) /* add based on sockaddr */
|
||||
__P((void *v, void *mask,
|
||||
struct radix_node_head *head, struct radix_node nodes[]));
|
||||
struct radix_node *(*rnh_addpkt) /* add based on packet hdr */
|
||||
__P((void *v, void *mask,
|
||||
struct radix_node_head *head, struct radix_node nodes[]));
|
||||
struct radix_node *(*rnh_deladdr) /* remove based on sockaddr */
|
||||
__P((void *v, void *mask, struct radix_node_head *head));
|
||||
struct radix_node *(*rnh_delpkt) /* remove based on packet hdr */
|
||||
__P((void *v, void *mask, struct radix_node_head *head));
|
||||
struct radix_node *(*rnh_matchaddr) /* locate based on sockaddr */
|
||||
__P((void *v, struct radix_node_head *head));
|
||||
struct radix_node *(*rnh_lookup) /* locate based on sockaddr */
|
||||
__P((void *v, void *mask, struct radix_node_head *head));
|
||||
struct radix_node *(*rnh_matchpkt) /* locate based on packet hdr */
|
||||
__P((void *v, struct radix_node_head *head));
|
||||
int (*rnh_walktree) /* traverse tree */
|
||||
__P((struct radix_node_head *head, walktree_f_t *f, void *w));
|
||||
int (*rnh_walktree_from) /* traverse tree below a */
|
||||
__P((struct radix_node_head *head, void *a, void *m,
|
||||
walktree_f_t *f, void *w));
|
||||
void (*rnh_close) /* do something when the last ref drops */
|
||||
__P((struct radix_node *rn, struct radix_node_head *head));
|
||||
struct radix_node rnh_nodes[3]; /* empty tree for common case */
|
||||
};
|
||||
|
||||
#ifndef KERNEL
|
||||
#define Bcmp(a, b, n) bcmp(((char *)(a)), ((char *)(b)), (n))
|
||||
#define Bcopy(a, b, n) bcopy(((char *)(a)), ((char *)(b)), (unsigned)(n))
|
||||
#define Bzero(p, n) bzero((char *)(p), (int)(n));
|
||||
#define R_Malloc(p, t, n) (p = (t) malloc((unsigned int)(n)))
|
||||
#define Free(p) free((char *)p);
|
||||
#else
|
||||
#define Bcmp(a, b, n) bcmp(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n))
|
||||
#define Bcopy(a, b, n) bcopy(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n))
|
||||
#define Bzero(p, n) bzero((caddr_t)(p), (unsigned)(n));
|
||||
#define R_Malloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_DONTWAIT))
|
||||
#define Free(p) free((caddr_t)p, M_RTABLE);
|
||||
#endif /*KERNEL*/
|
||||
|
||||
void rn_init __P((void));
|
||||
int rn_inithead __P((void **, int));
|
||||
int rn_refines __P((void *, void *));
|
||||
struct radix_node
|
||||
*rn_addmask __P((void *, int, int)),
|
||||
*rn_addroute __P((void *, void *, struct radix_node_head *,
|
||||
struct radix_node [2])),
|
||||
*rn_delete __P((void *, void *, struct radix_node_head *)),
|
||||
*rn_lookup __P((void *v_arg, void *m_arg,
|
||||
struct radix_node_head *head)),
|
||||
*rn_match __P((void *, struct radix_node_head *));
|
||||
|
||||
|
||||
#endif /* _RADIX_H_ */
|
292
StdLib/Include/net/route.h
Normal file
292
StdLib/Include/net/route.h
Normal file
@@ -0,0 +1,292 @@
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)route.h 8.3 (Berkeley) 4/19/94
|
||||
* $Id: route.h,v 1.1.1.1 2006/05/30 06:12:46 hhzhou Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NET_ROUTE_H_
|
||||
#define _NET_ROUTE_H_
|
||||
|
||||
#define __P(protos) protos /* full-blown ANSI C */
|
||||
|
||||
|
||||
/*
|
||||
* Kernel resident routing tables.
|
||||
*
|
||||
* The routing tables are initialized when interface addresses
|
||||
* are set by making entries for all directly connected interfaces.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A route consists of a destination address and a reference
|
||||
* to a routing entry. These are often held by protocols
|
||||
* in their control blocks, e.g. inpcb.
|
||||
*/
|
||||
struct route {
|
||||
struct rtentry *ro_rt;
|
||||
struct sockaddr ro_dst;
|
||||
};
|
||||
|
||||
/*
|
||||
* These numbers are used by reliable protocols for determining
|
||||
* retransmission behavior and are included in the routing structure.
|
||||
*/
|
||||
struct rt_metrics {
|
||||
u_long rmx_locks; /* Kernel must leave these values alone */
|
||||
u_long rmx_mtu; /* MTU for this path */
|
||||
u_long rmx_hopcount; /* max hops expected */
|
||||
u_long rmx_expire; /* lifetime for route, e.g. redirect */
|
||||
u_long rmx_recvpipe; /* inbound delay-bandwidth product */
|
||||
u_long rmx_sendpipe; /* outbound delay-bandwidth product */
|
||||
u_long rmx_ssthresh; /* outbound gateway buffer limit */
|
||||
u_long rmx_rtt; /* estimated round trip time */
|
||||
u_long rmx_rttvar; /* estimated rtt variance */
|
||||
u_long rmx_pksent; /* packets sent using this route */
|
||||
u_long rmx_filler[4]; /* will be used for T/TCP later */
|
||||
};
|
||||
|
||||
/*
|
||||
* rmx_rtt and rmx_rttvar are stored as microseconds;
|
||||
* RTTTOPRHZ(rtt) converts to a value suitable for use
|
||||
* by a protocol slowtimo counter.
|
||||
*/
|
||||
#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */
|
||||
#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ))
|
||||
|
||||
/*
|
||||
* XXX kernel function pointer `rt_output' is visible to applications.
|
||||
*/
|
||||
struct mbuf;
|
||||
|
||||
/*
|
||||
* We distinguish between routes to hosts and routes to networks,
|
||||
* preferring the former if available. For each route we infer
|
||||
* the interface to use from the gateway address supplied when
|
||||
* the route was entered. Routes that forward packets through
|
||||
* gateways are marked so that the output routines know to address the
|
||||
* gateway rather than the ultimate destination.
|
||||
*/
|
||||
#ifndef RNF_NORMAL
|
||||
#include <net/radix.h>
|
||||
#endif
|
||||
struct rtentry {
|
||||
struct radix_node rt_nodes[2]; /* tree glue, and other values */
|
||||
#define rt_key(r) ((struct sockaddr *)((r)->rt_nodes->rn_key))
|
||||
#define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask))
|
||||
struct sockaddr *rt_gateway; /* value */
|
||||
short rt_filler; /* was short flags field */
|
||||
short rt_refcnt; /* # held references */
|
||||
u_long rt_flags; /* up/down?, host/net */
|
||||
struct ifnet *rt_ifp; /* the answer: interface to use */
|
||||
struct ifaddr *rt_ifa; /* the answer: interface to use */
|
||||
struct sockaddr *rt_genmask; /* for generation of cloned routes */
|
||||
caddr_t rt_llinfo; /* pointer to link level info cache */
|
||||
struct rt_metrics rt_rmx; /* metrics used by rx'ing protocols */
|
||||
struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */
|
||||
int (*rt_output) __P((struct ifnet *, struct mbuf *,
|
||||
struct sockaddr *, struct rtentry *));
|
||||
/* output routine for this (rt,if) */
|
||||
struct rtentry *rt_parent; /* cloning parent of this route */
|
||||
void *rt_filler2; /* more filler */
|
||||
};
|
||||
|
||||
/*
|
||||
* Following structure necessary for 4.3 compatibility;
|
||||
* We should eventually move it to a compat file.
|
||||
*/
|
||||
struct ortentry {
|
||||
u_long rt_hash; /* to speed lookups */
|
||||
struct sockaddr rt_dst; /* key */
|
||||
struct sockaddr rt_gateway; /* value */
|
||||
short rt_flags; /* up/down?, host/net */
|
||||
short rt_refcnt; /* # held references */
|
||||
u_long rt_use; /* raw # packets forwarded */
|
||||
struct ifnet *rt_ifp; /* the answer: interface to use */
|
||||
};
|
||||
|
||||
#define rt_use rt_rmx.rmx_pksent
|
||||
|
||||
#define RTF_UP 0x1 /* route usable */
|
||||
#define RTF_GATEWAY 0x2 /* destination is a gateway */
|
||||
#define RTF_HOST 0x4 /* host entry (net otherwise) */
|
||||
#define RTF_REJECT 0x8 /* host or net unreachable */
|
||||
#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */
|
||||
#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */
|
||||
#define RTF_DONE 0x40 /* message confirmed */
|
||||
/* 0x80 unused */
|
||||
#define RTF_CLONING 0x100 /* generate new routes on use */
|
||||
#define RTF_XRESOLVE 0x200 /* external daemon resolves name */
|
||||
#define RTF_LLINFO 0x400 /* generated by link layer (e.g. ARP) */
|
||||
#define RTF_STATIC 0x800 /* manually added */
|
||||
#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */
|
||||
#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
|
||||
#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
|
||||
|
||||
#define RTF_PRCLONING 0x10000 /* protocol requires cloning */
|
||||
#define RTF_WASCLONED 0x20000 /* route generated through cloning */
|
||||
#define RTF_PROTO3 0x40000 /* protocol specific routing flag */
|
||||
/* 0x80000 unused */
|
||||
#define RTF_PINNED 0x100000 /* future use */
|
||||
#define RTF_LOCAL 0x200000 /* route represents a local address */
|
||||
#define RTF_BROADCAST 0x400000 /* route represents a bcast address */
|
||||
#define RTF_MULTICAST 0x800000 /* route represents a mcast address */
|
||||
/* 0x1000000 and up unassigned */
|
||||
|
||||
/*
|
||||
* Routing statistics.
|
||||
*/
|
||||
struct rtstat {
|
||||
short rts_badredirect; /* bogus redirect calls */
|
||||
short rts_dynamic; /* routes created by redirects */
|
||||
short rts_newgateway; /* routes modified by redirects */
|
||||
short rts_unreach; /* lookups which failed */
|
||||
short rts_wildcard; /* lookups satisfied by a wildcard */
|
||||
};
|
||||
/*
|
||||
* Structures for routing messages.
|
||||
*/
|
||||
struct rt_msghdr {
|
||||
u_short rtm_msglen; /* to skip over non-understood messages */
|
||||
u_char rtm_version; /* future binary compatibility */
|
||||
u_char rtm_type; /* message type */
|
||||
u_short rtm_index; /* index for associated ifp */
|
||||
int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
|
||||
int rtm_addrs; /* bitmask identifying sockaddrs in msg */
|
||||
pid_t rtm_pid; /* identify sender */
|
||||
int rtm_seq; /* for sender to identify action */
|
||||
int rtm_errno; /* why failed */
|
||||
int rtm_use; /* from rtentry */
|
||||
u_long rtm_inits; /* which metrics we are initializing */
|
||||
struct rt_metrics rtm_rmx; /* metrics themselves */
|
||||
};
|
||||
|
||||
#define RTM_VERSION 5 /* Up the ante and ignore older versions */
|
||||
|
||||
#define RTM_ADD 0x1 /* Add Route */
|
||||
#define RTM_DELETE 0x2 /* Delete Route */
|
||||
#define RTM_CHANGE 0x3 /* Change Metrics or flags */
|
||||
#define RTM_GET 0x4 /* Report Metrics */
|
||||
#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */
|
||||
#define RTM_REDIRECT 0x6 /* Told to use different route */
|
||||
#define RTM_MISS 0x7 /* Lookup failed on this address */
|
||||
#define RTM_LOCK 0x8 /* fix specified metrics */
|
||||
#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */
|
||||
#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */
|
||||
#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */
|
||||
#define RTM_NEWADDR 0xc /* address being added to iface */
|
||||
#define RTM_DELADDR 0xd /* address being removed from iface */
|
||||
#define RTM_IFINFO 0xe /* iface going up/down etc. */
|
||||
#define RTM_NEWMADDR 0xf /* mcast group membership being added to if */
|
||||
#define RTM_DELMADDR 0x10 /* mcast group membership being deleted */
|
||||
|
||||
#define RTV_MTU 0x1 /* init or lock _mtu */
|
||||
#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */
|
||||
#define RTV_EXPIRE 0x4 /* init or lock _hopcount */
|
||||
#define RTV_RPIPE 0x8 /* init or lock _recvpipe */
|
||||
#define RTV_SPIPE 0x10 /* init or lock _sendpipe */
|
||||
#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */
|
||||
#define RTV_RTT 0x40 /* init or lock _rtt */
|
||||
#define RTV_RTTVAR 0x80 /* init or lock _rttvar */
|
||||
|
||||
/*
|
||||
* Bitmask values for rtm_addr.
|
||||
*/
|
||||
#define RTA_DST 0x1 /* destination sockaddr present */
|
||||
#define RTA_GATEWAY 0x2 /* gateway sockaddr present */
|
||||
#define RTA_NETMASK 0x4 /* netmask sockaddr present */
|
||||
#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */
|
||||
#define RTA_IFP 0x10 /* interface name sockaddr present */
|
||||
#define RTA_IFA 0x20 /* interface addr sockaddr present */
|
||||
#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */
|
||||
#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */
|
||||
|
||||
/*
|
||||
* Index offsets for sockaddr array for alternate internal encoding.
|
||||
*/
|
||||
#define RTAX_DST 0 /* destination sockaddr present */
|
||||
#define RTAX_GATEWAY 1 /* gateway sockaddr present */
|
||||
#define RTAX_NETMASK 2 /* netmask sockaddr present */
|
||||
#define RTAX_GENMASK 3 /* cloning mask sockaddr present */
|
||||
#define RTAX_IFP 4 /* interface name sockaddr present */
|
||||
#define RTAX_IFA 5 /* interface addr sockaddr present */
|
||||
#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */
|
||||
#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */
|
||||
#define RTAX_MAX 8 /* size of array to allocate */
|
||||
|
||||
struct rt_addrinfo {
|
||||
int rti_addrs;
|
||||
struct sockaddr *rti_info[RTAX_MAX];
|
||||
};
|
||||
|
||||
struct route_cb {
|
||||
int ip_count;
|
||||
int ipx_count;
|
||||
int ns_count;
|
||||
int iso_count;
|
||||
int any_count;
|
||||
};
|
||||
|
||||
#ifdef KERNEL
|
||||
#define RTFREE(rt) \
|
||||
if ((rt)->rt_refcnt <= 1) \
|
||||
rtfree(rt); \
|
||||
else \
|
||||
(rt)->rt_refcnt--;
|
||||
|
||||
extern struct route_cb route_cb;
|
||||
extern struct radix_node_head *rt_tables[AF_MAX+1];
|
||||
|
||||
struct ifmultiaddr;
|
||||
struct proc;
|
||||
|
||||
void route_init __P((void));
|
||||
void rt_ifmsg __P((struct ifnet *));
|
||||
void rt_missmsg __P((int, struct rt_addrinfo *, int, int));
|
||||
void rt_newaddrmsg __P((int, struct ifaddr *, int, struct rtentry *));
|
||||
void rt_newmaddrmsg __P((int, struct ifmultiaddr *));
|
||||
int rt_setgate __P((struct rtentry *,
|
||||
struct sockaddr *, struct sockaddr *));
|
||||
void rtalloc __P((struct route *));
|
||||
void rtalloc_ign __P((struct route *, unsigned long));
|
||||
struct rtentry *
|
||||
rtalloc1 __P((struct sockaddr *, int, unsigned long));
|
||||
void rtfree __P((struct rtentry *));
|
||||
int rtinit __P((struct ifaddr *, int, int));
|
||||
int rtioctl __P((int, caddr_t, struct proc *));
|
||||
void rtredirect __P((struct sockaddr *, struct sockaddr *,
|
||||
struct sockaddr *, int, struct sockaddr *, struct rtentry **));
|
||||
int rtrequest __P((int, struct sockaddr *,
|
||||
struct sockaddr *, struct sockaddr *, int, struct rtentry **));
|
||||
#endif
|
||||
|
||||
#endif
|
92
StdLib/Include/netatalk/at.h
Normal file
92
StdLib/Include/netatalk/at.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 1990,1991 Regents of The University of Michigan.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby granted,
|
||||
* provided that the above copyright notice appears in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation, and that the name of The University
|
||||
* of Michigan not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. This software is supplied as is without expressed or
|
||||
* implied warranties of any kind.
|
||||
*
|
||||
* Research Systems Unix Group
|
||||
* The University of Michigan
|
||||
* c/o Mike Clark
|
||||
* 535 W. William Street
|
||||
* Ann Arbor, Michigan
|
||||
* +1-313-763-0525
|
||||
* netatalk@itd.umich.edu
|
||||
*/
|
||||
|
||||
#ifndef __AT_HEADER__
|
||||
#define __AT_HEADER__
|
||||
/*
|
||||
* Supported protocols
|
||||
*/
|
||||
#define ATPROTO_DDP 0
|
||||
#define ATPROTO_AARP 254
|
||||
|
||||
/*
|
||||
* Ethernet types, for DIX.
|
||||
* These should really be in some global header file, but we can't
|
||||
* count on them being there, and it's annoying to patch system files.
|
||||
*/
|
||||
#define ETHERTYPE_AT 0x809B /* AppleTalk protocol */
|
||||
#define ETHERTYPE_AARP 0x80F3 /* AppleTalk ARP */
|
||||
|
||||
#define DDP_MAXSZ 587
|
||||
|
||||
/*
|
||||
* If ATPORT_FIRST <= Port < ATPORT_RESERVED,
|
||||
* Port was created by a privileged process.
|
||||
* If ATPORT_RESERVED <= Port < ATPORT_LAST,
|
||||
* Port was not necessarily created by a
|
||||
* privileged process.
|
||||
*/
|
||||
#define ATPORT_FIRST 1
|
||||
#define ATPORT_RESERVED 128
|
||||
#define ATPORT_LAST 255
|
||||
|
||||
/*
|
||||
* AppleTalk address.
|
||||
*/
|
||||
struct at_addr {
|
||||
u_short s_net;
|
||||
u_char s_node;
|
||||
};
|
||||
|
||||
#define ATADDR_ANYNET (u_short)0x0000
|
||||
#define ATADDR_ANYNODE (u_char)0x00
|
||||
#define ATADDR_ANYPORT (u_char)0x00
|
||||
#define ATADDR_BCAST (u_char)0xff /* There is no BCAST for NET */
|
||||
|
||||
struct netrange {
|
||||
u_char nr_phase;
|
||||
u_short nr_firstnet;
|
||||
u_short nr_lastnet;
|
||||
};
|
||||
|
||||
/*
|
||||
* Socket address, AppleTalk style. We keep magic information in the
|
||||
* zero bytes. There are three types, NONE, CONFIG which has the phase
|
||||
* and a net range, and IFACE which has the network address of an
|
||||
* interface. IFACE may be filled in by the client, and is filled in
|
||||
* by the kernel.
|
||||
*/
|
||||
struct sockaddr_at {
|
||||
u_char sat_len;
|
||||
u_char sat_family;
|
||||
u_char sat_port;
|
||||
struct at_addr sat_addr;
|
||||
union {
|
||||
struct netrange r_netrange;
|
||||
char r_zero[ 8 ]; /* Hide a struct netrange in here */
|
||||
} sat_range;
|
||||
};
|
||||
|
||||
#define sat_zero sat_range.r_zero
|
||||
|
||||
#endif /* !__AT_HEADER__ */
|
@@ -94,6 +94,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/featuretest.h>
|
||||
#include <inttypes.h>
|
||||
#include <paths.h>
|
||||
/*
|
||||
* Data types
|
||||
*/
|
||||
@@ -108,27 +109,6 @@ typedef __socklen_t socklen_t;
|
||||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
|
||||
////#if defined(_NETBSD_SOURCE)
|
||||
////#ifndef _PATH_HEQUIV
|
||||
////#define _PATH_HEQUIV "/etc/hosts.equiv"
|
||||
////#endif
|
||||
#ifndef _PATH_HOSTS
|
||||
#define _PATH_HOSTS "/etc/hosts"
|
||||
#endif
|
||||
#ifndef _PATH_NETWORKS
|
||||
#define _PATH_NETWORKS "/etc/networks"
|
||||
#endif
|
||||
#ifndef _PATH_PROTOCOLS
|
||||
#define _PATH_PROTOCOLS "/etc/protocols"
|
||||
#endif
|
||||
#ifndef _PATH_SERVICES
|
||||
#define _PATH_SERVICES "/etc/services"
|
||||
#endif
|
||||
////#ifndef _PATH_SERVICES_DB
|
||||
////#define _PATH_SERVICES_DB "/var/db/services.db"
|
||||
////#endif
|
||||
////#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern int h_errno;
|
||||
__END_DECLS
|
||||
@@ -219,14 +199,11 @@ struct addrinfo {
|
||||
#define NETDB_INTERNAL -1 /*%< see errno */
|
||||
#define NETDB_SUCCESS 0 /*%< no problem */
|
||||
#endif
|
||||
////#define NO_ADDRESS NO_DATA /* no address, look for MX record */
|
||||
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
|
||||
#define HOST_NOT_FOUND 1 /*%< Authoritative Answer Host not found */
|
||||
#define TRY_AGAIN 2 /*%< Non-Authoritive Host not found, or SERVERFAIL */
|
||||
#define NO_RECOVERY 3 /*%< Non recoverable errors, FORMERR, REFUSED, NOTIMP */
|
||||
////#define NO_DATA 4 /*%< Valid name, no data record of requested type */
|
||||
////#if defined(_NETBSD_SOURCE)
|
||||
////#define NO_ADDRESS NO_DATA /*%< no address, look for MX record */
|
||||
////#endif
|
||||
#define NO_DATA 4 /*%< Valid name, no data record of requested type */
|
||||
|
||||
/*
|
||||
* Error return codes from getaddrinfo()
|
||||
|
62
StdLib/Include/netinet/in_systm.h
Normal file
62
StdLib/Include/netinet/in_systm.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)in_systm.h 8.1 (Berkeley) 6/10/93
|
||||
* $Id: in_systm.h,v 1.1.1.1 2006/05/30 06:12:48 hhzhou Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_IN_SYSTM_H_
|
||||
#define _NETINET_IN_SYSTM_H_
|
||||
|
||||
/*
|
||||
* Miscellaneous internetwork
|
||||
* definitions for kernel.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Network types.
|
||||
*
|
||||
* Internally the system keeps counters in the headers with the bytes
|
||||
* swapped so that VAX instructions will work on them. It reverses
|
||||
* the bytes before transmission at each protocol level. The n_ types
|
||||
* represent the types with the bytes in ``high-ender'' order.
|
||||
*/
|
||||
typedef u_int16_t n_short; /* short as received from the net */
|
||||
typedef u_int32_t n_long; /* long as received from the net */
|
||||
|
||||
typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */
|
||||
|
||||
#ifdef KERNEL
|
||||
n_time iptime __P((void));
|
||||
#endif
|
||||
|
||||
#endif
|
197
StdLib/Include/netinet/ip.h
Normal file
197
StdLib/Include/netinet/ip.h
Normal file
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Portions copyright (c) 1999, 2000
|
||||
* Intel Corporation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
*
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley, Intel Corporation, and its contributors.
|
||||
*
|
||||
* 4. Neither the name of University, Intel Corporation, or their respective
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS, INTEL CORPORATION AND
|
||||
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS,
|
||||
* INTEL CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ip.h 8.2 (Berkeley) 6/1/94
|
||||
* $Id: ip.h,v 1.1.1.1 2006/05/30 06:12:48 hhzhou Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_IP_H_
|
||||
#define _NETINET_IP_H_
|
||||
|
||||
#ifndef _ORG_FREEBSD_
|
||||
#define _IP_VHL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Definitions for internet protocol version 4.
|
||||
* Per RFC 791, September 1981.
|
||||
*/
|
||||
#define IPVERSION 4
|
||||
|
||||
/*
|
||||
* Structure of an internet header, naked of options.
|
||||
*/
|
||||
struct ip {
|
||||
#ifdef _IP_VHL
|
||||
u_char ip_vhl; /* version << 4 | header length >> 2 */
|
||||
#else
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
u_int ip_hl:4, /* header length */
|
||||
ip_v:4; /* version */
|
||||
#endif
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
u_int ip_v:4, /* version */
|
||||
ip_hl:4; /* header length */
|
||||
#endif
|
||||
#endif /* not _IP_VHL */
|
||||
u_char ip_tos; /* type of service */
|
||||
u_short ip_len; /* total length */
|
||||
u_short ip_id; /* identification */
|
||||
u_short ip_off; /* fragment offset field */
|
||||
#define IP_RF 0x8000 /* reserved fragment flag */
|
||||
#define IP_DF 0x4000 /* dont fragment flag */
|
||||
#define IP_MF 0x2000 /* more fragments flag */
|
||||
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
|
||||
u_char ip_ttl; /* time to live */
|
||||
u_char ip_p; /* protocol */
|
||||
u_short ip_sum; /* checksum */
|
||||
struct in_addr ip_src,ip_dst; /* source and dest address */
|
||||
};
|
||||
|
||||
#ifdef _IP_VHL
|
||||
#define IP_MAKE_VHL(v, hl) ((v) << 4 | (hl))
|
||||
#define IP_VHL_HL(vhl) ((vhl) & 0x0f)
|
||||
#define IP_VHL_V(vhl) ((vhl) >> 4)
|
||||
#define IP_VHL_BORING 0x45
|
||||
#endif
|
||||
|
||||
#define IP_MAXPACKET 65535 /* maximum packet size */
|
||||
|
||||
/*
|
||||
* Definitions for IP type of service (ip_tos)
|
||||
*/
|
||||
#define IPTOS_LOWDELAY 0x10
|
||||
#define IPTOS_THROUGHPUT 0x08
|
||||
#define IPTOS_RELIABILITY 0x04
|
||||
#define IPTOS_MINCOST 0x02
|
||||
|
||||
/*
|
||||
* Definitions for IP precedence (also in ip_tos) (hopefully unused)
|
||||
*/
|
||||
#define IPTOS_PREC_NETCONTROL 0xe0
|
||||
#define IPTOS_PREC_INTERNETCONTROL 0xc0
|
||||
#define IPTOS_PREC_CRITIC_ECP 0xa0
|
||||
#define IPTOS_PREC_FLASHOVERRIDE 0x80
|
||||
#define IPTOS_PREC_FLASH 0x60
|
||||
#define IPTOS_PREC_IMMEDIATE 0x40
|
||||
#define IPTOS_PREC_PRIORITY 0x20
|
||||
#define IPTOS_PREC_ROUTINE 0x00
|
||||
|
||||
/*
|
||||
* Definitions for options.
|
||||
*/
|
||||
#define IPOPT_COPIED(o) ((o)&0x80)
|
||||
#define IPOPT_CLASS(o) ((o)&0x60)
|
||||
#define IPOPT_NUMBER(o) ((o)&0x1f)
|
||||
|
||||
#define IPOPT_CONTROL 0x00
|
||||
#define IPOPT_RESERVED1 0x20
|
||||
#define IPOPT_DEBMEAS 0x40
|
||||
#define IPOPT_RESERVED2 0x60
|
||||
|
||||
#define IPOPT_EOL 0 /* end of option list */
|
||||
#define IPOPT_NOP 1 /* no operation */
|
||||
|
||||
#define IPOPT_RR 7 /* record packet route */
|
||||
#define IPOPT_TS 68 /* timestamp */
|
||||
#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
|
||||
#define IPOPT_LSRR 131 /* loose source route */
|
||||
#define IPOPT_SATID 136 /* satnet id */
|
||||
#define IPOPT_SSRR 137 /* strict source route */
|
||||
#define IPOPT_RA 148 /* router alert */
|
||||
|
||||
/*
|
||||
* Offsets to fields in options other than EOL and NOP.
|
||||
*/
|
||||
#define IPOPT_OPTVAL 0 /* option ID */
|
||||
#define IPOPT_OLEN 1 /* option length */
|
||||
#define IPOPT_OFFSET 2 /* offset within option */
|
||||
#define IPOPT_MINOFF 4 /* min value of above */
|
||||
|
||||
/*
|
||||
* Time stamp option structure.
|
||||
*/
|
||||
struct ip_timestamp {
|
||||
u_char ipt_code; /* IPOPT_TS */
|
||||
u_char ipt_len; /* size of structure (variable) */
|
||||
u_char ipt_ptr; /* index of current entry */
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
u_int ipt_flg:4, /* flags, see below */
|
||||
ipt_oflw:4; /* overflow counter */
|
||||
#endif
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
u_int ipt_oflw:4, /* overflow counter */
|
||||
ipt_flg:4; /* flags, see below */
|
||||
#endif
|
||||
union ipt_timestamp {
|
||||
n_long ipt_time[1];
|
||||
struct ipt_ta {
|
||||
struct in_addr ipt_addr;
|
||||
n_long ipt_time;
|
||||
} ipt_ta[1];
|
||||
} ipt_timestamp;
|
||||
};
|
||||
|
||||
/* flag bits for ipt_flg */
|
||||
#define IPOPT_TS_TSONLY 0 /* timestamps only */
|
||||
#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
|
||||
#define IPOPT_TS_PRESPEC 3 /* specified modules only */
|
||||
|
||||
/* bits for security (not byte swapped) */
|
||||
#define IPOPT_SECUR_UNCLASS 0x0000
|
||||
#define IPOPT_SECUR_CONFID 0xf135
|
||||
#define IPOPT_SECUR_EFTO 0x789a
|
||||
#define IPOPT_SECUR_MMMM 0xbc4d
|
||||
#define IPOPT_SECUR_RESTR 0xaf13
|
||||
#define IPOPT_SECUR_SECRET 0xd788
|
||||
#define IPOPT_SECUR_TOPSECRET 0x6bc5
|
||||
|
||||
/*
|
||||
* Internet implementation parameters.
|
||||
*/
|
||||
#define MAXTTL 255 /* maximum time to live (seconds) */
|
||||
#define IPDEFTTL 64 /* default ttl, from RFC 1340 */
|
||||
#define IPFRAGTTL 60 /* time to live for frags, slowhz */
|
||||
#define IPTTLDEC 1 /* subtracted when forwarding */
|
||||
|
||||
#define IP_MSS 576 /* default maximum segment size */
|
||||
|
||||
#endif
|
157
StdLib/Include/netns/ns.h
Normal file
157
StdLib/Include/netns/ns.h
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Copyright (c) 1984, 1985, 1986, 1987, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ns.h 8.1 (Berkeley) 6/10/93
|
||||
* $Id: ns.h,v 1.1.1.1 2003/11/19 01:48:56 kyu3 Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETNS_NS_H_
|
||||
#define _NETNS_NS_H_
|
||||
|
||||
/*
|
||||
* Constants and Structures defined by the Xerox Network Software
|
||||
* per "Internet Transport Protocols", XSIS 028112, December 1981
|
||||
*/
|
||||
|
||||
/*
|
||||
* Protocols
|
||||
*/
|
||||
#define NSPROTO_RI 1 /* Routing Information */
|
||||
#define NSPROTO_ECHO 2 /* Echo Protocol */
|
||||
#define NSPROTO_ERROR 3 /* Error Protocol */
|
||||
#define NSPROTO_PE 4 /* Packet Exchange */
|
||||
#define NSPROTO_SPP 5 /* Sequenced Packet */
|
||||
#define NSPROTO_RAW 255 /* Placemarker*/
|
||||
#define NSPROTO_MAX 256 /* Placemarker*/
|
||||
|
||||
|
||||
/*
|
||||
* Port/Socket numbers: network standard functions
|
||||
*/
|
||||
|
||||
#define NSPORT_RI 1 /* Routing Information */
|
||||
#define NSPORT_ECHO 2 /* Echo */
|
||||
#define NSPORT_RE 3 /* Router Error */
|
||||
|
||||
/*
|
||||
* Ports < NSPORT_RESERVED are reserved for priveleged
|
||||
* processes (e.g. root).
|
||||
*/
|
||||
#define NSPORT_RESERVED 3000
|
||||
|
||||
/* flags passed to ns_output as last parameter */
|
||||
|
||||
#define NS_FORWARDING 0x1 /* most of idp header exists */
|
||||
#define NS_ROUTETOIF 0x10 /* same as SO_DONTROUTE */
|
||||
#define NS_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
|
||||
|
||||
#define NS_MAXHOPS 15
|
||||
|
||||
/* flags passed to get/set socket option */
|
||||
#define SO_HEADERS_ON_INPUT 1
|
||||
#define SO_HEADERS_ON_OUTPUT 2
|
||||
#define SO_DEFAULT_HEADERS 3
|
||||
#define SO_LAST_HEADER 4
|
||||
#define SO_NSIP_ROUTE 5
|
||||
#define SO_SEQNO 6
|
||||
#define SO_ALL_PACKETS 7
|
||||
#define SO_MTU 8
|
||||
|
||||
|
||||
/*
|
||||
* NS addressing
|
||||
*/
|
||||
union ns_host {
|
||||
u_char c_host[6];
|
||||
u_short s_host[3];
|
||||
};
|
||||
|
||||
union ns_net {
|
||||
u_char c_net[4];
|
||||
u_short s_net[2];
|
||||
};
|
||||
|
||||
union ns_net_u {
|
||||
union ns_net net_e;
|
||||
u_long long_e;
|
||||
};
|
||||
|
||||
struct ns_addr {
|
||||
union ns_net x_net;
|
||||
union ns_host x_host;
|
||||
u_short x_port;
|
||||
};
|
||||
|
||||
/*
|
||||
* Socket address, Xerox style
|
||||
*/
|
||||
struct sockaddr_ns {
|
||||
u_char sns_len;
|
||||
u_char sns_family;
|
||||
struct ns_addr sns_addr;
|
||||
char sns_zero[2];
|
||||
};
|
||||
#define sns_port sns_addr.x_port
|
||||
|
||||
#ifdef vax
|
||||
#define ns_netof(a) (*(long *) & ((a).x_net)) /* XXX - not needed */
|
||||
#endif
|
||||
#define ns_neteqnn(a,b) (((a).s_net[0]==(b).s_net[0]) && \
|
||||
((a).s_net[1]==(b).s_net[1]))
|
||||
#define ns_neteq(a,b) ns_neteqnn((a).x_net, (b).x_net)
|
||||
#define satons_addr(sa) (((struct sockaddr_ns *)&(sa))->sns_addr)
|
||||
#define ns_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \
|
||||
(s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2])
|
||||
#define ns_hosteq(s,t) (ns_hosteqnh((s).x_host,(t).x_host))
|
||||
#define ns_nullhost(x) (((x).x_host.s_host[0]==0) && \
|
||||
((x).x_host.s_host[1]==0) && ((x).x_host.s_host[2]==0))
|
||||
|
||||
#ifdef KERNEL
|
||||
extern struct domain nsdomain;
|
||||
union ns_host ns_thishost;
|
||||
union ns_host ns_zerohost;
|
||||
union ns_host ns_broadhost;
|
||||
union ns_net ns_zeronet;
|
||||
union ns_net ns_broadnet;
|
||||
u_short ns_cksum();
|
||||
#else
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern struct ns_addr ns_addr (const char *);
|
||||
extern char *ns_ntoa (struct ns_addr);
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -45,6 +45,19 @@
|
||||
//#define _PATH_DEFPATH "/usr/bin:/bin:/usr/pkg/bin:/usr/local/bin"
|
||||
//#endif
|
||||
|
||||
/*
|
||||
* Provide trailing slash, since mostly used for building pathnames.
|
||||
* see the __CONCAT() macro from <sys/EfiCdefs.h> for cpp examples.
|
||||
*/
|
||||
#define _PATH_DEV "/dev/"
|
||||
#define _PATH_ETC "/Efi/etc/"
|
||||
#define _PATH_TMP "/Efi/Temp/"
|
||||
//#define _PATH_DEV_PTS "/dev/pts/"
|
||||
//#define _PATH_EMUL_AOUT "/emul/aout/"
|
||||
//#define _PATH_VARDB "/var/db/"
|
||||
//#define _PATH_VARRUN "/var/run/"
|
||||
//#define _PATH_VARTMP "/var/tmp/"
|
||||
|
||||
///*
|
||||
// * All standard utilities path.
|
||||
// * set by init(8) for system programs & scripts (e.g. /etc/rc)
|
||||
@@ -97,33 +110,34 @@
|
||||
#define _PATH_SOCKET "socket:"
|
||||
|
||||
// *nix style device paths
|
||||
#define _PATH_DEVTTY "/dev/tty"
|
||||
#define _PATH_DEVNULL "/dev/null"
|
||||
#define _PATH_DEVCONSOLE "/dev/console"
|
||||
#define _PATH_DEVCONSTTY "/dev/constty"
|
||||
#define _PATH_DEVSTDIN "/dev/stdin"
|
||||
#define _PATH_DEVSTDOUT "/dev/stdout"
|
||||
#define _PATH_DEVSTDERR "/dev/stderr"
|
||||
#define _PATH_DEVSOCKET "/dev/socket"
|
||||
#define _PATH_DEVTTY _PATH_DEV "tty"
|
||||
#define _PATH_DEVNULL _PATH_DEV "null"
|
||||
#define _PATH_DEVCONSOLE _PATH_DEV "console"
|
||||
#define _PATH_DEVCONSTTY _PATH_DEV "constty"
|
||||
#define _PATH_DEVSTDIN _PATH_DEV "stdin"
|
||||
#define _PATH_DEVSTDOUT _PATH_DEV "stdout"
|
||||
#define _PATH_DEVSTDERR _PATH_DEV "stderr"
|
||||
#define _PATH_DEVSOCKET _PATH_DEV "socket"
|
||||
|
||||
// Special files and locations
|
||||
#define _PATH_HOSTS "/Efi/etc/hosts"
|
||||
#define _PATH_SERVICES "/Efi/etc/services"
|
||||
#define _PATH_HOSTNAME "/Efi/etc/hostname"
|
||||
#define _PATH_LOCALE "/Efi/etc/Locale"
|
||||
#define _PATH_FSTAB "/Efi/etc/fstab"
|
||||
#define _PATH_FSTAB _PATH_ETC "fstab"
|
||||
////#define _PATH_HEQUIV _PATH_ETC "hosts.equiv"
|
||||
#define _PATH_HOSTNAME _PATH_ETC "hostname"
|
||||
#define _PATH_HOSTS _PATH_ETC "hosts"
|
||||
#define _PATH_HOSTCONF _PATH_ETC "host.conf"
|
||||
#define _PATH_LOCALE _PATH_ETC "Locale"
|
||||
#define _PATH_NETCONF _PATH_ETC "host.conf"
|
||||
#define _PATH_NETWORKS _PATH_ETC "networks"
|
||||
#define _PATH_PROTOCOLS _PATH_ETC "protocols"
|
||||
|
||||
/*
|
||||
* Provide trailing slash, since mostly used for building pathnames.
|
||||
* see the __CONCAT() macro from <sys/EfiCdefs.h> for cpp examples.
|
||||
* Resolver configuration file.
|
||||
* Normally not present, but may contain the address of the
|
||||
* inital name server(s) to query and the domain search list.
|
||||
*/
|
||||
#define _PATH_DEV "/dev/"
|
||||
#define _PATH_TMP "/Efi/Temp/"
|
||||
//#define _PATH_DEV_PTS "/dev/pts/"
|
||||
//#define _PATH_EMUL_AOUT "/emul/aout/"
|
||||
//#define _PATH_VARDB "/var/db/"
|
||||
//#define _PATH_VARRUN "/var/run/"
|
||||
//#define _PATH_VARTMP "/var/tmp/"
|
||||
#define _PATH_RESCONF _PATH_ETC "resolv.conf"
|
||||
#define _PATH_SERVICES _PATH_ETC "services"
|
||||
////#define _PATH_SERVICES_DB "/Efi/var/db/services.db"
|
||||
|
||||
//#define _PATH_BSHELL RESCUEDIR "/sh"
|
||||
//#define _PATH_CSHELL RESCUEDIR "/csh"
|
||||
|
145
StdLib/Include/pwd.h
Normal file
145
StdLib/Include/pwd.h
Normal file
@@ -0,0 +1,145 @@
|
||||
/* $NetBSD: pwd.h,v 1.39 2005/05/24 17:36:29 kleink Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)pwd.h 8.2 (Berkeley) 1/21/94
|
||||
*/
|
||||
|
||||
/*-
|
||||
* Portions Copyright(C) 1995, Jason Downs. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _PWD_H_
|
||||
#define _PWD_H_
|
||||
|
||||
#include <sys/EfiCdefs.h>
|
||||
#include <sys/featuretest.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define _PATH_PASSWD "/etc/passwd"
|
||||
#define _PATH_MASTERPASSWD "/etc/master.passwd"
|
||||
#define _PATH_MASTERPASSWD_LOCK "/etc/ptmp"
|
||||
|
||||
#define _PATH_PASSWD_CONF "/etc/passwd.conf"
|
||||
#define _PATH_PASSWDCONF _PATH_PASSWD_CONF /* XXX: compat */
|
||||
#define _PATH_USERMGMT_CONF "/etc/usermgmt.conf"
|
||||
|
||||
#define _PATH_MP_DB "/etc/pwd.db"
|
||||
#define _PATH_SMP_DB "/etc/spwd.db"
|
||||
|
||||
#define _PATH_PWD_MKDB "/usr/sbin/pwd_mkdb"
|
||||
|
||||
#define _PW_KEYBYNAME '1' /* stored by name */
|
||||
#define _PW_KEYBYNUM '2' /* stored by entry in the "file" */
|
||||
#define _PW_KEYBYUID '3' /* stored by uid */
|
||||
|
||||
#define _PASSWORD_EFMT1 '_' /* extended DES encryption format */
|
||||
#define _PASSWORD_NONDES '$' /* non-DES encryption formats */
|
||||
|
||||
#define _PASSWORD_LEN 128 /* max length, not counting NUL */
|
||||
|
||||
#define _PASSWORD_NOUID 0x01 /* flag for no specified uid. */
|
||||
#define _PASSWORD_NOGID 0x02 /* flag for no specified gid. */
|
||||
#define _PASSWORD_NOCHG 0x04 /* flag for no specified change. */
|
||||
#define _PASSWORD_NOEXP 0x08 /* flag for no specified expire. */
|
||||
|
||||
#define _PASSWORD_OLDFMT 0x10 /* flag to expect an old style entry */
|
||||
#define _PASSWORD_NOWARN 0x20 /* no warnings for bad entries */
|
||||
|
||||
#define _PASSWORD_WARNDAYS 14 /* days to warn about expiry */
|
||||
#define _PASSWORD_CHGNOW -1 /* special day to force password
|
||||
* change at next login */
|
||||
|
||||
struct passwd {
|
||||
__aconst char *pw_name; /* user name */
|
||||
__aconst char *pw_passwd; /* encrypted password */
|
||||
uid_t pw_uid; /* user uid */
|
||||
gid_t pw_gid; /* user gid */
|
||||
time_t pw_change; /* password change time */
|
||||
__aconst char *pw_class; /* user login class */
|
||||
__aconst char *pw_gecos; /* general information */
|
||||
__aconst char *pw_dir; /* home directory */
|
||||
__aconst char *pw_shell; /* default shell */
|
||||
time_t pw_expire; /* account expiration */
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
struct passwd *getpwuid(uid_t);
|
||||
struct passwd *getpwnam(const char *);
|
||||
|
||||
#if 0 /* Normally declared here but not implemented for UEFI. */
|
||||
|
||||
int getpwnam_r( const char *, struct passwd *, char *, size_t,
|
||||
struct passwd **);
|
||||
int getpwuid_r( uid_t, struct passwd *, char *, size_t,
|
||||
struct passwd **);
|
||||
|
||||
struct passwd *getpwent(void);
|
||||
void setpwent(void);
|
||||
void endpwent(void);
|
||||
|
||||
int pw_gensalt(char *, size_t, const char *, const char *);
|
||||
int pw_scan(char *, struct passwd *, int *);
|
||||
int setpassent(int);
|
||||
int getpwent_r(struct passwd *, char *, size_t, struct passwd **);
|
||||
const char *user_from_uid(uid_t, int);
|
||||
int uid_from_user(const char *, uid_t *);
|
||||
int pwcache_userdb( int (*)(int), void (*)(void),
|
||||
struct passwd * (*)(const char *),
|
||||
struct passwd * (*)(uid_t));
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_PWD_H_ */
|
293
StdLib/Include/resolv.h
Normal file
293
StdLib/Include/resolv.h
Normal file
@@ -0,0 +1,293 @@
|
||||
/*-
|
||||
* Copyright (c) 1983, 1987, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Portions Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @(#)resolv.h 8.1 (Berkeley) 6/2/93
|
||||
* From Id: resolv.h,v 8.12 1998/04/28 19:36:46 halley Exp $
|
||||
* $Id: resolv.h,v 1.1.1.1 2003/11/19 01:48:35 kyu3 Exp $
|
||||
*/
|
||||
|
||||
#ifndef _RESOLV_H_
|
||||
#define _RESOLV_H_
|
||||
|
||||
#include <arpa/nameser.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdio.h>
|
||||
#include <paths.h>
|
||||
|
||||
#ifndef __P
|
||||
#define __P(x) x
|
||||
#endif // __P
|
||||
|
||||
/*
|
||||
* Revision information. This is the release date in YYYYMMDD format.
|
||||
* It can change every day so the right thing to do with it is use it
|
||||
* in preprocessor commands such as "#if (__RES > 19931104)". Do not
|
||||
* compare for equality; rather, use it to determine whether your resolver
|
||||
* is new enough to contain a certain feature.
|
||||
*/
|
||||
|
||||
#define __RES 19960801
|
||||
|
||||
/*
|
||||
* Global defines and variables for resolver stub.
|
||||
*/
|
||||
#define MAXNS 3 /* max # name servers we'll track */
|
||||
#define MAXDFLSRCH 3 /* # default domain levels to try */
|
||||
#define MAXDNSRCH 6 /* max # domains in search path */
|
||||
#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
|
||||
|
||||
#define RES_TIMEOUT 5 /* min. seconds between retries */
|
||||
#define MAXRESOLVSORT 10 /* number of net to sort on */
|
||||
#define RES_MAXNDOTS 15 /* should reflect bit field size */
|
||||
|
||||
struct __res_state {
|
||||
int retrans; /* retransmition time interval */
|
||||
int retry; /* number of times to retransmit */
|
||||
u_long options; /* option flags - see below. */
|
||||
int nscount; /* number of name servers */
|
||||
struct sockaddr_in
|
||||
nsaddr_list[MAXNS]; /* address of name server */
|
||||
#define nsaddr nsaddr_list[0] /* for backward compatibility */
|
||||
u_short id; /* current message id */
|
||||
char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
|
||||
char defdname[256]; /* default domain (deprecated) */
|
||||
u_long pfcode; /* RES_PRF_ flags - see below. */
|
||||
unsigned ndots:4; /* threshold for initial abs. query */
|
||||
unsigned nsort:4; /* number of elements in sort_list[] */
|
||||
char unused[3];
|
||||
struct {
|
||||
struct in_addr addr;
|
||||
u_int32_t mask;
|
||||
} sort_list[MAXRESOLVSORT];
|
||||
char pad[72]; /* on an i386 this means 512b total */
|
||||
};
|
||||
|
||||
/*
|
||||
* Resolver options (keep these in synch with res_debug.c, please)
|
||||
*/
|
||||
#define RES_INIT 0x00000001 /* address initialized */
|
||||
#define RES_DEBUG 0x00000002 /* print debug messages */
|
||||
#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/
|
||||
#define RES_USEVC 0x00000008 /* use virtual circuit */
|
||||
#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */
|
||||
#define RES_IGNTC 0x00000020 /* ignore truncation errors */
|
||||
#define RES_RECURSE 0x00000040 /* recursion desired */
|
||||
#define RES_DEFNAMES 0x00000080 /* use default domain name */
|
||||
#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */
|
||||
#define RES_DNSRCH 0x00000200 /* search up local domain tree */
|
||||
#define RES_INSECURE1 0x00000400 /* type 1 security disabled */
|
||||
#define RES_INSECURE2 0x00000800 /* type 2 security disabled */
|
||||
#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */
|
||||
#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */
|
||||
#define RES_NOTLDQUERY 0x00004000 /* Don't query TLD names */
|
||||
|
||||
#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
|
||||
|
||||
/*
|
||||
* Resolver "pfcode" values. Used by dig.
|
||||
*/
|
||||
#define RES_PRF_STATS 0x00000001
|
||||
#define RES_PRF_UPDATE 0x00000002
|
||||
#define RES_PRF_CLASS 0x00000004
|
||||
#define RES_PRF_CMD 0x00000008
|
||||
#define RES_PRF_QUES 0x00000010
|
||||
#define RES_PRF_ANS 0x00000020
|
||||
#define RES_PRF_AUTH 0x00000040
|
||||
#define RES_PRF_ADD 0x00000080
|
||||
#define RES_PRF_HEAD1 0x00000100
|
||||
#define RES_PRF_HEAD2 0x00000200
|
||||
#define RES_PRF_TTLID 0x00000400
|
||||
#define RES_PRF_HEADX 0x00000800
|
||||
#define RES_PRF_QUERY 0x00001000
|
||||
#define RES_PRF_REPLY 0x00002000
|
||||
#define RES_PRF_INIT 0x00004000
|
||||
/* 0x00008000 */
|
||||
|
||||
typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
|
||||
res_sendhookact;
|
||||
|
||||
typedef res_sendhookact (*res_send_qhook)__P((struct sockaddr_in * const *ns,
|
||||
const u_char **query,
|
||||
int *querylen,
|
||||
u_char *ans,
|
||||
int anssiz,
|
||||
int *resplen));
|
||||
|
||||
typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr_in *ns,
|
||||
const u_char *query,
|
||||
int querylen,
|
||||
u_char *ans,
|
||||
int anssiz,
|
||||
int *resplen));
|
||||
|
||||
struct res_sym {
|
||||
int number; /* Identifying number, like T_MX */
|
||||
char * name; /* Its symbolic name, like "MX" */
|
||||
char * humanname; /* Its fun name, like "mail exchanger" */
|
||||
};
|
||||
|
||||
extern struct __res_state _res;
|
||||
extern const struct res_sym __p_class_syms[];
|
||||
extern const struct res_sym __p_type_syms[];
|
||||
|
||||
/* Private routines shared between libc/net, named, nslookup and others. */
|
||||
#define res_hnok __res_hnok
|
||||
#define res_ownok __res_ownok
|
||||
#define res_mailok __res_mailok
|
||||
#define res_dnok __res_dnok
|
||||
#define sym_ston __sym_ston
|
||||
#define sym_ntos __sym_ntos
|
||||
#define sym_ntop __sym_ntop
|
||||
#define b64_ntop __b64_ntop
|
||||
#define b64_pton __b64_pton
|
||||
#define loc_ntoa __loc_ntoa
|
||||
#define loc_aton __loc_aton
|
||||
#define fp_resstat __fp_resstat
|
||||
#define p_query __p_query
|
||||
#define dn_skipname __dn_skipname
|
||||
#define fp_resstat __fp_resstat
|
||||
#define fp_query __fp_query
|
||||
#define fp_nquery __fp_nquery
|
||||
#define hostalias __hostalias
|
||||
#define putlong __putlong
|
||||
#define putshort __putshort
|
||||
#define p_class __p_class
|
||||
#define p_time __p_time
|
||||
#define p_type __p_type
|
||||
#define p_query __p_query
|
||||
#define p_cdnname __p_cdnname
|
||||
#define p_section __p_section
|
||||
#define p_cdname __p_cdname
|
||||
#define p_fqnname __p_fqnname
|
||||
#define p_fqname __p_fqname
|
||||
#define p_option __p_option
|
||||
#define p_secstodate __p_secstodate
|
||||
#define dn_count_labels __dn_count_labels
|
||||
#define dn_comp __dn_comp
|
||||
#define dn_expand __dn_expand
|
||||
#define res_init __res_init
|
||||
#define res_randomid __res_randomid
|
||||
#define res_query __res_query
|
||||
#define res_search __res_search
|
||||
#define res_querydomain __res_querydomain
|
||||
#define res_mkquery __res_mkquery
|
||||
#define res_send __res_send
|
||||
#define res_isourserver __res_isourserver
|
||||
#define res_nameinquery __res_nameinquery
|
||||
#define res_queriesmatch __res_queriesmatch
|
||||
#define res_close __res_close
|
||||
#define res_mkupdate __res_mkupdate
|
||||
#define res_mkupdrec __res_mkupdrec
|
||||
#define res_freeupdrec __res_freeupdrec
|
||||
|
||||
__BEGIN_DECLS
|
||||
int res_hnok __P((const char *));
|
||||
int res_ownok __P((const char *));
|
||||
int res_mailok __P((const char *));
|
||||
int res_dnok __P((const char *));
|
||||
int sym_ston __P((const struct res_sym *, const char *, int *));
|
||||
const char * sym_ntos __P((const struct res_sym *, int, int *));
|
||||
const char * sym_ntop __P((const struct res_sym *, int, int *));
|
||||
int b64_ntop __P((u_char const *, size_t, char *, size_t));
|
||||
int b64_pton __P((char const *, u_char *, size_t));
|
||||
int loc_aton __P((const char *, u_char *));
|
||||
const char * loc_ntoa __P((const u_char *, char *));
|
||||
int dn_skipname __P((const u_char *, const u_char *));
|
||||
void fp_resstat __P((struct __res_state *, FILE *));
|
||||
void fp_query __P((const u_char *, FILE *));
|
||||
void fp_nquery __P((const u_char *, int, FILE *));
|
||||
const char * hostalias __P((const char *));
|
||||
void putlong __P((u_int32_t, u_char *));
|
||||
void putshort __P((u_int16_t, u_char *));
|
||||
const char * p_class __P((int));
|
||||
const char * p_time __P((u_int32_t));
|
||||
const char * p_type __P((int));
|
||||
void p_query __P((const u_char *));
|
||||
const u_char * p_cdnname __P((const u_char *, const u_char *, int, FILE *));
|
||||
const u_char * p_cdname __P((const u_char *, const u_char *, FILE *));
|
||||
const u_char * p_fqnname __P((const u_char *, const u_char *,
|
||||
int, char *, int));
|
||||
const u_char * p_fqname __P((const u_char *, const u_char *, FILE *));
|
||||
const char * p_option __P((u_long));
|
||||
char * p_secstodate __P((u_long));
|
||||
int dn_count_labels __P((const char *));
|
||||
int dn_comp __P((const char *, u_char *, int,
|
||||
u_char **, u_char **));
|
||||
int dn_expand __P((const u_char *, const u_char *, const u_char *,
|
||||
char *, int));
|
||||
int res_init __P((void));
|
||||
u_int res_randomid __P((void));
|
||||
int res_query __P((const char *, int, int, u_char *, int));
|
||||
int res_search __P((const char *, int, int, u_char *, int));
|
||||
int res_querydomain __P((const char *, const char *, int, int,
|
||||
u_char *, int));
|
||||
int res_mkquery __P((int, const char *, int, int, const u_char *,
|
||||
int, const u_char *, u_char *, int));
|
||||
int res_send __P((const u_char *, int, u_char *, int));
|
||||
int res_isourserver __P((const struct sockaddr_in *));
|
||||
int res_nameinquery __P((const char *, int, int,
|
||||
const u_char *, const u_char *));
|
||||
int res_queriesmatch __P((const u_char *, const u_char *,
|
||||
const u_char *, const u_char *));
|
||||
void res_close __P((void));
|
||||
const char * p_section __P((int, int));
|
||||
/* XXX The following depend on the ns_updrec typedef in arpa/nameser.h */
|
||||
#ifdef _ARPA_NAMESER_H_
|
||||
int res_update __P((ns_updrec *));
|
||||
int res_mkupdate __P((ns_updrec *, u_char *, int));
|
||||
ns_updrec * res_mkupdrec __P((int, const char *, u_int, u_int, u_long));
|
||||
void res_freeupdrec __P((ns_updrec *));
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_RESOLV_H_ */
|
@@ -14,7 +14,7 @@
|
||||
their semantics, and their default handling is implementation-defined; all
|
||||
signal numbers shall be positive.
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
@@ -57,6 +57,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#define SIGSEGV __SigSegv ///< an invalid access to storage
|
||||
#define SIGTERM __SigTerm ///< a termination request sent to the program
|
||||
#define SIGBREAK __SigBreak ///< added for Python
|
||||
#define SIGALRM __SigAlrm ///< Added for Posix timer functions
|
||||
#define SIGVTALRM __SigVtAlrm ///< Added for Posix timer functions
|
||||
#define SIGPROF __SigProf ///< Added for Posix timer functions
|
||||
#define SIGUSR1 __SigUsr1 ///< Added for Posix timer functions
|
||||
#define SIGUSR2 __SigUsr2 ///< Added for Posix timer functions
|
||||
#define SIGWINCH __SigWinch ///< Added for Posix timer functions
|
||||
#define SIGPIPE __SigPipe ///< Added for Posix timer functions
|
||||
#define SIGQUIT __SigQuit ///< Added for Posix timer functions
|
||||
#define SIG_LAST __Sig_Last ///< One more than the largest signal number
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
@@ -41,10 +41,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
/** The type va_list is a type suitable for holding information needed by the
|
||||
macros va_start, va_arg, and va_end.
|
||||
|
||||
This implementation aliases va_list to VA_LIST, declared in MdePkg/Base.h.
|
||||
**/
|
||||
#if defined(__GNUC__)
|
||||
typedef __builtin_va_list va_list;
|
||||
#else
|
||||
#define va_list VA_LIST
|
||||
#endif
|
||||
|
||||
/** The va_start macro shall be invoked before any access to the unnamed arguments.
|
||||
The va_start macro initializes ap for subsequent use by va_arg and va_end.
|
||||
@@ -63,11 +65,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
is not compatible with the type that results after
|
||||
application of the default argument promotions, the
|
||||
behavior is undefined.
|
||||
|
||||
This implementation aliases va_start to VA_START, declared in MdePkg/Base.h.
|
||||
**/
|
||||
//#define va_start(ap, ParamN) VA_START(ap, ParamN)
|
||||
#if defined(__GNUC__)
|
||||
#define va_start __builtin_va_start
|
||||
#else
|
||||
#define va_start VA_START
|
||||
#endif
|
||||
|
||||
/** The va_arg macro expands to an expression that has the type and value of
|
||||
the next argument in the call. The parameter ap shall be the same as the
|
||||
@@ -90,11 +93,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
va_start macro returns the value of the argument after that
|
||||
specified by paramN. Successive invocations return the values
|
||||
of the remaining arguments in succession.
|
||||
|
||||
This implementation aliases va_arg to VA_ARG, declared in MdePkg/Base.h.
|
||||
**/
|
||||
//#define va_arg(ap, type) VA_ARG(ap, type)
|
||||
#if defined(__GNUC__)
|
||||
#define va_arg __builtin_va_arg
|
||||
#else
|
||||
#define va_arg VA_ARG
|
||||
#endif
|
||||
|
||||
/** The va_end macro facillitates a normal return from the function whose
|
||||
variable argument list was referred to by the expansion of va_start that
|
||||
@@ -109,13 +113,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
@param ap An object of type va_list, initialized by a prior
|
||||
invocation of va_start, that will no longer be referenced.
|
||||
|
||||
This implementation aliases va_end to VA_END, declared in MdePkg/Base.h.
|
||||
**/
|
||||
//#define va_end(ap) VA_END(ap)
|
||||
#if defined(__GNUC__)
|
||||
#define va_end __builtin_va_end
|
||||
#else
|
||||
#define va_end VA_END
|
||||
#endif
|
||||
|
||||
/** For BSD compatibility. **/
|
||||
#if defined(__GNUC__)
|
||||
#define va_copy __builtin_va_copy
|
||||
#else
|
||||
#define va_copy(s,d) (s) = (d)
|
||||
#endif
|
||||
|
||||
#endif /* _STDARG_H */
|
||||
|
@@ -36,7 +36,7 @@
|
||||
#ifndef _STDIO_H_
|
||||
#define _STDIO_H_
|
||||
|
||||
#include <sys/EfiCdefs.h>
|
||||
#include <stdarg.h>
|
||||
#include <limits.h>
|
||||
#include <sys/ansi.h>
|
||||
#include <machine/ansi.h>
|
||||
@@ -475,14 +475,14 @@ int setvbuf (FILE * __restrict, char * __restrict, int, size_t);
|
||||
int sscanf (const char * __restrict, const char * __restrict, ...);
|
||||
FILE *tmpfile (void);
|
||||
int ungetc (int, FILE *);
|
||||
int vfprintf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_);
|
||||
int vprintf (const char * __restrict, _BSD_VA_LIST_);
|
||||
int vfprintf(FILE * __restrict, const char * __restrict, va_list);
|
||||
int vprintf (const char * __restrict, va_list);
|
||||
|
||||
#ifndef __AUDIT__
|
||||
char *gets (char *);
|
||||
int sprintf (char * __restrict, const char * __restrict, ...);
|
||||
char *tmpnam (char *);
|
||||
int vsprintf(char * __restrict, const char * __restrict, _BSD_VA_LIST_);
|
||||
int vsprintf(char * __restrict, const char * __restrict, va_list);
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
@@ -531,46 +531,33 @@ __END_DECLS
|
||||
/*
|
||||
* Functions defined in POSIX 1003.2 and XPG2 or later.
|
||||
*/
|
||||
#if (_POSIX_C_SOURCE - 0) >= 2 || (_XOPEN_SOURCE - 0) >= 2 || \
|
||||
defined(_NETBSD_SOURCE)
|
||||
__BEGIN_DECLS
|
||||
__BEGIN_DECLS
|
||||
int pclose (FILE *);
|
||||
FILE *popen (const char *, const char *);
|
||||
__END_DECLS
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Functions defined in ISO XPG4.2, ISO C99, POSIX 1003.1-2001 or later.
|
||||
*/
|
||||
#if ((__STDC_VERSION__ - 0) >= 199901L) || \
|
||||
((_POSIX_C_SOURCE - 0) >= 200112L) || \
|
||||
(defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
|
||||
((_XOPEN_SOURCE - 0) >= 500) || \
|
||||
defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
|
||||
__BEGIN_DECLS
|
||||
__BEGIN_DECLS
|
||||
int snprintf (char * __restrict, size_t, const char * __restrict, ...)
|
||||
__attribute__((__format__(__printf__, 3, 4)));
|
||||
int vsnprintf(char * __restrict, size_t, const char * __restrict, _BSD_VA_LIST_)
|
||||
int vsnprintf(char * __restrict, size_t, const char * __restrict, va_list)
|
||||
__attribute__((__format__(__printf__, 3, 0)));
|
||||
__END_DECLS
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Functions defined in XPG4.2.
|
||||
*/
|
||||
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
||||
__BEGIN_DECLS
|
||||
__BEGIN_DECLS
|
||||
int getw(FILE *);
|
||||
int putw(int, FILE *);
|
||||
char *mkdtemp(char *);
|
||||
int mkstemp(char *);
|
||||
char *mktemp(char *);
|
||||
|
||||
#ifndef __AUDIT__
|
||||
char *tempnam(const char *, const char *);
|
||||
#endif
|
||||
__END_DECLS
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* X/Open CAE Specification Issue 5 Version 2
|
||||
@@ -588,15 +575,13 @@ __END_DECLS
|
||||
/*
|
||||
* Routines that are purely local.
|
||||
*/
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define FPARSELN_UNESCESC 0x01
|
||||
#define FPARSELN_UNESCCONT 0x02
|
||||
#define FPARSELN_UNESCCOMM 0x04
|
||||
#define FPARSELN_UNESCREST 0x08
|
||||
#define FPARSELN_UNESCALL 0x0f
|
||||
|
||||
#define FPARSELN_UNESCESC 0x01
|
||||
#define FPARSELN_UNESCCONT 0x02
|
||||
#define FPARSELN_UNESCCOMM 0x04
|
||||
#define FPARSELN_UNESCREST 0x08
|
||||
#define FPARSELN_UNESCALL 0x0f
|
||||
|
||||
__BEGIN_DECLS
|
||||
__BEGIN_DECLS
|
||||
//int asprintf(char ** __restrict, const char * __restrict, ...)
|
||||
// __attribute__((__format__(__printf__, 2, 3)));
|
||||
char *fgetln(FILE * __restrict, size_t * __restrict);
|
||||
@@ -605,33 +590,32 @@ __END_DECLS
|
||||
void setbuffer(FILE *, char *, int);
|
||||
int setlinebuf(FILE *);
|
||||
int vasprintf(char ** __restrict, const char * __restrict,
|
||||
_BSD_VA_LIST_)
|
||||
va_list)
|
||||
__attribute__((__format__(__printf__, 2, 0)));
|
||||
int vscanf(const char * __restrict, _BSD_VA_LIST_)
|
||||
int vscanf(const char * __restrict, va_list)
|
||||
__attribute__((__format__(__scanf__, 1, 0)));
|
||||
int vfscanf(FILE * __restrict, const char * __restrict,
|
||||
_BSD_VA_LIST_)
|
||||
va_list)
|
||||
__attribute__((__format__(__scanf__, 2, 0)));
|
||||
int vsscanf(const char * __restrict, const char * __restrict,
|
||||
_BSD_VA_LIST_)
|
||||
va_list)
|
||||
__attribute__((__format__(__scanf__, 2, 0)));
|
||||
const char *fmtcheck(const char *, const char *)
|
||||
__attribute__((__format_arg__(2)));
|
||||
__END_DECLS
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Stdio function-access interface.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
__BEGIN_DECLS
|
||||
FILE *funopen(const void *,
|
||||
int (*)(void *, char *, int),
|
||||
int (*)(void *, const char *, int),
|
||||
fpos_t (*)(void *, fpos_t, int),
|
||||
int (*)(void *));
|
||||
__END_DECLS
|
||||
__END_DECLS
|
||||
//#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
|
||||
//#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
|
||||
/*
|
||||
* Functions internal to the implementation.
|
||||
@@ -646,6 +630,7 @@ __END_DECLS
|
||||
* define function versions in the C library.
|
||||
*/
|
||||
#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
|
||||
|
||||
#if defined(__GNUC__) && defined(__STDC__)
|
||||
static __inline int __sputc(int _c, FILE *_p) {
|
||||
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
|
||||
@@ -673,33 +658,23 @@ __END_DECLS
|
||||
#define __sfileno(p) ((p)->_file)
|
||||
|
||||
#ifndef __lint__
|
||||
#if !defined(_REENTRANT) && !defined(_PTHREADS)
|
||||
#define feof(p) __sfeof(p)
|
||||
#define ferror(p) __sferror(p)
|
||||
#define clearerr(p) __sclearerr(p)
|
||||
|
||||
#define getc(fp) __sgetc(fp)
|
||||
#define putc(x, fp) __sputc(x, fp)
|
||||
#endif /* !_REENTRANT && !_PTHREADS */
|
||||
#endif /* __lint__ */
|
||||
|
||||
#define getchar() getc(stdin)
|
||||
#define putchar(x) putc(x, stdout)
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
|
||||
defined(_NETBSD_SOURCE)
|
||||
#if !defined(_REENTRANT) && !defined(_PTHREADS)
|
||||
#define fileno(p) __sfileno(p)
|
||||
#endif /* !_REENTRANT && !_PTHREADS */
|
||||
#endif /* !_ANSI_SOURCE */
|
||||
#define fileno(p) __sfileno(p)
|
||||
|
||||
#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
|
||||
defined(_REENTRANT) || defined(_NETBSD_SOURCE)
|
||||
#define getc_unlocked(fp) __sgetc(fp)
|
||||
#define putc_unlocked(x, fp) __sputc(x, fp)
|
||||
#define getc_unlocked(fp) __sgetc(fp)
|
||||
#define putc_unlocked(x, fp) __sputc(x, fp)
|
||||
|
||||
#define getchar_unlocked() getc_unlocked(stdin)
|
||||
#define putchar_unlocked(x) putc_unlocked(x, stdout)
|
||||
#endif /* _POSIX_C_SOURCE >= 199506 || _XOPEN_SOURCE >= 500 || _REENTRANT... */
|
||||
#define getchar_unlocked() getc_unlocked(stdin)
|
||||
#define putchar_unlocked(x) putc_unlocked(x, stdout)
|
||||
|
||||
#endif /* _STDIO_H_ */
|
||||
|
@@ -91,7 +91,7 @@ __BEGIN_DECLS
|
||||
|
||||
@sa signal.h
|
||||
**/
|
||||
void abort(void);
|
||||
void abort(void) __noreturn;
|
||||
|
||||
/** The atexit function registers the function pointed to by func, to be
|
||||
called without arguments at normal program termination.
|
||||
@@ -122,6 +122,10 @@ int atexit(void (*)(void));
|
||||
status is zero, or EXIT_SUCCESS, status is returned unchanged. If the value
|
||||
of status is EXIT_FAILURE, EAPPLICATION is returned.
|
||||
Otherwise, status is returned unchanged.
|
||||
|
||||
While this function does not return, it can NOT be marked as "__noreturn"
|
||||
without causing a warning to be emitted because the compilers can not
|
||||
determine that the function truly does not return.
|
||||
**/
|
||||
void exit(int status) __noreturn;
|
||||
|
||||
@@ -140,7 +144,7 @@ void exit(int status) __noreturn;
|
||||
The status returned to the host environment is determined in the same way
|
||||
as for the exit function.
|
||||
**/
|
||||
void _Exit(int status);
|
||||
void _Exit(int status) __noreturn;
|
||||
|
||||
/** The getenv function searches an environment list, provided by the host
|
||||
environment, for a string that matches the string pointed to by name. The
|
||||
@@ -641,6 +645,42 @@ size_t mbstowcs(wchar_t * __restrict dest, const char * __restrict src, size_t
|
||||
**/
|
||||
size_t wcstombs(char * __restrict dest, const wchar_t * __restrict src, size_t limit);
|
||||
|
||||
/**
|
||||
The realpath() function shall derive, from the pathname pointed to by
|
||||
file_name, an absolute pathname that names the same file, whose resolution
|
||||
does not involve '.', '..', or symbolic links. The generated pathname shall
|
||||
be stored as a null-terminated string, up to a maximum of {PATH_MAX} bytes,
|
||||
in the buffer pointed to by resolved_name.
|
||||
|
||||
If resolved_name is a null pointer, the behavior of realpath() is
|
||||
implementation-defined.
|
||||
|
||||
@param[in] file_name The filename to convert.
|
||||
@param[in,out] resolved_name The resultant name.
|
||||
|
||||
@retval NULL An error occured.
|
||||
@return resolved_name.
|
||||
**/
|
||||
char * realpath(char *file_name, char *resolved_name);
|
||||
|
||||
/**
|
||||
The getprogname() function returns the name of the program. If the name
|
||||
has not been set yet, it will return NULL.
|
||||
|
||||
@retval The name of the program.
|
||||
@retval NULL The name has not been set.
|
||||
**/
|
||||
const char * getprogname(void);
|
||||
|
||||
/**
|
||||
The setprogname() function sets the name of the program.
|
||||
|
||||
@param[in] The name of the program. This memory must be retained
|
||||
by the caller until no calls to "getprogname" will be
|
||||
called.
|
||||
**/
|
||||
void setprogname(const char *progname);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _STDLIB_H */
|
||||
|
@@ -324,15 +324,31 @@ int strerror_r(int, char *, size_t);
|
||||
int strcasecmp(const char *s1, const char *s2);
|
||||
void *memccpy (void *, const void *, int, size_t);
|
||||
int strncasecmp(const char *s1, const char *s2, size_t n);
|
||||
size_t strlcpy(char *destination, const char *source, size_t size);
|
||||
size_t strlcat(char *destination, const char *source, size_t size);
|
||||
|
||||
// bcopy is same as memcpy but it is a void function, being used in socket lib
|
||||
#define bcopy(a,b,c) ( memcpy((void *)a, (void *)b, (size_t)c))
|
||||
// bcopy is is a void function with the src/dest arguments reversed, being used in socket lib
|
||||
#define bcopy(a,b,c) ( memcpy((void *)b, (const void *)a, (size_t)c))
|
||||
|
||||
// bcmp is same as memcmp, returns 0 for successful compare, non-zero otherwise
|
||||
#define bcmp(a,b,c) ( memcmp((void *)a, (void *)b, (size_t)c))
|
||||
|
||||
//strsep is the same as strtok, the only difference is for strsep the 1st parameter is a char**
|
||||
#define strsep(a,b) (strtok(*a,b))
|
||||
/*
|
||||
* Get next token from string *stringp, where tokens are possibly-empty
|
||||
* strings separated by characters from delim.
|
||||
*
|
||||
* Writes NULs into the string at *stringp to end tokens.
|
||||
* delim need not remain constant from call to call.
|
||||
* On return, *stringp points past the last NUL written (if there might
|
||||
* be further tokens), or is NULL (if there are definitely no more tokens).
|
||||
*
|
||||
* If *stringp is NULL, strsep returns NULL.
|
||||
*/
|
||||
char *
|
||||
strsep(
|
||||
register char **stringp,
|
||||
register const char *delim
|
||||
);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
65
StdLib/Include/stringlist.h
Normal file
65
StdLib/Include/stringlist.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/** @file contains all the stringlist types and functions.
|
||||
|
||||
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
|
||||
* Copyright (c) 1994 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
$NetBSD: stringlist.h,v 1.7 2008/04/28 20:22:54 martin Exp $
|
||||
**/
|
||||
|
||||
#ifndef _STRINGLIST_H
|
||||
#define _STRINGLIST_H
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* Simple string list
|
||||
*/
|
||||
typedef struct _stringlist {
|
||||
char **sl_str;
|
||||
size_t sl_max;
|
||||
size_t sl_cur;
|
||||
} StringList;
|
||||
|
||||
__BEGIN_DECLS
|
||||
StringList *sl_init(void);
|
||||
int sl_add(StringList *, char *);
|
||||
void sl_free(StringList *, int);
|
||||
char *sl_find(StringList *, const char *);
|
||||
int sl_delete(StringList *, const char *, int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _STRINGLIST_H */
|
@@ -17,16 +17,16 @@
|
||||
that the library can be easily tuned for different compilers.
|
||||
__inline Defined to the appropriate keyword or not defined.
|
||||
__func__ Defined to __FUNC__, __FUNCTION__, or NULL as appropriate.
|
||||
__restrict Defined to nothing for VC++ or to restrict for C99 compliant compilers.
|
||||
__restrict Defined to nothing for VC++ or to restrict for GCC and C99 compliant compilers.
|
||||
|
||||
This file and its contents are inspired by the <sys/cdefs.h> files in Berkeley
|
||||
Unix. They have been re-implemented to be specific to the EFI environment.
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
http://opensource.org/licenses/bsd-license.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
@@ -261,22 +261,7 @@
|
||||
#endif
|
||||
#endif /* !(__STDC_VERSION__ >= 199901L) */
|
||||
|
||||
// <DVM 12/21/2010> Experiment to disable RENAME for GCC
|
||||
#if 0
|
||||
#ifdef __GNUC__
|
||||
#define __RENAME(x) ___RENAME(x)
|
||||
#else
|
||||
#ifdef __lint__
|
||||
#define __RENAME(x) __symbolrename(x)
|
||||
#else
|
||||
/*DVM To see where this might be used... */
|
||||
//#error "No function renaming possible"
|
||||
#define __RENAME(x)
|
||||
#endif /* __lint__ */
|
||||
#endif /* __GNUC__ */
|
||||
#else /* if 0 */
|
||||
#define __RENAME(x)
|
||||
#endif /* if 0 */
|
||||
#define __RENAME(x)
|
||||
|
||||
/*
|
||||
* A barrier to stop the optimizer from moving code or assume live
|
||||
@@ -362,6 +347,4 @@ typedef UINT32 ULONG32;
|
||||
typedef INT64 LONG64;
|
||||
typedef UINT64 ULONG64;
|
||||
|
||||
//extern int EFIAPI main();
|
||||
|
||||
#endif /* _EFI_CDEFS_H */
|
||||
|
@@ -75,7 +75,7 @@ int isatty (int);
|
||||
int fstat (int, struct stat *);
|
||||
int lstat (const char *, struct stat *);
|
||||
int stat (const char *, void *);
|
||||
// int chmod (const char *, mode_t);
|
||||
int chmod (const char *, mode_t);
|
||||
#endif // __STAT_SYSCALLS_DECLARED
|
||||
|
||||
// These are also declared in sys/types.h
|
||||
@@ -110,10 +110,11 @@ int FindFreeFD (int MinFd);
|
||||
*/
|
||||
BOOLEAN ValidateFD (int fd, int IsOpen);
|
||||
|
||||
char *getcwd (char *, size_t);
|
||||
int chdir (const char *);
|
||||
|
||||
/* These system calls don't YET have EFI implementations. */
|
||||
int access (const char *path, int amode);
|
||||
int chdir (const char *);
|
||||
char *getcwd (char *, size_t);
|
||||
int reboot (int, char *);
|
||||
|
||||
__END_DECLS
|
||||
|
97
StdLib/Include/sys/_posix.h
Normal file
97
StdLib/Include/sys/_posix.h
Normal file
@@ -0,0 +1,97 @@
|
||||
#ifndef _SYS__POSIX_H_
|
||||
#define _SYS__POSIX_H_
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 HD Associates, Inc.
|
||||
* All rights reserved.
|
||||
* contact: dufault@hda.com
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: _posix.h,v 1.1.1.1 2006/05/30 06:13:04 hhzhou Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is a stand alone header file to set up for feature specification
|
||||
* defined to take place before the inclusion of any standard header.
|
||||
* It should only handle pre-processor defines.
|
||||
*
|
||||
* See section B.2.7 of 1003.1b-1993
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
#if !defined(ACTUALLY_LKM_NOT_KERNEL) && !defined(KLD_MODULE)
|
||||
#include "opt_posix.h"
|
||||
#endif
|
||||
|
||||
/* Only kern_mib.c uses _POSIX_VERSION. Introduce a kernel
|
||||
* one to avoid other pieces of the kernel getting dependant
|
||||
* on that.
|
||||
* XXX Complain if you think this dumb.
|
||||
*/
|
||||
|
||||
/* Make P1003 structures visible for the kernel if
|
||||
* the P1003_1B option is in effect.
|
||||
*/
|
||||
#ifdef P1003_1B
|
||||
#define _P1003_1B_VISIBLE
|
||||
#ifndef _KPOSIX_VERSION
|
||||
#define _KPOSIX_VERSION 199309L
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _KPOSIX_VERSION
|
||||
#define _KPOSIX_VERSION 199009L
|
||||
#endif
|
||||
|
||||
#define _P1003_1B_VISIBLE_HISTORICALLY
|
||||
|
||||
#else
|
||||
|
||||
/* Default to existing user space version.
|
||||
*/
|
||||
#ifndef _POSIX_VERSION
|
||||
#define _POSIX_VERSION 199009L
|
||||
#endif
|
||||
|
||||
/* Test for visibility of P1003.1B features:
|
||||
* If _POSIX_SOURCE and POSIX_C_SOURCE are completely undefined
|
||||
* they show up.
|
||||
*
|
||||
* If they specify a version including P1003.1B then they show up.
|
||||
*
|
||||
* (Two macros are added to permit hiding new extensions while
|
||||
* keeping historic BSD features - that is not done now)
|
||||
*
|
||||
*/
|
||||
|
||||
#if (!defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)) || \
|
||||
(_POSIX_VERSION >= 199309L && defined(_POSIX_C_SOURCE) && \
|
||||
_POSIX_C_SOURCE >= 199309L)
|
||||
#define _P1003_1B_VISIBLE
|
||||
#define _P1003_1B_VISIBLE_HISTORICALLY
|
||||
#endif
|
||||
|
||||
#endif /* not KERNEL */
|
||||
#endif /* _SYS__POSIX_H_ */
|
@@ -11,12 +11,7 @@
|
||||
#define _C_LABEL(x) __CONCAT(_,x)
|
||||
#define _C_LABEL_STRING(x) "_"x
|
||||
|
||||
#if __STDC__
|
||||
#define ___RENAME(x) __asm(___STRING(_C_LABEL(x)))
|
||||
#else
|
||||
#define ___RENAME(x) ____RENAME(_/**/x)
|
||||
#define ____RENAME(x) __asm(___STRING(x))
|
||||
#endif
|
||||
#define ___RENAME(x)
|
||||
|
||||
#define __indr_reference(sym,alias) /* nada, since we do weak refs */
|
||||
|
||||
|
102
StdLib/Include/sys/file.h
Normal file
102
StdLib/Include/sys/file.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)file.h 8.3 (Berkeley) 1/9/95
|
||||
* $Id: file.h,v 1.1.1.1 2006/05/30 06:12:53 hhzhou Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FILE_H_
|
||||
#define _SYS_FILE_H_
|
||||
|
||||
#ifndef KERNEL
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef KERNEL
|
||||
#include <sys/queue.h>
|
||||
|
||||
struct proc;
|
||||
struct uio;
|
||||
|
||||
/*
|
||||
* Kernel descriptor table.
|
||||
* One entry for each open kernel vnode and socket.
|
||||
*/
|
||||
struct file {
|
||||
LIST_ENTRY(file) f_list;/* list of active files */
|
||||
short f_flag; /* see fcntl.h */
|
||||
#define DTYPE_VNODE 1 /* file */
|
||||
#define DTYPE_SOCKET 2 /* communications endpoint */
|
||||
#define DTYPE_PIPE 3 /* pipe */
|
||||
#define DTYPE_FIFO 4 /* fifo (named pipe) */
|
||||
short f_type; /* descriptor type */
|
||||
short f_count; /* reference count */
|
||||
short f_msgcount; /* references from message queue */
|
||||
struct ucred *f_cred; /* credentials associated with descriptor */
|
||||
struct fileops {
|
||||
int (*fo_read) __P((struct file *fp, struct uio *uio,
|
||||
struct ucred *cred, int flags));
|
||||
int (*fo_write) __P((struct file *fp, struct uio *uio,
|
||||
struct ucred *cred, int flags));
|
||||
#define FOF_OFFSET 1
|
||||
int (*fo_ioctl) __P((struct file *fp, u_long com,
|
||||
caddr_t data, struct proc *p));
|
||||
int (*fo_poll) __P((struct file *fp, int events,
|
||||
struct ucred *cred, struct proc *p));
|
||||
int (*fo_close) __P((struct file *fp, struct proc *p));
|
||||
} *f_ops;
|
||||
int f_seqcount; /*
|
||||
* count of sequential accesses -- cleared
|
||||
* by most seek operations.
|
||||
*/
|
||||
off_t f_nextread; /*
|
||||
* offset of next expected read
|
||||
*/
|
||||
off_t f_offset;
|
||||
caddr_t f_data; /* vnode or socket */
|
||||
};
|
||||
|
||||
#ifdef MALLOC_DECLARE
|
||||
MALLOC_DECLARE(M_FILE);
|
||||
#endif
|
||||
|
||||
LIST_HEAD(filelist, file);
|
||||
extern struct filelist filehead; /* head of list of open files */
|
||||
extern struct fileops vnops;
|
||||
extern int maxfiles; /* kernel limit on number of open files */
|
||||
extern int maxfilesperproc; /* per process limit on number of open files */
|
||||
extern int nfiles; /* actual number of open files */
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* !SYS_FILE_H */
|
@@ -38,6 +38,7 @@
|
||||
#include <sys/fd_set.h>
|
||||
|
||||
#include <sys/sigtypes.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
@@ -22,6 +22,14 @@ enum {
|
||||
__SigSegv,
|
||||
__SigTerm,
|
||||
__SigBreak,
|
||||
__SigAlrm,
|
||||
__SigVtAlrm,
|
||||
__SigProf,
|
||||
__SigUsr1,
|
||||
__SigUsr2,
|
||||
__SigWinch,
|
||||
__SigPipe,
|
||||
__SigQuit,
|
||||
__Sig_Last
|
||||
};
|
||||
|
||||
|
100
StdLib/Include/sys/sockio.h
Normal file
100
StdLib/Include/sys/sockio.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1990, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Portions copyright (c) 1999, 2000
|
||||
* Intel Corporation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
*
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley, Intel Corporation, and its contributors.
|
||||
*
|
||||
* 4. Neither the name of University, Intel Corporation, or their respective
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS, INTEL CORPORATION AND
|
||||
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS,
|
||||
* INTEL CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @(#)sockio.h 8.1 (Berkeley) 3/28/94
|
||||
* $Id: sockio.h,v 1.1.1.1 2006/05/30 06:12:59 hhzhou Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SOCKIO_H_
|
||||
#define _SYS_SOCKIO_H_
|
||||
|
||||
#include <sys/ioccom.h>
|
||||
|
||||
/* Socket ioctl's. */
|
||||
#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */
|
||||
#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */
|
||||
#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */
|
||||
#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */
|
||||
#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */
|
||||
#define SIOCSPGRP _IOW('s', 8, int) /* set process group */
|
||||
#define SIOCGPGRP _IOR('s', 9, int) /* get process group */
|
||||
#ifndef _ORG_FREEBSD_
|
||||
#define SIOCUPCALL _IOW('s', 10, struct upcall_req)/* register upcall req */
|
||||
#endif
|
||||
|
||||
#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */
|
||||
#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */
|
||||
#define SIOCGETVIFCNT _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */
|
||||
#define SIOCGETSGCNT _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */
|
||||
|
||||
#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */
|
||||
#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */
|
||||
#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */
|
||||
#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */
|
||||
#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */
|
||||
#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */
|
||||
#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */
|
||||
#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */
|
||||
#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */
|
||||
#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */
|
||||
#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */
|
||||
#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */
|
||||
#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */
|
||||
#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */
|
||||
#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */
|
||||
#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */
|
||||
#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */
|
||||
#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */
|
||||
#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */
|
||||
#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */
|
||||
|
||||
#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */
|
||||
#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */
|
||||
#define SIOCGIFMTU _IOWR('i', 51, struct ifreq) /* get IF mtu */
|
||||
#define SIOCSIFMTU _IOW('i', 52, struct ifreq) /* set IF mtu */
|
||||
#define SIOCGIFPHYS _IOWR('i', 53, struct ifreq) /* get IF wire */
|
||||
#define SIOCSIFPHYS _IOW('i', 54, struct ifreq) /* set IF wire */
|
||||
#define SIOCSIFMEDIA _IOWR('i', 55, struct ifreq) /* set net media */
|
||||
#define SIOCGIFMEDIA _IOWR('i', 56, struct ifmediareq) /* get net media */
|
||||
#define SIOCSIFGENERIC _IOW('i', 57, struct ifreq) /* generic IF set op */
|
||||
#define SIOCGIFGENERIC _IOWR('i', 58, struct ifreq) /* generic IF get op */
|
||||
|
||||
#endif /* !_SYS_SOCKIO_H_ */
|
@@ -210,7 +210,7 @@ __BEGIN_DECLS
|
||||
extern int fstat (int, struct stat *);
|
||||
extern int lstat (const char *, struct stat *);
|
||||
extern int stat (const char *, void *);
|
||||
// extern int chmod (const char *, mode_t);
|
||||
extern int chmod (const char *, mode_t);
|
||||
#endif // __STAT_SYSCALLS_DECLARED
|
||||
__END_DECLS
|
||||
|
||||
|
505
StdLib/Include/sys/sysctl.h
Normal file
505
StdLib/Include/sys/sysctl.h
Normal file
@@ -0,0 +1,505 @@
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Mike Karels at Berkeley Software Design, Inc.
|
||||
*
|
||||
* Portions copyright (c) 1999, 2000
|
||||
* Intel Corporation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
*
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley, Intel Corporation, and its contributors.
|
||||
*
|
||||
* 4. Neither the name of University, Intel Corporation, or their respective
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS, INTEL CORPORATION AND
|
||||
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS,
|
||||
* INTEL CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
|
||||
* $Id: sysctl.h,v 1.1.1.1 2006/05/30 06:13:00 hhzhou Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SYSCTL_H_
|
||||
#define _SYS_SYSCTL_H_
|
||||
|
||||
#include <sys/_posix.h>
|
||||
|
||||
/*
|
||||
* Definitions for sysctl call. The sysctl call uses a hierarchical name
|
||||
* for objects that can be examined or modified. The name is expressed as
|
||||
* a sequence of integers. Like a file path name, the meaning of each
|
||||
* component depends on its place in the hierarchy. The top-level and kern
|
||||
* identifiers are defined here, and other identifiers are defined in the
|
||||
* respective subsystem header files.
|
||||
*/
|
||||
|
||||
#define CTL_MAXNAME 12 /* largest number of components supported */
|
||||
|
||||
/*
|
||||
* Each subsystem defined by sysctl defines a list of variables
|
||||
* for that subsystem. Each name is either a node with further
|
||||
* levels defined below it, or it is a leaf of some particular
|
||||
* type given below. Each sysctl level defines a set of name/type
|
||||
* pairs to be used by sysctl(1) in manipulating the subsystem.
|
||||
*/
|
||||
struct ctlname {
|
||||
char *ctl_name; /* subsystem name */
|
||||
int ctl_type; /* type of name */
|
||||
};
|
||||
|
||||
#define CTLTYPE 0xf /* Mask for the type */
|
||||
#define CTLTYPE_NODE 1 /* name is a node */
|
||||
#define CTLTYPE_INT 2 /* name describes an integer */
|
||||
#define CTLTYPE_STRING 3 /* name describes a string */
|
||||
#define CTLTYPE_QUAD 4 /* name describes a 64-bit number */
|
||||
#define CTLTYPE_OPAQUE 5 /* name describes a structure */
|
||||
#define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */
|
||||
|
||||
#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */
|
||||
#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */
|
||||
#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR)
|
||||
#define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */
|
||||
#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */
|
||||
#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */
|
||||
|
||||
/*
|
||||
* USE THIS instead of a hardwired number from the categories below
|
||||
* to get dynamically assigned sysctl entries using the linker-set
|
||||
* technology. This is the way nearly all new sysctl variables should
|
||||
* be implemented.
|
||||
* e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
|
||||
*/
|
||||
#define OID_AUTO (-1)
|
||||
|
||||
#ifdef KERNEL
|
||||
#define SYSCTL_HANDLER_ARGS (struct sysctl_oid *oidp, void *arg1, int arg2, \
|
||||
struct sysctl_req *req)
|
||||
|
||||
/*
|
||||
* This describes the access space for a sysctl request. This is needed
|
||||
* so that we can use the interface from the kernel or from user-space.
|
||||
*/
|
||||
struct sysctl_req {
|
||||
struct proc *p;
|
||||
int lock;
|
||||
void *oldptr;
|
||||
size_t oldlen;
|
||||
size_t oldidx;
|
||||
int (*oldfunc)(struct sysctl_req *, const void *, size_t);
|
||||
void *newptr;
|
||||
size_t newlen;
|
||||
size_t newidx;
|
||||
int (*newfunc)(struct sysctl_req *, void *, size_t);
|
||||
};
|
||||
|
||||
#ifndef _ORG_FREEBSD_
|
||||
#include <sys/ioccom.h>
|
||||
/*
|
||||
* Pseudo sysctl call through ioctl(2) interface
|
||||
*/
|
||||
#define IOCSYSCTL _IOWR('X', 0, struct sysctl_req)
|
||||
|
||||
struct pseudo_sysctl {
|
||||
int *name;
|
||||
u_int namelen;
|
||||
struct sysctl_req req;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This describes one "oid" in the MIB tree. Potentially more nodes can
|
||||
* be hidden behind it, expanded by the handler.
|
||||
*/
|
||||
struct sysctl_oid {
|
||||
int oid_number;
|
||||
int oid_kind;
|
||||
void *oid_arg1;
|
||||
int oid_arg2;
|
||||
const char *oid_name;
|
||||
int (*oid_handler) SYSCTL_HANDLER_ARGS;
|
||||
const char *oid_fmt;
|
||||
};
|
||||
|
||||
#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
|
||||
#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)
|
||||
|
||||
int sysctl_handle_int SYSCTL_HANDLER_ARGS;
|
||||
int sysctl_handle_long SYSCTL_HANDLER_ARGS;
|
||||
int sysctl_handle_intptr SYSCTL_HANDLER_ARGS;
|
||||
int sysctl_handle_string SYSCTL_HANDLER_ARGS;
|
||||
int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
|
||||
|
||||
#ifdef _ORG_FREEBSD_
|
||||
/* This constructs a "raw" MIB oid. */
|
||||
#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
|
||||
static struct sysctl_oid sysctl__##parent##_##name = { \
|
||||
nbr, kind, a1, a2, #name, handler, fmt }; \
|
||||
DATA_SET(sysctl_##parent, sysctl__##parent##_##name)
|
||||
|
||||
/* This constructs a node from which other oids can hang. */
|
||||
#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \
|
||||
extern struct linker_set sysctl_##parent##_##name; \
|
||||
SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|access, \
|
||||
(void*)&sysctl_##parent##_##name, 0, handler, "N", descr); \
|
||||
DATA_SET(sysctl_##parent##_##name, sysctl__##parent##_##name)
|
||||
#else
|
||||
#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr)
|
||||
#define SYSCTL_NODE(parent, nbr, name, access, handler, descr)
|
||||
#endif
|
||||
|
||||
/* Oid for a string. len can be 0 to indicate '\0' termination. */
|
||||
#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
|
||||
SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|access, \
|
||||
arg, len, sysctl_handle_string, "A", descr)
|
||||
|
||||
/* Oid for an int. If ptr is NULL, val is returned. */
|
||||
#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
|
||||
SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
|
||||
ptr, val, sysctl_handle_int, "I", descr)
|
||||
|
||||
/* Oid for a long. The pointer must be non NULL. */
|
||||
#define SYSCTL_LONG(parent, nbr, name, access, ptr, descr) \
|
||||
SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
|
||||
ptr, 0, sysctl_handle_long, "L", descr)
|
||||
|
||||
/* Oid for an opaque object. Specified by a pointer and a length. */
|
||||
#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
|
||||
SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
|
||||
ptr, len, sysctl_handle_opaque, fmt, descr)
|
||||
|
||||
/* Oid for a struct. Specified by a pointer and a type. */
|
||||
#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
|
||||
SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
|
||||
ptr, sizeof(struct type), sysctl_handle_opaque, \
|
||||
"S," #type, descr)
|
||||
|
||||
/* Oid for a procedure. Specified by a pointer and an arg. */
|
||||
#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
|
||||
SYSCTL_OID(parent, nbr, name, access, \
|
||||
ptr, arg, handler, fmt, descr)
|
||||
#endif /* KERNEL */
|
||||
|
||||
/*
|
||||
* Top-level identifiers
|
||||
*/
|
||||
#define CTL_UNSPEC 0 /* unused */
|
||||
#define CTL_KERN 1 /* "high kernel": proc, limits */
|
||||
#define CTL_VM 2 /* virtual memory */
|
||||
#define CTL_VFS 3 /* file system, mount type is next */
|
||||
#define CTL_NET 4 /* network, see socket.h */
|
||||
#define CTL_DEBUG 5 /* debugging parameters */
|
||||
#define CTL_HW 6 /* generic cpu/io */
|
||||
#define CTL_MACHDEP 7 /* machine dependent */
|
||||
#define CTL_USER 8 /* user-level */
|
||||
#define CTL_P1003_1B 9 /* POSIX 1003.1B */
|
||||
#define CTL_MAXID 10 /* number of valid top-level ids */
|
||||
|
||||
#define CTL_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "kern", CTLTYPE_NODE }, \
|
||||
{ "vm", CTLTYPE_NODE }, \
|
||||
{ "vfs", CTLTYPE_NODE }, \
|
||||
{ "net", CTLTYPE_NODE }, \
|
||||
{ "debug", CTLTYPE_NODE }, \
|
||||
{ "hw", CTLTYPE_NODE }, \
|
||||
{ "machdep", CTLTYPE_NODE }, \
|
||||
{ "user", CTLTYPE_NODE }, \
|
||||
{ "p1003_1b", CTLTYPE_NODE }, \
|
||||
}
|
||||
|
||||
/*
|
||||
* CTL_KERN identifiers
|
||||
*/
|
||||
#define KERN_OSTYPE 1 /* string: system version */
|
||||
#define KERN_OSRELEASE 2 /* string: system release */
|
||||
#define KERN_OSREV 3 /* int: system revision */
|
||||
#define KERN_VERSION 4 /* string: compile time info */
|
||||
#define KERN_MAXVNODES 5 /* int: max vnodes */
|
||||
#define KERN_MAXPROC 6 /* int: max processes */
|
||||
#define KERN_MAXFILES 7 /* int: max open files */
|
||||
#define KERN_ARGMAX 8 /* int: max arguments to exec */
|
||||
#define KERN_SECURELVL 9 /* int: system security level */
|
||||
#define KERN_HOSTNAME 10 /* string: hostname */
|
||||
#define KERN_HOSTID 11 /* int: host identifier */
|
||||
#define KERN_CLOCKRATE 12 /* struct: struct clockrate */
|
||||
#define KERN_VNODE 13 /* struct: vnode structures */
|
||||
#define KERN_PROC 14 /* struct: process entries */
|
||||
#define KERN_FILE 15 /* struct: file entries */
|
||||
#define KERN_PROF 16 /* node: kernel profiling info */
|
||||
#define KERN_POSIX1 17 /* int: POSIX.1 version */
|
||||
#define KERN_NGROUPS 18 /* int: # of supplemental group ids */
|
||||
#define KERN_JOB_CONTROL 19 /* int: is job control available */
|
||||
#define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */
|
||||
#define KERN_BOOTTIME 21 /* struct: time kernel was booted */
|
||||
#define KERN_NISDOMAINNAME 22 /* string: YP domain name */
|
||||
#define KERN_UPDATEINTERVAL 23 /* int: update process sleep time */
|
||||
#define KERN_OSRELDATE 24 /* int: OS release date */
|
||||
#define KERN_NTP_PLL 25 /* node: NTP PLL control */
|
||||
#define KERN_BOOTFILE 26 /* string: name of booted kernel */
|
||||
#define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */
|
||||
#define KERN_MAXPROCPERUID 28 /* int: max processes per uid */
|
||||
#define KERN_DUMPDEV 29 /* dev_t: device to dump on */
|
||||
#define KERN_IPC 30 /* node: anything related to IPC */
|
||||
#define KERN_DUMMY 31 /* unused */
|
||||
#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */
|
||||
#define KERN_USRSTACK 33 /* int: address of USRSTACK */
|
||||
#define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */
|
||||
#define KERN_MAXID 35 /* number of valid kern ids */
|
||||
|
||||
#define CTL_KERN_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "ostype", CTLTYPE_STRING }, \
|
||||
{ "osrelease", CTLTYPE_STRING }, \
|
||||
{ "osrevision", CTLTYPE_INT }, \
|
||||
{ "version", CTLTYPE_STRING }, \
|
||||
{ "maxvnodes", CTLTYPE_INT }, \
|
||||
{ "maxproc", CTLTYPE_INT }, \
|
||||
{ "maxfiles", CTLTYPE_INT }, \
|
||||
{ "argmax", CTLTYPE_INT }, \
|
||||
{ "securelevel", CTLTYPE_INT }, \
|
||||
{ "hostname", CTLTYPE_STRING }, \
|
||||
{ "hostid", CTLTYPE_INT }, \
|
||||
{ "clockrate", CTLTYPE_STRUCT }, \
|
||||
{ "vnode", CTLTYPE_STRUCT }, \
|
||||
{ "proc", CTLTYPE_STRUCT }, \
|
||||
{ "file", CTLTYPE_STRUCT }, \
|
||||
{ "profiling", CTLTYPE_NODE }, \
|
||||
{ "posix1version", CTLTYPE_INT }, \
|
||||
{ "ngroups", CTLTYPE_INT }, \
|
||||
{ "job_control", CTLTYPE_INT }, \
|
||||
{ "saved_ids", CTLTYPE_INT }, \
|
||||
{ "boottime", CTLTYPE_STRUCT }, \
|
||||
{ "nisdomainname", CTLTYPE_STRING }, \
|
||||
{ "update", CTLTYPE_INT }, \
|
||||
{ "osreldate", CTLTYPE_INT }, \
|
||||
{ "ntp_pll", CTLTYPE_NODE }, \
|
||||
{ "bootfile", CTLTYPE_STRING }, \
|
||||
{ "maxfilesperproc", CTLTYPE_INT }, \
|
||||
{ "maxprocperuid", CTLTYPE_INT }, \
|
||||
{ "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \
|
||||
{ "ipc", CTLTYPE_NODE }, \
|
||||
{ "dummy", CTLTYPE_INT }, \
|
||||
{ "ps_strings", CTLTYPE_INT }, \
|
||||
{ "usrstack", CTLTYPE_INT }, \
|
||||
{ "logsigexit", CTLTYPE_INT }, \
|
||||
}
|
||||
|
||||
/*
|
||||
* CTL_VFS identifiers
|
||||
*/
|
||||
#define CTL_VFS_NAMES { \
|
||||
{ "vfsconf", CTLTYPE_STRUCT }, \
|
||||
}
|
||||
|
||||
/*
|
||||
* KERN_PROC subtypes
|
||||
*/
|
||||
#define KERN_PROC_ALL 0 /* everything */
|
||||
#define KERN_PROC_PID 1 /* by process id */
|
||||
#define KERN_PROC_PGRP 2 /* by process group id */
|
||||
#define KERN_PROC_SESSION 3 /* by session of pid */
|
||||
#define KERN_PROC_TTY 4 /* by controlling tty */
|
||||
#define KERN_PROC_UID 5 /* by effective uid */
|
||||
#define KERN_PROC_RUID 6 /* by real uid */
|
||||
|
||||
/*
|
||||
* KERN_IPC identifiers
|
||||
*/
|
||||
#define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */
|
||||
#define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */
|
||||
#define KIPC_SOMAXCONN 3 /* int: max length of connection q */
|
||||
#define KIPC_MAX_LINKHDR 4 /* int: max length of link header */
|
||||
#define KIPC_MAX_PROTOHDR 5 /* int: max length of network header */
|
||||
#define KIPC_MAX_HDR 6 /* int: max total length of headers */
|
||||
#define KIPC_MAX_DATALEN 7 /* int: max length of data? */
|
||||
#define KIPC_MBSTAT 8 /* struct: mbuf usage statistics */
|
||||
#define KIPC_NMBCLUSTERS 9 /* int: maximum mbuf clusters */
|
||||
|
||||
/*
|
||||
* CTL_HW identifiers
|
||||
*/
|
||||
#define HW_MACHINE 1 /* string: machine class */
|
||||
#define HW_MODEL 2 /* string: specific machine model */
|
||||
#define HW_NCPU 3 /* int: number of cpus */
|
||||
#define HW_BYTEORDER 4 /* int: machine byte order */
|
||||
#define HW_PHYSMEM 5 /* int: total memory */
|
||||
#define HW_USERMEM 6 /* int: non-kernel memory */
|
||||
#define HW_PAGESIZE 7 /* int: software page size */
|
||||
#define HW_DISKNAMES 8 /* strings: disk drive names */
|
||||
#define HW_DISKSTATS 9 /* struct: diskstats[] */
|
||||
#define HW_FLOATINGPT 10 /* int: has HW floating point? */
|
||||
#define HW_MACHINE_ARCH 11 /* string: machine architecture */
|
||||
#define HW_MAXID 12 /* number of valid hw ids */
|
||||
|
||||
#define CTL_HW_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "machine", CTLTYPE_STRING }, \
|
||||
{ "model", CTLTYPE_STRING }, \
|
||||
{ "ncpu", CTLTYPE_INT }, \
|
||||
{ "byteorder", CTLTYPE_INT }, \
|
||||
{ "physmem", CTLTYPE_INT }, \
|
||||
{ "usermem", CTLTYPE_INT }, \
|
||||
{ "pagesize", CTLTYPE_INT }, \
|
||||
{ "disknames", CTLTYPE_STRUCT }, \
|
||||
{ "diskstats", CTLTYPE_STRUCT }, \
|
||||
{ "floatingpoint", CTLTYPE_INT }, \
|
||||
}
|
||||
|
||||
/*
|
||||
* CTL_USER definitions
|
||||
*/
|
||||
#define USER_CS_PATH 1 /* string: _CS_PATH */
|
||||
#define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */
|
||||
#define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */
|
||||
#define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */
|
||||
#define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */
|
||||
#define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */
|
||||
#define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */
|
||||
#define USER_LINE_MAX 8 /* int: LINE_MAX */
|
||||
#define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */
|
||||
#define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */
|
||||
#define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */
|
||||
#define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */
|
||||
#define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */
|
||||
#define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */
|
||||
#define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */
|
||||
#define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */
|
||||
#define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */
|
||||
#define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */
|
||||
#define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */
|
||||
#define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */
|
||||
#define USER_MAXID 21 /* number of valid user ids */
|
||||
|
||||
#define CTL_USER_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "cs_path", CTLTYPE_STRING }, \
|
||||
{ "bc_base_max", CTLTYPE_INT }, \
|
||||
{ "bc_dim_max", CTLTYPE_INT }, \
|
||||
{ "bc_scale_max", CTLTYPE_INT }, \
|
||||
{ "bc_string_max", CTLTYPE_INT }, \
|
||||
{ "coll_weights_max", CTLTYPE_INT }, \
|
||||
{ "expr_nest_max", CTLTYPE_INT }, \
|
||||
{ "line_max", CTLTYPE_INT }, \
|
||||
{ "re_dup_max", CTLTYPE_INT }, \
|
||||
{ "posix2_version", CTLTYPE_INT }, \
|
||||
{ "posix2_c_bind", CTLTYPE_INT }, \
|
||||
{ "posix2_c_dev", CTLTYPE_INT }, \
|
||||
{ "posix2_char_term", CTLTYPE_INT }, \
|
||||
{ "posix2_fort_dev", CTLTYPE_INT }, \
|
||||
{ "posix2_fort_run", CTLTYPE_INT }, \
|
||||
{ "posix2_localedef", CTLTYPE_INT }, \
|
||||
{ "posix2_sw_dev", CTLTYPE_INT }, \
|
||||
{ "posix2_upe", CTLTYPE_INT }, \
|
||||
{ "stream_max", CTLTYPE_INT }, \
|
||||
{ "tzname_max", CTLTYPE_INT }, \
|
||||
}
|
||||
|
||||
#define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */
|
||||
#define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */
|
||||
#define CTL_P1003_1B_MEMLOCK 3 /* boolean */
|
||||
#define CTL_P1003_1B_MEMLOCK_RANGE 4 /* boolean */
|
||||
#define CTL_P1003_1B_MEMORY_PROTECTION 5 /* boolean */
|
||||
#define CTL_P1003_1B_MESSAGE_PASSING 6 /* boolean */
|
||||
#define CTL_P1003_1B_PRIORITIZED_IO 7 /* boolean */
|
||||
#define CTL_P1003_1B_PRIORITY_SCHEDULING 8 /* boolean */
|
||||
#define CTL_P1003_1B_REALTIME_SIGNALS 9 /* boolean */
|
||||
#define CTL_P1003_1B_SEMAPHORES 10 /* boolean */
|
||||
#define CTL_P1003_1B_FSYNC 11 /* boolean */
|
||||
#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS 12 /* boolean */
|
||||
#define CTL_P1003_1B_SYNCHRONIZED_IO 13 /* boolean */
|
||||
#define CTL_P1003_1B_TIMERS 14 /* boolean */
|
||||
#define CTL_P1003_1B_AIO_LISTIO_MAX 15 /* int */
|
||||
#define CTL_P1003_1B_AIO_MAX 16 /* int */
|
||||
#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX 17 /* int */
|
||||
#define CTL_P1003_1B_DELAYTIMER_MAX 18 /* int */
|
||||
#define CTL_P1003_1B_MQ_OPEN_MAX 19 /* int */
|
||||
#define CTL_P1003_1B_PAGESIZE 20 /* int */
|
||||
#define CTL_P1003_1B_RTSIG_MAX 21 /* int */
|
||||
#define CTL_P1003_1B_SEM_NSEMS_MAX 22 /* int */
|
||||
#define CTL_P1003_1B_SEM_VALUE_MAX 23 /* int */
|
||||
#define CTL_P1003_1B_SIGQUEUE_MAX 24 /* int */
|
||||
#define CTL_P1003_1B_TIMER_MAX 25 /* int */
|
||||
|
||||
#define CTL_P1003_1B_MAXID 26
|
||||
|
||||
#define CTL_P1003_1B_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "asynchronous_io", CTLTYPE_INT }, \
|
||||
{ "mapped_files", CTLTYPE_INT }, \
|
||||
{ "memlock", CTLTYPE_INT }, \
|
||||
{ "memlock_range", CTLTYPE_INT }, \
|
||||
{ "memory_protection", CTLTYPE_INT }, \
|
||||
{ "message_passing", CTLTYPE_INT }, \
|
||||
{ "prioritized_io", CTLTYPE_INT }, \
|
||||
{ "priority_scheduling", CTLTYPE_INT }, \
|
||||
{ "realtime_signals", CTLTYPE_INT }, \
|
||||
{ "semaphores", CTLTYPE_INT }, \
|
||||
{ "fsync", CTLTYPE_INT }, \
|
||||
{ "shared_memory_objects", CTLTYPE_INT }, \
|
||||
{ "synchronized_io", CTLTYPE_INT }, \
|
||||
{ "timers", CTLTYPE_INT }, \
|
||||
{ "aio_listio_max", CTLTYPE_INT }, \
|
||||
{ "aio_max", CTLTYPE_INT }, \
|
||||
{ "aio_prio_delta_max", CTLTYPE_INT }, \
|
||||
{ "delaytimer_max", CTLTYPE_INT }, \
|
||||
{ "mq_open_max", CTLTYPE_INT }, \
|
||||
{ "pagesize", CTLTYPE_INT }, \
|
||||
{ "rtsig_max", CTLTYPE_INT }, \
|
||||
{ "nsems_max", CTLTYPE_INT }, \
|
||||
{ "sem_value_max", CTLTYPE_INT }, \
|
||||
{ "sigqueue_max", CTLTYPE_INT }, \
|
||||
{ "timer_max", CTLTYPE_INT }, \
|
||||
}
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
extern char machine[];
|
||||
extern char osrelease[];
|
||||
extern char ostype[];
|
||||
|
||||
int kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old,
|
||||
size_t *oldlenp, void *new, size_t newlen,
|
||||
size_t *retval);
|
||||
void sysctl_order_all(void);
|
||||
int userland_sysctl(struct proc *p, int *name, u_int namelen, void *old,
|
||||
size_t *oldlenp, int inkernel, void *new, size_t newlen,
|
||||
size_t *retval);
|
||||
|
||||
#else /* !KERNEL */
|
||||
#include <sys/EfiCdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
int sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
|
||||
int sysctlbyname __P((const char *, void *, size_t *, void *, size_t));
|
||||
__END_DECLS
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* !_SYS_SYSCTL_H_ */
|
@@ -37,7 +37,7 @@
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
#define ARG_MAX (2 * 1024) /* max bytes for an exec function */
|
||||
#define ARGC_MAX (ARG_MAX / 2) /* Maximum value for argc */
|
||||
#define ARGC_MAX (64) /* Maximum value for argc */
|
||||
|
||||
#ifndef CHILD_MAX
|
||||
#define CHILD_MAX 128 /* max simultaneous processes */
|
||||
|
@@ -71,6 +71,7 @@ struct timespec {
|
||||
(ts)->tv_sec = (tv)->tv_sec; \
|
||||
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TIMESPEC_TO_TIMEVAL(tv, ts) do { \
|
||||
(tv)->tv_sec = (ts)->tv_sec; \
|
||||
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
|
||||
@@ -79,10 +80,12 @@ struct timespec {
|
||||
/* Operations on timevals. */
|
||||
#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
|
||||
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
|
||||
|
||||
#define timercmp(tvp, uvp, cmp) \
|
||||
(((tvp)->tv_sec == (uvp)->tv_sec) ? \
|
||||
((tvp)->tv_usec cmp (uvp)->tv_usec) : \
|
||||
((tvp)->tv_sec cmp (uvp)->tv_sec))
|
||||
|
||||
#define timeradd(tvp, uvp, vvp) \
|
||||
do { \
|
||||
(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
|
||||
@@ -92,6 +95,7 @@ struct timespec {
|
||||
(vvp)->tv_usec -= 1000000; \
|
||||
} \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
|
||||
#define timersub(tvp, uvp, vvp) \
|
||||
do { \
|
||||
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
|
||||
@@ -105,10 +109,12 @@ struct timespec {
|
||||
/* Operations on timespecs. */
|
||||
#define timespecclear(tsp) (tsp)->tv_sec = (tsp)->tv_nsec = 0
|
||||
#define timespecisset(tsp) ((tsp)->tv_sec || (tsp)->tv_nsec)
|
||||
|
||||
#define timespeccmp(tsp, usp, cmp) \
|
||||
(((tsp)->tv_sec == (usp)->tv_sec) ? \
|
||||
((tsp)->tv_nsec cmp (usp)->tv_nsec) : \
|
||||
((tsp)->tv_sec cmp (usp)->tv_sec))
|
||||
|
||||
#define timespecadd(tsp, usp, vsp) \
|
||||
do { \
|
||||
(vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec; \
|
||||
@@ -118,6 +124,7 @@ struct timespec {
|
||||
(vsp)->tv_nsec -= 1000000000L; \
|
||||
} \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
|
||||
#define timespecsub(tsp, usp, vsp) \
|
||||
do { \
|
||||
(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
|
||||
@@ -182,5 +189,8 @@ __END_DECLS
|
||||
|
||||
/* BSD compatibility functions */
|
||||
int gettimeofday (struct timeval *tp, void *ignore);
|
||||
/* POSIX compatibility functions */
|
||||
int getitimer (int which, struct itimerval *value);
|
||||
int setitimer (int which, const struct itimerval *value, struct itimerval *ovalue);
|
||||
|
||||
#endif /* !_SYS_TIME_H_ */
|
||||
|
@@ -37,7 +37,7 @@
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
/* compile-time symbolic constants */
|
||||
#define _POSIX_JOB_CONTROL /* implementation supports job control */
|
||||
//#define _POSIX_JOB_CONTROL /* implementation supports job control */
|
||||
|
||||
/*
|
||||
* According to POSIX 1003.1:
|
||||
@@ -62,43 +62,42 @@
|
||||
|
||||
/* execution-time symbolic constants */
|
||||
/* chown requires appropriate privileges */
|
||||
#define _POSIX_CHOWN_RESTRICTED 1
|
||||
/* clock selection */
|
||||
#define _POSIX_CLOCK_SELECTION -1
|
||||
/* too-long path components generate errors */
|
||||
#define _POSIX_NO_TRUNC 1
|
||||
/* may disable terminal special characters */
|
||||
#define _POSIX_VDISABLE ((unsigned char)'\377')
|
||||
/* file synchronization is available */
|
||||
#define _POSIX_FSYNC 1
|
||||
/* synchronized I/O is available */
|
||||
#define _POSIX_SYNCHRONIZED_IO 1
|
||||
/* memory mapped files */
|
||||
#define _POSIX_MAPPED_FILES 1
|
||||
/* memory locking of whole address space */
|
||||
#define _POSIX_MEMLOCK 1
|
||||
/* memory locking address ranges */
|
||||
#define _POSIX_MEMLOCK_RANGE 1
|
||||
/* memory access protections */
|
||||
#define _POSIX_MEMORY_PROTECTION 1
|
||||
/* monotonic clock */
|
||||
#define _POSIX_MONOTONIC_CLOCK 200112L
|
||||
/* threads */
|
||||
#define _POSIX_THREADS 200112L
|
||||
/* semaphores */
|
||||
#define _POSIX_SEMAPHORES 0
|
||||
/* barriers */
|
||||
#define _POSIX_BARRIERS 200112L
|
||||
//#define _POSIX_CHOWN_RESTRICTED 1
|
||||
// /* clock selection */
|
||||
//#define _POSIX_CLOCK_SELECTION -1
|
||||
// /* too-long path components generate errors */
|
||||
//#define _POSIX_NO_TRUNC 1
|
||||
// /* may disable terminal special characters */
|
||||
//#define _POSIX_VDISABLE ((unsigned char)'\377')
|
||||
// /* file synchronization is available */
|
||||
//#define _POSIX_FSYNC 1
|
||||
// /* synchronized I/O is available */
|
||||
//#define _POSIX_SYNCHRONIZED_IO 1
|
||||
// /* memory mapped files */
|
||||
//#define _POSIX_MAPPED_FILES 1
|
||||
// /* memory locking of whole address space */
|
||||
//#define _POSIX_MEMLOCK 1
|
||||
// /* memory locking address ranges */
|
||||
//#define _POSIX_MEMLOCK_RANGE 1
|
||||
// /* memory access protections */
|
||||
//#define _POSIX_MEMORY_PROTECTION 1
|
||||
// /* monotonic clock */
|
||||
//#define _POSIX_MONOTONIC_CLOCK 200112L
|
||||
// /* threads */
|
||||
//#define _POSIX_THREADS 200112L
|
||||
// /* semaphores */
|
||||
//#define _POSIX_SEMAPHORES 0
|
||||
// /* barriers */
|
||||
//#define _POSIX_BARRIERS 200112L
|
||||
/* timers */
|
||||
#define _POSIX_TIMERS 200112L
|
||||
/* spin locks */
|
||||
#define _POSIX_SPIN_LOCKS 200112L
|
||||
/* read/write locks */
|
||||
#define _POSIX_READER_WRITER_LOCKS 200112L
|
||||
/* XPG4.2 shared memory */
|
||||
#define _XOPEN_SHM 0
|
||||
//#define _POSIX_SPIN_LOCKS 200112L
|
||||
// /* read/write locks */
|
||||
//#define _POSIX_READER_WRITER_LOCKS 200112L
|
||||
// /* XPG4.2 shared memory */
|
||||
//#define _XOPEN_SHM 0
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
/* whence values for lseek(2); renamed by POSIX 1003.1 */
|
||||
#define L_SET SEEK_SET
|
||||
#define L_INCR SEEK_CUR
|
||||
@@ -115,7 +114,6 @@
|
||||
#define FDATASYNC 0x0010 /* sync data and minimal metadata */
|
||||
#define FFILESYNC 0x0020 /* sync data and metadata */
|
||||
#define FDISKSYNC 0x0040 /* flush disk caches after sync */
|
||||
#endif
|
||||
|
||||
/* configurable pathname variables; use as argument to pathconf(3) */
|
||||
#define _PC_LINK_MAX 1
|
||||
|
170
StdLib/Include/sys/wait.h
Normal file
170
StdLib/Include/sys/wait.h
Normal file
@@ -0,0 +1,170 @@
|
||||
/* $NetBSD: wait.h,v 1.24 2005/12/11 12:25:21 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)wait.h 8.2 (Berkeley) 7/10/94
|
||||
*/
|
||||
#ifndef _SYS_WAIT_H_
|
||||
#define _SYS_WAIT_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* This file holds definitions relevent to the wait4 system call
|
||||
* and the alternate interfaces that use it (wait, wait3, waitpid).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Macros to test the exit status returned by wait
|
||||
* and extract the relevant values.
|
||||
*/
|
||||
#define _W_INT(w) (*(int *)(void *)&(w)) /* convert union wait to int */
|
||||
|
||||
#define _WSTATUS(x) (_W_INT(x) & 0177)
|
||||
#define _WSTOPPED 0177 /* _WSTATUS if process is stopped */
|
||||
#define WIFSTOPPED(x) (_WSTATUS(x) == _WSTOPPED)
|
||||
#define WSTOPSIG(x) ((int)(((unsigned int)_W_INT(x)) >> 8) & 0xff)
|
||||
#define WIFSIGNALED(x) (_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0)
|
||||
#define WTERMSIG(x) (_WSTATUS(x))
|
||||
#define WIFEXITED(x) (_WSTATUS(x) == 0)
|
||||
#define WEXITSTATUS(x) ((int)(((unsigned int)_W_INT(x)) >> 8) & 0xff)
|
||||
#define WCOREFLAG 0200
|
||||
#define WCOREDUMP(x) (_W_INT(x) & WCOREFLAG)
|
||||
|
||||
#define W_EXITCODE(ret, sig) ((ret) << 8 | (sig))
|
||||
#define W_STOPCODE(sig) ((sig) << 8 | _WSTOPPED)
|
||||
|
||||
/*
|
||||
* Option bits for the third argument of wait4. WNOHANG causes the
|
||||
* wait to not hang if there are no stopped or terminated processes, rather
|
||||
* returning an error indication in this case (pid==0). WUNTRACED
|
||||
* indicates that the caller should receive status about untraced children
|
||||
* which stop due to signals. If children are stopped and a wait without
|
||||
* this option is done, it is as though they were still running... nothing
|
||||
* about them is returned.
|
||||
*/
|
||||
#define WNOHANG 0x00000001 /* don't hang in wait */
|
||||
#define WUNTRACED 0x00000002 /* tell about stopped,
|
||||
untraced children */
|
||||
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
||||
#define WALTSIG 0x00000004 /* wait for processes that exit
|
||||
with an alternate signal (i.e.
|
||||
not SIGCHLD) */
|
||||
#define WALLSIG 0x00000008 /* wait for processes that exit
|
||||
with any signal, i.e. SIGCHLD
|
||||
and alternates */
|
||||
|
||||
/*
|
||||
* These are the Linux names of some of the above flags, for compatibility
|
||||
* with Linux's clone(2) API.
|
||||
*/
|
||||
#define __WCLONE WALTSIG
|
||||
#define __WALL WALLSIG
|
||||
|
||||
/*
|
||||
* These bits are used in order to support SVR4 (etc) functionality
|
||||
* without replicating sys_wait4 5 times.
|
||||
*/
|
||||
#define WNOWAIT 0x00010000 /* Don't mark child 'P_WAITED' */
|
||||
#define WNOZOMBIE 0x00020000 /* Ignore zombies */
|
||||
#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
|
||||
|
||||
/* POSIX extensions and 4.2/4.3 compatibility: */
|
||||
|
||||
/*
|
||||
* Tokens for special values of the "pid" parameter to wait4.
|
||||
*/
|
||||
#define WAIT_ANY (-1) /* any process */
|
||||
#define WAIT_MYPGRP 0 /* any process in my process group */
|
||||
|
||||
/*
|
||||
* Deprecated:
|
||||
* Structure of the information in the status word returned by wait4.
|
||||
* If w_stopval==WSTOPPED, then the second structure describes
|
||||
* the information returned, else the first.
|
||||
*/
|
||||
union wait {
|
||||
int w_status; /* used in syscall */
|
||||
/*
|
||||
* Terminated process status.
|
||||
*/
|
||||
struct {
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
unsigned int w_Termsig:7, /* termination signal */
|
||||
w_Coredump:1, /* core dump indicator */
|
||||
w_Retcode:8, /* exit code if w_termsig==0 */
|
||||
w_Filler:16; /* upper bits filler */
|
||||
#endif
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
unsigned int w_Filler:16, /* upper bits filler */
|
||||
w_Retcode:8, /* exit code if w_termsig==0 */
|
||||
w_Coredump:1, /* core dump indicator */
|
||||
w_Termsig:7; /* termination signal */
|
||||
#endif
|
||||
} w_T;
|
||||
/*
|
||||
* Stopped process status. Returned
|
||||
* only for traced children unless requested
|
||||
* with the WUNTRACED option bit.
|
||||
*/
|
||||
struct {
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
unsigned int w_Stopval:8, /* == W_STOPPED if stopped */
|
||||
w_Stopsig:8, /* signal that stopped us */
|
||||
w_Filler:16; /* upper bits filler */
|
||||
#endif
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
unsigned int w_Filler:16, /* upper bits filler */
|
||||
w_Stopsig:8, /* signal that stopped us */
|
||||
w_Stopval:8; /* == W_STOPPED if stopped */
|
||||
#endif
|
||||
} w_S;
|
||||
};
|
||||
#define w_termsig w_T.w_Termsig
|
||||
#define w_coredump w_T.w_Coredump
|
||||
#define w_retcode w_T.w_Retcode
|
||||
#define w_stopval w_S.w_Stopval
|
||||
#define w_stopsig w_S.w_Stopsig
|
||||
|
||||
#define WSTOPPED _WSTOPPED
|
||||
|
||||
__BEGIN_DECLS
|
||||
pid_t wait(int *);
|
||||
|
||||
#if 0 /* Normally declared here but not implemented for UEFI. */
|
||||
struct rusage; /* forward declaration */
|
||||
|
||||
pid_t waitpid(pid_t, int *, int);
|
||||
pid_t wait3(int *, int, struct rusage *);
|
||||
pid_t wait4(pid_t, int *, int, struct rusage *);
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_SYS_WAIT_H_ */
|
122
StdLib/Include/sysexits.h
Normal file
122
StdLib/Include/sysexits.h
Normal file
@@ -0,0 +1,122 @@
|
||||
/** @file contains exit code definitions for exiting systems applications.
|
||||
|
||||
These exit codes are an extension beyond the two values specified by
|
||||
ISO/IEC 9899:199409 and defined in <stdlib.h>.
|
||||
|
||||
* Copyright (c) 1987, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)sysexits.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
#ifndef _SYSEXITS_H_
|
||||
#define _SYSEXITS_H_
|
||||
|
||||
/*
|
||||
* SYSEXITS.H -- Exit status codes for system programs.
|
||||
*
|
||||
* This include file attempts to categorize possible error
|
||||
* exit statuses for system programs, notably delivermail
|
||||
* and the Berkeley network.
|
||||
*
|
||||
* Error numbers begin at EX__BASE to reduce the possibility of
|
||||
* clashing with other exit statuses that random programs may
|
||||
* already return. The meaning of the codes is approximately
|
||||
* as follows:
|
||||
*
|
||||
* EX_USAGE -- The command was used incorrectly, e.g., with
|
||||
* the wrong number of arguments, a bad flag, a bad
|
||||
* syntax in a parameter, or whatever.
|
||||
* EX_DATAERR -- The input data was incorrect in some way.
|
||||
* This should only be used for user's data & not
|
||||
* system files.
|
||||
* EX_NOINPUT -- An input file (not a system file) did not
|
||||
* exist or was not readable. This could also include
|
||||
* errors like "No message" to a mailer (if it cared
|
||||
* to catch it).
|
||||
* EX_NOUSER -- The user specified did not exist. This might
|
||||
* be used for mail addresses or remote logins.
|
||||
* EX_NOHOST -- The host specified did not exist. This is used
|
||||
* in mail addresses or network requests.
|
||||
* EX_UNAVAILABLE -- A service is unavailable. This can occur
|
||||
* if a support program or file does not exist. This
|
||||
* can also be used as a catchall message when something
|
||||
* you wanted to do doesn't work, but you don't know
|
||||
* why.
|
||||
* EX_SOFTWARE -- An internal software error has been detected.
|
||||
* This should be limited to non-operating system related
|
||||
* errors as possible.
|
||||
* EX_OSERR -- An operating system error has been detected.
|
||||
* This is intended to be used for such things as "cannot
|
||||
* fork", "cannot create pipe", or the like. It includes
|
||||
* things like getuid returning a user that does not
|
||||
* exist in the passwd file.
|
||||
* EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
|
||||
* etc.) does not exist, cannot be opened, or has some
|
||||
* sort of error (e.g., syntax error).
|
||||
* EX_CANTCREAT -- A (user specified) output file cannot be
|
||||
* created.
|
||||
* EX_IOERR -- An error occurred while doing I/O on some file.
|
||||
* EX_TEMPFAIL -- temporary failure, indicating something that
|
||||
* is not really an error. In sendmail, this means
|
||||
* that a mailer (e.g.) could not create a connection,
|
||||
* and the request should be reattempted later.
|
||||
* EX_PROTOCOL -- the remote system returned something that
|
||||
* was "not possible" during a protocol exchange.
|
||||
* EX_NOPERM -- You did not have sufficient permission to
|
||||
* perform the operation. This is not intended for
|
||||
* file system problems, which should use NOINPUT or
|
||||
* CANTCREAT, but rather for higher level permissions.
|
||||
*/
|
||||
|
||||
#define EX_OK 0 /* successful termination */
|
||||
|
||||
#define EX__BASE 64 /* base value for error messages */
|
||||
|
||||
#define EX_USAGE 64 /* command line usage error */
|
||||
#define EX_DATAERR 65 /* data format error */
|
||||
#define EX_NOINPUT 66 /* cannot open input */
|
||||
#define EX_NOUSER 67 /* addressee unknown */
|
||||
#define EX_NOHOST 68 /* host name unknown */
|
||||
#define EX_UNAVAILABLE 69 /* service unavailable */
|
||||
#define EX_SOFTWARE 70 /* internal software error */
|
||||
#define EX_OSERR 71 /* system error (e.g., can't fork) */
|
||||
#define EX_OSFILE 72 /* critical OS file missing */
|
||||
#define EX_CANTCREAT 73 /* can't create (user) output file */
|
||||
#define EX_IOERR 74 /* input/output error */
|
||||
#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
|
||||
#define EX_PROTOCOL 76 /* remote error in protocol */
|
||||
#define EX_NOPERM 77 /* permission denied */
|
||||
#define EX_CONFIG 78 /* configuration error */
|
||||
|
||||
#define EX__MAX 78 /* maximum listed value */
|
||||
|
||||
#endif /* !_SYSEXITS_H_ */
|
@@ -108,13 +108,13 @@
|
||||
**/
|
||||
struct tm {
|
||||
int tm_year; // years since 1900
|
||||
int tm_mon; // months since January <EFBFBD> [0, 11]
|
||||
int tm_mday; // day of the month <EFBFBD> [1, 31]
|
||||
int tm_hour; // hours since midnight <EFBFBD> [0, 23]
|
||||
int tm_min; // minutes after the hour <EFBFBD> [0, 59]
|
||||
int tm_sec; // seconds after the minute <EFBFBD> [0, 60]
|
||||
int tm_wday; // days since Sunday <EFBFBD> [0, 6]
|
||||
int tm_yday; // days since January 1 <EFBFBD> [0, 365]
|
||||
int tm_mon; // months since January [0, 11]
|
||||
int tm_mday; // day of the month [1, 31]
|
||||
int tm_hour; // hours since midnight [0, 23]
|
||||
int tm_min; // minutes after the hour [0, 59]
|
||||
int tm_sec; // seconds after the minute [0, 60]
|
||||
int tm_wday; // days since Sunday [0, 6]
|
||||
int tm_yday; // days since January 1 [0, 365]
|
||||
int tm_isdst; // Daylight Saving Time flag
|
||||
int tm_zoneoff; // EFI TimeZone offset, -1440 to 1440 or 2047
|
||||
int tm_daylight; // EFI Daylight flags
|
||||
@@ -125,7 +125,7 @@ struct tm {
|
||||
|
||||
/** The clock function determines the processor time used.
|
||||
|
||||
@return The clock function returns the implementation<EFBFBD>s best
|
||||
@return The clock function returns the implementation's best
|
||||
approximation to the processor time used by the program since the
|
||||
beginning of an implementation-defined era related only to the
|
||||
program invocation. To determine the time in seconds, the value
|
||||
@@ -137,11 +137,11 @@ struct tm {
|
||||
On IA32 or X64 platforms, the value returned is the number of
|
||||
CPU TimeStamp Counter ticks since the appliation started.
|
||||
**/
|
||||
clock_t EFIAPI clock(void);
|
||||
clock_t clock(void);
|
||||
|
||||
/**
|
||||
**/
|
||||
double EFIAPI difftime(time_t time1, time_t time0);
|
||||
double difftime(time_t time1, time_t time0);
|
||||
|
||||
/** The mktime function converts the broken-down time, expressed as local time,
|
||||
in the structure pointed to by timeptr into a calendar time value with the
|
||||
@@ -159,19 +159,19 @@ double EFIAPI difftime(time_t time1, time_t time0);
|
||||
as a value of type time_t. If the calendar time cannot be
|
||||
represented, the function returns the value (time_t)(-1).
|
||||
**/
|
||||
time_t EFIAPI mktime(struct tm *timeptr);
|
||||
time_t mktime(struct tm *timeptr);
|
||||
|
||||
/** The time function determines the current calendar time.
|
||||
|
||||
The encoding of the value is unspecified.
|
||||
|
||||
@return The time function returns the implementation<EFBFBD>s best approximation
|
||||
@return The time function returns the implementation's best approximation
|
||||
of the current calendar time. The value (time_t)(-1) is returned
|
||||
if the calendar time is not available. If timer is not a null
|
||||
pointer, the return value is also assigned to the object it
|
||||
points to.
|
||||
**/
|
||||
time_t EFIAPI time(time_t *timer);
|
||||
time_t time(time_t *timer);
|
||||
|
||||
/* ################# Time Conversion Functions ########################## */
|
||||
|
||||
@@ -181,7 +181,7 @@ time_t EFIAPI time(time_t *timer);
|
||||
|
||||
@return The asctime function returns a pointer to the string.
|
||||
**/
|
||||
char * EFIAPI asctime(const struct tm *timeptr);
|
||||
char * asctime(const struct tm *timeptr);
|
||||
|
||||
/** The ctime function converts the calendar time pointed to by timer to local
|
||||
time in the form of a string. It is equivalent to asctime(localtime(timer))
|
||||
@@ -189,7 +189,7 @@ char * EFIAPI asctime(const struct tm *timeptr);
|
||||
@return The ctime function returns the pointer returned by the asctime
|
||||
function with that broken-down time as argument.
|
||||
**/
|
||||
char * EFIAPI ctime(const time_t *timer);
|
||||
char * ctime(const time_t *timer);
|
||||
|
||||
/** The gmtime function converts the calendar time pointed to by timer into a
|
||||
brokendown time, expressed as UTC.
|
||||
@@ -197,7 +197,13 @@ char * EFIAPI ctime(const time_t *timer);
|
||||
@return The gmtime function returns a pointer to the broken-down time,
|
||||
or a null pointer if the specified time cannot be converted to UTC.
|
||||
**/
|
||||
struct tm * EFIAPI gmtime(const time_t *timer);
|
||||
struct tm * gmtime(const time_t *timer);
|
||||
|
||||
/** The timegm function is the opposite of gmtime.
|
||||
|
||||
@return The calendar time expressed as UTC.
|
||||
**/
|
||||
time_t timegm(struct tm*);
|
||||
|
||||
/** The localtime function converts the calendar time pointed to by timer into
|
||||
a broken-down time, expressed as local time.
|
||||
@@ -206,7 +212,7 @@ struct tm * EFIAPI gmtime(const time_t *timer);
|
||||
or a null pointer if the specified time cannot be converted to
|
||||
local time.
|
||||
**/
|
||||
struct tm * EFIAPI localtime(const time_t *timer);
|
||||
struct tm * localtime(const time_t *timer);
|
||||
|
||||
/** The strftime function places characters into the array pointed to by s as
|
||||
controlled by the string pointed to by format. The format shall be a
|
||||
@@ -228,11 +234,11 @@ struct tm * EFIAPI localtime(const time_t *timer);
|
||||
in the description. If any of the specified values is outside the normal
|
||||
range, the characters stored are unspecified.
|
||||
|
||||
%a is replaced by the locale<EFBFBD>s abbreviated weekday name. [tm_wday]
|
||||
%A is replaced by the locale<EFBFBD>s full weekday name. [tm_wday]
|
||||
%b is replaced by the locale<EFBFBD>s abbreviated month name. [tm_mon]
|
||||
%B is replaced by the locale<EFBFBD>s full month name. [tm_mon]
|
||||
%c is replaced by the locale<EFBFBD>s appropriate date and time representation.
|
||||
%a is replaced by the locale's abbreviated weekday name. [tm_wday]
|
||||
%A is replaced by the locale's full weekday name. [tm_wday]
|
||||
%b is replaced by the locale's abbreviated month name. [tm_mon]
|
||||
%B is replaced by the locale's full month name. [tm_mon]
|
||||
%c is replaced by the locale's appropriate date and time representation.
|
||||
%C is replaced by the year divided by 100 and truncated to an integer,
|
||||
as a decimal number (00-99). [tm_year]
|
||||
%d is replaced by the day of the month as a decimal number (01-31). [tm_mday]
|
||||
@@ -252,9 +258,9 @@ struct tm * EFIAPI localtime(const time_t *timer);
|
||||
%m is replaced by the month as a decimal number (01-12). [tm_mon]
|
||||
%M is replaced by the minute as a decimal number (00-59). [tm_min]
|
||||
%n is replaced by a new-line character.
|
||||
%p is replaced by the locale<EFBFBD>s equivalent of the AM/PM designations
|
||||
%p is replaced by the locale's equivalent of the AM/PM designations
|
||||
associated with a 12-hour clock. [tm_hour]
|
||||
%r is replaced by the locale<EFBFBD>s 12-hour clock time. [tm_hour, tm_min, tm_sec]
|
||||
%r is replaced by the locale's 12-hour clock time. [tm_hour, tm_min, tm_sec]
|
||||
%R is equivalent to "%H:%M". [tm_hour, tm_min]
|
||||
%S is replaced by the second as a decimal number (00-60). [tm_sec]
|
||||
%t is replaced by a horizontal-tab character.
|
||||
@@ -270,8 +276,8 @@ struct tm * EFIAPI localtime(const time_t *timer);
|
||||
[tm_wday]
|
||||
%W is replaced by the week number of the year (the first Monday as the
|
||||
first day of week 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
|
||||
%x is replaced by the locale<EFBFBD>s appropriate date representation.
|
||||
%X is replaced by the locale<EFBFBD>s appropriate time representation.
|
||||
%x is replaced by the locale's appropriate date representation.
|
||||
%X is replaced by the locale's appropriate time representation.
|
||||
%y is replaced by the last 2 digits of the year as a decimal
|
||||
number (00-99). [tm_year]
|
||||
%Y is replaced by the year as a decimal number (e.g., 1997). [tm_year]
|
||||
@@ -285,38 +291,38 @@ struct tm * EFIAPI localtime(const time_t *timer);
|
||||
Some conversion specifiers can be modified by the inclusion of an E or O
|
||||
modifier character to indicate an alternative format or specification.
|
||||
If the alternative format or specification does not exist for the current
|
||||
locale, the modifier is ignored. %Ec is replaced by the locale<EFBFBD>s
|
||||
locale, the modifier is ignored. %Ec is replaced by the locale's
|
||||
alternative date and time representation.
|
||||
|
||||
%EC is replaced by the name of the base year (period) in the locale<EFBFBD>s
|
||||
%EC is replaced by the name of the base year (period) in the locale's
|
||||
alternative representation.
|
||||
%Ex is replaced by the locale<EFBFBD>s alternative date representation.
|
||||
%EX is replaced by the locale<EFBFBD>s alternative time representation.
|
||||
%Ey is replaced by the offset from %EC (year only) in the locale<EFBFBD>s
|
||||
%Ex is replaced by the locale's alternative date representation.
|
||||
%EX is replaced by the locale's alternative time representation.
|
||||
%Ey is replaced by the offset from %EC (year only) in the locale's
|
||||
alternative representation.
|
||||
%EY is replaced by the locale<EFBFBD>s full alternative year representation.
|
||||
%Od is replaced by the day of the month, using the locale<EFBFBD>s alternative
|
||||
%EY is replaced by the locale's full alternative year representation.
|
||||
%Od is replaced by the day of the month, using the locale's alternative
|
||||
numeric symbols (filled as needed with leading zeros, or with leading
|
||||
spaces if there is no alternative symbol for zero).
|
||||
%Oe is replaced by the day of the month, using the locale<EFBFBD>s alternative
|
||||
%Oe is replaced by the day of the month, using the locale's alternative
|
||||
numeric symbols (filled as needed with leading spaces).
|
||||
%OH is replaced by the hour (24-hour clock), using the locale<EFBFBD>s
|
||||
%OH is replaced by the hour (24-hour clock), using the locale's
|
||||
alternative numeric symbols.
|
||||
%OI is replaced by the hour (12-hour clock), using the locale<EFBFBD>s
|
||||
%OI is replaced by the hour (12-hour clock), using the locale's
|
||||
alternative numeric symbols.
|
||||
%Om is replaced by the month, using the locale<EFBFBD>s alternative numeric symbols.
|
||||
%OM is replaced by the minutes, using the locale<EFBFBD>s alternative numeric symbols.
|
||||
%OS is replaced by the seconds, using the locale<EFBFBD>s alternative numeric symbols.
|
||||
%Ou is replaced by the ISO 8601 weekday as a number in the locale<EFBFBD>s
|
||||
%Om is replaced by the month, using the locale's alternative numeric symbols.
|
||||
%OM is replaced by the minutes, using the locale's alternative numeric symbols.
|
||||
%OS is replaced by the seconds, using the locale's alternative numeric symbols.
|
||||
%Ou is replaced by the ISO 8601 weekday as a number in the locale's
|
||||
alternative representation, where Monday is 1.
|
||||
%OU is replaced by the week number, using the locale<EFBFBD>s alternative numeric symbols.
|
||||
%OV is replaced by the ISO 8601 week number, using the locale<EFBFBD>s alternative
|
||||
%OU is replaced by the week number, using the locale's alternative numeric symbols.
|
||||
%OV is replaced by the ISO 8601 week number, using the locale's alternative
|
||||
numeric symbols.
|
||||
%Ow is replaced by the weekday as a number, using the locale<EFBFBD>s alternative
|
||||
%Ow is replaced by the weekday as a number, using the locale's alternative
|
||||
numeric symbols.
|
||||
%OW is replaced by the week number of the year, using the locale<EFBFBD>s
|
||||
%OW is replaced by the week number of the year, using the locale's
|
||||
alternative numeric symbols.
|
||||
%Oy is replaced by the last 2 digits of the year, using the locale<EFBFBD>s
|
||||
%Oy is replaced by the last 2 digits of the year, using the locale's
|
||||
alternative numeric symbols.
|
||||
|
||||
%g, %G, and %V give values according to the ISO 8601 week-based year. In
|
||||
@@ -358,7 +364,7 @@ struct tm * EFIAPI localtime(const time_t *timer);
|
||||
character. Otherwise, zero is returned and the contents of the
|
||||
array are indeterminate.
|
||||
**/
|
||||
size_t EFIAPI strftime( char * __restrict s, size_t maxsize,
|
||||
size_t strftime( char * __restrict s, size_t maxsize,
|
||||
const char * __restrict format,
|
||||
const struct tm * __restrict timeptr);
|
||||
|
||||
@@ -367,6 +373,6 @@ char *strptime(const char *, const char * format, struct tm*);
|
||||
|
||||
/* ################# Implementation Functions ########################### */
|
||||
|
||||
clock_t EFIAPI __getCPS(void);
|
||||
clock_t __getCPS(void);
|
||||
|
||||
#endif /* _TIME_H */
|
||||
|
@@ -27,8 +27,17 @@
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
int dup(int);
|
||||
int rename(const char *, const char *);
|
||||
|
||||
/* Functions implemented for compatibility. */
|
||||
int getopt(int, char * const [], const char *);
|
||||
extern char *optarg; /* getopt(3) external variables */
|
||||
extern int optind;
|
||||
pid_t getpgrp(void);
|
||||
pid_t tcgetpgrp(int);
|
||||
char *getpass(const char *);
|
||||
|
||||
// Networking
|
||||
long gethostid(void);
|
||||
int gethostname(char *, size_t);
|
||||
@@ -37,15 +46,20 @@ int setdomainname(const char *, size_t);
|
||||
int sethostid(long);
|
||||
int sethostname(const char *, size_t);
|
||||
|
||||
/* Stub functions implemented for porting ease.
|
||||
These functions always fail or return NULL.
|
||||
*/
|
||||
__aconst char *getlogin(void);
|
||||
pid_t fork(void);
|
||||
uid_t getuid(void);
|
||||
|
||||
// For Future implementation
|
||||
__dead void _exit(int) __attribute__((__noreturn__));
|
||||
ssize_t pread(int, void *, size_t, off_t);
|
||||
ssize_t pwrite(int, const void *, size_t, off_t);
|
||||
int syscall(int, ...);
|
||||
int dup(int);
|
||||
pid_t fork(void);
|
||||
|
||||
// The following *nix functions are not implemented
|
||||
#if 0 // The following functions are not implemented
|
||||
__dead void _exit(int) __attribute__((__noreturn__));
|
||||
unsigned int alarm(unsigned int);
|
||||
int chown(const char *, uid_t, gid_t);
|
||||
size_t confstr(int, char *, size_t);
|
||||
@@ -60,11 +74,8 @@ gid_t getegid(void);
|
||||
uid_t geteuid(void);
|
||||
gid_t getgid(void);
|
||||
int getgroups(int, gid_t []);
|
||||
__aconst char *getlogin(void);
|
||||
pid_t getpgrp(void);
|
||||
pid_t getpid(void);
|
||||
pid_t getppid(void);
|
||||
uid_t getuid(void);
|
||||
int link(const char *, const char *);
|
||||
long pathconf(const char *, int);
|
||||
int pause(void);
|
||||
@@ -75,18 +86,14 @@ pid_t setsid(void);
|
||||
int setuid(uid_t);
|
||||
unsigned int sleep(unsigned int);
|
||||
long sysconf(int);
|
||||
pid_t tcgetpgrp(int);
|
||||
|
||||
int tcsetpgrp(int, pid_t);
|
||||
__aconst char *ttyname(int);
|
||||
|
||||
int getopt(int, char * const [], const char *);
|
||||
|
||||
extern char *optarg; /* getopt(3) external variables */
|
||||
extern int opterr;
|
||||
extern int optind;
|
||||
extern int optopt;
|
||||
extern int optreset; /* getopt(3) external variable */
|
||||
extern char *suboptarg; /* getsubopt(3) external variable */
|
||||
extern int optreset;
|
||||
extern char *suboptarg;
|
||||
|
||||
int setegid(gid_t);
|
||||
int seteuid(uid_t);
|
||||
@@ -97,7 +104,6 @@ int chroot(const char *);
|
||||
int nice(int);
|
||||
__aconst char *crypt(const char *, const char *);
|
||||
int encrypt(char *, int);
|
||||
char *getpass(const char *);
|
||||
pid_t getsid(pid_t);
|
||||
|
||||
#ifndef intptr_t
|
||||
@@ -164,6 +170,7 @@ int undelete(const char *);
|
||||
int rcmd_af(char **, int, const char *, const char *, const char *, int *, int);
|
||||
int rresvport_af(int *, int);
|
||||
int iruserok_sa(const void *, int, int, const char *, const char *);
|
||||
#endif /* Unimplemented functions. */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
@@ -46,15 +46,6 @@
|
||||
/** maximum value for an object of type unsigned int **/
|
||||
#define __UINT_MAX 0xffffffff // 2^32 - 1
|
||||
|
||||
/** minimum value for an object of type long int **/
|
||||
#define __LONG_MIN (-2147483647L - 1L) // -(2^31 - 1)
|
||||
|
||||
/** maximum value for an object of type long int **/
|
||||
#define __LONG_MAX +2147483647L // 2^31 - 1
|
||||
|
||||
/** maximum value for an object of type unsigned long int **/
|
||||
#define __ULONG_MAX 0xffffffff // 2^32 - 1
|
||||
|
||||
/** minimum value for an object of type long long int **/
|
||||
//#define __LLONG_MIN -9223372036854775808LL // -(2^63 - 1)
|
||||
//#define __LLONG_MIN ((-9223372036854775807LL)-1) // -(2^63 - 1)
|
||||
@@ -71,7 +62,6 @@
|
||||
#define __SHORT_BIT 16
|
||||
#define __WCHAR_BIT 16
|
||||
#define __INT_BIT 32
|
||||
#define __LONG_BIT 32 /* Compiler dependent */
|
||||
#define __LONG_LONG_BIT 64
|
||||
|
||||
#endif /* _MACHINE_LIMITS_H */
|
||||
|
Reference in New Issue
Block a user