libsys: various updates

- move system calls for use by services from libminlib into libsys;
- move srv_fork(2) and srv_kill(2) from RS and into libsys;
- replace getprocnr(2) with sef_self(3);
- rename previous getnprocnr(2) to getprocnr(2);
- clean up getepinfo(2);
- change all libsys calls that used _syscall to use _taskcall, so as
  to avoid going through errno to pass errors; this is already how
  most calls work anyway, and many of the calls previously using
  _syscall were already assumed to return the actual error;
- initialize request messages to zero, for future compatibility
  (note that this does not include PCI calls, which are in need of a
  much bigger overhaul, nor kernel calls);
- clean up more of dead DS code as a side effect.

Change-Id: I8788f54c68598fcf58e23486e270c2d749780ebb
This commit is contained in:
David van Moolenbroek
2013-11-03 22:33:44 +01:00
committed by Lionel Sambuc
parent efd3487bc5
commit 80bd109cd3
82 changed files with 477 additions and 544 deletions

View File

@@ -36,16 +36,6 @@ void _loadname(const char *_name, message *_msgptr);
int _len(const char *_s);
void _begsig(int _dummy);
int getprocnr(void);
int getnprocnr(pid_t pid);
int getpprocnr(void);
int _pm_findproc(char *proc_name, int *proc_nr);
int mapdriver(char *label, int major);
pid_t getnpid(endpoint_t proc_ep);
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);
ssize_t pread64(int fd, void *buf, size_t count, u64_t where);
ssize_t pwrite64(int fd, const void *buf, size_t count, u64_t where);

View File

@@ -91,7 +91,6 @@
#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 GETEPINFO_O 107 /* to PM: get pid/uid/gid of an endpoint */
#define UTIMENS 108 /* to FS: [f]utimens(); also [fl]utimes */
#define FCNTL 109 /* to VFS */
#define TRUNCATE 110 /* to VFS */

View File

@@ -895,6 +895,20 @@
# 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 */

View File

@@ -23,9 +23,6 @@
#define DSF_OVERWRITE 0x01000 /* overwrite if entry exists */
#define DSF_INITIAL 0x02000 /* check subscriptions immediately */
#define DSMF_COPY_MAPPED 0x20000 /* copy mapped memory range */
#define DSMF_COPY_SNAPSHOT 0x40000 /* copy snapshot */
/* DS constants. */
#define DS_MAX_KEYLEN 80 /* Max length of a key, including '\0'. */

View File

@@ -8,6 +8,7 @@
/* SEF entry points for system processes. */
void sef_startup(void);
int sef_receive_status(endpoint_t src, message *m_ptr, int *status_ptr);
endpoint_t sef_self(void);
void sef_cancel(void);
void sef_exit(int status);
#define sef_receive(src, m_ptr) sef_receive_status(src, m_ptr, NULL)

View File

@@ -26,7 +26,6 @@ struct rusage;
*==========================================================================*/
int _taskcall(endpoint_t who, int syscallnr, message *msgptr);
int _kernel_call(int syscallnr, message *msgptr);
int _sendcall(endpoint_t who, int type, message *msgptr);
int sys_abort(int how);
int sys_enable_iop(endpoint_t proc_ep);
@@ -261,5 +260,16 @@ int sys_setmcontext(endpoint_t proc, mcontext_t *mcp);
/* input */
int tty_input_inject(int type, int code, int val);
/* Miscellaneous calls from servers and drivers. */
pid_t srv_fork(uid_t reuid, gid_t regid);
int srv_kill(pid_t pid, int sig);
int getprocnr(pid_t pid, endpoint_t *proc_ep);
int mapdriver(char *label, devmajor_t major);
pid_t getnpid(endpoint_t proc_ep);
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);
#endif /* _SYSLIB_H */