|
|
1.1 root 1: #include <errno.h>
2:
3: #include <linux/sched.h>
4: #include <linux/tty.h>
5: #include <linux/kernel.h>
6: #include <asm/segment.h>
7: #include <sys/times.h>
8: #include <sys/utsname.h>
9:
10: int sys_ftime()
11: {
12: return -ENOSYS;
13: }
14:
15: int sys_mknod()
16: {
17: return -ENOSYS;
18: }
19:
20: int sys_break()
21: {
22: return -ENOSYS;
23: }
24:
25: int sys_mount()
26: {
27: return -ENOSYS;
28: }
29:
30: int sys_umount()
31: {
32: return -ENOSYS;
33: }
34:
35: int sys_ustat(int dev,struct ustat * ubuf)
36: {
37: return -1;
38: }
39:
40: int sys_ptrace()
41: {
42: return -ENOSYS;
43: }
44:
45: int sys_stty()
46: {
47: return -ENOSYS;
48: }
49:
50: int sys_gtty()
51: {
52: return -ENOSYS;
53: }
54:
55: int sys_rename()
56: {
57: return -ENOSYS;
58: }
59:
60: int sys_prof()
61: {
62: return -ENOSYS;
63: }
64:
65: int sys_setgid(int gid)
66: {
67: if (current->euid && current->uid)
68: if (current->gid==gid || current->sgid==gid)
69: current->egid=gid;
70: else
71: return -EPERM;
72: else
73: current->gid=current->egid=gid;
74: return 0;
75: }
76:
77: int sys_acct()
78: {
79: return -ENOSYS;
80: }
81:
82: int sys_phys()
83: {
84: return -ENOSYS;
85: }
86:
87: int sys_lock()
88: {
89: return -ENOSYS;
90: }
91:
92: int sys_mpx()
93: {
94: return -ENOSYS;
95: }
96:
97: int sys_ulimit()
98: {
99: return -ENOSYS;
100: }
101:
102: int sys_time(long * tloc)
103: {
104: int i;
105:
106: i = CURRENT_TIME;
107: if (tloc) {
108: verify_area(tloc,4);
109: put_fs_long(i,(unsigned long *)tloc);
110: }
111: return i;
112: }
113:
114: int sys_setuid(int uid)
115: {
116: if (current->euid && current->uid)
117: if (uid==current->uid || current->suid==current->uid)
118: current->euid=uid;
119: else
120: return -EPERM;
121: else
122: current->euid=current->uid=uid;
123: return 0;
124: }
125:
126: int sys_stime(long * tptr)
127: {
128: if (current->euid && current->uid)
129: return -1;
130: startup_time = get_fs_long((unsigned long *)tptr) - jiffies/HZ;
131: return 0;
132: }
133:
134: int sys_times(struct tms * tbuf)
135: {
136: if (!tbuf)
137: return jiffies;
138: verify_area(tbuf,sizeof *tbuf);
139: put_fs_long(current->utime,(unsigned long *)&tbuf->tms_utime);
140: put_fs_long(current->stime,(unsigned long *)&tbuf->tms_stime);
141: put_fs_long(current->cutime,(unsigned long *)&tbuf->tms_cutime);
142: put_fs_long(current->cstime,(unsigned long *)&tbuf->tms_cstime);
143: return jiffies;
144: }
145:
146: int sys_brk(unsigned long end_data_seg)
147: {
148: if (end_data_seg >= current->end_code &&
149: end_data_seg < current->start_stack - 16384)
150: current->brk = end_data_seg;
151: return current->brk;
152: }
153:
154: /*
155: * This needs some heave checking ...
156: * I just haven't get the stomach for it. I also don't fully
157: * understand sessions/pgrp etc. Let somebody who does explain it.
158: */
159: int sys_setpgid(int pid, int pgid)
160: {
161: int i;
162:
163: if (!pid)
164: pid = current->pid;
165: if (!pgid)
166: pgid = pid;
167: for (i=0 ; i<NR_TASKS ; i++)
168: if (task[i] && task[i]->pid==pid) {
169: if (task[i]->leader)
170: return -EPERM;
171: if (task[i]->session != current->session)
172: return -EPERM;
173: task[i]->pgrp = pgid;
174: return 0;
175: }
176: return -ESRCH;
177: }
178:
179: int sys_getpgrp(void)
180: {
181: return current->pgrp;
182: }
183:
184: int sys_setsid(void)
185: {
186: if (current->uid && current->euid)
187: return -EPERM;
188: if (current->leader)
189: return -EPERM;
190: current->leader = 1;
191: current->session = current->pgrp = current->pid;
192: current->tty = -1;
193: return current->pgrp;
194: }
195:
196: int sys_uname(struct utsname * name)
197: {
198: static struct utsname thisname = {
199: "linux .0","nodename","release ","version ","machine "
200: };
201: int i;
202:
203: if (!name) return -1;
204: verify_area(name,sizeof *name);
205: for(i=0;i<sizeof *name;i++)
206: put_fs_byte(((char *) &thisname)[i],i+(char *) name);
207: return (0);
208: }
209:
210: int sys_umask(int mask)
211: {
212: int old = current->umask;
213:
214: current->umask = mask & 0777;
215: return (old);
216: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.