2 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3 * Alexander Warg <warg@os.inf.tu-dresden.de>
4 * economic rights: Technische Universität Dresden (Germany)
5 * This file is part of TUD:OS and distributed under the terms of the
6 * GNU Lesser General Public License 2.1.
7 * Please see the COPYING-LGPL-2.1 file for details.
19 #include <l4/sys/consts.h>
20 #include <l4/re/env.h>
21 #include <sys/utsname.h>
22 #include <sys/resource.h>
25 int __ctype_b_loc(void);
26 int __sched_cpucount(void);
27 int getloadavg(double loadavg[], int nelem);
30 int __ctype_b_loc(void)
32 printf("%s: implement me \n", __func__);
36 int __sched_cpucount(void)
38 return 4; // just some number
41 long sysconf(int name)
45 case _SC_NPROCESSORS_ONLN:
46 return __sched_cpucount();
51 case _SC_MONOTONIC_CLOCK:
56 printf("%s: unknown command, name=%d\n", __func__, name);
60 int getloadavg(double loadavg[], int nelem)
76 printf("Unimplemented: fork()\n");
81 int daemon(int nochdir, int noclose)
83 printf("Unimplemented: daemon(%d, %d)\n", nochdir, noclose);
88 int kill(pid_t pid, int sig)
90 printf("Unimplemented: kill(%d, %d)\n", pid, sig);
97 int timer_delete(timer_t timer_id)
99 printf("Unimplemented: %s(timer_id)\n", __func__);
105 int timer_gettime(timer_t timer_id, struct itimerspec *setting)
107 printf("Unimplemented: %s(timer_id)\n", __func__);
114 int timer_settime(timer_t timer_id, int __flags,
115 __const struct itimerspec *__restrict __value,
116 struct itimerspec *__restrict __ovalue)
118 printf("Unimplemented: %s(timer_id)\n", __func__);
127 int timer_create (clockid_t __clock_id,
128 struct sigevent *__restrict __evp,
129 timer_t *__restrict __timerid)
131 printf("Unimplemented: %s(clock_id)\n", __func__);
139 #include <sys/times.h>
141 clock_t times(struct tms *buf)
143 // some arbitrary values
144 buf->tms_utime = (clock_t)l4_kip_clock(l4re_kip());
148 return (clock_t)l4_kip_clock(l4re_kip());
153 char *ptsname(int fd);
154 char *ptsname(int fd)
156 printf("unimplemented: %s(%d)\n", __func__, fd);
157 return "unimplemented-ptsname";
162 int setuid(uid_t uid)
164 printf("Unimplemented: %s(%d)\n", __func__, uid);
170 printf("Unimplemented: %s()\n", __func__);
174 int setgid(gid_t gid)
176 printf("Unimplemented: %s(%d)\n", __func__, gid);
181 mode_t umask(mode_t mask)
183 printf("Unimplemented: %s(%d)\n", __func__, mask);
187 int pipe(int pipefd[2])
189 printf("Unimplemented: %s()\n", __func__);
190 printf(" Caller %p\n", __builtin_return_address(0));
196 #include <sys/wait.h>
197 pid_t waitpid(pid_t pid, int *status, int options)
199 printf("Unimplemented: %s(%d)\n", __func__, pid);
206 FILE *popen(const char *command, const char *type)
208 printf("Unimplemented: %s(%s, %s)\n", __func__, command, type);
212 int pclose(FILE *stream)
214 printf("Unimplemented: %s(..)\n", __func__);
221 int execv(const char *path, char *const argv[])
223 printf("Unimplemented: %s(%s)\n", __func__, path);
229 int execvp(const char *file, char *const argv[])
231 printf("Unimplemented: %s(%s)\n", __func__, file);
237 int execve(const char *filename, char *const argv[],
240 printf("Unimplemented: %s(%s)\n", __func__, filename);
247 int execl(const char *path, const char *arg, ...)
249 printf("Unimplemented: %s(%s)\n", __func__, path);
255 int execlp(const char *file, const char *arg, ...)
257 printf("Unimplemented: %s(%s)\n", __func__, file);
263 long fpathconf(int fd, int name)
265 printf("Unimplemented: %s(%d, %d)\n", __func__, fd, name);
270 long pathconf(const char *path, int name)
272 printf("Unimplemented: %s(%s, %d)\n", __func__, path, name);
283 int tcsendbreak(int fd, int duration)
285 printf("Unimplemented: %s()\n", __func__);
286 (void)fd; (void)duration;
291 void cfmakeraw(struct termios *termios_p)
293 printf("Unimplemented: %s()\n", __func__);
297 int openpty(int *amaster, int *aslave, char *name,
298 struct termios *termp, struct winsize *winp)
300 printf("Unimplemented: %s(.., .., %s, ..)\n", __func__, name);
301 (void)amaster; (void)aslave;
302 (void)termp; (void)winp;
311 uid_t getuid(void) { return 123; }
312 uid_t getgid(void) { return 123; }
313 uid_t geteuid(void) { return 123; }
314 uid_t getegid(void) { return 123; }
315 pid_t getpgrp(void) { return 7; }
316 pid_t getppid(void) { return 122; }
318 int setpgid(pid_t pid, pid_t pgid)
320 printf("Unimplemented: %s(%d, %d)\n", __func__, pid, pgid);
326 int getgroups(int size, gid_t list[])
328 (void)size; (void)list;
329 printf("Unimplemented: %s()\n", __func__);
334 pid_t wait3(int *status, int options, struct rusage *rusage)
336 printf("Unimplemented: %s(%p, %d, %p)\n", __func__,
337 status, options, rusage);
345 #include <sys/types.h>
347 int getrlimit(__rlimit_resource_t resource, struct rlimit *rlim)
349 printf("Unimplemented: %s(%d, %p)\n", __func__, resource, rlim);
354 int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlim)
356 printf("Unimplemented: %s(%d, %p)\n", __func__,
362 #ifdef __USE_LARGEFILE64
363 int setrlimit64(__rlimit_resource_t resource, const struct rlimit64 *rlim)
365 printf("Unimplemented: %s(%d, %p)\n", __func__,
371 #warning No large-file support enabled?
374 char *getpass( const char *prompt)
376 printf("This would be the prompt: '%s', delivering something static\n",
378 return "THE FAMOUS PASSWORD";
381 int system(const char *path)
390 int uname(struct utsname *u)
392 strncpy(u->sysname, "Fiasco.OC/L4Re", sizeof(u->sysname));
393 u->sysname[sizeof(u->sysname) - 1] = 0;
395 strncpy(u->nodename, "localhost", sizeof(u->nodename));
396 u->nodename[sizeof(u->nodename) - 1] = 0;
398 strncpy(u->release, "L4Re", sizeof(u->release));
399 u->release[sizeof(u->release) - 1] = 0;
401 strncpy(u->version, "0.x", sizeof(u->version));
402 u->version[sizeof(u->version) - 1] = 0;
405 strncpy(u->machine, "arm", sizeof(u->machine));
406 #elif defined(ARCH_x86)
407 strncpy(u->machine, "i686", sizeof(u->machine));
408 #elif defined(ARCH_amd64)
409 strncpy(u->machine, "x86_64", sizeof(u->machine));
410 #elif defined(ARCH_ppc32)
411 strncpy(u->machine, "ppc32", sizeof(u->machine));
412 #elif defined(ARCH_sparc)
413 strncpy(u->machine, "sparcv8", sizeof(u->machine));
415 #error Add your arch.
417 u->machine[sizeof(u->machine) - 1] = 0;
424 int shmget(key_t key, size_t size, int shmflg)
426 printf("%s(%d, %zd, %d)\n", __func__, key, size, shmflg);
431 void *shmat(int shmid, const void *shmaddr, int shmflg)
433 printf("%s(%d, %p, %d)\n", __func__, shmid, shmaddr, shmflg);
438 int shmctl(int shmid, int cmd, struct shmid_ds *buf)
440 printf("%s(%d, %d, %p)\n", __func__, shmid, cmd, buf);
445 int shmdt(const void *shmaddr)
447 printf("%s(%p)\n", __func__, shmaddr);
452 int getrusage(int who, struct rusage* usage)
454 (void)who; (void)usage;