PatchworkOS
Loading...
Searching...
No Matches
socket_family.c File Reference
#include <kernel/net/socket_family.h>
#include <kernel/fs/sysfs.h>
#include <kernel/fs/vfs.h>
#include <kernel/log/log.h>
#include <kernel/net/net.h>
#include <kernel/net/socket.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/list.h>

Go to the source code of this file.

Functions

static uint64_t socket_factory_read (file_t *file, void *buffer, uint64_t count, uint64_t *offset)
 
static uint64_t socket_factory_open (file_t *file)
 
static void socket_factory_close (file_t *file)
 
uint64_t socket_family_register (const socket_family_ops_t *ops, const char *name, socket_type_t supportedTypes)
 Register a socket family.
 
socket_family_tsocket_family_get (const char *name)
 Get a socket family by name.
 
static socket_family_tsocket_family_get_and_remove (const char *name)
 
void socket_family_unregister (const char *name)
 Unregister a socket family.
 
uint64_t socket_family_get_dir (socket_family_t *family, path_t *outPath)
 Get the directory of a socket family.
 

Variables

static list_t families = LIST_CREATE(families)
 
static lock_t lock = LOCK_CREATE
 
static file_ops_t fileOps
 

Function Documentation

◆ socket_factory_close()

static void socket_factory_close ( file_t file)
static

Definition at line 38 of file socket_family.c.

References DEREF, file, NULL, and dentry_t::private.

◆ socket_factory_open()

static uint64_t socket_factory_open ( file_t file)
static

◆ socket_factory_read()

static uint64_t socket_factory_read ( file_t file,
void *  buffer,
uint64_t  count,
uint64_t offset 
)
static

Definition at line 16 of file socket_family.c.

References buffer, BUFFER_READ, count, file, socket_t::id, dentry_t::private, and strlen().

◆ socket_family_get_and_remove()

static socket_family_t * socket_family_get_and_remove ( const char *  name)
static

Variable Documentation

◆ families

list_t families = LIST_CREATE(families)
static

◆ fileOps

file_ops_t fileOps
static
Initial value:
= {
}
static uint64_t socket_factory_read(file_t *file, void *buffer, uint64_t count, uint64_t *offset)
static void socket_factory_close(file_t *file)
static uint64_t socket_factory_open(file_t *file)

Definition at line 47 of file socket_family.c.

Referenced by socket_family_register().

◆ lock