summaryrefslogtreecommitdiff
path: root/userland/libc/include
diff options
context:
space:
mode:
Diffstat (limited to 'userland/libc/include')
-rw-r--r--userland/libc/include/queue.h21
-rw-r--r--userland/libc/include/sys/sendfile.h7
-rw-r--r--userland/libc/include/syscall.h1
-rw-r--r--userland/libc/include/tb/sha1.h26
4 files changed, 55 insertions, 0 deletions
diff --git a/userland/libc/include/queue.h b/userland/libc/include/queue.h
new file mode 100644
index 0000000..4883871
--- /dev/null
+++ b/userland/libc/include/queue.h
@@ -0,0 +1,21 @@
+#include <stdint.h>
+
+#define QUEUE_MOD_ADD 0
+#define QUEUE_MOD_CHANGE 1
+#define QUEUE_MOD_DELETE 2
+
+#define QUEUE_WAIT_READ (1 << 0)
+#define QUEUE_WAIT_WRITE (1 << 1)
+#define QUEUE_WAIT_CLOSE (1 << 2)
+
+struct queue_entry {
+ int fd;
+ uint8_t listen;
+ int data_type;
+ void *data;
+};
+
+int queue_create(void);
+int queue_mod_entries(int fd, int flag, struct queue_entry *entries,
+ int num_entries);
+int queue_wait(int fd, struct queue_entry *events, int num_events);
diff --git a/userland/libc/include/sys/sendfile.h b/userland/libc/include/sys/sendfile.h
new file mode 100644
index 0000000..5e83999
--- /dev/null
+++ b/userland/libc/include/sys/sendfile.h
@@ -0,0 +1,7 @@
+#include <stdint.h>
+#include <typedefs.h>
+#include <stddef.h>
+#include <sys/types.h>
+
+u32 sendfile(int out_fd, int in_fd, off_t *offset, size_t count,
+ int *error_rc);
diff --git a/userland/libc/include/syscall.h b/userland/libc/include/syscall.h
index 87622c5..dda4b82 100644
--- a/userland/libc/include/syscall.h
+++ b/userland/libc/include/syscall.h
@@ -51,6 +51,7 @@
#define SYS_QUEUE_CREATE 43
#define SYS_QUEUE_MOD_ENTRIES 44
#define SYS_QUEUE_WAIT 45
+#define SYS_SENDFILE 46
int syscall(uint32_t eax, uint32_t ebx, uint32_t ecx, uint32_t edx,
uint32_t esi, uint32_t edi);
diff --git a/userland/libc/include/tb/sha1.h b/userland/libc/include/tb/sha1.h
new file mode 100644
index 0000000..fe84196
--- /dev/null
+++ b/userland/libc/include/tb/sha1.h
@@ -0,0 +1,26 @@
+//
+// Copyright (C) 2022-2023 by Anton Kling <anton@kling.gg>
+//
+// SPDX-License-Identifier: 0BSD
+//
+#ifndef SHA1
+#define SHA1
+#include <stddef.h>
+#include <stdint.h>
+
+#define BLOCK_BYTES (64) /* 512/8 */
+#define SHA1_LEN (20)
+
+typedef struct SHA1_CTX {
+ uint32_t h[5];
+ uint8_t block[BLOCK_BYTES];
+ uint64_t active_len;
+ uint64_t len;
+} SHA1_CTX;
+
+void SHA1_Init(SHA1_CTX *ctx);
+void SHA1_Update(SHA1_CTX *ctx, const void *data, uint64_t len);
+void SHA1_Final(SHA1_CTX *ctx, unsigned char *message_digest);
+void SHA1_HMAC(unsigned char *message, uint64_t message_len, unsigned char *key,
+ uint64_t key_len, uint8_t output[SHA1_LEN]);
+#endif