167 backlog =
atol(argv[1]);
338 if (superblock ==
NULL)
#define assert(expression)
ctl_t ctl_array_t[]
Type definition for an array of ctl commands.
#define CTL_STANDARD_OPS_DEFINE(name,...)
Helper macro to define a standard ctl file operations structure.
void path_put(path_t *path)
Put a path.
#define PATH_EMPTY
Helper to create an empty path.
uint64_t socket_family_get_dir(socket_family_t *family, path_t *outPath)
Get the directory of a socket family.
socket_type_t
Socket type enumeration.
socket_state_t
Socket states.
socket_t * socket_new(socket_family_t *family, socket_type_t type, path_flags_t flags)
Create a new socket.
void socket_continue_transition(socket_t *sock, socket_state_t state)
Without releasing the socket mutex, start a transition to a new target state.
uint64_t socket_start_transition(socket_t *sock, socket_state_t state)
Starts a socket state transition.
void socket_end_transition(socket_t *sock, uint64_t result)
Ends a socket state transition.
process_t * sched_process(void)
Retrieves the process of the currently running thread.
void rwmutex_write_acquire(rwmutex_t *mtx)
Acquires a rwmutex for writing, blocking until it is available.
void rwmutex_init(rwmutex_t *mtx)
Initializes a rwmutex.
#define RWMUTEX_READ_SCOPE(mutex)
Acquires a rwmutex for reading for the reminder of the current scope.
void rwmutex_deinit(rwmutex_t *mtx)
Deinitializes a rwmutex.
void rwmutex_write_release(rwmutex_t *mtx)
Releases a rwmutex from writing.
static void ref_init(ref_t *ref, void *free)
Initialize a reference counter.
#define REF(ptr)
Increment reference count.
#define DEREF(ptr)
Decrement reference count.
#define EINVAL
Invalid argument.
#define ENOSYS
Function not implemented.
#define ENOMEM
Out of memory.
#define EINPROGRESS
Operation now in progress.
#define errno
Error number variable.
#define ENOTCONN
Transport endpoint is not connected.
poll_events_t
Poll events type.
#define NULL
Pointer error value.
#define ERR
Integer error value.
static inode_ops_t inodeOps
static file_ops_t acceptOps
bool socket_can_transition(socket_state_t from, socket_state_t to)
static const bool validTransitions[SOCKET_STATE_AMOUNT][SOCKET_STATE_AMOUNT]
static void socket_unmount(superblock_t *superblock)
static uint64_t socket_accept_open(file_t *file)
static uint64_t socket_ctl_bind(file_t *file, uint64_t argc, const char **argv)
static void socket_free(socket_t *sock)
static wait_queue_t * socket_data_poll(file_t *file, poll_events_t *revents)
static superblock_ops_t superblockOps
static file_ops_t dataOps
static uint64_t socket_ctl_connect(file_t *file, uint64_t argc, const char **argv)
static void socket_accept_close(file_t *file)
static uint64_t socket_data_write(file_t *file, const void *buf, size_t count, uint64_t *offset)
static void socket_inode_cleanup(inode_t *inode)
static uint64_t socket_data_read(file_t *file, void *buf, size_t count, uint64_t *offset)
static void socket_data_close(file_t *file)
static uint64_t socket_data_open(file_t *file)
static uint64_t socket_ctl_listen(file_t *file, uint64_t argc, const char **argv)
#define atomic_fetch_add(object, operand)
_PUBLIC int snprintf(char *_RESTRICT s, size_t n, const char *_RESTRICT format,...)
_PUBLIC void * calloc(size_t nmemb, size_t size)
_PUBLIC void free(void *ptr)
File operations structure.
uint64_t(* open)(file_t *file)
void(* cleanup)(inode_t *inode)
superblock_t * superblock
The superblock of the mounted filesystem.
dentry_t * root
The root dentry of the mounted filesystem.
uint64_t(* bind)(socket_t *sock, const char *address)
wait_queue_t *(* poll)(socket_t *sock, poll_events_t *revents)
uint64_t(* send)(socket_t *sock, const void *buffer, uint64_t count, uint64_t *offset)
uint64_t(* connect)(socket_t *sock, const char *address)
uint64_t(* listen)(socket_t *sock, uint32_t backlog)
uint64_t(* recv)(socket_t *sock, void *buffer, uint64_t count, uint64_t *offset)
uint64_t(* init)(socket_t *sock)
void(* deinit)(socket_t *sock)
uint64_t(* accept)(socket_t *sock, socket_t *newSock)
const socket_family_ops_t * ops
socket_state_t currentState
Superblock operations structure.
void(* unmount)(superblock_t *superblock)
mount_t * sysfs_mount_new(const path_t *parent, const char *name, namespace_t *ns, const superblock_ops_t *superblockOps)
Mount a new instance of SysFS.
dentry_t * sysfs_file_new(dentry_t *parent, const char *name, const inode_ops_t *inodeOps, const file_ops_t *fileOps, void *private)
Create a new file inside a mounted SysFS instance.