PatchworkOS
Loading...
Searching...
No Matches
vremovef.c
Go to the documentation of this file.
1#include <errno.h>
2#include <stdarg.h>
3#include <stdio.h>
4#include <sys/io.h>
5
7
8uint64_t vremovef(const char* format, va_list args)
9{
10 char path[MAX_PATH];
11 int count = vsnprintf(path, sizeof(path), format, args);
12 if (count < 0 || (uint64_t)count >= sizeof(path))
13 {
14 errno = EINVAL;
15 return ERR;
16 }
17
18 uint64_t result = _syscall_remove(path);
19 if (result == ERR)
20 {
22 return ERR;
23 }
24
25 return 0;
26}
#define MAX_PATH
Maximum length of filepaths.
Definition MAX_PATH.h:11
#define EINVAL
Invalid argument.
Definition errno.h:142
#define errno
Error number variable.
Definition errno.h:27
uint64_t vremovef(const char *format, va_list args)
Wrapper for removing a file with a formatted path, using a va_list.
Definition vremovef.c:8
#define ERR
Integer error value.
Definition ERR.h:17
static atomic_long count
Definition main.c:9
static uint64_t _syscall_remove(const char *path)
Definition syscalls.h:238
static errno_t _syscall_errno(void)
Definition syscalls.h:118
__builtin_va_list va_list
Definition stdarg.h:9
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
_PUBLIC int vsnprintf(char *_RESTRICT s, size_t n, const char *_RESTRICT format, va_list arg)
Definition vsnprintf.c:5