Many changes to simplify porting applications.
This commit is contained in:
parent
054e68baf6
commit
11cbb6faae
17 changed files with 204 additions and 6 deletions
|
@ -6,6 +6,17 @@ arpa/inet.h
|
|||
#define _ARPA__INET_H
|
||||
|
||||
/* Open Group Base Specifications Issue 6 (not complete): */
|
||||
|
||||
#ifndef _STRUCT_IN_ADDR
|
||||
#define _STRUCT_IN_ADDR
|
||||
/* Has to match corresponding declaration in <netinet/in.h> */
|
||||
struct in_addr
|
||||
{
|
||||
in_addr_t s_addr;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
char *inet_ntoa(struct in_addr in);
|
||||
|
||||
#endif /* _ARPA__INET_H */
|
||||
|
|
|
@ -94,6 +94,9 @@ extern int errno; /* place where the error numbers go */
|
|||
#define ENOCONN (_SIGN 66) /* no such connection */
|
||||
#define EAFNOSUPPORT (_SIGN 67) /* address family not supported */
|
||||
#define EPROTONOSUPPORT (_SIGN 68) /* protocol not supported by AF */
|
||||
#define EPROTOTYPE (_SIGN 69) /* Protocol wrong type for socket */
|
||||
#define EINPROGRESS (_SIGN 70) /* Operation now in progress */
|
||||
#define EADDRNOTAVAIL (_SIGN 71) /* Can't assign requested address */
|
||||
|
||||
/* The following are not POSIX errors, but they can still happen.
|
||||
* All of these are generated by the kernel and relate to message passing.
|
||||
|
|
|
@ -36,4 +36,8 @@ _PROTOTYPE( double sqrt, (double _x) );
|
|||
_PROTOTYPE( double tan, (double _x) );
|
||||
_PROTOTYPE( double tanh, (double _x) );
|
||||
|
||||
#ifdef _POSIX_SOURCE /* STD-C? */
|
||||
#include <mathconst.h>
|
||||
#endif
|
||||
|
||||
#endif /* _MATH_H */
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#define SUN_4 40 /* any Sun SPARC-based system */
|
||||
#define SUN_4_60 40 /* Sun-4/60 (aka SparcStation 1 or Campus) */
|
||||
#define ATARI 60 /* ATARI ST/STe/TT (68000/68030) */
|
||||
#define AMIGA 61 /* Commodore Amiga (68000) */
|
||||
#define MACINTOSH 62 /* Apple Macintosh (68000) */
|
||||
|
||||
/* Word size in bytes (a constant equal to sizeof(int)). */
|
||||
|
@ -160,7 +159,7 @@
|
|||
#define CHIP INTEL
|
||||
#endif
|
||||
|
||||
#if (MACHINE == ATARI) || (MACHINE == AMIGA) || (MACHINE == MACINTOSH)
|
||||
#if (MACHINE == ATARI) || (MACHINE == MACINTOSH)
|
||||
#define CHIP M68000
|
||||
#endif
|
||||
|
||||
|
|
3
include/net/if.h
Normal file
3
include/net/if.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*
|
||||
net/if.h
|
||||
*/
|
|
@ -11,11 +11,47 @@ netinet/in.h
|
|||
#include <stdint.h>
|
||||
|
||||
/* Open Group Base Specifications Issue 6 (not complete) */
|
||||
typedef uint32_t in_addr_t;
|
||||
#define INADDR_ANY (uint32_t)0x00000000
|
||||
|
||||
typedef uint16_t in_port_t;
|
||||
|
||||
#ifndef _IN_ADDR_T
|
||||
#define _IN_ADDR_T
|
||||
typedef uint32_t in_addr_t;
|
||||
#endif /* _IN_ADDR_T */
|
||||
|
||||
#ifndef _SA_FAMILY_T
|
||||
#define _SA_FAMILY_T
|
||||
/* Should match corresponding typedef in <sys/socket.h> */
|
||||
typedef uint8_t sa_family_t;
|
||||
#endif /* _SA_FAMILY_T */
|
||||
|
||||
/* Protocols */
|
||||
#define IPPROTO_IP 0 /* Dummy protocol */
|
||||
|
||||
/* setsockopt options at IP level */
|
||||
#define IP_ADD_MEMBERSHIP 12
|
||||
#define IP_DROP_MEMBERSHIP 13
|
||||
|
||||
#ifndef _STRUCT_IN_ADDR
|
||||
#define _STRUCT_IN_ADDR
|
||||
struct in_addr
|
||||
{
|
||||
in_addr_t s_addr;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct sockaddr_in
|
||||
{
|
||||
sa_family_t sin_family;
|
||||
in_port_t sin_port;
|
||||
struct in_addr sin_addr;
|
||||
};
|
||||
|
||||
struct ip_mreq
|
||||
{
|
||||
struct in_addr imr_multiaddr;
|
||||
struct in_addr imr_interface;
|
||||
};
|
||||
|
||||
#endif /* _NETINET__IN_H */
|
||||
|
|
0
include/netinet/tcp.h
Normal file
0
include/netinet/tcp.h
Normal file
|
@ -64,11 +64,21 @@ _PROTOTYPE( unsigned long int strtoul,
|
|||
(const char *_nptr, char **_endptr, int _base) );
|
||||
|
||||
#ifdef _POSIX_SOURCE
|
||||
/* Open Group Base Specifications Issue 6 */
|
||||
_PROTOTYPE( int mkstemp, (char *_fmt) );
|
||||
_PROTOTYPE( char *initstate, (unsigned _seed, char *_state,
|
||||
size_t _size) );
|
||||
_PROTOTYPE( long random, (void) );
|
||||
_PROTOTYPE( char *setstate, (const char *state) );
|
||||
_PROTOTYPE( void srandom, (unsigned seed) );
|
||||
#endif
|
||||
|
||||
#ifdef _MINIX
|
||||
_PROTOTYPE( int putenv, (const char *_name) );
|
||||
|
||||
/* According to POSIX, getopt should be in unistd.h. What do we do with
|
||||
* this?
|
||||
*/
|
||||
_PROTOTYPE(int getopt, (int _argc, char **_argv, char *_opts));
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
|
|
|
@ -40,6 +40,11 @@ _PROTOTYPE( char *strstr, (const char *_s1, const char *_s2) );
|
|||
_PROTOTYPE( char *strtok, (char *_s1, const char *_s2) );
|
||||
_PROTOTYPE( size_t strxfrm, (char *_s1, const char *_s2, size_t _n) );
|
||||
|
||||
#ifdef _POSIX_SOURCE
|
||||
/* Open Group Base Specifications Issue 6 (not complete) */
|
||||
char *strdup(const char *_s1);
|
||||
#endif
|
||||
|
||||
#ifdef _MINIX
|
||||
/* For backward compatibility. */
|
||||
_PROTOTYPE( char *index, (const char *_s, int _charwanted) );
|
||||
|
@ -49,6 +54,7 @@ _PROTOTYPE( int bcmp, (const void *_s1, const void *_s2, size_t _length));
|
|||
_PROTOTYPE( void bzero, (void *_dst, size_t _length) );
|
||||
_PROTOTYPE( void *memccpy, (char *_dst, const char *_src, int _ucharstop,
|
||||
size_t _size) );
|
||||
|
||||
/* Misc. extra functions */
|
||||
_PROTOTYPE( int strcasecmp, (const char *_s1, const char *_s2) );
|
||||
_PROTOTYPE( int strncasecmp, (const char *_s1, const char *_s2,
|
||||
|
|
11
include/sys/ioc_file.h
Executable file
11
include/sys/ioc_file.h
Executable file
|
@ -0,0 +1,11 @@
|
|||
/* sys/ioc_file.h - File ioctl() command codes.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_IOC_FILE_H
|
||||
#define _SYS_IOC_FILE_H
|
||||
|
||||
#include <minix/ioctl.h>
|
||||
|
||||
#define FIONREAD _IOR('f', 1, int)
|
||||
|
||||
#endif /* _SYS_IOC_FILE_H */
|
|
@ -16,6 +16,7 @@
|
|||
#include <sys/ioc_tty.h> /* 'T' 't' 'k' */
|
||||
#include <net/ioctl.h> /* 'n' */
|
||||
#include <sys/ioc_disk.h> /* 'd' */
|
||||
#include <sys/ioc_file.h> /* 'f' */
|
||||
#include <sys/ioc_memory.h> /* 'm' */
|
||||
#include <sys/ioc_tape.h> /* 'M' */
|
||||
#include <sys/ioc_scsi.h> /* 'S' */
|
||||
|
|
7
include/sys/param.h
Normal file
7
include/sys/param.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
sys/param.h
|
||||
*/
|
||||
|
||||
/* Do we need this header file? Maybe an empty one is sufficient to avoid
|
||||
* compilations errors.
|
||||
*/
|
|
@ -8,10 +8,10 @@
|
|||
#include <string.h>
|
||||
|
||||
/* Use this datatype as basic storage unit in fd_set */
|
||||
typedef u32_t _fdsetword;
|
||||
typedef u32_t fd_mask;
|
||||
|
||||
/* This many bits fit in an fd_set word. */
|
||||
#define _FDSETBITSPERWORD (sizeof(_fdsetword)*8)
|
||||
#define _FDSETBITSPERWORD (sizeof(fd_mask)*8)
|
||||
|
||||
/* Bit manipulation macros */
|
||||
#define _FD_BITMASK(b) (1L << ((b) % _FDSETBITSPERWORD))
|
||||
|
@ -26,7 +26,7 @@ typedef u32_t _fdsetword;
|
|||
#define _FDSETWORDS ((FD_SETSIZE+_FDSETBITSPERWORD-1)/_FDSETBITSPERWORD)
|
||||
|
||||
typedef struct {
|
||||
_fdsetword _fdsetval[_FDSETWORDS];
|
||||
fd_mask fds_bits[_FDSETWORDS];
|
||||
} fd_set;
|
||||
|
||||
_PROTOTYPE( int select, (int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout) );
|
||||
|
|
|
@ -2,5 +2,66 @@
|
|||
sys/socket.h
|
||||
*/
|
||||
|
||||
#ifndef SYS_SOCKET_H
|
||||
#define SYS_SOCKET_H
|
||||
|
||||
/* Can we include <stdint.h> here or do we need an additional header that is
|
||||
* safe to include?
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
/* Open Group Base Specifications Issue 6 (not complete) */
|
||||
#include <net/gen/socket.h>
|
||||
|
||||
#define SOCK_STREAM 1
|
||||
#define SOCK_DGRAM 2
|
||||
|
||||
#define SOL_SOCKET 0xFFFF
|
||||
|
||||
#define SO_REUSEADDR 0x0004
|
||||
#define SO_KEEPALIVE 0x0008
|
||||
|
||||
/* The how argument to shutdown */
|
||||
#define SHUT_RD 0 /* No further reads */
|
||||
#define SHUT_WR 1 /* No further writes */
|
||||
#define SHUT_RDWR 2 /* No further reads and writes */
|
||||
|
||||
#ifndef _SA_FAMILY_T
|
||||
#define _SA_FAMILY_T
|
||||
typedef uint8_t sa_family_t;
|
||||
#endif /* _SA_FAMILY_T */
|
||||
|
||||
typedef int32_t socklen_t;
|
||||
|
||||
struct sockaddr
|
||||
{
|
||||
sa_family_t sa_family;
|
||||
char sa_data[1];
|
||||
};
|
||||
|
||||
_PROTOTYPE( int accept, (int _socket,
|
||||
struct sockaddr *_RESTRICT _address,
|
||||
socklen_t *_RESTRICT _address_len) );
|
||||
_PROTOTYPE( int bind, (int _socket, const struct sockaddr *_address,
|
||||
socklen_t _address_len) );
|
||||
_PROTOTYPE( int connect, (int _socket, const struct sockaddr *_address,
|
||||
socklen_t _address_len) );
|
||||
_PROTOTYPE( int getpeername, (int _socket,
|
||||
struct sockaddr *_RESTRICT _address,
|
||||
socklen_t *_RESTRICT _address_len) );
|
||||
_PROTOTYPE( int getsockname, (int _socket,
|
||||
struct sockaddr *_RESTRICT _address,
|
||||
socklen_t *_RESTRICT _address_len) );
|
||||
_PROTOTYPE( int setsockopt,(int _socket, int _level, int _option_name,
|
||||
const void *_option_value, socklen_t _option_len) );
|
||||
_PROTOTYPE( int listen, (int _socket, int _backlog) );
|
||||
_PROTOTYPE( ssize_t recvfrom, (int _socket, void *_RESTRICT _buffer,
|
||||
size_t _length, int _flags, struct sockaddr *_RESTRICT _address,
|
||||
socklen_t *_RESTRICT _address_len) );
|
||||
_PROTOTYPE( ssize_t sendto, (int _socket, const void *_message,
|
||||
size_t _length, int _flags, const struct sockaddr *_dest_addr,
|
||||
socklen_t _dest_len) );
|
||||
_PROTOTYPE( int shutdown, (int _socket, int _how) );
|
||||
_PROTOTYPE( int socket, (int _domain, int _type, int _protocol) );
|
||||
|
||||
#endif /* SYS_SOCKET_H */
|
||||
|
|
23
include/sys/uio.h
Normal file
23
include/sys/uio.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
sys/uio.h
|
||||
|
||||
definitions for vector I/O operations
|
||||
*/
|
||||
|
||||
#ifndef _SYS_UIO_H
|
||||
#define _SYS_UIO_H
|
||||
|
||||
/* Open Group Base Specifications Issue 6 (not complete) */
|
||||
|
||||
struct iovec
|
||||
{
|
||||
void *iov_base;
|
||||
size_t iov_len;
|
||||
};
|
||||
|
||||
_PROTOTYPE(ssize_t readv, (int _fildes, const struct iovec *_iov,
|
||||
int _iovcnt) );
|
||||
_PROTOTYPE(ssize_t writev, (int _fildes, const struct iovec *_iov,
|
||||
int iovcnt) );
|
||||
|
||||
#endif /* _SYS_UIO_H */
|
19
include/sys/un.h
Normal file
19
include/sys/un.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
sys/un.h
|
||||
*/
|
||||
|
||||
/* Open Group Base Specifications Issue 6 */
|
||||
|
||||
#ifndef SA_FAMILY_T
|
||||
#define SA_FAMILY_T
|
||||
/* Should match corresponding typedef in <sys/socket.h> */
|
||||
typedef uint8_t sa_family_t;
|
||||
#endif /* SA_FAMILY_T */
|
||||
|
||||
struct sockaddr_un
|
||||
{
|
||||
sa_family_t sun_family;
|
||||
char sun_path[127];
|
||||
};
|
||||
|
||||
/* Note: UNIX domain sockets are not implemented! */
|
|
@ -133,6 +133,10 @@ _PROTOTYPE( ssize_t write, (int _fd, const void *_buf, size_t _n) );
|
|||
|
||||
/* Open Group Base Specifications Issue 6 (not complete) */
|
||||
_PROTOTYPE( int symlink, (const char *path1, const char *path2) );
|
||||
_PROTOTYPE( int getopt, (int _argc, char **_argv, char *_opts) );
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
_PROTOTYPE( int usleep, (useconds_t _useconds) );
|
||||
|
||||
#ifdef _MINIX
|
||||
#ifndef _TYPE_H
|
||||
|
|
Loading…
Reference in a new issue