2011-12-22 15:19:25 +00:00
|
|
|
/*
|
|
|
|
* \brief Facility for passing system-call arguments
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2011-02-15
|
|
|
|
*
|
|
|
|
* The 'Sysio' data structure is shared between the noux environment
|
|
|
|
* and the child. It is used to pass system-call arguments that would
|
|
|
|
* traditionally be transferred via 'copy_from_user' and 'copy_to_user'.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 20:44:47 +00:00
|
|
|
* Copyright (C) 2011-2013 Genode Labs GmbH
|
2011-12-22 15:19:25 +00:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE__NOUX_SESSION__SYSIO_H_
|
|
|
|
#define _INCLUDE__NOUX_SESSION__SYSIO_H_
|
|
|
|
|
|
|
|
/* Genode includes */
|
2013-10-17 10:48:45 +00:00
|
|
|
#include <os/ring_buffer.h>
|
2011-12-22 15:19:25 +00:00
|
|
|
#include <util/misc_math.h>
|
|
|
|
|
|
|
|
|
|
|
|
#define SYSIO_DECL(syscall_name, args, results) \
|
|
|
|
struct args syscall_name##_in; \
|
|
|
|
struct results syscall_name##_out;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Noux {
|
|
|
|
|
2012-04-23 18:42:55 +00:00
|
|
|
using namespace Genode;
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
struct Sysio
|
|
|
|
{
|
2013-10-17 10:48:45 +00:00
|
|
|
/* signal numbers must match with libc signal numbers */
|
|
|
|
enum Signal {
|
|
|
|
SIG_INT = 2,
|
2014-01-23 16:21:35 +00:00
|
|
|
SIG_CHLD = 20,
|
2013-10-17 10:48:45 +00:00
|
|
|
};
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2013-10-17 10:48:45 +00:00
|
|
|
enum { SIGNAL_QUEUE_SIZE = 32 };
|
|
|
|
Ring_buffer<enum Signal, SIGNAL_QUEUE_SIZE,
|
|
|
|
Ring_buffer_unsynchronized> pending_signals;
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
enum { MAX_PATH_LEN = 512 };
|
|
|
|
typedef char Path[MAX_PATH_LEN];
|
|
|
|
|
|
|
|
enum { CHUNK_SIZE = 7*1024 };
|
|
|
|
typedef char Chunk[CHUNK_SIZE];
|
|
|
|
|
2012-11-28 21:41:28 +00:00
|
|
|
enum { ARGS_MAX_LEN = 4*1024 };
|
2011-12-22 15:19:25 +00:00
|
|
|
typedef char Args[ARGS_MAX_LEN];
|
|
|
|
|
2012-11-22 20:20:06 +00:00
|
|
|
enum { ENV_MAX_LEN = 4*1024 };
|
2011-12-22 15:19:25 +00:00
|
|
|
typedef char Env[ENV_MAX_LEN];
|
|
|
|
|
|
|
|
typedef __SIZE_TYPE__ size_t;
|
2012-05-24 15:06:54 +00:00
|
|
|
typedef long int ssize_t;
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-04-25 21:52:49 +00:00
|
|
|
/**
|
|
|
|
* Flags of 'mode' argument of open syscall
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
OPEN_MODE_RDONLY = 0,
|
|
|
|
OPEN_MODE_WRONLY = 1,
|
|
|
|
OPEN_MODE_RDWR = 2,
|
|
|
|
OPEN_MODE_ACCMODE = 3,
|
2012-08-06 16:52:37 +00:00
|
|
|
OPEN_MODE_CREATE = 0x0800, /* libc O_EXCL */
|
2012-04-25 21:52:49 +00:00
|
|
|
};
|
|
|
|
|
2013-12-20 15:51:18 +00:00
|
|
|
/**
|
|
|
|
* These values are the same as in the FreeBSD libc
|
|
|
|
*/
|
2011-12-22 15:19:25 +00:00
|
|
|
enum {
|
|
|
|
STAT_MODE_SYMLINK = 0120000,
|
|
|
|
STAT_MODE_FILE = 0100000,
|
|
|
|
STAT_MODE_DIRECTORY = 0040000,
|
|
|
|
STAT_MODE_CHARDEV = 0020000,
|
2013-12-20 15:51:18 +00:00
|
|
|
STAT_MODE_BLOCKDEV = 0060000,
|
2011-12-22 15:19:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Stat
|
|
|
|
{
|
2012-04-23 18:42:55 +00:00
|
|
|
size_t size;
|
2011-12-22 15:19:25 +00:00
|
|
|
unsigned mode;
|
|
|
|
unsigned uid;
|
|
|
|
unsigned gid;
|
|
|
|
unsigned long inode;
|
|
|
|
unsigned device;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Argument structure used for ioctl syscall
|
|
|
|
*/
|
|
|
|
struct Ioctl_in
|
|
|
|
{
|
2012-11-20 16:25:56 +00:00
|
|
|
enum Opcode { OP_UNDEFINED, OP_TIOCGWINSZ, OP_TIOCSETAF,
|
2013-12-20 15:51:18 +00:00
|
|
|
OP_TIOCSETAW, OP_FIONBIO, OP_DIOCGMEDIASIZE };
|
2012-11-20 16:25:56 +00:00
|
|
|
|
|
|
|
enum Val { VAL_NULL, VAL_ECHO, VAL_ECHONL };
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
Opcode request;
|
2012-08-21 13:10:13 +00:00
|
|
|
int argp;
|
2011-12-22 15:19:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Structure carrying the result values of 'ioctl' syscalls
|
|
|
|
*/
|
|
|
|
struct Ioctl_out
|
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
|
|
|
/* if request was 'OP_TIOCGSIZE' */
|
|
|
|
struct {
|
|
|
|
int rows;
|
|
|
|
int columns;
|
|
|
|
} tiocgwinsz;
|
2013-12-20 15:51:18 +00:00
|
|
|
|
|
|
|
/* if request was 'OP_DIOCGMEDIASIZE' */
|
|
|
|
struct {
|
|
|
|
/* disk size rounded up to sector size in bytes*/
|
|
|
|
int size;
|
|
|
|
|
|
|
|
} diocgmediasize;
|
2011-12-22 15:19:25 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2012-04-25 21:52:49 +00:00
|
|
|
enum Lseek_whence { LSEEK_SET, LSEEK_CUR, LSEEK_END };
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
enum { DIRENT_MAX_NAME_LEN = 128 };
|
|
|
|
|
|
|
|
enum Dirent_type {
|
|
|
|
DIRENT_TYPE_FILE,
|
|
|
|
DIRENT_TYPE_DIRECTORY,
|
|
|
|
DIRENT_TYPE_FIFO,
|
2012-06-12 12:23:45 +00:00
|
|
|
DIRENT_TYPE_CHARDEV,
|
2013-12-20 15:51:18 +00:00
|
|
|
DIRENT_TYPE_BLOCKDEV,
|
2011-12-22 15:19:25 +00:00
|
|
|
DIRENT_TYPE_SYMLINK,
|
|
|
|
DIRENT_TYPE_END
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Dirent
|
|
|
|
{
|
|
|
|
int fileno;
|
|
|
|
Dirent_type type;
|
|
|
|
char name[DIRENT_MAX_NAME_LEN];
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Fcntl_cmd {
|
|
|
|
FCNTL_CMD_GET_FILE_STATUS_FLAGS,
|
2012-05-24 15:06:54 +00:00
|
|
|
FCNTL_CMD_SET_FILE_STATUS_FLAGS,
|
2011-12-22 15:19:25 +00:00
|
|
|
FCNTL_CMD_SET_FD_FLAGS
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Input and output argument type of select syscall
|
|
|
|
*/
|
|
|
|
struct Select_fds
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Maximum number of file descriptors supported
|
|
|
|
*/
|
|
|
|
enum { MAX_FDS = 32U };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Number of file descriptors to watch for read operations (rd),
|
|
|
|
* write operations (wr), or exceptions (ex).
|
|
|
|
*/
|
|
|
|
size_t num_rd,
|
|
|
|
num_wr,
|
|
|
|
num_ex;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Array containing the file descriptors, starting with those
|
|
|
|
* referring to rd, followed by wr, and finally ex
|
|
|
|
*/
|
|
|
|
int array[MAX_FDS];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return total number of file descriptors contained in the array
|
|
|
|
*/
|
|
|
|
size_t total_fds() const {
|
2012-04-23 18:42:55 +00:00
|
|
|
return min(num_rd + num_wr + num_ex, (size_t)MAX_FDS); }
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check for maximum population of fds array
|
|
|
|
*/
|
|
|
|
bool max_fds_exceeded() const
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Note that even though the corner case of num_rd + num_wr +
|
|
|
|
* num_ex == MAX_FDS is technically valid, this condition hints
|
|
|
|
* at a possible attempt to over popupate the array (see the
|
|
|
|
* implementation of 'select' in the Noux libc plugin). Hence,
|
|
|
|
* we regard this case as an error, too.
|
|
|
|
*/
|
|
|
|
return total_fds() >= MAX_FDS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true of fd set index should be watched for reading
|
|
|
|
*/
|
|
|
|
bool watch_for_rd(unsigned i) const { return i < num_rd; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if fd set index should be watched for writing
|
|
|
|
*/
|
|
|
|
bool watch_for_wr(unsigned i) const {
|
|
|
|
return (i >= num_rd) && (i < num_rd + num_wr); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if fd set index should be watched for exceptions
|
|
|
|
*/
|
|
|
|
bool watch_for_ex(unsigned i) const {
|
|
|
|
return (i >= num_rd + num_wr) && (i < total_fds()); }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Select_timeout
|
|
|
|
{
|
|
|
|
long sec, usec;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set timeout to infinity
|
|
|
|
*/
|
|
|
|
void set_infinite() { sec = -1; usec = -1; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the timeout is infinite
|
|
|
|
*/
|
|
|
|
bool infinite() const { return (sec == -1) && (usec == -1); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the timeout is zero
|
|
|
|
*/
|
|
|
|
bool zero() const { return (sec == 0) && (usec == 0); }
|
|
|
|
};
|
|
|
|
|
2012-05-24 15:06:54 +00:00
|
|
|
/**
|
|
|
|
* Socket related structures
|
|
|
|
*/
|
|
|
|
enum { MAX_HOSTNAME_LEN = 255 };
|
|
|
|
typedef char Hostname[MAX_HOSTNAME_LEN];
|
|
|
|
|
|
|
|
enum { MAX_SERVNAME_LEN = 255 };
|
|
|
|
typedef char Servname[MAX_SERVNAME_LEN];
|
|
|
|
|
|
|
|
enum { MAX_ADDRINFO_RESULTS = 4 };
|
|
|
|
|
|
|
|
struct in_addr
|
|
|
|
{
|
|
|
|
unsigned int s_addr;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sockaddr
|
|
|
|
{
|
|
|
|
unsigned char sa_len;
|
|
|
|
unsigned char sa_family;
|
|
|
|
char sa_data[14];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sockaddr_in {
|
|
|
|
unsigned char sin_len;
|
|
|
|
unsigned char sin_family;
|
|
|
|
unsigned short sin_port;
|
|
|
|
struct in_addr sin_addr;
|
|
|
|
char sin_zero[8];
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef unsigned socklen_t;
|
|
|
|
|
|
|
|
struct addrinfo {
|
|
|
|
int ai_flags;
|
|
|
|
int ai_family;
|
|
|
|
int ai_socktype;
|
|
|
|
int ai_protocol;
|
|
|
|
socklen_t ai_addrlen;
|
|
|
|
struct sockaddr *ai_addr;
|
|
|
|
char *ai_canonname;
|
|
|
|
struct addrinfo *ai_next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Addrinfo {
|
|
|
|
struct addrinfo addrinfo;
|
|
|
|
struct sockaddr ai_addr;
|
|
|
|
char ai_canonname[255];
|
|
|
|
};
|
|
|
|
|
2012-08-20 16:24:11 +00:00
|
|
|
/**
|
|
|
|
* user info defintions
|
|
|
|
*/
|
|
|
|
enum { USERINFO_GET_ALL = 0, USERINFO_GET_UID, USERINFO_GET_GID };
|
|
|
|
enum { MAX_USERNAME_LEN = 32 };
|
|
|
|
typedef char User[MAX_USERNAME_LEN];
|
|
|
|
enum { MAX_SHELL_LEN = 16 };
|
|
|
|
typedef char Shell[MAX_SHELL_LEN];
|
|
|
|
enum { MAX_HOME_LEN = 128 };
|
|
|
|
typedef char Home[MAX_HOME_LEN];
|
|
|
|
typedef unsigned int Uid;
|
|
|
|
|
2012-09-12 14:12:55 +00:00
|
|
|
/**
|
|
|
|
* time/clock definitions
|
|
|
|
*/
|
|
|
|
enum Clock_Id { CLOCK_ID_SECOND };
|
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
enum General_error { ERR_FD_INVALID, NUM_GENERAL_ERRORS };
|
|
|
|
enum Stat_error { STAT_ERR_NO_ENTRY = NUM_GENERAL_ERRORS };
|
|
|
|
enum Fcntl_error { FCNTL_ERR_CMD_INVALID = NUM_GENERAL_ERRORS };
|
2013-10-17 10:48:45 +00:00
|
|
|
enum Ftruncate_error { FTRUNCATE_ERR_NO_PERM = NUM_GENERAL_ERRORS,
|
|
|
|
FTRUNCATE_ERR_INTERRUPT };
|
2012-08-02 13:17:24 +00:00
|
|
|
enum Open_error { OPEN_ERR_UNACCESSIBLE, OPEN_ERR_NO_PERM,
|
|
|
|
OPEN_ERR_EXISTS };
|
|
|
|
enum Execve_error { EXECVE_NONEXISTENT = NUM_GENERAL_ERRORS };
|
2013-10-17 10:48:45 +00:00
|
|
|
enum Select_error { SELECT_ERR_INTERRUPT };
|
2012-08-02 13:17:24 +00:00
|
|
|
enum Unlink_error { UNLINK_ERR_NO_ENTRY, UNLINK_ERR_NO_PERM };
|
2012-10-08 12:44:31 +00:00
|
|
|
enum Readlink_error { READLINK_ERR_NO_ENTRY };
|
2012-08-02 13:17:24 +00:00
|
|
|
enum Rename_error { RENAME_ERR_NO_ENTRY, RENAME_ERR_CROSS_FS,
|
|
|
|
RENAME_ERR_NO_PERM };
|
|
|
|
enum Mkdir_error { MKDIR_ERR_EXISTS, MKDIR_ERR_NO_ENTRY,
|
|
|
|
MKDIR_ERR_NO_SPACE, MKDIR_ERR_NO_PERM,
|
|
|
|
MKDIR_ERR_NAME_TOO_LONG};
|
2012-10-08 12:44:31 +00:00
|
|
|
enum Symlink_error { SYMLINK_ERR_EXISTS, SYMLINK_ERR_NO_ENTRY,
|
|
|
|
SYMLINK_ERR_NAME_TOO_LONG};
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-08-24 15:04:02 +00:00
|
|
|
enum Read_error { READ_ERR_AGAIN, READ_ERR_WOULD_BLOCK,
|
2013-10-17 10:48:45 +00:00
|
|
|
READ_ERR_INVALID, READ_ERR_IO,
|
|
|
|
READ_ERR_INTERRUPT };
|
2012-08-24 15:04:02 +00:00
|
|
|
|
|
|
|
enum Write_error { WRITE_ERR_AGAIN, WRITE_ERR_WOULD_BLOCK,
|
2013-10-17 10:48:45 +00:00
|
|
|
WRITE_ERR_INVALID, WRITE_ERR_IO,
|
|
|
|
WRITE_ERR_INTERRUPT };
|
2012-08-24 15:04:02 +00:00
|
|
|
|
2012-11-20 16:25:56 +00:00
|
|
|
enum Ioctl_error { IOCTL_ERR_INVALID, IOCTL_ERR_NOTTY };
|
|
|
|
|
2012-08-24 15:04:02 +00:00
|
|
|
/**
|
|
|
|
* Socket related errors
|
|
|
|
*/
|
|
|
|
enum Accept_error { ACCEPT_ERR_AGAIN, ACCEPT_ERR_WOULD_BLOCK,
|
|
|
|
ACCEPT_ERR_INVALID, ACCEPT_ERR_NO_MEMORY,
|
|
|
|
ACCEPT_ERR_NOT_SUPPORTED };
|
|
|
|
|
|
|
|
enum Bind_error { BIND_ERR_ACCESS, BIND_ERR_ADDR_IN_USE,
|
|
|
|
BIND_ERR_INVALID, BIND_ERR_NO_MEMORY };
|
|
|
|
|
|
|
|
enum Connect_error { CONNECT_ERR_ACCESS, CONNECT_ERR_AGAIN,
|
|
|
|
CONNECT_ERR_ALREADY, CONNECT_ERR_CONN_REFUSED,
|
|
|
|
CONNECT_ERR_NO_PERM, CONNECT_ERR_ADDR_IN_USE,
|
|
|
|
CONNECT_ERR_IN_PROGRESS, CONNECT_ERR_IS_CONNECTED };
|
|
|
|
|
|
|
|
enum Listen_error { LISTEN_ERR_ADDR_IN_USE, LISTEN_ERR_NOT_SUPPORTED };
|
|
|
|
|
|
|
|
enum Recv_error { RECV_ERR_AGAIN, RECV_ERR_WOULD_BLOCK,
|
|
|
|
RECV_ERR_CONN_REFUSED, RECV_ERR_INVALID,
|
|
|
|
RECV_ERR_NOT_CONNECTED, RECV_ERR_NO_MEMORY };
|
|
|
|
|
|
|
|
enum Send_error { SEND_ERR_AGAIN, SEND_ERR_WOULD_BLOCK,
|
|
|
|
SEND_ERR_CONNECTION_RESET, SEND_ERR_INVALID,
|
|
|
|
SEND_ERR_IS_CONNECTED, SEND_ERR_NO_MEMORY };
|
|
|
|
|
|
|
|
enum Shutdown_error { SHUTDOWN_ERR_NOT_CONNECTED };
|
|
|
|
|
|
|
|
enum Socket_error { SOCKET_ERR_ACCESS, SOCKET_ERR_NO_AF_SUPPORT,
|
|
|
|
SOCKET_ERR_INVALID, SOCKET_ERR_NO_MEMORY };
|
|
|
|
|
2012-09-12 14:12:55 +00:00
|
|
|
enum Clock_error { CLOCK_ERR_INVALID, CLOCK_ERR_FAULT, CLOCK_ERR_NO_PERM };
|
|
|
|
|
|
|
|
enum Utimes_error { UTIMES_ERR_ACCESS, UTIMES_ERR_FAUL, UTIMES_ERR_EIO,
|
|
|
|
UTIMES_ERR_NAME_TOO_LONG, UTIMES_ERR_NO_ENTRY,
|
|
|
|
UTIMES_ERR_NOT_DIRECTORY, UTIMES_ERR_NO_PERM,
|
|
|
|
UTIMES_ERR_READ_ONLY };
|
|
|
|
|
2014-01-23 16:21:35 +00:00
|
|
|
enum Wait4_error { WAIT4_ERR_INTERRUPT };
|
|
|
|
|
|
|
|
enum Kill_error { KILL_ERR_SRCH };
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
union {
|
2012-08-02 13:17:24 +00:00
|
|
|
General_error general;
|
|
|
|
Stat_error stat;
|
|
|
|
Fcntl_error fcntl;
|
|
|
|
Ftruncate_error ftruncate;
|
|
|
|
Open_error open;
|
|
|
|
Execve_error execve;
|
2013-10-17 10:48:45 +00:00
|
|
|
Select_error select;
|
2012-08-02 13:17:24 +00:00
|
|
|
Unlink_error unlink;
|
2012-10-08 12:44:31 +00:00
|
|
|
Readlink_error readlink;
|
2012-08-02 13:17:24 +00:00
|
|
|
Rename_error rename;
|
|
|
|
Mkdir_error mkdir;
|
2012-10-08 12:44:31 +00:00
|
|
|
Symlink_error symlink;
|
2012-08-24 15:04:02 +00:00
|
|
|
Read_error read;
|
|
|
|
Write_error write;
|
2012-11-20 16:25:56 +00:00
|
|
|
Ioctl_error ioctl;
|
2012-08-24 15:04:02 +00:00
|
|
|
Accept_error accept;
|
|
|
|
Bind_error bind;
|
|
|
|
Connect_error connect;
|
|
|
|
Listen_error listen;
|
|
|
|
Recv_error recv;
|
|
|
|
Send_error send;
|
|
|
|
Shutdown_error shutdown;
|
|
|
|
Socket_error socket;
|
2012-09-12 14:12:55 +00:00
|
|
|
Clock_error clock;
|
|
|
|
Utimes_error utimes;
|
2014-01-23 16:21:35 +00:00
|
|
|
Wait4_error wait4;
|
|
|
|
Kill_error kill;
|
2011-12-22 15:19:25 +00:00
|
|
|
} error;
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(write, { int fd; size_t count; Chunk chunk; },
|
|
|
|
{ size_t count; });
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(stat, { Path path; }, { Stat st; });
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-10-08 12:44:31 +00:00
|
|
|
SYSIO_DECL(symlink, { Path oldpath; Path newpath; }, { });
|
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(fstat, { int fd; }, { Stat st; });
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(ftruncate, { int fd; off_t length; }, { });
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(fcntl, { int fd; long long_arg; Fcntl_cmd cmd; },
|
|
|
|
{ int result; });
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(open, { Path path; int mode; }, { int fd; });
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(close, { int fd; }, { });
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(ioctl, : Ioctl_in { int fd; }, : Ioctl_out { });
|
2012-04-25 21:52:49 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(lseek, { int fd; off_t offset; Lseek_whence whence; },
|
|
|
|
{ off_t offset; });
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(dirent, { int fd; }, { Dirent entry; });
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(read, { int fd; size_t count; },
|
|
|
|
{ Chunk chunk; size_t count; });
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-10-08 12:44:31 +00:00
|
|
|
SYSIO_DECL(readlink, { Path path; size_t bufsiz; },
|
|
|
|
{ Chunk chunk; ssize_t count; });
|
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(execve, { Path filename; Args args; Env env; }, { });
|
2012-02-15 18:51:13 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(select, { Select_fds fds; Select_timeout timeout; },
|
|
|
|
{ Select_fds fds; });
|
2012-02-15 18:51:13 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(fork, { addr_t ip; addr_t sp;
|
|
|
|
addr_t parent_cap_addr; },
|
|
|
|
{ int pid; });
|
2012-02-24 14:19:38 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(getpid, { }, { int pid; });
|
2012-03-19 21:52:26 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(wait4, { int pid; bool nohang; },
|
|
|
|
{ int pid; int status; });
|
|
|
|
SYSIO_DECL(pipe, { }, { int fd[2]; });
|
2012-04-25 21:52:49 +00:00
|
|
|
|
2012-10-04 10:48:41 +00:00
|
|
|
SYSIO_DECL(dup2, { int fd; int to_fd; }, { int fd; });
|
2012-04-25 21:52:49 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(unlink, { Path path; }, { });
|
2012-04-25 21:52:49 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(rename, { Path from_path; Path to_path; }, { });
|
2012-05-24 15:06:54 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(mkdir, { Path path; int mode; }, { });
|
|
|
|
|
|
|
|
SYSIO_DECL(socket, { int domain; int type; int protocol; },
|
|
|
|
{ int fd; });
|
2012-05-24 15:06:54 +00:00
|
|
|
|
|
|
|
/* XXX for now abuse Chunk for passing optval */
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(getsockopt, { int fd; int level; int optname; Chunk optval;
|
|
|
|
socklen_t optlen; }, { int result; });
|
2012-05-24 15:06:54 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(setsockopt, { int fd; int level;
|
|
|
|
int optname; Chunk optval;
|
|
|
|
socklen_t optlen; }, { });
|
2012-05-24 15:06:54 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(accept, { int fd; struct sockaddr addr; socklen_t addrlen; },
|
|
|
|
{ int fd; });
|
2012-05-24 15:06:54 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(bind, { int fd; struct sockaddr addr;
|
|
|
|
socklen_t addrlen; }, { int result; });
|
2012-05-24 15:06:54 +00:00
|
|
|
|
|
|
|
SYSIO_DECL(getpeername, { int fd; struct sockaddr addr;
|
|
|
|
socklen_t addrlen; }, { });
|
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(listen, { int fd; int type; int backlog; },
|
|
|
|
{ int result; });
|
2012-05-24 15:06:54 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(send, { int fd; Chunk buf; size_t len; int flags; },
|
|
|
|
{ ssize_t len; });
|
2012-05-24 15:06:54 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(sendto, { int fd; Chunk buf; size_t len; int flags;
|
|
|
|
struct sockaddr dest_addr; socklen_t addrlen; },
|
|
|
|
{ ssize_t len; });
|
2012-05-24 15:06:54 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(recv, { int fd; Chunk buf; size_t len; int flags; },
|
|
|
|
{ size_t len; });
|
2012-05-24 15:06:54 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(recvfrom, { int fd; Chunk buf; size_t len; int flags;
|
|
|
|
struct sockaddr src_addr; socklen_t addrlen; },
|
|
|
|
{ size_t len; });
|
2012-06-08 12:24:38 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(shutdown, { int fd; int how; }, { });
|
2012-05-24 15:06:54 +00:00
|
|
|
|
2012-08-02 13:17:24 +00:00
|
|
|
SYSIO_DECL(connect, { int fd; struct sockaddr addr; socklen_t addrlen; },
|
|
|
|
{ int result; });
|
2012-05-24 15:06:54 +00:00
|
|
|
|
2012-08-20 16:24:11 +00:00
|
|
|
SYSIO_DECL(userinfo, { int request; Uid uid; },
|
|
|
|
{ User name; Uid uid; Uid gid; Shell shell;
|
|
|
|
Home home; });
|
2012-09-12 14:12:55 +00:00
|
|
|
|
|
|
|
SYSIO_DECL(gettimeofday, { }, { unsigned long sec; unsigned int usec; });
|
|
|
|
|
|
|
|
SYSIO_DECL(clock_gettime, { Clock_Id clock_id; },
|
|
|
|
{ unsigned long sec; unsigned long nsec; });
|
|
|
|
|
|
|
|
SYSIO_DECL(utimes, { Path path; unsigned long sec; unsigned long usec; },
|
|
|
|
{ });
|
2013-12-18 11:04:04 +00:00
|
|
|
|
|
|
|
SYSIO_DECL(sync, { }, { });
|
2014-01-23 16:21:35 +00:00
|
|
|
|
|
|
|
SYSIO_DECL(kill, { int pid; Signal sig; }, { });
|
2011-12-22 15:19:25 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
#undef SYSIO_DECL
|
|
|
|
|
|
|
|
#endif /* _INCLUDE__NOUX_SESSION__SYSIO_H_ */
|