syscalls: isatty

This commit is contained in:
Matheus
2023-07-04 20:19:15 -03:00
parent 51446cdd37
commit 04a5aa4bc6
8 changed files with 59 additions and 11 deletions
+4 -1
View File
@@ -6,6 +6,7 @@
#include <stdint.h>
#include <kernel/abi.h>
#include <time.h>
#include <errno.h>
typedef struct {
uid_t uid;
@@ -90,6 +91,7 @@ typedef struct vops_t {
int (*mmap)(vnode_t *node, void *addr, uintmax_t offset, int flags, cred_t *cred);
int (*munmap)(vnode_t *node, void *addr, uintmax_t offset, int flags, cred_t *cred);
int (*getdents)(vnode_t *node, dent_t *buffer, size_t count, uintmax_t offset, size_t *readcount);
int (*isatty)(vnode_t *node);
} vops_t;
#define VFS_MOUNT(vfs, mp, b, d) (vfs)->ops->mount(vfs, mp, b, d)
@@ -116,7 +118,8 @@ typedef struct vops_t {
#define VOP_MMAP(v, a, o, f, c) (v)->ops->mmap(v, a, o, f, c)
#define VOP_MUNMAP(v, a, o, f, c) (v)->ops->munmap(v, a, o, f, c)
#define VOP_GETDENTS(v, b, c, o, rc) (v)->ops->getdents(v, b, c, o, rc)
#define VOP_POLL(v, p) (v)->ops->poll(v, p);
#define VOP_POLL(v, p) (v)->ops->poll(v, p)
#define VOP_ISATTY(v) ((v)->ops->isatty ? (v)->ops->isatty(v) : ENOTTY)
#define VOP_HOLD(v) __atomic_add_fetch(&(v)->refcount, 1, __ATOMIC_SEQ_CST)
#define VOP_RELEASE(v) {\
if (__atomic_sub_fetch(&(v)->refcount, 1, __ATOMIC_SEQ_CST) == 0) {\