Merge branch 'master' of gitlab.ibr.cs.tu-bs.de:vss/teaching/ws25/v_bsb2/Gruppe_003
This commit is contained in:
@@ -9,6 +9,14 @@ enum class ID : size_t {
|
||||
TEST = 0,
|
||||
WRITE = 1,
|
||||
READ = 2,
|
||||
//SLEEP =3,
|
||||
SEM_INIT=4,
|
||||
SEM_DESTROY=5,
|
||||
SEM_WAIT=6,
|
||||
SEM_SIGNAL=7,
|
||||
//SYS_GETPID=8,
|
||||
//SYS_EXIT= 9,
|
||||
//SYS_KILL=10
|
||||
};
|
||||
} // namespace Syscall
|
||||
|
||||
@@ -26,9 +34,24 @@ extern "C" ssize_t sys_safe_call(Syscall::ID id, size_t p1, size_t p2,
|
||||
}
|
||||
|
||||
[[gnu::always_inline]] static inline int write(int fd, const void *buf, size_t len, int x = -1, int y = -1) {
|
||||
return sys_call(Syscall::ID::WRITE, fd, (size_t)buf, len, x, y);
|
||||
return sys_call(Syscall::ID::WRITE, fd, (size_t)buf, len, x, y);
|
||||
}
|
||||
|
||||
[[gnu::always_inline]] static inline int read(int fd, void *buf, size_t len){
|
||||
return sys_call(Syscall::ID::READ, fd, (size_t)buf, len, 0, 0);
|
||||
}
|
||||
|
||||
[[gnu::always_inline]] static inline int sem_init(int fd, int semid, int value) {
|
||||
return sys_call(Syscall::ID::SEM_INIT, fd, semid, value, 0,0);
|
||||
}
|
||||
[[gnu::always_inline]] static inline int sem_destroy(int fd, int semid) {
|
||||
return sys_call(Syscall::ID::SEM_DESTROY, fd, semid,0,0,0);
|
||||
}
|
||||
[[gnu::always_inline]] static inline int sem_wait(int fd, int semid) {
|
||||
return sys_call(Syscall::ID::SEM_WAIT, fd, semid,0,0,0);
|
||||
}
|
||||
|
||||
[[gnu::always_inline]] static inline int sem_signal(int fd, int semid) {
|
||||
return sys_call(Syscall::ID::SEM_SIGNAL, fd, semid,0,0,0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user