diff --git a/sys/include/sys/sysproto_posix.h b/sys/include/sys/sysproto_posix.h index 76ac7d0..5497c4a 100644 --- a/sys/include/sys/sysproto_posix.h +++ b/sys/include/sys/sysproto_posix.h @@ -26,13 +26,12 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _SYS_SYSPROTO_POSIX_H -#define _SYS_SYSPROTO_POSIX_H +#ifndef _SYS_SYSPROTO_POSIX_H_ +#define _SYS_SYSPROTO_POSIX_H_ #include #include - /* TEMP */ #include @@ -48,7 +47,6 @@ #define PADR_(t) 0 #endif -//Protos struct sys_exit_args { char status_l_[PADL_(int)]; int status; @@ -217,9 +215,15 @@ }; struct sys_lseek_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; - char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)]; + char fd_l_[PADL_(int)]; + int fd; + char fd_r_[PADR_(int)]; + char offset_l_[PADL_(off_t)]; + off_t offset; + char offset_r_[PADR_(off_t)]; + char whence_l_[PADL_(int)]; + int whence; + char whence_r_[PADR_(int)]; }; struct sys_sysctl_args { @@ -257,7 +261,6 @@ char arg_r_[PADR_(long)]; }; - /* OLD */ struct setitimer_args { @@ -684,32 +687,73 @@ }; struct sys_gettimeofday_args { - char tp_l_[PADL_(struct timeval *)]; struct timeval * tp; char tp_r_[PADR_(struct timeval *)]; - char tzp_l_[PADL_(struct timezone *)]; struct timezone * tzp; char tzp_r_[PADR_(struct timezone *)]; + char tp_l_[PADL_(struct timeval *)]; + struct timeval * tp; + char tp_r_[PADR_(struct timeval *)]; + char tzp_l_[PADL_(struct timezone *)]; + struct timezone * tzp; + char tzp_r_[PADR_(struct timezone *)]; }; - struct sys_sendto_args { - char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)]; - char buf_l_[PADL_(caddr_t)]; caddr_t buf; char buf_r_[PADR_(caddr_t)]; - char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; - char to_l_[PADL_(caddr_t)]; caddr_t to; char to_r_[PADR_(caddr_t)]; - char tolen_l_[PADL_(int)]; int tolen; char tolen_r_[PADR_(int)]; + char s_l_[PADL_(int)]; + int s; + char s_r_[PADR_(int)]; + char buf_l_[PADL_(caddr_t)]; + caddr_t buf; + char buf_r_[PADR_(caddr_t)]; + char len_l_[PADL_(size_t)]; + size_t len; + char len_r_[PADR_(size_t)]; + char flags_l_[PADL_(int)]; + int flags; + char flags_r_[PADR_(int)]; + char to_l_[PADL_(caddr_t)]; + caddr_t to; + char to_r_[PADR_(caddr_t)]; + char tolen_l_[PADL_(int)]; + int tolen; + char tolen_r_[PADR_(int)]; }; struct sys_rename_args { - char from_l_[PADL_(char *)]; char * from; char from_r_[PADR_(char *)]; - char to_l_[PADL_(char *)]; char * to; char to_r_[PADR_(char *)]; + char from_l_[PADL_(char *)]; + char * from; + char from_r_[PADR_(char *)]; + char to_l_[PADL_(char *)]; + char * to; + char to_r_[PADR_(char *)]; }; struct sys_pread_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)]; - char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; - char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; + char fd_l_[PADL_(int)]; + int fd; + char fd_r_[PADR_(int)]; + char buf_l_[PADL_(void *)]; + void * buf; + char buf_r_[PADR_(void *)]; + char nbyte_l_[PADL_(size_t)]; + size_t nbyte; + char nbyte_r_[PADR_(size_t)]; + char offset_l_[PADL_(off_t)]; + off_t offset; + char offset_r_[PADR_(off_t)]; }; +struct sys_readlink_args { + char path_l_[PADL_(char *)]; + char * path; + char path_r_[PADR_(char *)]; + char buf_l_[PADL_(char *)]; + char * buf; + char buf_r_[PADR_(char *)]; + char count_l_[PADL_(size_t)]; + size_t count; + char count_r_[PADR_(size_t)]; +}; + +int sys_readlink(struct thread *, struct sys_readlink_args *); + //Func Defs int sys_invalid(struct thread *, void *); @@ -795,4 +839,5 @@ int sys_sendto(struct thread *td, struct sys_sendto_args *); int sys_pread(struct thread *td, struct sys_pread_args *); -#endif /* END _SYS_SYSPROTO_POSIX_H */ + +#endif /* END _SYS_SYSPROTO_POSIX_H_ */ diff --git a/sys/kernel/syscalls_posix.c b/sys/kernel/syscalls_posix.c index 96f5375..2ec995a 100644 --- a/sys/kernel/syscalls_posix.c +++ b/sys/kernel/syscalls_posix.c @@ -324,8 +324,8 @@ { 0, "readlink", - sys_invalid, - SYSCALL_NOTIMP }, // 58 - readlink + sys_readlink, + SYSCALL_VALID }, /* 58 */ { ARG_COUNT(sys_execve_args), "execve", diff --git a/sys/kernel/vfs_calls.c b/sys/kernel/vfs_calls.c index 86c0c14..be84897 100644 --- a/sys/kernel/vfs_calls.c +++ b/sys/kernel/vfs_calls.c @@ -289,3 +289,11 @@ return (0); } + +int sys_readlink(struct thread *thr, struct sys_readlink_args *args) { + kprintf("Call to readlink\n"); + kprintf("Path: %s\n", args->path); + kprintf("Count: %i\n", args->count); + thr->td_retval[0] = -1; + return (0); +}