Many changes to simplify porting applications.

This commit is contained in:
Philip Homburg
2005-07-11 13:00:43 +00:00
parent 054e68baf6
commit 11cbb6faae
17 changed files with 204 additions and 6 deletions
+11
View 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 */
+1
View File
@@ -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
View File
@@ -0,0 +1,7 @@
/*
sys/param.h
*/
/* Do we need this header file? Maybe an empty one is sufficient to avoid
* compilations errors.
*/
+3 -3
View File
@@ -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) );
+61
View File
@@ -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
View 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
View 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! */