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)
81 printf("Unimplemented: fork()\n");
86 int daemon(int nochdir, int noclose)
88 printf("Unimplemented: daemon(%d, %d)\n", nochdir, noclose);
93 int kill(pid_t pid, int sig)
95 printf("Unimplemented: kill(%d, %d)\n", pid, sig);
102 int timer_delete(timer_t timer_id)
104 printf("Unimplemented: %s(timer_id)\n", __func__);
110 int timer_gettime(timer_t timer_id, struct itimerspec *setting)
112 printf("Unimplemented: %s(timer_id)\n", __func__);
119 int timer_settime(timer_t timer_id, int __flags,
120 __const struct itimerspec *__restrict __value,
121 struct itimerspec *__restrict __ovalue)
123 printf("Unimplemented: %s(timer_id)\n", __func__);
132 int timer_create (clockid_t __clock_id,
133 struct sigevent *__restrict __evp,
134 timer_t *__restrict __timerid)
136 printf("Unimplemented: %s(clock_id)\n", __func__);
144 #include <sys/times.h>
146 clock_t times(struct tms *buf)
148 // some arbitrary values
149 buf->tms_utime = (clock_t)l4re_kip()->clock;
153 return (clock_t)l4re_kip()->clock;
158 char *ptsname(int fd);
159 char *ptsname(int fd)
161 printf("unimplemented: %s(%d)\n", __func__, fd);
162 return "unimplemented-ptsname";
167 int setuid(uid_t uid)
169 printf("Unimplemented: %s(%d)\n", __func__, uid);
175 printf("Unimplemented: %s()\n", __func__);
179 int setgid(gid_t gid)
181 printf("Unimplemented: %s(%d)\n", __func__, gid);
186 mode_t umask(mode_t mask)
188 printf("Unimplemented: %s(%d)\n", __func__, mask);
192 int pipe(int pipefd[2])
194 printf("Unimplemented: %s()\n", __func__);
195 printf(" Caller %p\n", __builtin_return_address(0));
201 #include <sys/wait.h>
202 pid_t waitpid(pid_t pid, int *status, int options)
204 printf("Unimplemented: %s(%d)\n", __func__, pid);
211 FILE *popen(const char *command, const char *type)
213 printf("Unimplemented: %s(%s, %s)\n", __func__, command, type);
217 int pclose(FILE *stream)
219 printf("Unimplemented: %s(..)\n", __func__);
226 int execv(const char *path, char *const argv[])
228 printf("Unimplemented: %s(%s)\n", __func__, path);
234 int execvp(const char *file, char *const argv[])
236 printf("Unimplemented: %s(%s)\n", __func__, file);
242 int execve(const char *filename, char *const argv[],
245 printf("Unimplemented: %s(%s)\n", __func__, filename);
252 int execl(const char *path, const char *arg, ...)
254 printf("Unimplemented: %s(%s)\n", __func__, path);
260 int execlp(const char *file, const char *arg, ...)
262 printf("Unimplemented: %s(%s)\n", __func__, file);
268 long pathconf(const char *path, int name)
270 printf("Unimplemented: %s(%s, %d)\n", __func__, path, name);
280 int cfsetispeed(struct termios *termios_p, speed_t speed)
282 printf("Unimplemented: %s()\n", __func__);
283 (void)termios_p; (void)speed;
288 int cfsetospeed(struct termios *termios_p, speed_t speed)
290 printf("Unimplemented: %s()\n", __func__);
291 (void)termios_p; (void)speed;
296 int tcsendbreak(int fd, int duration)
298 printf("Unimplemented: %s()\n", __func__);
299 (void)fd; (void)duration;
304 void cfmakeraw(struct termios *termios_p)
306 printf("Unimplemented: %s()\n", __func__);
310 int openpty(int *amaster, int *aslave, char *name,
311 struct termios *termp, struct winsize *winp)
313 printf("Unimplemented: %s(.., .., %s, ..)\n", __func__, name);
314 (void)amaster; (void)aslave;
315 (void)termp; (void)winp;
324 uid_t getuid(void) { return 123; }
325 uid_t getgid(void) { return 123; }
326 uid_t geteuid(void) { return 123; }
327 uid_t getegid(void) { return 123; }
328 pid_t getpgrp(void) { return 7; }
329 pid_t getppid(void) { return 122; }
331 int setpgid(pid_t pid, pid_t pgid)
333 printf("Unimplemented: %s(%d, %d)\n", __func__, pid, pgid);
339 int getgroups(int size, gid_t list[])
341 (void)size; (void)list;
342 printf("Unimplemented: %s()\n", __func__);
347 pid_t wait3(int *status, int options, struct rusage *rusage)
349 printf("Unimplemented: %s(%p, %d, %p)\n", __func__,
350 status, options, rusage);
358 #include <sys/types.h>
360 int getrlimit(__rlimit_resource_t resource, struct rlimit *rlim)
362 printf("Unimplemented: %s(%d, %p)\n", __func__, resource, rlim);
367 int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlim)
369 printf("Unimplemented: %s(%d, %p)\n", __func__,
375 #ifdef __USE_LARGEFILE64
376 int setrlimit64(__rlimit_resource_t resource, const struct rlimit64 *rlim)
378 printf("Unimplemented: %s(%d, %p)\n", __func__,
384 #warning No large-file support enabled?
387 char *getpass( const char *prompt)
389 printf("This would be the prompt: '%s', delivering something static\n",
391 return "THE FAMOUS PASSWORD";
394 int system(const char *path)
403 int uname(struct utsname *u)
405 strncpy(u->sysname, "Fiasco.OC/L4Re", sizeof(u->sysname));
406 u->sysname[sizeof(u->sysname) - 1] = 0;
408 strncpy(u->nodename, "localhost", sizeof(u->nodename));
409 u->nodename[sizeof(u->nodename) - 1] = 0;
411 strncpy(u->release, "L4Re", sizeof(u->release));
412 u->release[sizeof(u->release) - 1] = 0;
414 strncpy(u->version, "0.x", sizeof(u->version));
415 u->version[sizeof(u->version) - 1] = 0;
418 strncpy(u->machine, "arm", sizeof(u->machine));
419 #elif defined(ARCH_x86)
420 strncpy(u->machine, "i686", sizeof(u->machine));
421 #elif defined(ARCH_amd64)
422 strncpy(u->machine, "x86_64", sizeof(u->machine));
423 #elif defined(ARCH_ppc32)
424 strncpy(u->machine, "ppc32", sizeof(u->machine));
426 #error Add your arch.
428 u->machine[sizeof(u->machine) - 1] = 0;
435 int shmget(key_t key, size_t size, int shmflg)
437 printf("%s(%d, %zd, %d)\n", __func__, key, size, shmflg);
442 void *shmat(int shmid, const void *shmaddr, int shmflg)
444 printf("%s(%d, %p, %d)\n", __func__, shmid, shmaddr, shmflg);
449 int shmctl(int shmid, int cmd, struct shmid_ds *buf)
451 printf("%s(%d, %d, %p)\n", __func__, shmid, cmd, buf);
456 int shmdt(const void *shmaddr)
458 printf("%s(%p)\n", __func__, shmaddr);