kernel/elf: structures must be packed
[meinos.git] / apps / include / proc.h
blob4e5d057fec9f630eec1e9f279c9c9dcbef4be53e
1 /*
2 meinOS - A unix-like x86 microkernel operating system
3 Copyright (C) 2008 Janosch Gräf <janosch.graef@gmx.net>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef _PROC_H_
20 #define _PROC_H_
22 #include <sys/types.h>
23 #include <syscall.h>
24 #include <signal.h>
26 static __inline__ pid_t proc_create(char *name,uid_t uid,gid_t gid,pid_t parent) {
27 return syscall_call(SYSCALL_PROC_CREATE,4,name,uid,gid,parent);
30 static __inline__ int proc_destroy(pid_t pid) {
31 return syscall_call(SYSCALL_PROC_DESTROY,1,pid);
34 static __inline__ int proc_getvar(pid_t pid,int var) {
35 return syscall_call(SYSCALL_PROC_GETVAR,1,pid);
38 static __inline__ void proc_setvar(pid_t pid,int var) {
39 syscall_call(SYSCALL_PROC_SETVAR,2,pid,var);
42 static __inline__ void proc_setname(pid_t pid,const char *name) {
43 syscall_call(SYSCALL_PROC_SETNAME,2,pid,name);
46 static __inline__ int proc_memmap(pid_t pid,void *virt,void *phys,int writable,int swappable,int cow) {
47 return syscall_call(SYSCALL_PROC_MEMMAP,6,pid,virt,phys,writable,swappable,cow);
50 static __inline__ int proc_memalloc(pid_t pid,void *virt,int writable,int swappable) {
51 return syscall_call(SYSCALL_PROC_MEMALLOC,4,pid,virt,writable,swappable);
54 static __inline__ int proc_memunmap(pid_t pid,void *virt) {
55 return syscall_call(SYSCALL_PROC_MEMMAP,2,pid,virt);
58 static __inline__ int proc_memfree(pid_t pid,void *virt) {
59 return syscall_call(SYSCALL_PROC_MEMFREE,2,pid,virt);
62 static __inline__ void *proc_memget(pid_t pid,void *virt,int *exists,int *writable,int *swappable,int *cow) {
63 return (void*)syscall_call(SYSCALL_PROC_MEMGET,6,pid,virt,exists,writable,swappable,cow);
66 static __inline__ int proc_system(pid_t pid,int system) {
67 return syscall_call(SYSCALL_PROC_SYSTEM,2,pid,system);
70 static __inline__ int proc_jump(pid_t pid,void *dest) {
71 return syscall_call(SYSCALL_PROC_JUMP,2,pid,dest);
74 static __inline__ int proc_createstack(pid_t pid) {
75 return syscall_call(SYSCALL_PROC_CREATESTACK,1,pid);
78 static __inline__ void proc_run(pid_t pid) {
79 kill(pid,SIGCONT);
82 static __inline__ void proc_stop(pid_t pid) {
83 kill(pid,SIGSTOP);
86 static inline pid_t getpidbyname(const char *name) {
87 return syscall_call(SYSCALL_PROC_GETPIDBYNAME,1,name);
90 static inline uid_t getuidbypid(pid_t pid) {
91 return syscall_call(SYSCALL_PROC_GETUID,1,pid);
94 static inline uid_t getgidbypid(pid_t pid) {
95 return syscall_call(SYSCALL_PROC_GETGID,1,pid);
98 static inline pid_t getppidbypid(pid_t pid) {
99 return syscall_call(SYSCALL_PROC_GETPARENT,1,pid);
102 static inline gid_t getpgidbypid(pid_t pid) {
103 return syscall_call(SYSCALL_PROC_GETGID,1,pid);
106 char *getname(pid_t pid);
108 #endif