-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b934bd
commit 41a0679
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* lux - a lightweight unix-like operating system | ||
* Omar Elghoul, 2024 | ||
* | ||
* Core Microkernel | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <stdint.h> | ||
#include <stddef.h> | ||
|
||
/* socket family/domain - only Unix sockets will be implemented in the kernel */ | ||
#define AF_UNIX 1 | ||
#define AF_LOCAL AF_UNIX | ||
|
||
/* socket type - these will all be the same for the local Unix sockets */ | ||
/* the kernel will ensure packets are sent and received in the same order */ | ||
#define SOCK_STREAM 1 // stream-oriented | ||
#define SOCK_DGRAM 2 // datagram-oriented | ||
#define SOCK_SEQPACKET 3 // connection-oriented | ||
|
||
typedef uint32_t sa_family_t; | ||
typedef size_t socklen_t; | ||
|
||
/* generic socket */ | ||
struct sockaddr { | ||
sa_family_t sa_family; | ||
char sa_data[]; | ||
} | ||
|
||
/* Unix domain socket */ | ||
struct sockaddr_un { | ||
sa_family_t sun_family; // AF_UNIX | ||
char sun_path[512]; // filename | ||
} |