Clean up interface to PM and VFS

- introduce new call numbers, names, and field aliases;
- initialize request messages to zero for all ABI calls;
- format callnr.h in the same way as com.h;
- redo call tables in both servers;
- remove param.h namespace pollution in the servers;
- make brk(2) go to VM directly, rather than through PM;
- remove obsolete BRK, UTIME, and WAIT calls;
- clean up path copying routine in VFS;
- move remaining system calls from libminlib to libc;
- correct some errno-related mistakes in libc routines.

Change-Id: I2d8ec5d061cd7e0b30c51ffd77aa72ebf84e2565
This commit is contained in:
David van Moolenbroek 2013-11-04 22:48:08 +01:00 committed by Lionel Sambuc
parent 2c8310fce6
commit 24ec0d73b5
164 changed files with 1615 additions and 1778 deletions

View file

@ -4,6 +4,7 @@
#include <lib.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <time.h>
@ -146,6 +147,7 @@ readclock(int type, struct tm *t, int flags)
exit(1);
}
memset(&m, 0, sizeof(m));
m.RTCDEV_TM = (char *) t;
m.RTCDEV_FLAGS = flags;

View file

@ -727,7 +727,6 @@ struct
{
{ "EXIT", VM_EXIT },
{ "FORK", VM_FORK },
{ "BRK", VM_BRK },
{ "EXEC_NEWMEM", VM_EXEC_NEWMEM },
{ "PUSH_SIG", 0 },
{ "WILLEXIT", VM_WILLEXIT },

View file

@ -416,6 +416,7 @@ int main(int argc, char **argv)
* should end up here. The default is used for not yet supported requests.
*/
result = OK;
memset(&m, 0, sizeof(m));
switch(request) {
case RS_UPDATE:
m.RS_LU_STATE = req_lu_state;

View file

@ -57,7 +57,6 @@ service pm
vm # Extra VM calls allowed:
EXIT # 00
FORK # 01
BRK # 02
EXEC_NEWMEM # 03
WILLEXIT # 05
NOTIFY_SIG # 39

View file

@ -1,116 +1,395 @@
#define NCALLS 129 /* number of system calls allowed */
/* This header file defines the calls to PM and VFS. */
#ifndef _MINIX_CALLNR_H
#define _MINIX_CALLNR_H
/* In case it isn't obvious enough: this list is sorted numerically. */
#define EXIT 1
#define FORK 2
#define READ 3
#define WRITE 4
#define OPEN 5
#define CLOSE 6
#define WAIT 7
#define LINK 9
#define UNLINK 10
#define WAITPID 11
#define CHDIR 12
#define TIME 13
#define MKNOD 14
#define CHMOD 15
#define CHOWN 16
#define BRK 17
#define MINIX_GETPID 20
#define MOUNT 21
#define UMOUNT 22
#define SETUID 23
#define GETUID 24
#define STIME 25
#define PTRACE 26
#define UTIME 30
#define GETEPINFO 31
#define SETGROUPS 32
#define ACCESS 33
#define GETGROUPS 34
#define SYNC 36
#define KILL 37
#define RENAME 38
#define MKDIR 39
#define RMDIR 40
#define PIPE 42
#define SYMLINK 45
#define SETGID 46
#define GETGID 47
#define SIGNAL 48
#define RDLNK 49
#define STAT 51
#define FSTAT 52
#define LSTAT 53
#define IOCTL 54
#define COPYFD 56
#define FS_READY 57
#define PIPE2 58
#define EXEC 59
#define UMASK 60
#define CHROOT 61
#define SETSID 62
#define GETPGRP 63
#define ITIMER 64
#define GETMCONTEXT 67
#define SETMCONTEXT 68
#define GETDENTS 69
#define FTRUNCATE 70
/*===========================================================================*
* Calls to PM *
*===========================================================================*/
/* Posix signal handling. */
#define SIGACTION 71
#define SIGSUSPEND 72
#define SIGPENDING 73
#define SIGPROCMASK 74
#define SIGRETURN 75
#define PM_BASE 0x000
#define REBOOT 76
#define PM_SVRCTL 77 /* to PM */
#define SYSUNAME 78
#define LLSEEK 81 /* to VFS */
#define GETVFSSTAT 82 /* to VFS */
#define STATVFS1 83 /* to VFS */
#define FSTATVFS1 84 /* to VFS */
#define SELECT 85 /* to VFS */
#define FCHDIR 86 /* to VFS */
#define FSYNC 87 /* to VFS */
#define GETPRIORITY 88 /* to PM */
#define SETPRIORITY 89 /* to PM */
#define GETTIMEOFDAY 90 /* to PM */
#define SETEUID 91 /* to PM */
#define SETEGID 92 /* to PM */
#define FCHMOD 95 /* to VFS */
#define FCHOWN 96 /* to VFS */
#define LSEEK 97
#define SPROF 98 /* to PM */
#define CPROF 99 /* to PM */
#define IS_PM_CALL(type) (((type) & ~0xff) == PM_BASE)
#define PM_NEWEXEC 100 /* from VFS or RS to PM: new exec */
#define SRV_FORK 101 /* to PM: special fork call for RS */
#define EXEC_RESTART 102 /* to PM: final part of exec for RS */
#define GETPROCNR 104 /* to PM */
#define ISSETUGID 106 /* to PM: ask if process is tainted */
#define UTIMENS 108 /* to FS: [f]utimens(); also [fl]utimes */
#define FCNTL 109 /* to VFS */
#define TRUNCATE 110 /* to VFS */
#define SRV_KILL 111 /* to PM: special kill call for RS */
/* Message type 0 is traditionally reserved. */
#define PM_EXIT (PM_BASE + 1)
#define PM_FORK (PM_BASE + 2)
#define PM_WAITPID (PM_BASE + 3)
#define PM_GETPID (PM_BASE + 4)
#define PM_SETUID (PM_BASE + 5)
#define PM_GETUID (PM_BASE + 6)
#define PM_STIME (PM_BASE + 7)
#define PM_PTRACE (PM_BASE + 8)
#define PM_SETGROUPS (PM_BASE + 9)
#define PM_GETGROUPS (PM_BASE + 10)
#define PM_KILL (PM_BASE + 11)
#define PM_SETGID (PM_BASE + 12)
#define PM_GETGID (PM_BASE + 13)
#define PM_EXEC (PM_BASE + 14)
#define PM_SETSID (PM_BASE + 15)
#define PM_GETPGRP (PM_BASE + 16)
#define PM_ITIMER (PM_BASE + 17)
#define PM_GETMCONTEXT (PM_BASE + 18)
#define PM_SETMCONTEXT (PM_BASE + 19)
#define PM_SIGACTION (PM_BASE + 20)
#define PM_SIGSUSPEND (PM_BASE + 21)
#define PM_SIGPENDING (PM_BASE + 22)
#define PM_SIGPROCMASK (PM_BASE + 23)
#define PM_SIGRETURN (PM_BASE + 24)
#define PM_SYSUNAME (PM_BASE + 25)
#define PM_GETPRIORITY (PM_BASE + 26)
#define PM_SETPRIORITY (PM_BASE + 27)
#define PM_GETTIMEOFDAY (PM_BASE + 28)
#define PM_SETEUID (PM_BASE + 29)
#define PM_SETEGID (PM_BASE + 30)
#define PM_ISSETUGID (PM_BASE + 31)
#define PM_GETSID (PM_BASE + 32)
#define PM_CLOCK_GETRES (PM_BASE + 33)
#define PM_CLOCK_GETTIME (PM_BASE + 34)
#define PM_CLOCK_SETTIME (PM_BASE + 35)
#define PM_GETRUSAGE (PM_BASE + 36)
#define PM_REBOOT (PM_BASE + 37)
#define PM_SVRCTL (PM_BASE + 38)
#define PM_SPROF (PM_BASE + 39)
#define PM_CPROF (PM_BASE + 40)
#define PM_SRV_FORK (PM_BASE + 41)
#define PM_SRV_KILL (PM_BASE + 42)
#define PM_EXEC_NEW (PM_BASE + 43)
#define PM_EXEC_RESTART (PM_BASE + 44)
#define PM_GETEPINFO (PM_BASE + 45)
#define PM_GETPROCNR (PM_BASE + 46)
#define PM_GETSYSINFO (PM_BASE + 47)
#define GCOV_FLUSH 112 /* flush gcov data from server to gcov files */
#define NR_PM_CALLS 48 /* highest number from base plus one */
#define PM_GETSID 113 /* PM getsid() */
#define CLOCK_GETRES 114 /* clock_getres() */
#define CLOCK_GETTIME 115 /* clock_gettime() */
#define CLOCK_SETTIME 116 /* clock_settime() */
/* Field names for the getprocnr(2) call. */
#define PM_GETPROCNR_PID m1_i1 /* pid_t */
#define PM_GETPROCNR_ENDPT m1_i1 /* endpoint_t */
#define VFS_VMCALL 117
/* Field names for the getepinfo(2) call. */
#define PM_GETEPINFO_ENDPT m1_i1 /* endpoint_t */
#define PM_GETEPINFO_UID m1_i1 /* uid_t */
#define PM_GETEPINFO_GID m1_i2 /* gid_t */
#define MAPDRIVER 122 /* to VFS, map a device */
#define PM_GETRUSAGE 123 /* to PM */
/* Field names for the exit(2) call. */
#define PM_EXIT_STATUS m1_i1 /* int */
#define VFS_CHECKPERMS 124 /* to VFS */
/* Field names for the waitpid(2) call. */
#define PM_WAITPID_PID m1_i1 /* pid_t */
#define PM_WAITPID_OPTIONS m1_i2 /* int */
#define PM_WAITPID_STATUS m2_i1 /* int */
#define PM_GETSYSINFO 125 /* to PM */
#define VFS_GETSYSINFO 126 /* to VFS */
#define VFS_GETRUSAGE 127 /* to VFS */
#define VFS_SVRCTL 128 /* to VFS */
/* Field names for the gettimeofday(2), clock_*(2), adjtime(2), stime(2) calls.
*/
#define PM_TIME_CLK_ID m2_i1 /* clockid_t */
#define PM_TIME_NOW m2_i2 /* int */
#define PM_TIME_SEC m2_l1 /* time_t */
#define PM_TIME_USEC m2_l2 /* long */
#define PM_TIME_NSEC m2_l2 /* long */
/* Field names for the ptrace(2) call. */
#define PM_PTRACE_PID m2_i1 /* pid_t */
#define PM_PTRACE_REQ m2_i2 /* int */
#define PM_PTRACE_ADDR m2_l1 /* long */
#define PM_PTRACE_DATA m2_l2 /* long */
/* Field names for the sysuname(2) call. */
#define PM_SYSUNAME_REQ m1_i1 /* int */
#define PM_SYSUNAME_FIELD m1_i2 /* int */
#define PM_SYSUNAME_LEN m1_i3 /* char * */
#define PM_SYSUNAME_VALUE m1_p1 /* size_t */
/* Field names for the getitimer(2)/setitimer(2) calls. */
#define PM_ITIMER_WHICH m1_i1 /* int */
#define PM_ITIMER_VALUE m1_p1 /* const struct itimerval * */
#define PM_ITIMER_OVALUE m1_p2 /* struct itimerval * */
/* Field names for the execve(2) call. */
#define PM_EXEC_NAME m1_p1 /* const char * */
#define PM_EXEC_NAMELEN m1_i1 /* size_t */
#define PM_EXEC_FRAME m1_p2 /* char * */
#define PM_EXEC_FRAMELEN m1_i2 /* size_t */
#define PM_EXEC_PS_STR m1_p3 /* char * */
/* Field names for the kill(2), srv_kill(2), and sigaction(2) calls. */
#define PM_SIG_PID m1_i1 /* pid_t */
#define PM_SIG_NR m1_i2 /* int */
#define PM_SIG_ACT m1_p1 /* const struct sigaction * */
#define PM_SIG_OACT m1_p2 /* struct sigaction * */
#define PM_SIG_RET m1_p3 /* int (*)(void) */
/* Field names for the remaining sigpending(2), sigprocmask(2), sigreturn(2),
* sigsuspend(2) calls.
*/
#define PM_SIG_HOW m2_i1 /* int */
#define PM_SIG_SET m2_l1 /* sigset_t */
#define PM_SIG_CTX m2_p1 /* struct sigcontext * */
/* Field names for the srv_fork(2) call. */
#define PM_SRV_FORK_UID m1_i1 /* uid_t */
#define PM_SRV_FORK_GID m1_i2 /* gid_t */
/* Field names for the getuid(2) call. */
#define PM_GETUID_EUID m1_i1 /* uid_t */
/* Field names for the getgid(2) call. */
#define PM_GETGID_EGID m1_i1 /* gid_t */
/* Field names for the setuid(2)/seteuid(2) calls. */
#define PM_SETUID_UID m1_i1 /* uid_t */
/* Field names for the setgid(2)/setegid(2) calls. */
#define PM_SETGID_GID m1_i1 /* gid_t */
/* Field names for the getppid(2) call. */
#define PM_GETPID_PARENT m2_i1 /* pid_t */
/* Field names for the setsid(2) call. */
#define PM_GETSID_PID m1_i1 /* pid_t */
/* Field names for the setgroups(2)/setgroups(2) calls. */
#define PM_GROUPS_NUM m1_i1 /* int */
#define PM_GROUPS_PTR m1_p1 /* gid_t * */
/* Field names for the getpriority(2)/setpriority(2) calls. */
#define PM_PRIORITY_WHICH m1_i1 /* int */
#define PM_PRIORITY_WHO m1_i2 /* int */
#define PM_PRIORITY_PRIO m1_i3 /* int */
/* Field names for the getmcontext(2)/setmcontext(2) calls. */
#define PM_MCONTEXT_CTX m1_p1 /* mcontext_t * */
/* Field names for the reboot(2) call. */
#define PM_REBOOT_HOW m1_i1 /* int */
/* Field names for the PM_EXEC_NEW call. */
#define PM_EXEC_NEW_ENDPT m1_i1 /* endpoint_t */
#define PM_EXEC_NEW_PTR m1_p1 /* struct exec_info * */
#define PM_EXEC_NEW_SUID m1_i2 /* int */
/* Field names for the PM_EXEC_RESTART call. */
#define PM_EXEC_RESTART_ENDPT m1_i1 /* endpoint_t */
#define PM_EXEC_RESTART_RESULT m1_i2 /* int */
#define PM_EXEC_RESTART_PC m1_p1 /* vir_bytes */
#define PM_EXEC_RESTART_PS_STR m1_p2 /* vir_bytes */
/*===========================================================================*
* Calls to VFS *
*===========================================================================*/
#define VFS_BASE 0x100
#define IS_VFS_CALL(type) (((type) & ~0xff) == VFS_BASE)
#define VFS_READ (VFS_BASE + 0)
#define VFS_WRITE (VFS_BASE + 1)
#define VFS_LSEEK (VFS_BASE + 2)
#define VFS_OPEN (VFS_BASE + 3)
#define VFS_CREAT (VFS_BASE + 4)
#define VFS_CLOSE (VFS_BASE + 5)
#define VFS_LINK (VFS_BASE + 6)
#define VFS_UNLINK (VFS_BASE + 7)
#define VFS_CHDIR (VFS_BASE + 8)
#define VFS_MKDIR (VFS_BASE + 9)
#define VFS_MKNOD (VFS_BASE + 10)
#define VFS_CHMOD (VFS_BASE + 11)
#define VFS_CHOWN (VFS_BASE + 12)
#define VFS_MOUNT (VFS_BASE + 13)
#define VFS_UMOUNT (VFS_BASE + 14)
#define VFS_ACCESS (VFS_BASE + 15)
#define VFS_SYNC (VFS_BASE + 16)
#define VFS_RENAME (VFS_BASE + 17)
#define VFS_RMDIR (VFS_BASE + 18)
#define VFS_SYMLINK (VFS_BASE + 19)
#define VFS_READLINK (VFS_BASE + 20)
#define VFS_STAT (VFS_BASE + 21)
#define VFS_FSTAT (VFS_BASE + 22)
#define VFS_LSTAT (VFS_BASE + 23)
#define VFS_IOCTL (VFS_BASE + 24)
#define VFS_FCNTL (VFS_BASE + 25)
#define VFS_PIPE2 (VFS_BASE + 26)
#define VFS_UMASK (VFS_BASE + 27)
#define VFS_CHROOT (VFS_BASE + 28)
#define VFS_GETDENTS (VFS_BASE + 29)
#define VFS_SELECT (VFS_BASE + 30)
#define VFS_FCHDIR (VFS_BASE + 31)
#define VFS_FSYNC (VFS_BASE + 32)
#define VFS_TRUNCATE (VFS_BASE + 33)
#define VFS_FTRUNCATE (VFS_BASE + 34)
#define VFS_FCHMOD (VFS_BASE + 35)
#define VFS_FCHOWN (VFS_BASE + 36)
#define VFS_UTIMENS (VFS_BASE + 37)
#define VFS_VMCALL (VFS_BASE + 38)
#define VFS_GETVFSSTAT (VFS_BASE + 39)
#define VFS_STATVFS1 (VFS_BASE + 40)
#define VFS_FSTATVFS1 (VFS_BASE + 41)
#define VFS_GETRUSAGE (VFS_BASE + 42)
#define VFS_SVRCTL (VFS_BASE + 43)
#define VFS_GCOV_FLUSH (VFS_BASE + 44)
#define VFS_MAPDRIVER (VFS_BASE + 45)
#define VFS_COPYFD (VFS_BASE + 46)
#define VFS_CHECKPERMS (VFS_BASE + 47)
#define VFS_GETSYSINFO (VFS_BASE + 48)
#define NR_VFS_CALLS 49 /* highest number from base plus one */
/* Field names for the select(2) call. */
#define VFS_SELECT_NFDS m8_i1 /* int */
#define VFS_SELECT_READFDS m8_p1 /* fd_set * */
#define VFS_SELECT_WRITEFDS m8_p2 /* fd_set * */
#define VFS_SELECT_ERRORFDS m8_p3 /* fd_set * */
#define VFS_SELECT_TIMEOUT m8_p4 /* struct timeval * */
/* Field names for the getvfsstat(2) call. */
#define VFS_GETVFSSTAT_BUF m1_p1 /* struct statvfs * */
#define VFS_GETVFSSTAT_LEN m1_i1 /* size_t */
#define VFS_GETVFSSTAT_FLAGS m1_i2 /* int */
/* Field names for the statvfs1(2) and fstatvfs1(2) calls. */
#define VFS_STATVFS1_LEN m1_i1 /* size_t */
#define VFS_STATVFS1_NAME m1_p1 /* const char * */
#define VFS_STATVFS1_FD m1_i1 /* int */
#define VFS_STATVFS1_BUF m1_p2 /* struct statvfs * */
#define VFS_STATVFS1_FLAGS m1_i2 /* int */
/* Field names for the mount(2) call. */
#define VFS_MOUNT_FLAGS m11_i1 /* int */
#define VFS_MOUNT_DEVLEN m11_s1 /* size_t */
#define VFS_MOUNT_PATHLEN m11_s2 /* size_t */
#define VFS_MOUNT_TYPELEN m11_s3 /* size_t */
#define VFS_MOUNT_LABELLEN m11_s4 /* size_t */
#define VFS_MOUNT_DEV m11_p1 /* char * */
#define VFS_MOUNT_PATH m11_p2 /* char * */
#define VFS_MOUNT_TYPE m11_p3 /* char * */
#define VFS_MOUNT_LABEL m11_p4 /* char * */
/* Field names for the umount(2) call. */
#define VFS_UMOUNT_NAME m1_p1 /* char * */
#define VFS_UMOUNT_NAMELEN m1_i1 /* size_t */
#define VFS_UMOUNT_LABEL m1_p2 /* char * */
#define VFS_UMOUNT_LABELLEN m1_i2 /* size_t */
/* Field names for the ioctl(2) call. */
#define VFS_IOCTL_FD m2_i1 /* int */
#define VFS_IOCTL_REQ m2_i3 /* unsigned long */
#define VFS_IOCTL_ARG m2_p1 /* void * */
/* Field names for the checkperms(2) call. */
#define VFS_CHECKPERMS_ENDPT m2_i1 /* endpoint_t */
#define VFS_CHECKPERMS_GRANT m2_i2 /* cp_grant_id_t */
#define VFS_CHECKPERMS_COUNT m2_i3 /* size_t */
/* Field names for the copyfd(2) call. */
#define VFS_COPYFD_ENDPT m1_i1 /* endpoint_t */
#define VFS_COPYFD_FD m1_i2 /* int */
#define VFS_COPYFD_WHAT m1_i3 /* int */
/* Field names for the mapdriver(2) call. */
#define VFS_MAPDRIVER_MAJOR m1_i1 /* devmajor_t */
#define VFS_MAPDRIVER_LABELLEN m1_i2 /* size_t */
#define VFS_MAPDRIVER_LABEL m1_p1 /* char * */
/* Field names for the utimens(2) call. */
#define VFS_UTIMENS_FD m2_i1 /* int */
#define VFS_UTIMENS_NAME m2_p1 /* const char * */
#define VFS_UTIMENS_LEN m2_i1 /* size_t */
#define VFS_UTIMENS_ATIME m2_l1 /* time_t */
#define VFS_UTIMENS_ANSEC m2_i2 /* long */
#define VFS_UTIMENS_MTIME m2_l2 /* time_t */
#define VFS_UTIMENS_MNSEC m2_i3 /* long */
#define VFS_UTIMENS_FLAGS m2_s1 /* int */
/* Field names for the fsync(2) call. */
#define VFS_FSYNC_FD m1_i1 /* int */
/* Field names for the lseek(2) call. */
#define VFS_LSEEK_FD m2_i1 /* int */
#define VFS_LSEEK_OFF_LO m2_l1 /* off_t (low 32 bits) */
#define VFS_LSEEK_OFF_HI m2_l2 /* off_t (high 32 bits) */
#define VFS_LSEEK_WHENCE m2_i2 /* int */
/* Field names for the truncate(2) and ftruncate(2) calls. */
#define VFS_TRUNCATE_FD m2_i1 /* int */
#define VFS_TRUNCATE_NAME m2_p1 /* const char * */
#define VFS_TRUNCATE_LEN m2_i1 /* size_t */
#define VFS_TRUNCATE_OFF_LO m2_l1 /* off_t (low 32 bits) */
#define VFS_TRUNCATE_OFF_HI m2_l2 /* off_t (high 32 bits) */
/* Field names for the pipe2(2) call. */
#define VFS_PIPE2_FD0 m1_i1 /* int */
#define VFS_PIPE2_FD1 m1_i2 /* int */
#define VFS_PIPE2_FLAGS m1_i3 /* int */
/* Field names for the umask(2) call. */
#define VFS_UMASK_MASK m1_i1 /* mode_t */
/* Field names for the link(2), symlink(2), and rename(2) call. */
#define VFS_LINK_NAME1 m1_p1 /* const char * */
#define VFS_LINK_LEN1 m1_i1 /* size_t */
#define VFS_LINK_NAME2 m1_p2 /* const char * */
#define VFS_LINK_LEN2 m1_i2 /* size_t */
/* Field names for the readlink(2) call. */
#define VFS_READLINK_NAME m1_p1 /* const char * */
#define VFS_READLINK_NAMELEN m1_i1 /* size_t */
#define VFS_READLINK_BUF m1_p2 /* char * */
#define VFS_READLINK_BUFSIZE m1_i2 /* size_t */
/* Field names for the stat(2) and lstat(2) calls. */
#define VFS_STAT_NAME m1_p1 /* const char * */
#define VFS_STAT_LEN m1_i1 /* size_t */
#define VFS_STAT_BUF m1_p2 /* struct stat * */
/* Field names for the fstat(2) call. */
#define VFS_FSTAT_FD m1_i1 /* int */
#define VFS_FSTAT_BUF m1_p1 /* struct stat * */
/* Field names for the fcntl(2) call. */
#define VFS_FCNTL_FD m1_i1 /* int */
#define VFS_FCNTL_CMD m1_i2 /* int */
#define VFS_FCNTL_ARG_INT m1_i3 /* int */
#define VFS_FCNTL_ARG_PTR m1_p1 /* struct flock * */
/* Field names for the mknod(2) call. */
#define VFS_MKNOD_NAME m1_p1 /* const char * */
#define VFS_MKNOD_LEN m1_i1 /* size_t */
#define VFS_MKNOD_MODE m1_i2 /* mode_t */
#define VFS_MKNOD_DEV m1_i3 /* dev_t */
/* Field names for the open(2), chdir(2), chmod(2), chroot(2), rmdir(2), and
* unlink(2) calls.
*/
#define VFS_PATH_NAME m3_p1 /* const char * */
#define VFS_PATH_LEN m3_i1 /* size_t */
#define VFS_PATH_FLAGS m3_i2 /* int */
#define VFS_PATH_MODE m3_i2 /* mode_t */
#define VFS_PATH_BUF m3_ca1 /* char[M3_STRING] */
/* Field names for the creat(2) call. */
#define VFS_CREAT_NAME m1_p1 /* const char * */
#define VFS_CREAT_LEN m1_i1 /* size_t */
#define VFS_CREAT_FLAGS m1_i2 /* int */
#define VFS_CREAT_MODE m1_i3 /* mode_t */
/* Field names for the chown(2) and fchown(2) calls. */
#define VFS_CHOWN_NAME m1_p1 /* const char * */
#define VFS_CHOWN_LEN m1_i1 /* size_t */
#define VFS_CHOWN_FD m1_i1 /* int */
#define VFS_CHOWN_OWNER m1_i2 /* uid_t */
#define VFS_CHOWN_GROUP m1_i3 /* gid_t */
/* Field names for the fchdir(2) call. */
#define VFS_FCHDIR_FD m1_i1 /* int */
/* Field names for the fchmod(2) call. */
#define VFS_FCHMOD_FD m1_i1 /* int */
#define VFS_FCHMOD_MODE m1_i2 /* mode_t */
/* Field names for the close(2) call. */
#define VFS_CLOSE_FD m1_i1 /* int */
/* Field names for the read(2), write(2), and getdents(2) calls. */
#define VFS_READWRITE_FD m1_i1 /* int */
#define VFS_READWRITE_BUF m1_p1 /* char * */
#define VFS_READWRITE_LEN m1_i2 /* size_t */
#endif /* !_MINIX_CALLNR_H */

View file

@ -5,29 +5,29 @@
* debugging purposes, each protocol is assigned its own unique number range.
* The following such message type ranges have been allocated:
*
* 1 - 0xFF POSIX requests (see callnr.h)
* 0x00 - 0xFF Process Manager (PM) requests (see callnr.h)
* 0x100 - 0x1FF Virtual File System (VFS) requests (see callnr.h)
* 0x200 - 0x2FF Data link layer requests and responses
* 0x300 - 0x3FF Bus controller requests and responses
* 0x400 - 0x4FF Character device requests and responses
* 0x500 - 0x5FF Block device requests and responses
* 0x600 - 0x6FF Kernel calls to SYSTEM task
* 0x600 - 0x6FF Kernel calls
* 0x700 - 0x7FF Reincarnation Server (RS) requests
* 0x800 - 0x8FF Data Store (DS) requests
* 0x900 - 0x9FF Requests from PM to VFS, and responses
* 0xA00 - 0xAFF Requests from VFS to file systems (see vfsif.h)
* 0xB00 - 0xBFF Requests from VM to VFS
* 0xB00 - 0xBFF Transaction IDs from VFS to file systems (see vfsif.h)
* 0xC00 - 0xCFF Virtual Memory (VM) requests
* 0xD00 - 0xDFF IPC server requests
* 0xE00 - 0xEFF Common system messages (e.g. system signals)
* 0xF00 - 0xFFF Scheduling messages
* 0xF00 - 0xFFF Scheduling messages
* 0x1000 - 0x10FF Notify messages
* 0x1100 - 0x11FF USB
* 0x1200 - 0x12FF Devman
* 0x1200 - 0x12FF Devman
* 0x1300 - 0x13FF TTY requests
* 0x1400 - 0x14FF VFS-FS transaction IDs
* 0x1400 - 0x14FF Real Time Clock requests and responses
* 0x1500 - 0x15FF Input server messages
* 0x1600 - 0x16FF VirtualBox (VBOX) requests (see vboxif.h)
* 0x1700 - 0x17FF Real Time Clock requests and responses
*
* Zero and negative values are widely used for OK and error responses.
*/
@ -493,9 +493,7 @@
#define PR_FORK_MSGADDR m1_p1 /* reply message address of forked child */
#define PR_CTX_PTR m1_p1 /* pointer to mcontext_t structure */
/* Field names for EXEC sent from userland to PM. */
#define PMEXEC_FLAGS m1_i3 /* PMEF_* */
/* Constants for exec. FIXME: these do not belong here. */
#define PMEF_AUXVECTORS 20
#define PMEF_EXECNAMELEN1 PATH_MAX
@ -756,7 +754,6 @@
*/
# define VFS_PM_FRAME m7_p2 /* arguments and environment */
# define VFS_PM_FRAME_LEN m7_i3 /* size of frame */
# define VFS_PM_EXECFLAGS m7_i4 /* PMEXEC_FLAGS */
# define VFS_PM_PS_STR m7_i5 /* ps_strings pointer */
/* Additional parameters for PM_EXEC_REPLY and PM_CORE_REPLY */
@ -774,29 +771,6 @@
/* Additional parameters for PM_DUMPCORE */
# define VFS_PM_TERM_SIG m7_i2 /* process's termination signal */
/* Parameters for the EXEC_NEWMEM call */
#define EXC_NM_PROC m1_i1 /* process that needs new map */
#define EXC_NM_PTR m1_p1 /* parameters in struct exec_info */
/* Results:
* the status will be in m_type.
* the top of the stack will be in m1_i1.
* the following flags will be in m1_i2:
*/
#define EXC_NM_RF_LOAD_TEXT 1 /* Load text segment (otherwise the
* text segment is already present)
*/
#define EXC_NM_RF_ALLOW_SETUID 2 /* Setuid execution is allowed (tells
* FS to update its uid and gid
* fields.
*/
#define EXC_NM_RF_FULLVM 4
/* Parameters for the EXEC_RESTART call */
#define EXC_RS_PROC m1_i1 /* process that needs to be restarted */
#define EXC_RS_RESULT m1_i2 /* result of the exec */
#define EXC_RS_PC m1_p1 /* program counter */
#define EXC_RS_PS_STR m1_p2 /* ps_strings pointer */
/*===========================================================================*
* Messages used from VFS to file servers *
*===========================================================================*/
@ -822,103 +796,6 @@
# define GCOV_BUFF_P m1_p1
# define GCOV_BUFF_SZ m1_i1
/* Field names for the getsysinfo(2) call. */
#define SI_WHAT m1_i1
#define SI_WHERE m1_p1
#define SI_SIZE m1_i2
/* PM field names */
/* BRK */
#define PMBRK_ADDR m1_p1
/* TRACE */
#define PMTRACE_ADDR m2_l1
#define PM_ENDPT m1_i1
#define PM_PENDPT m1_i2
#define PM_NUID m2_i1
#define PM_NGID m2_i2
#define PM_GETSID_PID m1_i1
/* Field names for SELECT (FS). */
#define SEL_NFDS m8_i1
#define SEL_READFDS m8_p1
#define SEL_WRITEFDS m8_p2
#define SEL_ERRORFDS m8_p3
#define SEL_TIMEOUT m8_p4
/* Field names for the getvfsstat(2) call. */
#define VFS_GETVFSSTAT_BUF m1_p1
#define VFS_GETVFSSTAT_SIZE m1_i1
#define VFS_GETVFSSTAT_FLAGS m1_i2
/* Field names for the fstatvfs1(2) call. */
#define VFS_FSTATVFS1_FD m1_i1
#define VFS_FSTATVFS1_BUF m1_p1
#define VFS_FSTATVFS1_FLAGS m1_i2
/* Field names for the statvfs1(2) call. */
#define VFS_STATVFS1_LEN m1_i1
#define VFS_STATVFS1_NAME m1_p1
#define VFS_STATVFS1_BUF m1_p2
#define VFS_STATVFS1_FLAGS m1_i2
/* Field names for the mount(2) call. */
#define VFS_MOUNT_FLAGS m11_i1
#define VFS_MOUNT_DEVLEN m11_s1
#define VFS_MOUNT_PATHLEN m11_s2
#define VFS_MOUNT_TYPELEN m11_s3
#define VFS_MOUNT_LABELLEN m11_s4
#define VFS_MOUNT_DEV m11_p1
#define VFS_MOUNT_PATH m11_p2
#define VFS_MOUNT_TYPE m11_p3
#define VFS_MOUNT_LABEL m11_p4
/* Field names for the umount(2) call. */
#define VFS_UMOUNT_NAME m1_p1
#define VFS_UMOUNT_NAMELEN m1_i1
#define VFS_UMOUNT_LABEL m1_p2
#define VFS_UMOUNT_LABELLEN m1_i2
/* Field names for the ioctl(2) call. */
#define VFS_IOCTL_FD m2_i1
#define VFS_IOCTL_REQ m2_i3
#define VFS_IOCTL_ARG m2_p1
/* Field names for the checkperms(2) call. */
#define VFS_CHECKPERMS_ENDPT m2_i1
#define VFS_CHECKPERMS_GRANT m2_i2
#define VFS_CHECKPERMS_COUNT m2_i3
/* Field names for the copyfd(2) call. */
#define VFS_COPYFD_ENDPT m1_i1
#define VFS_COPYFD_FD m1_i2
#define VFS_COPYFD_WHAT m1_i3
# define COPYFD_FROM 0 /* copy file descriptor from remote process */
# define COPYFD_TO 1 /* copy file descriptor to remote process */
# define COPYFD_CLOSE 2 /* close file descriptor in remote process */
/* Field names for the getprocnr(2) call. */
#define PM_GETPROCNR_PID m1_i1
#define PM_GETPROCNR_ENDPT m1_i1
/* Field names for the getepinfo(2) call. */
#define PM_GETEPINFO_ENDPT m1_i1
#define PM_GETEPINFO_UID m1_i1
#define PM_GETEPINFO_GID m1_i2
/* Field names for the mapdriver(2) call. */
#define VFS_MAPDRIVER_MAJOR m1_i1
#define VFS_MAPDRIVER_LABELLEN m1_i2
#define VFS_MAPDRIVER_LABEL m1_p1
/* Field names for GETRUSAGE related calls */
#define RU_ENDPT m1_i1 /* indicates a process for sys_getrusage */
#define RU_WHO m1_i1 /* who argument in getrusage call */
#define RU_RUSAGE_ADDR m1_p1 /* pointer to struct rusage */
/*===========================================================================*
* Messages for VM server *
*===========================================================================*/
@ -932,9 +809,7 @@
# define VMF_SLOTNO m1_i2
# define VMF_CHILD_ENDPOINT m1_i3 /* result */
#define VM_BRK (VM_RQ_BASE+2)
# define VMB_ENDPOINT m1_i1
# define VMB_ADDR m1_p1
# define VMB_RETADDR m1_p2 /* result */
#define VM_EXEC_NEWMEM (VM_RQ_BASE+3)
# define VMEN_ENDPOINT m1_i1
# define VMEN_ARGSPTR m1_p1
@ -1117,7 +992,8 @@
/* Basic vm calls allowed to every process. */
#define VM_BASIC_CALLS \
VM_MMAP, VM_MUNMAP, VM_MAP_PHYS, VM_UNMAP_PHYS, VM_INFO, VM_GETRUSAGE
VM_BRK, VM_MMAP, VM_MUNMAP, VM_MAP_PHYS, VM_UNMAP_PHYS, VM_INFO, \
VM_GETRUSAGE
/*===========================================================================*
* Messages for IPC server *
@ -1297,7 +1173,7 @@
* VFS-FS TRANSACTION IDs *
*===========================================================================*/
#define VFS_TRANSACTION_BASE 0x1400
#define VFS_TRANSACTION_BASE 0xB00
#define VFS_TRANSID (VFS_TRANSACTION_BASE + 1)
#define IS_VFS_FS_TRANSID(type) (((type) & ~0xff) == VFS_TRANSACTION_BASE)
@ -1410,8 +1286,8 @@
*===========================================================================*/
/* Base type for real time clock requests and responses. */
#define RTCDEV_RQ_BASE 0x1700
#define RTCDEV_RS_BASE 0x1780
#define RTCDEV_RQ_BASE 0x1400
#define RTCDEV_RS_BASE 0x1480
#define IS_RTCDEV_RQ(type) (((type) & ~0x7f) == RTCDEV_RQ_BASE)
#define IS_RTCDEV_RS(type) (((type) & ~0x7f) == RTCDEV_RS_BASE)
@ -1439,6 +1315,24 @@
#define RTCDEV_Y2KBUG 0x01 /* Interpret 1980 as 2000 for RTC w/Y2K bug */
#define RTCDEV_CMOSREG 0x02 /* Also set the CMOS clock register bits. */
/*===========================================================================*
* Field names shared across several call codes *
*===========================================================================*/
/* Field names for the getsysinfo(2) call. */
#define SI_WHAT m1_i1 /* int */
#define SI_WHERE m1_p1 /* void */
#define SI_SIZE m1_i2 /* size_t */
/* Field names for the svrctl(2) call. */
#define SVRCTL_REQ m2_i1 /* int */
#define SVRCTL_ARG m2_p1 /* void * */
/* Field names for the getrusage(2) call. */
#define RU_ENDPT m1_i1 /* endpoint_t */
#define RU_WHO m1_i1 /* int */
#define RU_RUSAGE_ADDR m1_p1 /* struct rusage * */
/*===========================================================================*
* Internal codes used by several services *
*===========================================================================*/

View file

@ -270,6 +270,9 @@ uid_t getnuid(endpoint_t proc_ep);
gid_t getngid(endpoint_t proc_ep);
int checkperms(endpoint_t endpt, char *path, size_t size);
int copyfd(endpoint_t endpt, int fd, int what);
#define COPYFD_FROM 0 /* copy file descriptor from remote process */
#define COPYFD_TO 1 /* copy file descriptor to remote process */
#define COPYFD_CLOSE 2 /* close file descriptor in remote process */
#endif /* _SYSLIB_H */

View file

@ -8,7 +8,6 @@
int vm_exit(endpoint_t ep);
int vm_fork(endpoint_t ep, int slotno, endpoint_t *child_ep);
int vm_brk(endpoint_t ep, char *newaddr);
int vm_willexit(endpoint_t ep);
int vm_adddma(endpoint_t proc_e, phys_bytes start, phys_bytes size);
int vm_deldma(endpoint_t proc_e, phys_bytes start, phys_bytes size);

View file

@ -7,8 +7,8 @@ set -e
cat ../include/minix/callnr.h | \
tr -s ' \t' ' ' | \
sed 's/^# /#/' | \
egrep '^#define [A-Z_][A-Z0-9_]* [0-9]+' | grep -v NCALLS
egrep '^#define [A-Z_][A-Z0-9_]* \((PM|VFS)_BASE \+ *[0-9]+\)'
cat ../include/minix/com.h | \
tr -s ' \t' ' ' | \
sed 's/^# /#/' | \

View file

@ -1,28 +0,0 @@
/* utime(2) for POSIX Authors: Terrence W. Holm & Edwin L. Froese */
#include <sys/cdefs.h>
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <utime.h>
int utime(const char *name, const struct utimbuf *timp)
{
message m;
if (timp == NULL) {
m.m2_i1 = 0; /* name size 0 means NULL `timp' */
m.m2_i2 = strlen(name) + 1; /* actual size here */
} else {
m.m2_l1 = timp->actime;
m.m2_l2 = timp->modtime;
m.m2_i1 = strlen(name) + 1;
}
m.m2_p1 = (char *) __UNCONST(name);
return(_syscall(VFS_PROC_NR, UTIME, &m));
}
#if defined(__minix) && defined(__weak_alias)
__weak_alias(utime, __utime50)
#endif

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <sys/wait.h>
#ifdef __weak_alias
@ -12,7 +13,10 @@ pid_t wait(int * status)
{
message m;
if (_syscall(PM_PROC_NR, WAIT, &m) < 0) return(-1);
if (status != 0) *status = m.m2_i1;
memset(&m, 0, sizeof(m));
m.PM_WAITPID_PID = -1;
m.PM_WAITPID_OPTIONS = 0;
if (_syscall(PM_PROC_NR, PM_WAITPID, &m) < 0) return(-1);
if (status != 0) *status = m.PM_WAITPID_STATUS;
return(m.m_type);
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <sys/wait.h>
#ifdef __weak_alias
@ -12,9 +13,10 @@ pid_t waitpid(pid_t pid, int *status, int options)
{
message m;
m.m1_i1 = pid;
m.m1_i2 = options;
if (_syscall(PM_PROC_NR, WAITPID, &m) < 0) return(-1);
if (status != 0) *status = m.m2_i1;
memset(&m, 0, sizeof(m));
m.PM_WAITPID_PID = pid;
m.PM_WAITPID_OPTIONS = options;
if (_syscall(PM_PROC_NR, PM_WAITPID, &m) < 0) return(-1);
if (status != 0) *status = m.PM_WAITPID_STATUS;
return m.m_type;
}

View file

@ -4,7 +4,8 @@ SRCS+= accept.c access.c adjtime.c bind.c brk.c sbrk.c m_closefrom.c getsid.c \
chdir.c chmod.c fchmod.c chown.c fchown.c chroot.c close.c \
clock_getres.c clock_gettime.c clock_settime.c \
connect.c dup.c dup2.c execve.c fcntl.c flock.c fpathconf.c fork.c \
fstatfs.c fstatvfs.c fsync.c ftruncate.c getdents.c getegid.c getgid.c \
fstatfs.c fstatvfs.c fsync.c ftruncate.c gcov_flush.c getdents.c \
getegid.c getgid.c \
getgroups.c getitimer.c setitimer.c __getlogin.c getpeername.c \
getpgrp.c getpid.c getppid.c priority.c getrlimit.c getsockname.c \
getsockopt.c setsockopt.c gettimeofday.c geteuid.c getuid.c \
@ -16,7 +17,8 @@ SRCS+= accept.c access.c adjtime.c bind.c brk.c sbrk.c m_closefrom.c getsid.c \
rmdir.c select.c sem.c sendmsg.c sendto.c setgroups.c setsid.c \
setgid.c settimeofday.c setuid.c shmat.c shmctl.c shmget.c stime.c \
vectorio.c shutdown.c sigaction.c sigpending.c sigreturn.c sigsuspend.c\
sigprocmask.c socket.c socketpair.c stat.c statvfs.c symlink.c \
sigprocmask.c socket.c socketpair.c stat.c statvfs.c svrctl.c \
symlink.c \
sync.c syscall.c sysuname.c truncate.c umask.c unlink.c write.c \
utimensat.c utimes.c futimes.c lutimes.c futimens.c \
_exit.c _ucontext.c environ.c __getcwd.c vfork.c sizeup.c init.c \

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
@ -14,8 +15,9 @@ int status;
void (*suicide)(void);
message m;
m.m1_i1 = status;
_syscall(PM_PROC_NR, EXIT, &m);
memset(&m, 0, sizeof(m));
m.PM_EXIT_STATUS = status;
_syscall(PM_PROC_NR, PM_EXIT, &m);
/* If exiting nicely through PM fails for some reason, try to
* commit suicide. E.g., message to PM might fail due to deadlock.

View file

@ -5,6 +5,7 @@
#include <lib.h>
#include <namespace.h>
#include <string.h>
#include <ucontext.h>
#include <unistd.h>
@ -12,9 +13,10 @@ int setmcontext(const mcontext_t *mcp)
{
message m;
m.m1_p1 = (char *) __UNCONST(mcp);
memset(&m, 0, sizeof(m));
m.PM_MCONTEXT_CTX = (char *) __UNCONST(mcp);
return(_syscall(PM_PROC_NR, SETMCONTEXT, &m));
return(_syscall(PM_PROC_NR, PM_SETMCONTEXT, &m));
}
@ -22,8 +24,9 @@ int getmcontext(mcontext_t *mcp)
{
message m;
m.m1_p1 = (char *) mcp;
memset(&m, 0, sizeof(m));
m.PM_MCONTEXT_CTX = (char *) mcp;
return(_syscall(PM_PROC_NR, GETMCONTEXT, &m));
return(_syscall(PM_PROC_NR, PM_GETMCONTEXT, &m));
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
@ -14,7 +15,8 @@ int mode;
{
message m;
m.m3_i2 = mode;
memset(&m, 0, sizeof(m));
m.VFS_PATH_MODE = mode;
_loadname(name, &m);
return(_syscall(VFS_PROC_NR, ACCESS, &m));
return(_syscall(VFS_PROC_NR, VFS_ACCESS, &m));
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <sys/time.h>
#include <time.h>
@ -13,12 +14,13 @@ int adjtime(const struct timeval *delta, struct timeval *olddelta)
{
message m;
m.m2_i2 = 0; /* use adjtime() method to slowly adjust the clock. */
m.m2_i1 = (clockid_t) CLOCK_REALTIME;
m.m2_l1 = (time_t) delta->tv_sec;
m.m2_l2 = (long) delta->tv_usec * 1000; /* convert usec to nsec */
memset(&m, 0, sizeof(m));
m.PM_TIME_CLK_ID = (clockid_t) CLOCK_REALTIME;
m.PM_TIME_NOW = 0; /* use adjtime() method to slowly adjust the clock. */
m.PM_TIME_SEC = (time_t) delta->tv_sec;
m.PM_TIME_NSEC = (long) delta->tv_usec * 1000; /* convert usec to nsec */
if (_syscall(PM_PROC_NR, CLOCK_SETTIME, &m) < 0)
if (_syscall(PM_PROC_NR, PM_CLOCK_SETTIME, &m) < 0)
return -1;
if (olddelta != NULL) {

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
@ -13,7 +14,6 @@ extern char *_brksize;
/* Both OSF/1 and SYSVR4 man pages specify that brk(2) returns int.
* However, BSD4.3 specifies that brk() returns char*. POSIX omits
* brk() on the grounds that it imposes a memory model on an architecture.
* For this reason, brk() and sbrk() are not in the lib/posix directory.
* On the other hand, they are so crucial to correct operation of so many
* parts of the system, that we have chosen to hide the name brk using _brk,
* as with system calls. In this way, if a user inadvertently defines a
@ -25,9 +25,10 @@ void *addr;
message m;
if (addr != _brksize) {
m.PMBRK_ADDR = addr;
if (_syscall(PM_PROC_NR, BRK, &m) < 0) return(-1);
_brksize = m.m2_p1;
memset(&m, 0, sizeof(m));
m.VMB_ADDR = addr;
if (_syscall(VM_PROC_NR, VM_BRK, &m) < 0) return(-1);
_brksize = addr;
}
return(0);
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
@ -14,8 +15,9 @@ const char *name;
{
message m;
memset(&m, 0, sizeof(m));
_loadname(name, &m);
return(_syscall(VFS_PROC_NR, CHDIR, &m));
return(_syscall(VFS_PROC_NR, VFS_CHDIR, &m));
}
int fchdir(fd)
@ -23,6 +25,7 @@ int fd;
{
message m;
m.m1_i1 = fd;
return(_syscall(VFS_PROC_NR, FCHDIR, &m));
memset(&m, 0, sizeof(m));
m.VFS_FCHDIR_FD = fd;
return(_syscall(VFS_PROC_NR, VFS_FCHDIR, &m));
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <sys/stat.h>
#ifdef __weak_alias
@ -12,7 +13,8 @@ int chmod(const char *name, mode_t mode)
{
message m;
m.m3_i2 = mode;
memset(&m, 0, sizeof(m));
m.VFS_PATH_MODE = mode;
_loadname(name, &m);
return(_syscall(VFS_PROC_NR, CHMOD, &m));
return(_syscall(VFS_PROC_NR, VFS_CHMOD, &m));
}

View file

@ -13,9 +13,10 @@ int chown(const char *name, uid_t owner, gid_t grp)
{
message m;
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = owner;
m.m1_i3 = grp;
m.m1_p1 = (char *) __UNCONST(name);
return(_syscall(VFS_PROC_NR, CHOWN, &m));
memset(&m, 0, sizeof(m));
m.VFS_CHOWN_LEN = strlen(name) + 1;
m.VFS_CHOWN_OWNER = owner;
m.VFS_CHOWN_GROUP = grp;
m.VFS_CHOWN_NAME = (char *) __UNCONST(name);
return(_syscall(VFS_PROC_NR, VFS_CHOWN, &m));
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
@ -13,6 +14,7 @@ const char *name;
{
message m;
memset(&m, 0, sizeof(m));
_loadname(name, &m);
return(_syscall(VFS_PROC_NR, CHROOT, &m));
return(_syscall(VFS_PROC_NR, VFS_CHROOT, &m));
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <sys/time.h>
#ifdef __weak_alias
@ -12,13 +13,14 @@ int clock_getres(clockid_t clock_id, struct timespec *res)
{
message m;
m.m2_i1 = (clockid_t) clock_id;
memset(&m, 0, sizeof(m));
m.PM_TIME_CLK_ID = (clockid_t) clock_id;
if (_syscall(PM_PROC_NR, CLOCK_GETRES, &m) < 0)
if (_syscall(PM_PROC_NR, PM_CLOCK_GETRES, &m) < 0)
return -1;
res->tv_sec = (time_t) m.m2_l1;
res->tv_nsec = (long) m.m2_l2;
res->tv_sec = (time_t) m.PM_TIME_SEC;
res->tv_nsec = (long) m.PM_TIME_NSEC;
return 0;
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <sys/time.h>
#ifdef __weak_alias
@ -12,13 +13,14 @@ int clock_gettime(clockid_t clock_id, struct timespec *res)
{
message m;
m.m2_i1 = (clockid_t) clock_id;
memset(&m, 0, sizeof(m));
m.PM_TIME_CLK_ID = (clockid_t) clock_id;
if (_syscall(PM_PROC_NR, CLOCK_GETTIME, &m) < 0)
if (_syscall(PM_PROC_NR, PM_CLOCK_GETTIME, &m) < 0)
return -1;
res->tv_sec = (time_t) m.m2_l1;
res->tv_nsec = (long) m.m2_l2;
res->tv_sec = (time_t) m.PM_TIME_SEC;
res->tv_nsec = (long) m.PM_TIME_USEC;
return 0;
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <time.h>
#ifdef __weak_alias
@ -12,12 +13,13 @@ int clock_settime(clockid_t clock_id, const struct timespec *ts)
{
message m;
m.m2_i2 = 1; /* set time immediately. don't use adjtime() method. */
m.m2_i1 = (clockid_t) clock_id;
m.m2_l1 = (time_t) ts->tv_sec;
m.m2_l2 = (long) ts->tv_nsec;
memset(&m, 0, sizeof(m));
m.PM_TIME_CLK_ID = (clockid_t) clock_id;
m.PM_TIME_NOW = 1; /* set time immediately. don't use adjtime() method. */
m.PM_TIME_SEC = (time_t) ts->tv_sec;
m.PM_TIME_NSEC = (long) ts->tv_nsec;
if (_syscall(PM_PROC_NR, CLOCK_SETTIME, &m) < 0)
if (_syscall(PM_PROC_NR, PM_CLOCK_SETTIME, &m) < 0)
return -1;
return 0;

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
@ -13,6 +14,7 @@ int fd;
{
message m;
m.m1_i1 = fd;
return(_syscall(VFS_PROC_NR, CLOSE, &m));
memset(&m, 0, sizeof(m));
m.VFS_CLOSE_FD = fd;
return(_syscall(VFS_PROC_NR, VFS_CLOSE, &m));
}

View file

@ -7,17 +7,19 @@ __weak_alias(cprofile, _cprofile)
#endif
#include <lib.h>
#include <string.h>
#include <minix/profile.h>
int cprofile(int action, int size, void *ctl_ptr, void *mem_ptr)
{
message m;
memset(&m, 0, sizeof(m));
m.PROF_ACTION = action;
m.PROF_MEM_SIZE = size;
m.PROF_CTL_PTR = (void *) ctl_ptr;
m.PROF_MEM_PTR = (void *) mem_ptr;
return _syscall(PM_PROC_NR, CPROF, &m);
return _syscall(PM_PROC_NR, PM_CPROF, &m);
}

View file

@ -48,13 +48,13 @@ int execve(const char *path, char * const *argv, char * const *envp)
memset(&m, 0, sizeof(m));
/* We can finally make the system call. */
m.m1_i1 = strlen(path) + 1;
m.m1_i2 = frame_size;
m.m1_p1 = (char *) __UNCONST(path);
m.m1_p2 = frame;
m.m1_p4 = (char *)(vsp + ((char *)psp - frame));
m.PM_EXEC_NAME = (char *) __UNCONST(path);
m.PM_EXEC_NAMELEN = strlen(path) + 1;
m.PM_EXEC_FRAME = frame;
m.PM_EXEC_FRAMELEN = frame_size;
m.PM_EXEC_PS_STR = (char *)(vsp + ((char *)psp - frame));
(void) _syscall(PM_PROC_NR, EXEC, &m);
(void) _syscall(PM_PROC_NR, PM_EXEC, &m);
/* Failure, return the memory used for the frame and exit. */
(void) sbrk(-frame_size);

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <sys/stat.h>
#ifdef __weak_alias
@ -12,7 +13,8 @@ int fchmod(int fd, mode_t mode)
{
message m;
m.m1_i1 = fd;
m.m1_i2 = mode;
return(_syscall(VFS_PROC_NR, FCHMOD, &m));
memset(&m, 0, sizeof(m));
m.VFS_FCHMOD_FD = fd;
m.VFS_FCHMOD_MODE = mode;
return(_syscall(VFS_PROC_NR, VFS_FCHMOD, &m));
}

View file

@ -13,8 +13,9 @@ int fchown(int fd, uid_t owner, gid_t grp)
{
message m;
m.m1_i1 = fd;
m.m1_i2 = owner;
m.m1_i3 = grp;
return(_syscall(VFS_PROC_NR, FCHOWN, &m));
memset(&m, 0, sizeof(m));
m.VFS_CHOWN_FD = fd;
m.VFS_CHOWN_OWNER = owner;
m.VFS_CHOWN_GROUP = grp;
return(_syscall(VFS_PROC_NR, VFS_FCHOWN, &m));
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <fcntl.h>
#include <stdarg.h>
@ -19,27 +20,26 @@ int fcntl(int fd, int cmd, ...)
/* Set up for the sensible case where there is no variable parameter. This
* covers F_GETFD, F_GETFL and invalid commands.
*/
m.m1_i3 = 0;
m.m1_p1 = NULL;
memset(&m, 0, sizeof(m));
/* Adjust for the stupid cases. */
switch(cmd) {
case F_DUPFD:
case F_SETFD:
case F_SETFL:
m.m1_i3 = va_arg(argp, int);
m.VFS_FCNTL_ARG_INT = va_arg(argp, int);
break;
case F_GETLK:
case F_SETLK:
case F_SETLKW:
case F_FREESP:
m.m1_p1 = (char *) va_arg(argp, struct flock *);
m.VFS_FCNTL_ARG_PTR = (char *) va_arg(argp, struct flock *);
break;
}
/* Clean up and make the system call. */
va_end(argp);
m.m1_i1 = fd;
m.m1_i2 = cmd;
return(_syscall(VFS_PROC_NR, FCNTL, &m));
m.VFS_FCNTL_FD = fd;
m.VFS_FCNTL_CMD = cmd;
return(_syscall(VFS_PROC_NR, VFS_FCNTL, &m));
}

View file

@ -2,15 +2,17 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(fork, _fork)
#endif
pid_t fork()
pid_t fork(void)
{
message m;
return(_syscall(PM_PROC_NR, FORK, &m));
memset(&m, 0, sizeof(m));
return(_syscall(PM_PROC_NR, PM_FORK, &m));
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <sys/statvfs.h>
#ifdef __weak_alias
@ -13,10 +14,11 @@ int fstatvfs1(int fd, struct statvfs *buffer, int flags)
{
message m;
m.VFS_FSTATVFS1_FD = fd;
m.VFS_FSTATVFS1_BUF = (char *) buffer;
m.VFS_FSTATVFS1_FLAGS = flags;
return(_syscall(VFS_PROC_NR, FSTATVFS1, &m));
memset(&m, 0, sizeof(m));
m.VFS_STATVFS1_FD = fd;
m.VFS_STATVFS1_BUF = (char *) buffer;
m.VFS_STATVFS1_FLAGS = flags;
return(_syscall(VFS_PROC_NR, VFS_FSTATVFS1, &m));
}
int fstatvfs(int fd, struct statvfs *buffer)

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
@ -12,7 +13,8 @@ int fsync(int fd)
{
message m;
m.m1_i1 = fd;
memset(&m, 0, sizeof(m));
m.VFS_FSYNC_FD = fd;
return(_syscall(VFS_PROC_NR, FSYNC, &m));
return(_syscall(VFS_PROC_NR, VFS_FSYNC, &m));
}

View file

@ -14,9 +14,10 @@ int ftruncate(int _fd, off_t _length)
{
message m;
m.m2_l1 = ex64lo(_length);
m.m2_l2 = ex64hi(_length);
m.m2_i1 = _fd;
memset(&m, 0, sizeof(m));
m.VFS_TRUNCATE_OFF_LO = ex64lo(_length);
m.VFS_TRUNCATE_OFF_HI = ex64hi(_length);
m.VFS_TRUNCATE_FD = _fd;
return(_syscall(VFS_PROC_NR, FTRUNCATE, &m));
return(_syscall(VFS_PROC_NR, VFS_FTRUNCATE, &m));
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <sys/stat.h>
int futimens(int fd, const struct timespec tv[2])
@ -11,13 +12,14 @@ int futimens(int fd, const struct timespec tv[2])
if (tv == NULL) tv = now;
m.m2_i1 = fd;
m.m2_l1 = tv[0].tv_sec;
m.m2_l2 = tv[1].tv_sec;
m.m2_i2 = tv[0].tv_nsec;
m.m2_i3 = tv[1].tv_nsec;
m.m2_p1 = NULL;
m.m2_s1 = 0;
memset(&m, 0, sizeof(m));
m.VFS_UTIMENS_FD = fd;
m.VFS_UTIMENS_ATIME = tv[0].tv_sec;
m.VFS_UTIMENS_MTIME = tv[1].tv_sec;
m.VFS_UTIMENS_ANSEC = tv[0].tv_nsec;
m.VFS_UTIMENS_MNSEC = tv[1].tv_nsec;
m.VFS_UTIMENS_NAME = NULL;
m.VFS_UTIMENS_FLAGS = 0;
return(_syscall(VFS_PROC_NR, UTIMENS, &m));
return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m));
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
@ -13,19 +14,20 @@ int futimes(int fd, const struct timeval tv[2])
{
message m;
m.m2_i1 = fd;
memset(&m, 0, sizeof(m));
m.VFS_UTIMENS_FD = fd;
if (tv == NULL) {
m.m2_l1 = m.m2_l2 = 0;
m.m2_i2 = m.m2_i3 = UTIME_NOW;
m.VFS_UTIMENS_ATIME = m.VFS_UTIMENS_MTIME = 0;
m.VFS_UTIMENS_ANSEC = m.VFS_UTIMENS_MNSEC = UTIME_NOW;
}
else {
m.m2_l1 = tv[0].tv_sec;
m.m2_l2 = tv[1].tv_sec;
m.m2_i2 = tv[0].tv_usec * 1000;
m.m2_i3 = tv[1].tv_usec * 1000;
m.VFS_UTIMENS_ATIME = tv[0].tv_sec;
m.VFS_UTIMENS_MTIME = tv[1].tv_sec;
m.VFS_UTIMENS_ANSEC = tv[0].tv_usec * 1000;
m.VFS_UTIMENS_MNSEC = tv[1].tv_usec * 1000;
}
m.m2_p1 = NULL;
m.m2_s1 = 0;
m.VFS_UTIMENS_NAME = NULL;
m.VFS_UTIMENS_FLAGS = 0;
return(_syscall(VFS_PROC_NR, UTIMENS, &m));
return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m));
}

View file

@ -0,0 +1,19 @@
#include <lib.h>
#include <string.h>
#include <minix/gcov.h>
int gcov_flush_svr(char *buff, int buff_sz, int server_nr)
{
message m;
memset(&m, 0, sizeof(m));
m.GCOV_BUFF_P = buff;
m.GCOV_BUFF_SZ = buff_sz;
m.GCOV_PID = server_nr;
/* Make the call to server. It will call the gcov library,
* buffer the stdio requests, and copy the buffer to this user
* space
*/
return _syscall(VFS_PROC_NR, VFS_GCOV_FLUSH, &m);
}

View file

@ -2,16 +2,18 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <dirent.h>
ssize_t getdents(int fd, char *buffer, size_t nbytes)
{
message m;
m.m1_i1 = fd;
m.m1_i2 = nbytes;
m.m1_p1 = (char *) buffer;
return _syscall(VFS_PROC_NR, GETDENTS, &m);
memset(&m, 0, sizeof(m));
m.VFS_READWRITE_FD = fd;
m.VFS_READWRITE_LEN = nbytes;
m.VFS_READWRITE_BUF = (char *) buffer;
return _syscall(VFS_PROC_NR, VFS_GETDENTS, &m);
}
#if defined(__minix) && defined(__weak_alias)

View file

@ -2,21 +2,23 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(getegid, _getegid)
#endif
gid_t getegid()
gid_t getegid(void)
{
message m;
memset(&m, 0, sizeof(m));
/* POSIX says that this function is always successful and that no
* return value is reserved to indicate an error. Minix syscalls
* are not always successful and Minix returns the unreserved value
* (gid_t) -1 when there is an error.
*/
if (_syscall(PM_PROC_NR, GETGID, &m) < 0) return ( (gid_t) -1);
return( (gid_t) m.m2_i1);
if (_syscall(PM_PROC_NR, PM_GETGID, &m) < 0) return ( (gid_t) -1);
return( (gid_t) m.PM_GETGID_EGID);
}

View file

@ -2,21 +2,23 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(geteuid, _geteuid)
#endif
uid_t geteuid()
uid_t geteuid(void)
{
message m;
memset(&m, 0, sizeof(m));
/* POSIX says that this function is always successful and that no
* return value is reserved to indicate an error. Minix syscalls
* are not always successful and Minix returns the unreserved value
* (uid_t) -1 when there is an error.
*/
if (_syscall(PM_PROC_NR, GETUID, &m) < 0) return ( (uid_t) -1);
return( (uid_t) m.m2_i1);
if (_syscall(PM_PROC_NR, PM_GETUID, &m) < 0) return ( (uid_t) -1);
return( (uid_t) m.PM_GETUID_EUID);
}

View file

@ -2,15 +2,17 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(getgid, _getgid)
#endif
gid_t getgid()
gid_t getgid(void)
{
message m;
return( (gid_t) _syscall(PM_PROC_NR, GETGID, &m));
memset(&m, 0, sizeof(m));
return( (gid_t) _syscall(PM_PROC_NR, PM_GETGID, &m));
}

View file

@ -6,6 +6,7 @@ getgroups.c
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
@ -16,9 +17,11 @@ __weak_alias(getgroups, _getgroups)
int getgroups(int ngroups, gid_t *arr)
{
message m;
m.m1_i1 = ngroups;
m.m1_p1 = (char *) arr;
return(_syscall(PM_PROC_NR, GETGROUPS, &m));
memset(&m, 0, sizeof(m));
m.PM_GROUPS_NUM = ngroups;
m.PM_GROUPS_PTR = (char *) arr;
return(_syscall(PM_PROC_NR, PM_GETGROUPS, &m));
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <sys/time.h>
/*
@ -12,11 +13,12 @@ int getitimer(int which, struct itimerval *value)
{
message m;
m.m1_i1 = which;
m.m1_p1 = NULL; /* only retrieve the timer */
m.m1_p2 = (char *) value;
memset(&m, 0, sizeof(m));
m.PM_ITIMER_WHICH = which;
m.PM_ITIMER_VALUE = NULL; /* only retrieve the timer */
m.PM_ITIMER_OVALUE = (char *) value;
return _syscall(PM_PROC_NR, ITIMER, &m);
return _syscall(PM_PROC_NR, PM_ITIMER, &m);
}
#if defined(__minix) && defined(__weak_alias)

View file

@ -2,15 +2,17 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(getpgrp, _getpgrp)
#endif
pid_t getpgrp()
pid_t getpgrp(void)
{
message m;
return(_syscall(PM_PROC_NR, GETPGRP, &m));
memset(&m, 0, sizeof(m));
return(_syscall(PM_PROC_NR, PM_GETPGRP, &m));
}

View file

@ -2,15 +2,17 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(getpid, _getpid)
#endif
pid_t getpid()
pid_t getpid(void)
{
message m;
return(_syscall(PM_PROC_NR, MINIX_GETPID, &m));
memset(&m, 0, sizeof(m));
return(_syscall(PM_PROC_NR, PM_GETPID, &m));
}

View file

@ -2,21 +2,23 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(getppid, _getppid)
#endif
pid_t getppid()
pid_t getppid(void)
{
message m;
memset(&m, 0, sizeof(m));
/* POSIX says that this function is always successful and that no
* return value is reserved to indicate an error. Minix syscalls
* are not always successful and Minix returns the reserved value
* (pid_t) -1 when there is an error.
*/
if (_syscall(PM_PROC_NR, MINIX_GETPID, &m) < 0) return ( (pid_t) -1);
return( (pid_t) m.m2_i1);
if (_syscall(PM_PROC_NR, PM_GETPID, &m) < 0) return ( (pid_t) -1);
return( (pid_t) m.PM_GETPID_PARENT);
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#include <sys/resource.h>
@ -9,8 +10,10 @@ int getrusage(int who, struct rusage *r_usage)
{
int rc;
message m;
memset(&m, 0, sizeof(m));
m.RU_WHO = who;
m.RU_RUSAGE_ADDR = r_usage;
m.RU_RUSAGE_ADDR = (char *) r_usage;
if (r_usage == NULL) {
errno = EFAULT;
@ -24,9 +27,13 @@ int getrusage(int who, struct rusage *r_usage)
memset(r_usage, 0, sizeof(struct rusage));
if ((rc = _syscall(PM_PROC_NR, PM_GETRUSAGE, &m)) < 0)
return rc;
m.RU_RUSAGE_ADDR = r_usage;
memset(&m, 0, sizeof(m));
m.RU_RUSAGE_ADDR = (char *) r_usage;
if ((rc = _syscall(VFS_PROC_NR, VFS_GETRUSAGE, &m)) < 0)
return rc;
m.RU_RUSAGE_ADDR = r_usage;
memset(&m, 0, sizeof(m));
m.RU_RUSAGE_ADDR = (char *) r_usage;
return _syscall(VM_PROC_NR, VM_GETRUSAGE, &m);
}

View file

@ -6,6 +6,7 @@ gettimeofday.c
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <sys/time.h>
#ifdef __weak_alias
@ -16,11 +17,13 @@ int gettimeofday(struct timeval *__restrict tp, void *__restrict tzp)
{
message m;
if (_syscall(PM_PROC_NR, GETTIMEOFDAY, &m) < 0)
memset(&m, 0, sizeof(m));
if (_syscall(PM_PROC_NR, PM_GETTIMEOFDAY, &m) < 0)
return -1;
tp->tv_sec = m.m2_l1;
tp->tv_usec = m.m2_l2;
tp->tv_sec = m.PM_TIME_SEC;
tp->tv_usec = m.PM_TIME_USEC;
return 0;
}

View file

@ -2,15 +2,17 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(getuid, _getuid)
#endif
uid_t getuid()
uid_t getuid(void)
{
message m;
return( (uid_t) _syscall(PM_PROC_NR, GETUID, &m));
memset(&m, 0, sizeof(m));
return( (uid_t) _syscall(PM_PROC_NR, PM_GETUID, &m));
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <sys/statvfs.h>
#ifdef __weak_alias
@ -12,8 +13,9 @@ int getvfsstat(struct statvfs *buf, size_t bufsize, int flags)
{
message m;
memset(&m, 0, sizeof(m));
m.VFS_GETVFSSTAT_BUF = (char *) buf;
m.VFS_GETVFSSTAT_SIZE = bufsize;
m.VFS_GETVFSSTAT_LEN = bufsize;
m.VFS_GETVFSSTAT_FLAGS = flags;
return(_syscall(VFS_PROC_NR, GETVFSSTAT, &m));
return(_syscall(VFS_PROC_NR, VFS_GETVFSSTAT, &m));
}

View file

@ -73,11 +73,12 @@ void *data;
break;
}
memset(&m, 0, sizeof(m));
m.VFS_IOCTL_FD = fd;
m.VFS_IOCTL_REQ = request;
m.VFS_IOCTL_ARG = (char *) addr;
r = _syscall(VFS_PROC_NR, IOCTL, &m);
r = _syscall(VFS_PROC_NR, VFS_IOCTL, &m);
/* Translate back to original form */
switch (request_save) {

View file

@ -2,14 +2,13 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
int issetugid(void)
{
int r;
message m;
r = _syscall(PM_PROC_NR, ISSETUGID, &m);
if (r == -1) return 0; /* Default to old behavior */
return(r);
memset(&m, 0, sizeof(m));
return _syscall(PM_PROC_NR, PM_ISSETUGID, &m);
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <signal.h>
#ifdef __weak_alias
@ -9,12 +10,13 @@ __weak_alias(kill, _kill)
#endif
int kill(proc, sig)
int proc; /* which process is to be sent the signal */
pid_t proc; /* which process is to be sent the signal */
int sig; /* signal number */
{
message m;
m.m1_i1 = proc;
m.m1_i2 = sig;
return(_syscall(PM_PROC_NR, KILL, &m));
memset(&m, 0, sizeof(m));
m.PM_SIG_PID = proc;
m.PM_SIG_NR = sig;
return(_syscall(PM_PROC_NR, PM_KILL, &m));
}

View file

@ -13,9 +13,10 @@ int link(const char *name, const char *name2)
{
message m;
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = strlen(name2) + 1;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) __UNCONST(name2);
return(_syscall(VFS_PROC_NR, LINK, &m));
memset(&m, 0, sizeof(m));
m.VFS_LINK_LEN1 = strlen(name) + 1;
m.VFS_LINK_LEN2 = strlen(name2) + 1;
m.VFS_LINK_NAME1 = (char *) __UNCONST(name);
m.VFS_LINK_NAME2 = (char *) __UNCONST(name2);
return(_syscall(VFS_PROC_NR, VFS_LINK, &m));
}

View file

@ -10,11 +10,10 @@ void _loadname(const char *name, message *msgptr)
* string fits in the message, it is copied there. If not, a pointer to
* it is passed.
*/
register size_t k;
k = strlen(name) + 1;
msgptr->m3_i1 = k;
msgptr->m3_p1 = (char *) __UNCONST(name);
if (k <= M3_STRING) strcpy(msgptr->m3_ca1, name);
msgptr->VFS_PATH_LEN = k;
msgptr->VFS_PATH_NAME = (char *) __UNCONST(name);
if (k <= M3_STRING) strcpy(msgptr->VFS_PATH_BUF, name);
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <minix/u64.h>
#include <unistd.h>
@ -14,13 +15,11 @@ lseek(int fd, off_t offset, int whence)
{
message m;
m.m2_i1 = fd;
m.m2_l1 = ex64lo(offset);
m.m2_l2 = ex64hi(offset);
m.m2_i2 = whence;
if (_syscall(VFS_PROC_NR, LSEEK, &m) < 0)
return( (off_t) -1);
return( (off_t) make64(m.m2_l1, m.m2_l2));
memset(&m, 0, sizeof(m));
m.VFS_LSEEK_FD = fd;
m.VFS_LSEEK_OFF_LO = ex64lo(offset);
m.VFS_LSEEK_OFF_HI = ex64hi(offset);
m.VFS_LSEEK_WHENCE = whence;
if (_syscall(VFS_PROC_NR, VFS_LSEEK, &m) < 0) return( (off_t) -1);
return( (off_t) make64(m.VFS_LSEEK_OFF_LO, m.VFS_LSEEK_OFF_HI));
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#include <minix/u64.h>
@ -13,12 +14,13 @@ u64_t *newpos;
{
message m;
m.m2_i1 = fd;
m.m2_l1 = ex64lo(offset);
m.m2_l2 = ex64hi(offset);
m.m2_i2 = whence;
if (_syscall(VFS_PROC_NR, LLSEEK, &m) < 0) return -1;
memset(&m, 0, sizeof(m));
m.VFS_LSEEK_FD = fd;
m.VFS_LSEEK_OFF_LO = ex64lo(offset);
m.VFS_LSEEK_OFF_HI = ex64hi(offset);
m.VFS_LSEEK_WHENCE = whence;
if (_syscall(VFS_PROC_NR, VFS_LSEEK, &m) < 0) return -1;
if (newpos)
*newpos= make64(m.m2_l1, m.m2_l2);
*newpos= make64(m.VFS_LSEEK_OFF_LO, m.VFS_LSEEK_OFF_HI);
return 0;
}

View file

@ -16,21 +16,28 @@ int lutimes(const char *name, const struct timeval tv[2])
{
message m;
if (name == NULL) return EINVAL;
if (name[0] == '\0') return ENOENT; /* X/Open requirement */
m.m2_i1 = strlen(name) + 1;
m.m2_p1 = (char *) __UNCONST(name);
if (name == NULL) {
errno = EINVAL;
return -1;
}
if (name[0] == '\0') { /* X/Open requirement */
errno = ENOENT;
return -1;
}
memset(&m, 0, sizeof(m));
m.VFS_UTIMENS_FD = strlen(name) + 1;
m.VFS_UTIMENS_NAME = (char *) __UNCONST(name);
if (tv == NULL) {
m.m2_l1 = m.m2_l2 = 0;
m.m2_i2 = m.m2_i3 = UTIME_NOW;
m.VFS_UTIMENS_ATIME = m.VFS_UTIMENS_MTIME = 0;
m.VFS_UTIMENS_ANSEC = m.VFS_UTIMENS_MNSEC = UTIME_NOW;
}
else {
m.m2_l1 = tv[0].tv_sec;
m.m2_l2 = tv[1].tv_sec;
m.m2_i2 = tv[0].tv_usec * 1000;
m.m2_i3 = tv[1].tv_usec * 1000;
m.VFS_UTIMENS_ATIME = tv[0].tv_sec;
m.VFS_UTIMENS_MTIME = tv[1].tv_sec;
m.VFS_UTIMENS_ANSEC = tv[0].tv_usec * 1000;
m.VFS_UTIMENS_MNSEC = tv[1].tv_usec * 1000;
}
m.m2_s1 = AT_SYMLINK_NOFOLLOW;
m.VFS_UTIMENS_FLAGS = AT_SYMLINK_NOFOLLOW;
return(_syscall(VFS_PROC_NR, UTIMENS, &m));
return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m));
}

View file

@ -2,7 +2,6 @@
#include <sys/cdefs.h>
#include <minix/callnr.h>
#include <minix/com.h>
#include <minix/config.h>
#include <minix/ipc.h>
@ -27,6 +26,7 @@ int minix_rs_lookup(const char *name, endpoint_t *value)
len_key = strlen(name)+1;
memset(&m, 0, sizeof(m));
m.RS_NAME = (char *) __UNCONST(name);
m.RS_NAME_LEN = len_key;

View file

@ -13,8 +13,8 @@ int mkdir(const char *name, mode_t mode)
{
message m;
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = mode;
m.m1_p1 = (char *) __UNCONST(name);
return(_syscall(VFS_PROC_NR, MKDIR, &m));
memset(&m, 0, sizeof(m));
m.VFS_PATH_MODE = mode;
_loadname(name, &m);
return(_syscall(VFS_PROC_NR, VFS_MKDIR, &m));
}

View file

@ -11,12 +11,12 @@ int mknod(const char *name, mode_t mode, dev_t dev)
{
message m;
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = mode;
m.m1_i3 = dev;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) ((int) 0); /* obsolete size field */
return(_syscall(VFS_PROC_NR, MKNOD, &m));
memset(&m, 0, sizeof(m));
m.VFS_MKNOD_LEN = strlen(name) + 1;
m.VFS_MKNOD_MODE = mode;
m.VFS_MKNOD_DEV = dev;
m.VFS_MKNOD_NAME = (char *) __UNCONST(name);
return(_syscall(VFS_PROC_NR, VFS_MKNOD, &m));
}
#if defined(__minix) && defined(__weak_alias)

View file

@ -28,6 +28,7 @@ void *minix_mmap_for(endpoint_t forwhom,
message m;
int r;
memset(&m, 0, sizeof(m));
m.VMM_ADDR = (vir_bytes) addr;
m.VMM_LEN = len;
m.VMM_PROT = prot;
@ -87,6 +88,7 @@ int minix_munmap(void *addr, size_t len)
{
message m;
memset(&m, 0, sizeof(m));
m.VMUM_ADDR = addr;
m.VMUM_LEN = len;
@ -103,6 +105,7 @@ void *vm_remap(endpoint_t d,
message m;
int r;
memset(&m, 0, sizeof(m));
m.VMRE_D = d;
m.VMRE_S = s;
m.VMRE_DA = (char *) da;
@ -124,6 +127,7 @@ void *vm_remap_ro(endpoint_t d,
message m;
int r;
memset(&m, 0, sizeof(m));
m.VMRE_D = d;
m.VMRE_S = s;
m.VMRE_DA = (char *) da;
@ -140,6 +144,7 @@ int vm_unmap(endpoint_t endpt, void *addr)
{
message m;
memset(&m, 0, sizeof(m));
m.VMUN_ENDPT = endpt;
m.VMUN_ADDR = (long) addr;
@ -151,6 +156,7 @@ unsigned long vm_getphys(endpoint_t endpt, void *addr)
message m;
int r;
memset(&m, 0, sizeof(m));
m.VMPHYS_ENDPT = endpt;
m.VMPHYS_ADDR = (long) addr;
@ -165,6 +171,7 @@ u8_t vm_getrefcount(endpoint_t endpt, void *addr)
message m;
int r;
memset(&m, 0, sizeof(m));
m.VMREFCNT_ENDPT = endpt;
m.VMREFCNT_ADDR = (long) addr;

View file

@ -148,6 +148,7 @@ int mountflags, srvflags;
}
/* Now perform mount(). */
memset(&m, 0, sizeof(m));
m.VFS_MOUNT_FLAGS = mountflags;
m.VFS_MOUNT_DEVLEN = special ? strlen(special) + 1 : 0;
m.VFS_MOUNT_PATHLEN = strlen(name) + 1;
@ -157,7 +158,7 @@ int mountflags, srvflags;
m.VFS_MOUNT_PATH = name;
m.VFS_MOUNT_TYPE = type;
m.VFS_MOUNT_LABEL = label;
r = _syscall(VFS_PROC_NR, MOUNT, &m);
r = _syscall(VFS_PROC_NR, VFS_MOUNT, &m);
if (r != OK && !use_existing) {
/* If mount() failed, tell RS to shutdown FS process.
@ -177,11 +178,12 @@ int srvflags;
message m;
int r;
memset(&m, 0, sizeof(m));
m.VFS_UMOUNT_NAME = __UNCONST(name);
m.VFS_UMOUNT_NAMELEN = strlen(name) + 1;
m.VFS_UMOUNT_LABEL = label;
m.VFS_UMOUNT_LABELLEN = sizeof(label);
r = _syscall(VFS_PROC_NR, UMOUNT, &m);
r = _syscall(VFS_PROC_NR, VFS_UMOUNT, &m);
/* don't shut down the driver when exist flag is set */
if (!(srvflags & MS_EXISTING)) {

View file

@ -26,13 +26,17 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
struct timespec rqt;
/* check parameters */
if (!rqtp)
return EFAULT;
if (!rqtp) {
errno = EFAULT;
return -1;
}
if (rqtp->tv_sec < 0 ||
rqtp->tv_nsec < 0 ||
rqtp->tv_nsec >= NSEC_PER_SEC)
return EINVAL;
rqtp->tv_nsec >= NSEC_PER_SEC) {
errno = EINVAL;
return -1;
}
/* store *rqtp to make sure it is not overwritten */
rqt = *rqtp;

View file

@ -14,20 +14,24 @@ int open(const char *name, int flags, ...)
{
va_list argp;
message m;
int call;
memset(&m, 0, sizeof(m));
va_start(argp, flags);
/* Depending on whether O_CREAT is set, a different message layout is used,
* and therefore a different call number as well.
*/
if (flags & O_CREAT) {
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = flags;
/* Since it's a vararg parameter that is smaller than
* an int, the mode was passed as an int.
*/
m.m1_i3 = va_arg(argp, int);
m.m1_p1 = (char *) __UNCONST(name);
m.VFS_CREAT_LEN = strlen(name) + 1;
m.VFS_CREAT_FLAGS = flags;
m.VFS_CREAT_MODE = va_arg(argp, int);
m.VFS_CREAT_NAME = (char *) __UNCONST(name);
call = VFS_CREAT;
} else {
_loadname(name, &m);
m.m3_i2 = flags;
m.VFS_PATH_FLAGS = flags;
call = VFS_OPEN;
}
va_end(argp);
return (_syscall(VFS_PROC_NR, OPEN, &m));
return (_syscall(VFS_PROC_NR, call, &m));
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
@ -9,26 +10,22 @@ __weak_alias(pipe, _pipe)
__weak_alias(pipe2, _pipe2)
#endif
int
pipe(int fild[2])
{
message m;
if (_syscall(VFS_PROC_NR, PIPE, &m) < 0) return(-1);
fild[0] = m.m1_i1;
fild[1] = m.m1_i2;
return(0);
}
int
pipe2(int fild[2], int flags)
{
message m;
m.m1_i3 = flags;
memset(&m, 0, sizeof(m));
m.VFS_PIPE2_FLAGS = flags;
if (_syscall(VFS_PROC_NR, PIPE2, &m) < 0) return(-1);
fild[0] = m.m1_i1;
fild[1] = m.m1_i2;
if (_syscall(VFS_PROC_NR, VFS_PIPE2, &m) < 0) return(-1);
fild[0] = m.VFS_PIPE2_FD0;
fild[1] = m.VFS_PIPE2_FD1;
return(0);
}
int
pipe(int fild[2])
{
return pipe2(fild, 0);
}

View file

@ -18,8 +18,9 @@ int getpriority(int which, int who)
int v;
message m;
m.m1_i1 = which;
m.m1_i2 = who;
memset(&m, 0, sizeof(m));
m.PM_PRIORITY_WHICH = which;
m.PM_PRIORITY_WHO = who;
/* GETPRIORITY returns negative for error.
* Otherwise, it returns the priority plus the minimum
@ -28,7 +29,7 @@ int getpriority(int which, int who)
* to see if something really went wrong.)
*/
if((v = _syscall(PM_PROC_NR, GETPRIORITY, &m)) < 0) {
if((v = _syscall(PM_PROC_NR, PM_GETPRIORITY, &m)) < 0) {
return v;
}
@ -39,10 +40,11 @@ int setpriority(int which, int who, int prio)
{
message m;
m.m1_i1 = which;
m.m1_i2 = who;
m.m1_i3 = prio;
memset(&m, 0, sizeof(m));
m.PM_PRIORITY_WHICH = which;
m.PM_PRIORITY_WHO = who;
m.PM_PRIORITY_PRIO = prio;
return _syscall(PM_PROC_NR, SETPRIORITY, &m);
return _syscall(PM_PROC_NR, PM_SETPRIORITY, &m);
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <sys/ptrace.h>
#ifdef __weak_alias
@ -12,16 +13,17 @@ long ptrace(int req, pid_t pid, long addr, long data)
{
message m;
m.m2_i1 = pid;
m.m2_i2 = req;
m.PMTRACE_ADDR = addr;
m.m2_l2 = data;
if (_syscall(PM_PROC_NR, PTRACE, &m) < 0) return(-1);
memset(&m, 0, sizeof(m));
m.PM_PTRACE_PID = pid;
m.PM_PTRACE_REQ = req;
m.PM_PTRACE_ADDR = addr;
m.PM_PTRACE_DATA = data;
if (_syscall(PM_PROC_NR, PM_PTRACE, &m) < 0) return(-1);
/* There was no error, but -1 is a legal return value. Clear errno if
* necessary to distinguish this case. _syscall has set errno to nonzero
* for the error case.
*/
if (m.m2_l2 == -1) errno = 0;
return(m.m2_l2);
if (m.PM_PTRACE_DATA == -1) errno = 0;
return(m.PM_PTRACE_DATA);
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
@ -12,8 +13,9 @@ ssize_t read(int fd, void *buffer, size_t nbytes)
{
message m;
m.m1_i1 = fd;
m.m1_i2 = nbytes;
m.m1_p1 = (char *) buffer;
return(_syscall(VFS_PROC_NR, READ, &m));
memset(&m, 0, sizeof(m));
m.VFS_READWRITE_FD = fd;
m.VFS_READWRITE_LEN = nbytes;
m.VFS_READWRITE_BUF = (char *) buffer;
return(_syscall(VFS_PROC_NR, VFS_READ, &m));
}

View file

@ -13,10 +13,11 @@ ssize_t readlink(const char *name, char *buffer, size_t bufsiz)
{
message m;
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = bufsiz;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) buffer;
memset(&m, 0, sizeof(m));
m.VFS_READLINK_NAMELEN = strlen(name) + 1;
m.VFS_READLINK_BUFSIZE = bufsiz;
m.VFS_READLINK_NAME = (char *) __UNCONST(name);
m.VFS_READLINK_BUF = (char *) buffer;
return(_syscall(VFS_PROC_NR, RDLNK, &m));
return(_syscall(VFS_PROC_NR, VFS_READLINK, &m));
}

View file

@ -1,4 +1,4 @@
/* reboot.c - Systemcall interface to mm/signal.c::do_reboot()
/* reboot.c
author: Edvard Tuinder v892231@si.hhs.NL
*/
@ -8,14 +8,14 @@
#include <unistd.h>
#include "namespace.h"
#include <unistd.h>
#include <string.h>
#include <sys/reboot.h>
#include <stdarg.h>
int reboot(int how)
{
message m;
m.m1_i1 = how;
return _syscall(PM_PROC_NR, REBOOT, &m);
memset(&m, 0, sizeof(m));
m.PM_REBOOT_HOW = how;
return _syscall(PM_PROC_NR, PM_REBOOT, &m);
}

View file

@ -9,9 +9,10 @@ int rename(const char *name, const char *name2)
{
message m;
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = strlen(name2) + 1;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) __UNCONST(name2);
return(_syscall(VFS_PROC_NR, RENAME, &m));
memset(&m, 0, sizeof(m));
m.VFS_LINK_LEN1 = strlen(name) + 1;
m.VFS_LINK_LEN2 = strlen(name2) + 1;
m.VFS_LINK_NAME1 = (char *) __UNCONST(name);
m.VFS_LINK_NAME2 = (char *) __UNCONST(name2);
return(_syscall(VFS_PROC_NR, VFS_RENAME, &m));
}

View file

@ -6,6 +6,7 @@
__weak_alias(rmdir, _rmdir)
#endif
#include <string.h>
#include <unistd.h>
int rmdir(name)
@ -13,6 +14,7 @@ const char *name;
{
message m;
memset(&m, 0, sizeof(m));
_loadname(name, &m);
return(_syscall(VFS_PROC_NR, RMDIR, &m));
return(_syscall(VFS_PROC_NR, VFS_RMDIR, &m));
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <sys/time.h>
#include <sys/select.h>
@ -11,13 +12,14 @@ int select(int nfds,
{
message m;
m.SEL_NFDS = nfds;
m.SEL_READFDS = (char *) readfds;
m.SEL_WRITEFDS = (char *) writefds;
m.SEL_ERRORFDS = (char *) errorfds;
m.SEL_TIMEOUT = (char *) timeout;
memset(&m, 0, sizeof(m));
m.VFS_SELECT_NFDS = nfds;
m.VFS_SELECT_READFDS = (char *) readfds;
m.VFS_SELECT_WRITEFDS = (char *) writefds;
m.VFS_SELECT_ERRORFDS = (char *) errorfds;
m.VFS_SELECT_TIMEOUT = (char *) timeout;
return (_syscall(VFS_PROC_NR, SELECT, &m));
return (_syscall(VFS_PROC_NR, VFS_SELECT, &m));
}

View file

@ -14,6 +14,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
#include <string.h>
static int get_ipc_endpt(endpoint_t *pt)
{
@ -32,6 +33,7 @@ int semget(key_t key, int nsems, int semflag)
return -1;
}
memset(&m, 0, sizeof(m));
m.SEMGET_KEY = key;
m.SEMGET_NR = nsems;
m.SEMGET_FLAG = semflag;
@ -56,6 +58,7 @@ int semctl(int semid, int semnum, int cmd, ...)
return -1;
}
memset(&m, 0, sizeof(m));
m.SEMCTL_ID = semid;
m.SEMCTL_NUM = semnum;
m.SEMCTL_CMD = cmd;
@ -85,6 +88,7 @@ int semop(int semid, struct sembuf *sops, size_t nsops)
return -1;
}
memset(&m, 0, sizeof(m));
m.SEMOP_ID = semid;
m.SEMOP_OPS = (long) sops;
m.SEMOP_SIZE = nsops;

View file

@ -2,6 +2,8 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#ifdef __weak_alias
__weak_alias(setgid, _setgid)
__weak_alias(setegid, _setegid)
@ -13,14 +15,16 @@ int setgid(gid_t grp)
{
message m;
m.m1_i1 = (int) grp;
return(_syscall(PM_PROC_NR, SETGID, &m));
memset(&m, 0, sizeof(m));
m.PM_SETGID_GID = (int) grp;
return(_syscall(PM_PROC_NR, PM_SETGID, &m));
}
int setegid(gid_t grp)
{
message m;
m.m1_i1 = (int) grp;
return(_syscall(PM_PROC_NR, SETEGID, &m));
memset(&m, 0, sizeof(m));
m.PM_SETGID_GID = (int) grp;
return(_syscall(PM_PROC_NR, PM_SETEGID, &m));
}

View file

@ -2,6 +2,8 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#ifdef __weak_alias
__weak_alias(setgroups, _setgroups)
#endif
@ -12,10 +14,9 @@ int setgroups(int ngroups, const gid_t *gidset)
{
message m;
m.m1_p1 = (char *) __UNCONST(gidset);
m.m1_i1 = ngroups;
memset(&m, 0, sizeof(m));
m.PM_GROUPS_PTR = (char *) __UNCONST(gidset);
m.PM_GROUPS_NUM = ngroups;
return(_syscall(PM_PROC_NR, SETGROUPS, &m));
return(_syscall(PM_PROC_NR, PM_SETGROUPS, &m));
}

View file

@ -2,6 +2,7 @@
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <sys/time.h>
/*
@ -16,13 +17,17 @@ int setitimer(int which, const struct itimerval *__restrict value,
/* A null pointer for 'value' would make setitimer behave like getitimer,
* which is not according to the specification, so disallow null pointers.
*/
if (value == NULL) return(EINVAL);
if (value == NULL) {
errno = EINVAL;
return -1;
}
m.m1_i1 = which;
m.m1_p1 = (char *) __UNCONST(value);
m.m1_p2 = (char *) ovalue;
memset(&m, 0, sizeof(m));
m.PM_ITIMER_WHICH = which;
m.PM_ITIMER_VALUE = (char *) __UNCONST(value);
m.PM_ITIMER_OVALUE = (char *) ovalue;
return _syscall(PM_PROC_NR, ITIMER, &m);
return _syscall(PM_PROC_NR, PM_ITIMER, &m);
}
#if defined(__minix) && defined(__weak_alias)

View file

@ -2,15 +2,17 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(setsid, _setsid)
#endif
pid_t setsid()
pid_t setsid(void)
{
message m;
return(_syscall(PM_PROC_NR, SETSID, &m));
memset(&m, 0, sizeof(m));
return(_syscall(PM_PROC_NR, PM_SETSID, &m));
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
@ -13,14 +14,16 @@ int setuid(uid_t usr)
{
message m;
m.m1_i1 = usr;
return(_syscall(PM_PROC_NR, SETUID, &m));
memset(&m, 0, sizeof(m));
m.PM_SETUID_UID = usr;
return(_syscall(PM_PROC_NR, PM_SETUID, &m));
}
int seteuid(uid_t usr)
{
message m;
m.m1_i1 = usr;
return(_syscall(PM_PROC_NR, SETEUID, &m));
memset(&m, 0, sizeof(m));
m.PM_SETUID_UID = usr;
return(_syscall(PM_PROC_NR, PM_SETEUID, &m));
}

View file

@ -12,6 +12,7 @@
#include <sys/shm.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#ifdef __weak_alias
__weak_alias(shmat, _shmat)
@ -36,6 +37,7 @@ void *shmat(int shmid, const void *shmaddr, int shmflg)
return NULL;
}
memset(&m, 0, sizeof(m));
m.SHMAT_ID = shmid;
m.SHMAT_ADDR = (long) shmaddr;
m.SHMAT_FLAG = shmflg;
@ -57,6 +59,7 @@ int shmdt(const void *shmaddr)
return -1;
}
memset(&m, 0, sizeof(m));
m.SHMDT_ADDR = (long) shmaddr;
return _syscall(ipc_pt, IPC_SHMDT, &m);

View file

@ -11,6 +11,7 @@
#include <sys/shm.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
static int get_ipc_endpt(endpoint_t *pt)
{
@ -29,6 +30,7 @@ int shmctl(int shmid, int cmd, struct shmid_ds *buf)
return -1;
}
memset(&m, 0, sizeof(m));
m.SHMCTL_ID = shmid;
m.SHMCTL_CMD = cmd;
m.SHMCTL_BUF = (long) buf;

View file

@ -10,7 +10,7 @@
#include <sys/shm.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#ifdef __weak_alias
__weak_alias(shmget, _shmget)
@ -33,6 +33,7 @@ int shmget(key_t key, size_t size, int shmflg)
return -1;
}
memset(&m, 0, sizeof(m));
m.SHMGET_KEY = key;
m.SHMGET_SIZE = size;
m.SHMGET_FLAG = shmflg;

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <signal.h>
int __sigreturn(void);
@ -10,13 +11,13 @@ int sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
{
message m;
m.m1_i2 = sig;
memset(&m, 0, sizeof(m));
m.PM_SIG_NR = sig;
m.PM_SIG_ACT = (char *) __UNCONST(act);
m.PM_SIG_OACT = (char *) oact;
m.PM_SIG_RET = (char *) __sigreturn;
m.m1_p1 = (char *) __UNCONST(act);
m.m1_p2 = (char *) oact;
m.m1_p3 = (char *) __sigreturn;
return(_syscall(PM_PROC_NR, SIGACTION, &m));
return(_syscall(PM_PROC_NR, PM_SIGACTION, &m));
}
#if defined(__minix) && defined(__weak_alias)

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <signal.h>
int sigpending(set)
@ -9,8 +10,9 @@ sigset_t *set;
{
message m;
if (_syscall(PM_PROC_NR, SIGPENDING, &m) < 0) return(-1);
*set = (sigset_t) m.m2_l1;
memset(&m, 0, sizeof(m));
if (_syscall(PM_PROC_NR, PM_SIGPENDING, &m) < 0) return(-1);
*set = (sigset_t) m.PM_SIG_SET;
return(m.m_type);
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <signal.h>
int sigprocmask(how, set, oset)
@ -11,15 +12,16 @@ sigset_t *oset;
{
message m;
memset(&m, 0, sizeof(m));
if (set == (sigset_t *) NULL) {
m.m2_i1 = SIG_INQUIRE;
m.m2_l1 = 0;
m.PM_SIG_HOW = SIG_INQUIRE;
m.PM_SIG_SET = 0;
} else {
m.m2_i1 = how;
m.m2_l1 = (long) *set;
m.PM_SIG_HOW = how;
m.PM_SIG_SET = (long) *set;
}
if (_syscall(PM_PROC_NR, SIGPROCMASK, &m) < 0) return(-1);
if (oset != (sigset_t *) NULL) *oset = (sigset_t) (m.m2_l1);
if (_syscall(PM_PROC_NR, PM_SIGPROCMASK, &m) < 0) return(-1);
if (oset != (sigset_t *) NULL) *oset = (sigset_t) (m.PM_SIG_SET);
return(m.m_type);
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <signal.h>
#include <sys/signal.h>
@ -25,8 +26,8 @@ register struct sigcontext *scp;
sigfillset(&set); /* splhi */
sigprocmask(SIG_SETMASK, &set, (sigset_t *) NULL);
m.m2_l1 = scp->sc_mask;
m.m2_i2 = scp->sc_flags;
m.m2_p1 = (char *) scp;
return(_syscall(PM_PROC_NR, SIGRETURN, &m)); /* normally this doesn't return */
memset(&m, 0, sizeof(m));
m.PM_SIG_SET = scp->sc_mask;
m.PM_SIG_CTX = (char *) scp;
return(_syscall(PM_PROC_NR, PM_SIGRETURN, &m)); /* normally doesn't return */
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <signal.h>
int sigsuspend(set)
@ -9,8 +10,9 @@ const sigset_t *set;
{
message m;
m.m2_l1 = (long) *set;
return(_syscall(PM_PROC_NR, SIGSUSPEND, &m));
memset(&m, 0, sizeof(m));
m.PM_SIG_SET = (long) *set;
return(_syscall(PM_PROC_NR, PM_SIGSUSPEND, &m));
}
#if defined(__minix) && defined(__weak_alias)

View file

@ -7,6 +7,7 @@ __weak_alias(sprofile, _sprofile)
#endif
#include <lib.h>
#include <string.h>
#include <minix/profile.h>
int sprofile(int action,
@ -18,6 +19,7 @@ int sprofile(int action,
{
message m;
memset(&m, 0, sizeof(m));
m.PROF_ACTION = action;
m.PROF_MEM_SIZE = size;
m.PROF_FREQ = freq;
@ -25,6 +27,6 @@ int sprofile(int action,
m.PROF_CTL_PTR = (void *) ctl_ptr;
m.PROF_MEM_PTR = (void *) mem_ptr;
return _syscall(PM_PROC_NR, SPROF, &m);
return _syscall(PM_PROC_NR, PM_SPROF, &m);
}

View file

@ -23,11 +23,12 @@ int stat(const char *name, struct stat *buffer)
{
message m;
m.m1_i1 = strlen(name) + 1;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) buffer;
memset(&m, 0, sizeof(m));
m.VFS_STAT_LEN = strlen(name) + 1;
m.VFS_STAT_NAME = (char *) __UNCONST(name);
m.VFS_STAT_BUF = (char *) buffer;
return _syscall(VFS_PROC_NR, STAT, &m);
return _syscall(VFS_PROC_NR, VFS_STAT, &m);
}
int _fstat(int fd, struct stat *buffer) { return fstat(fd, buffer); }
@ -36,10 +37,11 @@ int fstat(int fd, struct stat *buffer)
{
message m;
m.m1_i1 = fd;
m.m1_p1 = (char *) buffer;
memset(&m, 0, sizeof(m));
m.VFS_FSTAT_FD = fd;
m.VFS_FSTAT_BUF = (char *) buffer;
return _syscall(VFS_PROC_NR, FSTAT, &m);
return _syscall(VFS_PROC_NR, VFS_FSTAT, &m);
}
int _lstat(const char *name, struct stat *buffer) { return lstat(name, buffer); }
@ -48,9 +50,10 @@ int lstat(const char *name, struct stat *buffer)
{
message m;
m.m1_i1 = strlen(name) + 1;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) buffer;
memset(&m, 0, sizeof(m));
m.VFS_STAT_LEN = strlen(name) + 1;
m.VFS_STAT_NAME = (char *) __UNCONST(name);
m.VFS_STAT_BUF = (char *) buffer;
return _syscall(VFS_PROC_NR, LSTAT, &m);
return _syscall(VFS_PROC_NR, VFS_LSTAT, &m);
}

View file

@ -14,11 +14,12 @@ int statvfs1(const char *name, struct statvfs *buffer, int flags)
{
message m;
memset(&m, 0, sizeof(m));
m.VFS_STATVFS1_LEN = strlen(name) + 1;
m.VFS_STATVFS1_NAME = (char *) __UNCONST(name);
m.VFS_STATVFS1_BUF = (char *) buffer;
m.VFS_STATVFS1_FLAGS = flags;
return(_syscall(VFS_PROC_NR, STATVFS1, &m));
return(_syscall(VFS_PROC_NR, VFS_STATVFS1, &m));
}
int statvfs(const char *name, struct statvfs *buffer)

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <time.h>
#ifdef __weak_alias
@ -12,6 +13,7 @@ int stime(time_t *top)
{
message m;
m.m2_l1 = (long)*top;
return(_syscall(PM_PROC_NR, STIME, &m));
memset(&m, 0, sizeof(m));
m.PM_TIME_SEC = (long)*top;
return(_syscall(PM_PROC_NR, PM_STIME, &m));
}

View file

@ -3,14 +3,16 @@
*/
#include <lib.h>
#include <stdio.h>
#include <string.h>
#include <sys/svrctl.h>
int svrctl(int request, void *argp)
{
message m;
m.m2_i1 = request;
m.m2_p1 = argp;
memset(&m, 0, sizeof(m));
m.SVRCTL_REQ = request;
m.SVRCTL_ARG = argp;
switch ((request >> 8) & 0xFF) {
case 'M':

View file

@ -13,9 +13,10 @@ int symlink(const char *name, const char *name2)
{
message m;
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = strlen(name2) + 1;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) __UNCONST(name2);
return(_syscall(VFS_PROC_NR, SYMLINK, &m));
memset(&m, 0, sizeof(m));
m.VFS_LINK_LEN1 = strlen(name) + 1;
m.VFS_LINK_LEN2 = strlen(name2) + 1;
m.VFS_LINK_NAME1 = (char *) __UNCONST(name);
m.VFS_LINK_NAME2 = (char *) __UNCONST(name2);
return(_syscall(VFS_PROC_NR, VFS_SYMLINK, &m));
}

View file

@ -2,15 +2,18 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#ifdef __weak_alias
__weak_alias(sync, _sync)
#endif
#include <unistd.h>
void sync()
void sync(void)
{
message m;
(void)(_syscall(VFS_PROC_NR, SYNC, &m));
memset(&m, 0, sizeof(m));
(void)(_syscall(VFS_PROC_NR, VFS_SYNC, &m));
}

View file

@ -5,22 +5,20 @@
#include <sys/cdefs.h>
#include "namespace.h"
#include <lib.h>
#include <string.h>
#include <sys/utsname.h>
int sysuname(int req, int field, char *value, size_t len)
{
message m;
m.m1_i1 = req;
m.m1_i2 = field;
m.m1_i3 = len;
m.m1_p1 = value;
memset(&m, 0, sizeof(m));
m.PM_SYSUNAME_REQ = req;
m.PM_SYSUNAME_FIELD = field;
m.PM_SYSUNAME_LEN = len;
m.PM_SYSUNAME_VALUE = value;
/* Clear unused fields */
m.m1_p2 = NULL;
m.m1_p3 = NULL;
return _syscall(PM_PROC_NR, SYSUNAME, &m);
return _syscall(PM_PROC_NR, PM_SYSUNAME, &m);
}
/*

View file

@ -14,10 +14,11 @@ int truncate(const char *_path, off_t _length)
{
message m;
m.m2_p1 = (char *) __UNCONST(_path);
m.m2_i1 = strlen(_path)+1;
m.m2_l1 = ex64lo(_length);
m.m2_l2 = ex64hi(_length);
memset(&m, 0, sizeof(m));
m.VFS_TRUNCATE_NAME = (char *) __UNCONST(_path);
m.VFS_TRUNCATE_LEN = strlen(_path)+1;
m.VFS_TRUNCATE_OFF_LO = ex64lo(_length);
m.VFS_TRUNCATE_OFF_HI = ex64hi(_length);
return(_syscall(VFS_PROC_NR, TRUNCATE, &m));
return(_syscall(VFS_PROC_NR, VFS_TRUNCATE, &m));
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <sys/stat.h>
#ifdef __weak_alias
@ -12,6 +13,7 @@ mode_t umask(mode_t complmode)
{
message m;
m.m1_i1 = complmode;
return( (mode_t) _syscall(VFS_PROC_NR, UMASK, &m));
memset(&m, 0, sizeof(m));
m.VFS_UMASK_MASK = complmode;
return( (mode_t) _syscall(VFS_PROC_NR, VFS_UMASK, &m));
}

View file

@ -2,6 +2,7 @@
#include <lib.h>
#include "namespace.h"
#include <string.h>
#include <unistd.h>
#ifdef __weak_alias
@ -13,6 +14,7 @@ const char *name;
{
message m;
memset(&m, 0, sizeof(m));
_loadname(name, &m);
return(_syscall(VFS_PROC_NR, UNLINK, &m));
return(_syscall(VFS_PROC_NR, VFS_UNLINK, &m));
}

Some files were not shown because too many files have changed in this diff Show more