1/** \file 2 * \brief test inheritance of file descriptors 3 */ 4 5/* 6 * Copyright (c) 2010, 2012, ETH Zurich. 7 * All rights reserved. 8 * 9 * This file is distributed under the terms in the attached LICENSE file. 10 * If you do not find this file, copies can be found by writing to: 11 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 12 */ 13 14#ifndef __TESTDESC_H__ 15#define __TESTDESC_H__ 16 17#include <vfs/fdtab.h> 18 19/* This is posixcompat/unixsock.h */ 20 21#include <sys/un.h> 22#include <vfs/vfs.h> 23#include <if/unixsock_defs.h> 24 25/// Default receive buffer size 26#define _UNIX_SOCKET_RECV_BUF_SIZE 4096 27 28enum _unix_socket_mode { 29 _UNIX_SOCKET_MODE_CONNECTING, 30 _UNIX_SOCKET_MODE_CONNECTED, 31}; 32 33struct _unix_socket_recv { 34 struct _unix_socket_recv *next, *prev; 35 uint8_t *msg; 36 size_t size, consumed; 37}; 38 39struct _unix_socket { 40 int type; // Socket type == AF_UNIX 41 int protocol; // Protocol subtype == 0 42 bool passive; // true iff socket is passive (used to listen) 43 bool nonblocking; // True iff socket is non-blocking 44 45 // Local and peer Sockaddr (includes filename) 46 struct sockaddr_un sockaddr, peer; 47 48 union { 49 struct { 50 struct unixsock_binding **backlog; // Array of new bindings 51 int max_backlog; 52 iref_t listen_iref; // IREF we're listening on 53 } passive; 54 struct { 55 struct unixsock_binding *binding; // The binding 56 enum _unix_socket_mode mode; // See enum _unix_socket_mode 57 } active; 58 } u; 59 60 // VFS handle to socket file (represented by filename) 61 vfs_handle_t vfs_handle; 62 63 // Total size of receive buffer 64 ssize_t recv_buf_size, recv_buf_valid; 65 struct _unix_socket_recv *recv_list, *recv_list_end; 66 67 // Send buffer 68 uint8_t *send_buf; 69}; 70 71/* end unixsock.h */ 72 73 74struct fd_store { 75 int num; 76 enum fdtab_type type; 77 void *handle; 78}; 79 80 81#endif // __TESTDESC_H__ 82