[uClibc-cvs] uClibc/libc/sysdeps/linux/common __rt_sigtimedwait.c, NONE, 1.1 __socketcall.c, NONE, 1.1 __syscall_fcntl.c, NONE, 1.1 __syscall_fcntl64.c, NONE, 1.1 __syscall_ipc.c, NONE, 1.1 __syscall_rt_sigaction.c, NONE, 1.1 __syscall_sigaction.c, NONE, 1.1 access.c, NONE, 1.1 acct.c, NONE, 1.1 adjtimex.c, NONE, 1.1 alarm.c, NONE, 1.1 bdflush.c, NONE, 1.1 capget.c, NONE, 1.1 capset.c, NONE, 1.1 chdir.c, NONE, 1.1 chmod.c, NONE, 1.1 chown.c, NONE, 1.1 chroot.c, NONE, 1.1 close.c, NONE, 1.1 delete_module.c, NONE, 1.1 dup.c, NONE, 1.1 dup2.c, NONE, 1.1 execve.c, NONE, 1.1 fchdir.c, NONE, 1.1 fchmod.c, NONE, 1.1 fchown.c, NONE, 1.1 fdatasync.c, NONE, 1.1 flock.c, NONE, 1.1 fork.c, NONE, 1.1 fstat.c, NONE, 1.1 fstat64.c, NONE, 1.1 fstatfs.c, NONE, 1.1 fsync.c, NONE, 1.1 ftruncate.c, NONE, 1.1 get_kernel_syms.c, NONE, 1.1 getegid.c, NONE, 1.1 geteuid.c, NONE, 1.1 getgid.c, NONE, 1.1 getgroups.c, NONE, 1.1 getitimer.c, NONE, 1.1 getpgid.c, NONE, 1.1 getpgrp.c, NONE, 1.1 getpid.c, NONE, 1.1 getppid.c, NONE, 1.1 getpriority.c, NONE, 1.1 getresgid.c, NONE, 1.1 getresuid.c, NONE, 1.1 getrlimit.c, NONE, 1.1 getrusage.c, NONE, 1.1 getsid.c, NONE, 1.1 gettimeofday.c, NONE, 1.1 getuid.c, NONE, 1.1 init_module.c, NONE, 1.1 ioperm.c, NONE, 1.1 iopl.c, NONE, 1.1 kill.c, NONE, 1.1 klogctl.c, NONE, 1.1 lchown.c, NONE, 1.1 link.c, NONE, 1.1 lseek.c, NONE, 1.1 lstat.c, NONE, 1.1 lstat64.c, NONE, 1.1 madvise.c, NONE, 1.1 mkdir.c, NONE, 1.1 mknod.c, 1.3, 1.4 mlock.c, NONE, 1.1 mlockall.c, NONE, 1.1 mmap.c, NONE, 1.1 modify_ldt.c, NONE, 1.1 mount.c, NONE, 1.1 mprotect.c, NONE, 1.1 mremap.c, NONE, 1.1 msync.c, NONE, 1.1 munlock.c, NONE, 1.1 munlockall.c, NONE, 1.1 munmap.c, NONE, 1.1 nanosleep.c, NONE, 1.1 nice.c, NONE, 1.1 open.c, NONE, 1.1 pause.c, NONE, 1.1 personality.c, NONE, 1.1 pipe.c, NONE, 1.1 pivot_root.c, NONE, 1.1 prctl.c, NONE, 1.1 query_module.c, NONE, 1.1 quotactl.c, NONE, 1.1 read.c, NONE, 1.1 readlink.c, NONE, 1.1 readv.c, NONE, 1.1 reboot.c, NONE, 1.1 rename.c, NONE, 1.1 rmdir.c, NONE, 1.1 sched_get_priority_max.c, NONE, 1.1 sched_get_priority_min.c, NONE, 1.1 sched_getparam.c, NONE, 1.1 sched_getscheduler.c, NONE, 1.1 sched_rr_get_interval.c, NONE, 1.1 sched_setparam.c, NONE, 1.1 sched_setscheduler.c, NONE, 1.1 sched_yield.c, NONE, 1.1 select.c, NONE, 1.1 sendfile.c, NONE, 1.1 setdomainname.c, NONE, 1.1 setfsgid.c, NONE, 1.1 setfsuid.c, NONE, 1.1 setgid.c, NONE, 1.1 setgroups.c, NONE, 1.1 sethostname.c, NONE, 1.1 setitimer.c, NONE, 1.1 setpgid.c, NONE, 1.1 setpriority.c, NONE, 1.1 setregid.c, NONE, 1.1 setresgid.c, NONE, 1.1 setresuid.c, NONE, 1.1 setreuid.c, NONE, 1.1 setrlimit.c, NONE, 1.1 setsid.c, NONE, 1.1 settimeofday.c, NONE, 1.1 setuid.c, 1.2, 1.3 sigaltstack.c, NONE, 1.1 sigpending.c, NONE, 1.1 sigprocmask.c, NONE, 1.1 sigsuspend.c, NONE, 1.1 stat.c, NONE, 1.1 stat64.c, NONE, 1.1 statfs.c, NONE, 1.1 stime.c, NONE, 1.1 swapoff.c, NONE, 1.1 swapon.c, NONE, 1.1 symlink.c, NONE, 1.1 syscalls.h, NONE, 1.1 sysctl.c, NONE, 1.1 sysfs.c, NONE, 1.1 sysinfo.c, NONE, 1.1 time.c, NONE, 1.1 times.c, NONE, 1.1 truncate.c, NONE, 1.1 umask.c, NONE, 1.1 umount.c, NONE, 1.1 umount2.c, NONE, 1.1 uname.c, NONE, 1.1 unlink.c, NONE, 1.1 uselib.c, NONE, 1.1 ustat.c, NONE, 1.1 utime.c, NONE, 1.1 utimes.c, NONE, 1.1 vhangup.c, NONE, 1.1 wait4.c, NONE, 1.1 write.c, NONE, 1.1 writev.c, NONE, 1.1 Makefile, 1.96, 1.97 _exit.c, 1.1, 1.2 ioctl.c, 1.1, 1.2 ssp.c, 1.1, 1.2 xstatconv.h, 1.2, 1.3 list_syscalls.sh, 1.1, NONE str_syscalls.sh, 1.5, NONE syscalls.c, 1.128, NONE unified_syscall_i386.h, 1.6, NONE
Erik Andersen
andersen at uclibc.org
Wed Jan 21 23:27:43 UTC 2004
- Previous message: [uClibc-cvs] uClibc/libc/misc/sysvipc ftok.c, 1.3, 1.4 ipc.h, 1.2, 1.3 msgq.c, 1.2, 1.3 sem.c, 1.4, 1.5 shm.c, 1.5, 1.6
- Next message: [uClibc-cvs] uClibc/libc/sysdeps/linux/i960 mmap.S, NONE, 1.1 _mmap.S, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/cvs/uClibc/libc/sysdeps/linux/common
In directory nail:/tmp/cvs-serv30526/sysdeps/linux/common
Modified Files:
Makefile _exit.c ioctl.c ssp.c xstatconv.h
Added Files:
__rt_sigtimedwait.c __socketcall.c __syscall_fcntl.c
__syscall_fcntl64.c __syscall_ipc.c __syscall_rt_sigaction.c
__syscall_sigaction.c access.c acct.c adjtimex.c alarm.c
bdflush.c capget.c capset.c chdir.c chmod.c chown.c chroot.c
close.c delete_module.c dup.c dup2.c execve.c fchdir.c
fchmod.c fchown.c fdatasync.c flock.c fork.c fstat.c fstat64.c
fstatfs.c fsync.c ftruncate.c get_kernel_syms.c getegid.c
geteuid.c getgid.c getgroups.c getitimer.c getpgid.c getpgrp.c
getpid.c getppid.c getpriority.c getresgid.c getresuid.c
getrlimit.c getrusage.c getsid.c gettimeofday.c getuid.c
init_module.c ioperm.c iopl.c kill.c klogctl.c lchown.c link.c
lseek.c lstat.c lstat64.c madvise.c mkdir.c mknod.c mlock.c
mlockall.c mmap.c modify_ldt.c mount.c mprotect.c mremap.c
msync.c munlock.c munlockall.c munmap.c nanosleep.c nice.c
open.c pause.c personality.c pipe.c pivot_root.c prctl.c
query_module.c quotactl.c read.c readlink.c readv.c reboot.c
rename.c rmdir.c sched_get_priority_max.c
sched_get_priority_min.c sched_getparam.c sched_getscheduler.c
sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c
sched_yield.c select.c sendfile.c setdomainname.c setfsgid.c
setfsuid.c setgid.c setgroups.c sethostname.c setitimer.c
setpgid.c setpriority.c setregid.c setresgid.c setresuid.c
setreuid.c setrlimit.c setsid.c settimeofday.c setuid.c
sigaltstack.c sigpending.c sigprocmask.c sigsuspend.c stat.c
stat64.c statfs.c stime.c swapoff.c swapon.c symlink.c
syscalls.h sysctl.c sysfs.c sysinfo.c time.c times.c
truncate.c umask.c umount.c umount2.c uname.c unlink.c
uselib.c ustat.c utime.c utimes.c vhangup.c wait4.c write.c
writev.c
Removed Files:
list_syscalls.sh str_syscalls.sh syscalls.c
unified_syscall_i386.h
Log Message:
Split up syscalls.c, since it had grown to be quite large and ugly.
-Erik
--- NEW FILE: getppid.c ---
/* vi: set sw=4 ts=4: */
/*
* getppid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
# include <unistd.h>
# ifdef __NR_getppid
_syscall0(pid_t, getppid);
# else
pid_t getppid(void)
{
return (getpid());
}
# endif
--- NEW FILE: flock.c ---
/* vi: set sw=4 ts=4: */
/*
* flock() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/file.h>
#define __NR___syscall_flock __NR_flock
static inline _syscall2(int, __syscall_flock, int, fd, int, operation);
int flock(int fd, int operation)
{
return (__syscall_flock(fd, operation));
}
--- NEW FILE: setfsuid.c ---
/* vi: set sw=4 ts=4: */
/*
* setfsuid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/fsuid.h>
#define __NR___syscall_setfsuid __NR_setfsuid
static inline _syscall1(int, __syscall_setfsuid, __kernel_uid_t, uid);
int setfsuid(uid_t uid)
{
if (uid != (uid_t) ((__kernel_uid_t) uid)) {
__set_errno(EINVAL);
return -1;
}
return (__syscall_setfsuid(uid));
}
--- NEW FILE: acct.c ---
/* vi: set sw=4 ts=4: */
/*
* acct() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall1(int, acct, const char *, filename);
--- NEW FILE: adjtimex.c ---
/* vi: set sw=4 ts=4: */
/*
* adjtimex() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/timex.h>
_syscall1(int, adjtimex, struct timex *, buf);
weak_alias(adjtimex, __adjtimex);
weak_alias(adjtimex, ntp_adjtime);
--- NEW FILE: getpriority.c ---
/* vi: set sw=4 ts=4: */
/*
* getpriority() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/resource.h>
#define __NR___syscall_getpriority __NR_getpriority
static inline _syscall2(int, __syscall_getpriority,
__priority_which_t, which, id_t, who);
/* The return value of __syscall_getpriority is biased by this value
* to avoid returning negative values. */
#define PZERO 20
int getpriority(enum __priority_which which, id_t who)
{
int res;
res = __syscall_getpriority(which, who);
if (res >= 0)
res = PZERO - res;
return res;
}
Index: _exit.c
===================================================================
RCS file: /var/cvs/uClibc/libc/sysdeps/linux/common/_exit.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- _exit.c 22 Jul 2002 17:11:58 -0000 1.1
+++ _exit.c 21 Jan 2004 23:27:39 -0000 1.2
@@ -28,7 +28,7 @@
#ifndef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) __syscall_exit (args)
-#define __NR___syscall_exit __NR_exit
+#define __NR___syscall_exit __NR_exit
static inline _syscall1(void, __syscall_exit, int, status);
#endif
--- NEW FILE: chown.c ---
/* vi: set sw=4 ts=4: */
/*
* chown() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___syscall_chown __NR_chown
static inline _syscall3(int, __syscall_chown, const char *, path,
__kernel_uid_t, owner, __kernel_gid_t, group);
int chown(const char *path, uid_t owner, gid_t group)
{
if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
|| ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
__set_errno(EINVAL);
return -1;
}
return (__syscall_chown(path, owner, group));
}
--- NEW FILE: chdir.c ---
/* vi: set sw=4 ts=4: */
/*
* chdir() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <string.h>
#include <sys/param.h>
#define __NR___syscall_chdir __NR_chdir
static inline _syscall1(int, __syscall_chdir, const char *, path);
int chdir(const char *path)
{
return __syscall_chdir(path);
}
--- NEW FILE: setfsgid.c ---
/* vi: set sw=4 ts=4: */
/*
* setfsgid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/fsuid.h>
#define __NR___syscall_setfsgid __NR_setfsgid
static inline _syscall1(int, __syscall_setfsgid, __kernel_gid_t, gid);
int setfsgid(gid_t gid)
{
if (gid != (gid_t) ((__kernel_gid_t) gid)) {
__set_errno(EINVAL);
return -1;
}
return (__syscall_setfsgid(gid));
}
--- NEW FILE: modify_ldt.c ---
/* vi: set sw=4 ts=4: */
/*
* modify_ldt() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
_syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount);
weak_alias(modify_ldt, __modify_ldt);
--- NEW FILE: sigsuspend.c ---
/* vi: set sw=4 ts=4: */
/*
* sigsuspend() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <signal.h>
#undef sigsuspend
#ifdef __NR_rt_sigsuspend
#define __NR___rt_sigsuspend __NR_rt_sigsuspend
_syscall2(int, __rt_sigsuspend, const sigset_t *, mask, size_t, size);
int sigsuspend(const sigset_t * mask)
{
return __rt_sigsuspend(mask, _NSIG / 8);
}
#else
#define __NR___sigsuspend __NR_sigsuspend
_syscall3(int, __sigsuspend, int, a, unsigned long int, b,
unsigned long int, c);
int sigsuspend(const sigset_t * set)
{
return __sigsuspend(0, 0, set->__val[0]);
}
#endif
--- NEW FILE: fork.c ---
/* vi: set sw=4 ts=4: */
/*
* fork() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#ifdef __ARCH_HAS_MMU__
#define __NR___libc_fork __NR_fork
_syscall0(pid_t, __libc_fork);
#else
pid_t __libc_fork(void)
{
__set_errno(ENOSYS);
return -1;
}
#endif
weak_alias(__libc_fork, fork);
--- NEW FILE: getitimer.c ---
/* vi: set sw=4 ts=4: */
/*
* getitimer() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/time.h>
_syscall2(int, getitimer, __itimer_which_t, which, struct itimerval *, value);
--- NEW FILE: getrusage.c ---
/* vi: set sw=4 ts=4: */
/*
* getrusage() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#include <wait.h>
_syscall2(int, getrusage, int, who, struct rusage *, usage);
--- NEW FILE: __socketcall.c ---
/* vi: set sw=4 ts=4: */
/*
* __socketcall() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#ifdef __NR_socketcall
#define __NR___socketcall __NR_socketcall
_syscall2(int, __socketcall, int, call, unsigned long *, args);
#endif
--- NEW FILE: chroot.c ---
/* vi: set sw=4 ts=4: */
/*
* chroot() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#include <string.h>
#include <sys/param.h>
#define __NR___syscall_chroot __NR_chroot
static inline _syscall1(int, __syscall_chroot, const char *, path);
int chroot(const char *path)
{
return __syscall_chroot(path);
}
--- NEW FILE: setregid.c ---
/* vi: set sw=4 ts=4: */
/*
* setregid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___syscall_setregid __NR_setregid
static inline _syscall2(int, __syscall_setregid,
__kernel_gid_t, rgid, __kernel_gid_t, egid);
int setregid(gid_t rgid, gid_t egid)
{
if (((rgid + 1) > (gid_t) ((__kernel_gid_t) - 1U))
|| ((egid + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
__set_errno(EINVAL);
return -1;
}
return (__syscall_setregid(rgid, egid));
}
--- NEW FILE: munlockall.c ---
/* vi: set sw=4 ts=4: */
/*
* munlockall() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/mman.h>
#if defined __ARCH_HAS_MMU__
_syscall0(int, munlockall);
#endif
--- NEW FILE: getpgid.c ---
/* vi: set sw=4 ts=4: */
/*
* getpgid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#define __NR___syscall_getpgid __NR_getpgid
static inline _syscall1(__kernel_pid_t, __syscall_getpgid, __kernel_pid_t, pid);
pid_t __getpgid(pid_t pid)
{
return (__syscall_getpgid(pid));
}
weak_alias(__getpgid, getpgid);
--- NEW FILE: settimeofday.c ---
/* vi: set sw=4 ts=4: */
/*
* settimeofday() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/time.h>
_syscall2(int, settimeofday, const struct timeval *, tv,
const struct timezone *, tz);
--- NEW FILE: iopl.c ---
/* vi: set sw=4 ts=4: */
/*
* iopl() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
/* For arm there is a totally different implementation */
#if !defined(__arm__)
/* Tuns out the m68k unistd.h kernel header is broken */
# if defined __ARCH_HAS_MMU__ && defined __NR_iopl && ( !defined(__mc68000__))
_syscall1(int, iopl, int, level);
# else
int iopl(int level)
{
__set_errno(ENOSYS);
return -1;
}
# endif
# endif
--- NEW FILE: setrlimit.c ---
/* vi: set sw=4 ts=4: */
/*
* setrlimit() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#ifndef __NR_ugetrlimit
/* Only wrap setrlimit if the new ugetrlimit is not present */
#define __NR___setrlimit __NR_setrlimit
#include <unistd.h>
#include <sys/resource.h>
#define RMIN(x, y) ((x) < (y) ? (x) : (y))
_syscall2(int, __setrlimit, int, resource, const struct rlimit *, rlim);
int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits)
{
struct rlimit rlimits_small;
/* We might have to correct the limits values. Since the old values
* were signed the new values might be too large. */
rlimits_small.rlim_cur = RMIN((unsigned long int) rlimits->rlim_cur,
RLIM_INFINITY >> 1);
rlimits_small.rlim_max = RMIN((unsigned long int) rlimits->rlim_max,
RLIM_INFINITY >> 1);
return (__setrlimit(resource, &rlimits_small));
}
#undef RMIN
#else /* We don't need to wrap setrlimit */
#include <unistd.h>
struct rlimit;
_syscall2(int, setrlimit, unsigned int, resource,
const struct rlimit *, rlim);
#endif
--- NEW FILE: pivot_root.c ---
/* vi: set sw=4 ts=4: */
/*
* pivot_root() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
_syscall2(int, pivot_root, const char *, new_root, const char *, put_old);
--- NEW FILE: madvise.c ---
/* vi: set sw=4 ts=4: */
/*
* madvise() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
_syscall3(int, madvise, void *, __addr, size_t, __len, int, __advice);
--- NEW FILE: lchown.c ---
/* vi: set sw=4 ts=4: */
/*
* lchown() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___syscall_lchown __NR_lchown
static inline _syscall3(int, __syscall_lchown, const char *, path,
__kernel_uid_t, owner, __kernel_gid_t, group);
int lchown(const char *path, uid_t owner, gid_t group)
{
if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
|| ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
__set_errno(EINVAL);
return -1;
}
return __syscall_lchown(path, owner, group);
}
--- NEW FILE: sysinfo.c ---
/* vi: set sw=4 ts=4: */
/*
* sysinfo() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/sysinfo.h>
_syscall1(int, sysinfo, struct sysinfo *, info);
--- NEW FILE: stat64.c ---
/* vi: set sw=4 ts=4: */
/*
* stat64() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#if defined __UCLIBC_HAS_LFS__ && defined __NR_stat64
#define __NR___syscall_stat64 __NR_stat64
#include <unistd.h>
#include <sys/stat.h>
#include <bits/kernel_stat.h>
#include "xstatconv.h"
static inline _syscall2(int, __syscall_stat64,
const char *, file_name, struct kernel_stat64 *, buf);
int stat64(const char *file_name, struct stat64 *buf)
{
int result;
struct kernel_stat64 kbuf;
result = __syscall_stat64(file_name, &kbuf);
if (result == 0) {
__xstat64_conv(&kbuf, buf);
}
return result;
}
#endif /* __UCLIBC_HAS_LFS__ */
Index: ioctl.c
===================================================================
RCS file: /var/cvs/uClibc/libc/sysdeps/linux/common/ioctl.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ioctl.c 18 Feb 2003 05:48:08 -0000 1.1
+++ ioctl.c 21 Jan 2004 23:27:40 -0000 1.2
@@ -1,9 +1,19 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * ioctl() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
#include <stdarg.h>
#include <sys/ioctl.h>
-extern int __syscall_ioctl(int fd, int request, void *arg);
+#define __NR___syscall_ioctl __NR_ioctl
+_syscall3(int, __syscall_ioctl, int, fd, unsigned long int, request, void *, arg);
-/* powerpc has its own special version... */
int ioctl(int fd, unsigned long int request, ...)
{
void *arg;
--- NEW FILE: vhangup.c ---
/* vi: set sw=4 ts=4: */
/*
* vhangup() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall0(int, vhangup);
--- NEW FILE: sched_setscheduler.c ---
/* vi: set sw=4 ts=4: */
/*
* sched_setscheduler() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sched.h>
#define __NR___syscall_sched_setscheduler __NR_sched_setscheduler
static inline _syscall3(int, __syscall_sched_setscheduler,
__kernel_pid_t, pid, int, policy, const struct sched_param *, p);
int sched_setscheduler(pid_t pid, int policy, const struct sched_param *p)
{
return (__syscall_sched_setscheduler(pid, policy, p));
}
--- NEW FILE: dup.c ---
/* vi: set sw=4 ts=4: */
/*
* dup() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall1(int, dup, int, oldfd);
--- NEW FILE: wait4.c ---
/* vi: set sw=4 ts=4: */
/*
* wait4() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#define __NR___syscall_wait4 __NR_wait4
static inline _syscall4(int, __syscall_wait4, __kernel_pid_t, pid,
int *, status, int, opts, void *, rusage);
int wait4(pid_t pid, int *status, int opts, void *rusage)
{
return (__syscall_wait4(pid, status, opts, rusage));
}
--- NEW FILE: __syscall_ipc.c ---
/* vi: set sw=4 ts=4: */
/*
* __syscall_ipc() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#ifdef __NR_ipc
#define __NR___syscall_ipc __NR_ipc
_syscall5(int, __syscall_ipc, unsigned int, call, int, first, int, second, int,
third, void *, ptr);
#endif
--- str_syscalls.sh DELETED ---
--- NEW FILE: geteuid.c ---
/* vi: set sw=4 ts=4: */
/*
* geteuid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#ifdef __NR_geteuid
#define __NR___syscall_geteuid __NR_geteuid
static inline _syscall0(int, __syscall_geteuid);
uid_t geteuid(void)
{
return (__syscall_geteuid());
}
#else
uid_t geteuid(void)
{
return (getuid());
}
#endif
--- NEW FILE: getegid.c ---
/* vi: set sw=4 ts=4: */
/*
* getegid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#ifdef __NR_getegid
#define __NR___syscall_getegid __NR_getegid
static inline _syscall0(int, __syscall_getegid);
gid_t getegid(void)
{
return (__syscall_getegid());
}
#else
gid_t getegid(void)
{
return (getgid());
}
#endif
--- NEW FILE: gettimeofday.c ---
/* vi: set sw=4 ts=4: */
/*
* gettimeofday() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/time.h>
_syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz);
Index: Makefile
===================================================================
RCS file: /var/cvs/uClibc/libc/sysdeps/linux/common/Makefile,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- Makefile 21 Jan 2004 21:06:38 -0000 1.96
+++ Makefile 21 Jan 2004 23:27:39 -0000 1.97
@@ -26,7 +26,45 @@
truncate64.c getrlimit64.c setrlimit64.c creat64.c \
llseek.c pread_write.c _exit.c sync.c getdirname.c \
sendfile64.c xstatconv.c getdents.c getdents64.c vfork.c \
- ulimit.c ntp_gettime.c poll.c
+ ulimit.c ntp_gettime.c poll.c \
+ fork.c read.c write.c open.c \
+ close.c link.c unlink.c execve.c chdir.c \
+ time.c mknod.c chmod.c lchown.c \
+ lseek.c getpid.c mount.c umount.c setuid.c \
+ getuid.c stime.c alarm.c pause.c utime.c utimes.c \
+ access.c nice.c kill.c rename.c mkdir.c \
+ rmdir.c dup.c pipe.c times.c setgid.c getgid.c \
+ geteuid.c getegid.c acct.c umount2.c \
+ ioctl.c setpgid.c \
+ umask.c chroot.c ustat.c dup2.c \
+ getppid.c getpgrp.c setsid.c __syscall_sigaction.c \
+ setreuid.c setregid.c sigsuspend.c sigpending.c \
+ sethostname.c setrlimit.c getrlimit.c getrusage.c \
+ gettimeofday.c settimeofday.c getgroups.c \
+ setgroups.c select.c symlink.c readlink.c uselib.c swapon.c \
+ reboot.c mmap.c munmap.c truncate.c ftruncate.c fchmod.c \
+ fchown.c getpriority.c setpriority.c \
+ statfs.c fstatfs.c ioperm.c __socketcall.c klogctl.c \
+ setitimer.c getitimer.c stat.c lstat.c \
+ fstat.c iopl.c vhangup.c wait4.c swapoff.c \
+ sysinfo.c __syscall_ipc.c fsync.c setdomainname.c uname.c modify_ldt.c \
+ adjtimex.c mprotect.c sigprocmask.c init_module.c \
+ delete_module.c get_kernel_syms.c quotactl.c getpgid.c \
+ fchdir.c bdflush.c sysfs.c personality.c setfsuid.c \
+ setfsgid.c flock.c msync.c \
+ readv.c writev.c getsid.c fdatasync.c sysctl.c mlock.c \
+ munlock.c mlockall.c munlockall.c sched_setparam.c \
+ sched_getparam.c sched_setscheduler.c \
+ sched_getscheduler.c sched_yield.c sched_get_priority_max.c \
+ sched_get_priority_min.c sched_rr_get_interval.c \
+ nanosleep.c mremap.c setresuid.c \
+ getresuid.c query_module.c setresgid.c \
+ getresgid.c prctl.c __syscall_rt_sigaction.c \
+ __rt_sigtimedwait.c \
+ chown.c capget.c capset.c sigaltstack.c \
+ sendfile.c stat64.c lstat64.c \
+ fstat64.c pivot_root.c madvise.c __syscall_fcntl.c __syscall_fcntl64.c
+
ifneq ($(strip $(EXCLUDE_BRK)),y)
CSRC+=sbrk.c
endif
@@ -38,9 +76,6 @@
endif
COBJS=$(patsubst %.c,%.o, $(CSRC))
-MSRC=syscalls.c
-MOBJ=$(shell ./list_syscalls.sh)
-
OBJ=$(COBJS) $(MOBJ)
all: $(STR_SYSCALLS) $(OBJ) $(LIBC)
@@ -50,10 +85,6 @@
ar-target: $(OBJ)
$(AR) $(ARFLAGS) $(LIBC) $(OBJ)
-$(MOBJ): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
$(COBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
@@ -62,4 +93,4 @@
$(LN) -fs ../libc/sysdeps/linux/common/fpu_control.h $(TOPDIR)/include/
clean:
- $(RM) *.[oa] *~ core crt[in].* *.S
+ $(RM) *.[oa] *~ core
--- NEW FILE: getuid.c ---
/* vi: set sw=4 ts=4: */
/*
* getuid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#if defined (__alpha__)
#define __NR_getuid __NR_getxuid
#endif
#define __NR___syscall_getuid __NR_getuid
static inline _syscall0(int, __syscall_getuid);
uid_t getuid(void)
{
return (__syscall_getuid());
}
--- NEW FILE: setdomainname.c ---
/* vi: set sw=4 ts=4: */
/*
* setdomainname() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall2(int, setdomainname, const char *, name, size_t, len);
--- NEW FILE: query_module.c ---
/* vi: set sw=4 ts=4: */
/*
* query_module() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
# ifdef __NR_query_module
_syscall5(int, query_module, const char *, name, int, which,
void *, buf, size_t, bufsize, size_t *, ret);
# else
int query_module(const char *name, int which,
void *buf, size_t bufsize, size_t * ret)
{
__set_errno(ENOSYS);
return -1;
}
# endif
--- NEW FILE: setsid.c ---
/* vi: set sw=4 ts=4: */
/*
* setsid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall0(pid_t, setsid);
--- NEW FILE: utime.c ---
/* vi: set sw=4 ts=4: */
/*
* utime() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <utime.h>
#ifdef __NR_utime
_syscall2(int, utime, const char *, file, const struct utimbuf *, times);
#else
#include <stdlib.h>
#include <sys/time.h>
int utime(const char *file, const struct utimbuf *times)
{
struct timeval timevals[2];
if (times != NULL) {
timevals[0].tv_usec = 0L;
timevals[1].tv_usec = 0L;
timevals[0].tv_sec = (long int) times->actime;
timevals[1].tv_sec = (long int) times->modtime;
} else {
if (gettimeofday(&timevals[0], NULL) < 0) {
return -1;
}
timevals[1] = timevals[0];
}
return utimes(file, timevals);
}
#endif
--- NEW FILE: sigprocmask.c ---
/* vi: set sw=4 ts=4: */
/*
* sigprocmask() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <signal.h>
#undef sigprocmask
#ifdef __NR_rt_sigprocmask
#define __NR___rt_sigprocmask __NR_rt_sigprocmask
_syscall4(int, __rt_sigprocmask, int, how, const sigset_t *, set,
sigset_t *, oldset, size_t, size);
int sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
{
if (set &&
#if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2)
(((unsigned int) how) > 2)
#else
#warning "compile time assumption violated.. slow path..."
((how != SIG_BLOCK) && (how != SIG_UNBLOCK)
&& (how != SIG_SETMASK))
#endif
) {
__set_errno(EINVAL);
return -1;
}
return __rt_sigprocmask(how, set, oldset, _NSIG / 8);
}
#else
#define __NR___syscall_sigprocmask __NR_sigprocmask
static inline
_syscall3(int, __syscall_sigprocmask, int, how, const sigset_t *, set,
sigset_t *, oldset);
int sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
{
if (set &&
#if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2)
(((unsigned int) how) > 2)
#else
#warning "compile time assumption violated.. slow path..."
((how != SIG_BLOCK) && (how != SIG_UNBLOCK)
&& (how != SIG_SETMASK))
#endif
) {
__set_errno(EINVAL);
return -1;
}
return (__syscall_sigprocmask(how, set, oldset));
}
#endif
--- list_syscalls.sh DELETED ---
--- NEW FILE: prctl.c ---
/* vi: set sw=4 ts=4: */
/*
* prctl() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <stdarg.h>
//#include <sys/prctl.h>
_syscall5(int, prctl, int, a, int, b, int, c, int, d, int, e);
--- NEW FILE: ftruncate.c ---
/* vi: set sw=4 ts=4: */
/*
* ftruncate() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall2(int, ftruncate, int, fd, __off_t, length);
--- NEW FILE: writev.c ---
/* vi: set sw=4 ts=4: */
/*
* writev() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/uio.h>
_syscall3(ssize_t, writev, int, filedes, const struct iovec *, vector,
int, count);
--- NEW FILE: getgroups.c ---
/* vi: set sw=4 ts=4: */
/*
* getgroups() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define MIN(a,b) (((a)<(b))?(a):(b))
#define __NR___syscall_getgroups __NR_getgroups
static inline _syscall2(int, __syscall_getgroups,
int, size, __kernel_gid_t *, list);
int getgroups(int n, gid_t * groups)
{
if (unlikely(n < 0)) {
__set_errno(EINVAL);
return -1;
} else {
int i, ngids;
__kernel_gid_t kernel_groups[n = MIN(n, sysconf(_SC_NGROUPS_MAX))];
ngids = __syscall_getgroups(n, kernel_groups);
if (n != 0 && ngids > 0) {
for (i = 0; i < ngids; i++) {
groups[i] = kernel_groups[i];
}
}
return ngids;
}
}
--- NEW FILE: umask.c ---
/* vi: set sw=4 ts=4: */
/*
* umask() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/stat.h>
#define __NR___syscall_umask __NR_umask
static inline _syscall1(__kernel_mode_t, __syscall_umask, __kernel_mode_t, mode);
mode_t umask(mode_t mode)
{
return (__syscall_umask(mode));
}
--- NEW FILE: setpgid.c ---
/* vi: set sw=4 ts=4: */
/*
* setpgid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___syscall_setpgid __NR_setpgid
static inline _syscall2(int, __syscall_setpgid,
__kernel_pid_t, pid, __kernel_pid_t, pgid);
int setpgid(pid_t pid, pid_t pgid)
{
return (__syscall_setpgid(pid, pgid));
}
--- NEW FILE: umount.c ---
/* vi: set sw=4 ts=4: */
/*
* umount() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/mount.h>
_syscall1(int, umount, const char *, specialfile);
--- NEW FILE: fchown.c ---
/* vi: set sw=4 ts=4: */
/*
* fchown() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___syscall_fchown __NR_fchown
static inline _syscall3(int, __syscall_fchown, int, fd,
__kernel_uid_t, owner, __kernel_gid_t, group);
int fchown(int fd, uid_t owner, gid_t group)
{
if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
|| ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
__set_errno(EINVAL);
return -1;
}
return (__syscall_fchown(fd, owner, group));
}
--- syscalls.c DELETED ---
--- NEW FILE: sethostname.c ---
/* vi: set sw=4 ts=4: */
/*
* sethostname() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall2(int, sethostname, const char *, name, size_t, len);
--- NEW FILE: syscalls.h ---
/* vi: set sw=4 ts=4: */
/*
* Common header file for uClibc syscalls
*
* Copyright (C) 2001-2004 by Erik Andersen <andersen at codpoet.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
#define _GNU_SOURCE
#define _LARGEFILE64_SOURCE
#include <features.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/syscall.h>
#include <endian.h>
#undef __OPTIMIZE__
/* We absolutely do _NOT_ want interfaces silently
* * * renamed under us or very bad things will happen... */
#ifdef __USE_FILE_OFFSET64
# undef __USE_FILE_OFFSET64
#endif
--- NEW FILE: fstatfs.c ---
/* vi: set sw=4 ts=4: */
/*
* fstatfs() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/vfs.h>
_syscall2(int, fstatfs, int, fd, struct statfs *, buf);
--- NEW FILE: fstat64.c ---
/* vi: set sw=4 ts=4: */
/*
* fstat64() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#if defined __UCLIBC_HAS_LFS__ && defined __NR_fstat64
#define __NR___syscall_fstat64 __NR_fstat64
#include <unistd.h>
#include <sys/stat.h>
#include <bits/kernel_stat.h>
#include "xstatconv.h"
static inline _syscall2(int, __syscall_fstat64,
int, filedes, struct kernel_stat64 *, buf);
int fstat64(int fd, struct stat64 *buf)
{
int result;
struct kernel_stat64 kbuf;
result = __syscall_fstat64(fd, &kbuf);
if (result == 0) {
__xstat64_conv(&kbuf, buf);
}
return result;
}
#endif /* __UCLIBC_HAS_LFS__ */
--- NEW FILE: readlink.c ---
/* vi: set sw=4 ts=4: */
/*
* readlink() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall3(int, readlink, const char *, path, char *, buf, size_t, bufsiz);
--- NEW FILE: alarm.c ---
/* vi: set sw=4 ts=4: */
/*
* alarm() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#ifdef __NR_alarm
_syscall1(unsigned int, alarm, unsigned int, seconds);
#else
#include <sys/time.h>
unsigned int alarm(unsigned int seconds)
{
struct itimerval old, new;
unsigned int retval;
new.it_value.tv_usec = 0;
new.it_interval.tv_sec = 0;
new.it_interval.tv_usec = 0;
new.it_value.tv_sec = (long int) seconds;
if (setitimer(ITIMER_REAL, &new, &old) < 0) {
return 0;
}
retval = old.it_value.tv_sec;
if (old.it_value.tv_usec) {
++retval;
}
return retval;
}
#endif
--- NEW FILE: setresgid.c ---
/* vi: set sw=4 ts=4: */
/*
* setresgid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#define __NR___syscall_setresgid __NR_setresgid
static inline _syscall3(int, __syscall_setresgid,
__kernel_gid_t, rgid, __kernel_gid_t, egid, __kernel_gid_t, sgid);
int setresgid(gid_t rgid, gid_t egid, gid_t sgid)
{
if (((rgid + 1) > (gid_t) ((__kernel_gid_t) - 1U))
|| ((egid + 1) > (gid_t) ((__kernel_gid_t) - 1U))
|| ((sgid + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
__set_errno(EINVAL);
return -1;
}
return (__syscall_setresgid(rgid, egid, sgid));
}
--- NEW FILE: fchmod.c ---
/* vi: set sw=4 ts=4: */
/*
* fchmod() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/stat.h>
#define __NR___syscall_fchmod __NR_fchmod
static inline _syscall2(int, __syscall_fchmod,
int, fildes, __kernel_mode_t, mode);
int fchmod(int fildes, mode_t mode)
{
return (__syscall_fchmod(fildes, mode));
}
--- NEW FILE: __rt_sigtimedwait.c ---
/* vi: set sw=4 ts=4: */
/*
* __rt_sigtimedwait() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <signal.h>
#define __need_NULL
#include <stddef.h>
#ifdef __NR_rt_sigtimedwait
#define __NR___rt_sigtimedwait __NR_rt_sigtimedwait
_syscall4(int, __rt_sigtimedwait, const sigset_t *, set, siginfo_t *, info,
const struct timespec *, timeout, size_t, setsize);
int sigwaitinfo(const sigset_t * set, siginfo_t * info)
{
return __rt_sigtimedwait(set, info, NULL, _NSIG / 8);
}
int sigtimedwait(const sigset_t * set, siginfo_t * info,
const struct timespec *timeout)
{
return __rt_sigtimedwait(set, info, timeout, _NSIG / 8);
}
#else
int sigwaitinfo(const sigset_t * set, siginfo_t * info)
{
if (set == NULL)
__set_errno(EINVAL);
else
__set_errno(ENOSYS);
return -1;
}
int sigtimedwait(const sigset_t * set, siginfo_t * info,
const struct timespec *timeout)
{
if (set == NULL)
__set_errno(EINVAL);
else
__set_errno(ENOSYS);
return -1;
}
#endif
--- NEW FILE: access.c ---
/* vi: set sw=4 ts=4: */
/*
* access() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall2(int, access, const char *, pathname, int, mode);
--- NEW FILE: lstat.c ---
/* vi: set sw=4 ts=4: */
/*
* lstat() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define _SYS_STAT_H
#include <bits/stat.h>
#include <bits/kernel_stat.h>
#include "xstatconv.h"
#define __NR___syscall_lstat __NR_lstat
static inline _syscall2(int, __syscall_lstat,
const char *, file_name, struct kernel_stat *, buf);
int lstat(const char *file_name, struct stat *buf)
{
int result;
struct kernel_stat kbuf;
result = __syscall_lstat(file_name, &kbuf);
if (result == 0) {
__xstat_conv(&kbuf, buf);
}
return result;
}
#if ! defined __NR_lstat64 && defined __UCLIBC_HAS_LFS__
weak_alias(lstat, lstat64);
#endif
--- NEW FILE: rmdir.c ---
/* vi: set sw=4 ts=4: */
/*
* rmdir() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall1(int, rmdir, const char *, pathname);
--- NEW FILE: dup2.c ---
/* vi: set sw=4 ts=4: */
/*
* dup2() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall2(int, dup2, int, oldfd, int, newfd);
--- NEW FILE: reboot.c ---
/* vi: set sw=4 ts=4: */
/*
* _reboot() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#define __NR__reboot __NR_reboot
static inline _syscall3(int, _reboot, int, magic, int, magic2, int, flag);
int reboot(int flag)
{
return (_reboot((int) 0xfee1dead, 672274793, flag));
}
--- NEW FILE: mknod.c ---
/* vi: set sw=4 ts=4: */
/*
* mknod() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/stat.h>
#define __NR___syscall_mknod __NR_mknod
static inline _syscall3(int, __syscall_mknod, const char *, path,
__kernel_mode_t, mode, __kernel_dev_t, dev);
int mknod(const char *path, mode_t mode, dev_t dev)
{
/* We must convert the dev_t value to a __kernel_dev_t */
__kernel_dev_t k_dev;
k_dev = ((major(dev) & 0xff) << 8) | (minor(dev) & 0xff);
return __syscall_mknod(path, mode, k_dev);
}
--- NEW FILE: sched_getscheduler.c ---
/* vi: set sw=4 ts=4: */
/*
* sched_getscheduler() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sched.h>
#define __NR___syscall_sched_getscheduler __NR_sched_getscheduler
static inline _syscall1(int, __syscall_sched_getscheduler, __kernel_pid_t, pid);
int sched_getscheduler(pid_t pid)
{
return (__syscall_sched_getscheduler(pid));
}
--- NEW FILE: __syscall_fcntl.c ---
/* vi: set sw=4 ts=4: */
/*
* __syscall_fcntl() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <stdarg.h>
#include <fcntl.h>
#define __NR___syscall_fcntl __NR_fcntl
#ifdef __UCLIBC_HAS_LFS__
static inline
#endif
_syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg);
int __libc_fcntl(int fd, int cmd, ...)
{
long arg;
va_list list;
if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
__set_errno(ENOSYS);
return -1;
}
va_start(list, cmd);
arg = va_arg(list, long);
va_end(list);
return (__syscall_fcntl(fd, cmd, arg));
}
weak_alias(__libc_fcntl, fcntl);
#if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__
weak_alias(__libc_fcntl, fcntl64);
#endif
--- NEW FILE: pause.c ---
/* vi: set sw=4 ts=4: */
/*
* pause() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#ifdef __NR_pause
#define __NR___libc_pause __NR_pause
_syscall0(int, __libc_pause);
weak_alias(__libc_pause, pause);
#else
#include <signal.h>
int __libc_pause(void)
{
return (__sigpause(sigblock(0), 0));
}
weak_alias(__libc_pause, pause);
#endif
--- NEW FILE: fchdir.c ---
/* vi: set sw=4 ts=4: */
/*
* fchdir() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall1(int, fchdir, int, fd);
--- NEW FILE: init_module.c ---
/* vi: set sw=4 ts=4: */
/*
* init_module() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
/* This may have 5 arguments (for old 2.0 kernels) or 2 arguments
* (for 2.2 and 2.4 kernels). Use the greatest common denominator,
* and let the kernel cope with whatever it gets. It's good at that. */
_syscall5(int, init_module, void *, first, void *, second, void *, third,
void *, fourth, void *, fifth);
--- NEW FILE: setpriority.c ---
/* vi: set sw=4 ts=4: */
/*
* setpriority() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/resource.h>
_syscall3(int, setpriority, __priority_which_t, which, id_t, who, int, prio);
--- NEW FILE: sched_get_priority_max.c ---
/* vi: set sw=4 ts=4: */
/*
* sched_get_priority_max() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sched.h>
_syscall1(int, sched_get_priority_max, int, policy);
--- NEW FILE: stime.c ---
/* vi: set sw=4 ts=4: */
/*
* stime() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <time.h>
#include <sys/time.h>
#ifdef __NR_stime
_syscall1(int, stime, const time_t *, t);
#else
int stime(const time_t * when)
{
struct timeval tv;
if (when == NULL) {
__set_errno(EINVAL);
return -1;
}
tv.tv_sec = *when;
tv.tv_usec = 0;
return settimeofday(&tv, (struct timezone *) 0);
}
#endif
--- NEW FILE: sched_rr_get_interval.c ---
/* vi: set sw=4 ts=4: */
/*
* sched_rr_get_interval() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sched.h>
#define __NR___syscall_sched_rr_get_interval __NR_sched_rr_get_interval
static inline _syscall2(int, __syscall_sched_rr_get_interval,
__kernel_pid_t, pid, struct timespec *, tp);
int sched_rr_get_interval(pid_t pid, struct timespec *tp)
{
return (__syscall_sched_rr_get_interval(pid, tp));
}
--- NEW FILE: getresgid.c ---
/* vi: set sw=4 ts=4: */
/*
* getresgid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#define __NR___syscall_getresgid __NR_getresgid
static inline _syscall3(int, __syscall_getresgid, __kernel_gid_t *, egid,
__kernel_gid_t *, rgid, __kernel_gid_t *, sgid);
int getresgid(gid_t * rgid, gid_t * egid, gid_t * sgid)
{
int result;
__kernel_gid_t k_rgid, k_egid, k_sgid;
result = __syscall_getresgid(&k_rgid, &k_egid, &k_sgid);
if (result == 0) {
*rgid = (gid_t) k_rgid;
*egid = (gid_t) k_egid;
*sgid = (gid_t) k_sgid;
}
return result;
}
--- NEW FILE: getgid.c ---
/* vi: set sw=4 ts=4: */
/*
* getgid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___syscall_getgid __NR_getgid
#if defined (__alpha__)
#define __NR_getgid __NR_getxgid
#endif
static inline _syscall0(int, __syscall_getgid);
gid_t getgid(void)
{
return (__syscall_getgid());
}
--- NEW FILE: close.c ---
/* vi: set sw=4 ts=4: */
/*
* close() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___libc_close __NR_close
_syscall1(int, __libc_close, int, fd);
weak_alias(__libc_close, close);
--- NEW FILE: ioperm.c ---
/* vi: set sw=4 ts=4: */
/*
* ioperm() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
# if defined __ARCH_HAS_MMU__ && defined __NR_ioperm
_syscall3(int, ioperm, unsigned long, from, unsigned long, num, int, turn_on);
# else
int ioperm(unsigned long from, unsigned long num, int turn_on)
{
__set_errno(ENOSYS);
return -1;
}
# endif
--- NEW FILE: mprotect.c ---
/* vi: set sw=4 ts=4: */
/*
* mprotect() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/mman.h>
_syscall3(int, mprotect, void *, addr, size_t, len, int, prot);
--- NEW FILE: getsid.c ---
/* vi: set sw=4 ts=4: */
/*
* getsid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___syscall_getsid __NR_getsid
static inline _syscall1(__kernel_pid_t, __syscall_getsid, __kernel_pid_t, pid);
pid_t getsid(pid_t pid)
{
return (__syscall_getsid(pid));
}
--- NEW FILE: __syscall_sigaction.c ---
/* vi: set sw=4 ts=4: */
/*
* __syscall_sigaction() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#ifndef __NR_rt_sigaction
#define __NR___syscall_sigaction __NR_sigaction
#include <signal.h>
#undef sigaction
_syscall3(int, __syscall_sigaction, int, signum, const struct sigaction *,
act, struct sigaction *, oldact);
#endif
--- NEW FILE: get_kernel_syms.c ---
/* vi: set sw=4 ts=4: */
/*
* get_kernel_syms() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
struct kernel_sym;
_syscall1(int, get_kernel_syms, struct kernel_sym *, table);
--- NEW FILE: truncate.c ---
/* vi: set sw=4 ts=4: */
/*
* truncate() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall2(int, truncate, const char *, path, __off_t, length);
--- NEW FILE: sigpending.c ---
/* vi: set sw=4 ts=4: */
/*
* sigpending() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <signal.h>
#undef sigpending
#ifdef __NR_rt_sigpending
#define __NR___rt_sigpending __NR_rt_sigpending
_syscall2(int, __rt_sigpending, sigset_t *, set, size_t, size);
int sigpending(sigset_t * set)
{
return __rt_sigpending(set, _NSIG / 8);
}
#else
_syscall1(int, sigpending, sigset_t *, set);
#endif
--- NEW FILE: readv.c ---
/* vi: set sw=4 ts=4: */
/*
* readv() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/uio.h>
_syscall3(ssize_t, readv, int, filedes, const struct iovec *, vector,
int, count);
--- NEW FILE: pipe.c ---
/* vi: set sw=4 ts=4: */
/*
* pipe() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall1(int, pipe, int *, filedes);
--- NEW FILE: symlink.c ---
/* vi: set sw=4 ts=4: */
/*
* symlink() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall2(int, symlink, const char *, oldpath, const char *, newpath);
--- NEW FILE: __syscall_fcntl64.c ---
/* vi: set sw=4 ts=4: */
/*
* __syscall_fcntl64() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <stdarg.h>
#include <fcntl.h>
#if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
#define __NR___syscall_fcntl64 __NR_fcntl64
static inline _syscall3(int, __syscall_fcntl64, int, fd, int, cmd, long, arg);
int __libc_fcntl64(int fd, int cmd, ...)
{
long arg;
va_list list;
va_start(list, cmd);
arg = va_arg(list, long);
va_end(list);
return (__syscall_fcntl64(fd, cmd, arg));
}
weak_alias(__libc_fcntl64, fcntl64);
#endif
--- NEW FILE: nice.c ---
/* vi: set sw=4 ts=4: */
/*
* nice() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#ifdef __NR_nice
_syscall1(int, nice, int, inc);
#else
#include <sys/resource.h>
int nice(int incr)
{
int save, prio, result;
save = errno;
__set_errno(0);
prio = getpriority(PRIO_PROCESS, 0);
if (prio == -1) {
if (errno != 0) {
return -1;
} else {
__set_errno(save);
}
}
result = setpriority(PRIO_PROCESS, 0, prio + incr);
if (result != -1) {
return prio + incr;
} else {
return -1;
}
}
#endif
Index: xstatconv.h
===================================================================
RCS file: /var/cvs/uClibc/libc/sysdeps/linux/common/xstatconv.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xstatconv.h 28 Jan 2003 08:34:57 -0000 1.2
+++ xstatconv.h 21 Jan 2004 23:27:41 -0000 1.3
@@ -15,8 +15,8 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
-
+ 02111-1307 USA.
+
Modified for uClibc by Erik Andersen <andersen at codepoet.org>
*/
--- NEW FILE: rename.c ---
/* vi: set sw=4 ts=4: */
/*
* rename() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#include <string.h>
#include <sys/param.h>
#include <stdio.h>
#define __NR___syscall_rename __NR_rename
static inline _syscall2(int, __syscall_rename, const char *, oldpath,
const char *, newpath);
int rename(const char * oldpath, const char * newpath)
{
return __syscall_rename(oldpath, newpath);
}
--- NEW FILE: ustat.c ---
/* vi: set sw=4 ts=4: */
/*
* ustat() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/ustat.h>
#define __NR___syscall_ustat __NR_ustat
static inline _syscall2(int, __syscall_ustat,
unsigned short int, kdev_t, struct ustat *, ubuf);
int ustat(dev_t dev, struct ustat *ubuf)
{
/* We must convert the dev_t value to a __kernel_dev_t */
__kernel_dev_t k_dev;
k_dev = ((major(dev) & 0xff) << 8) | (minor(dev) & 0xff);
return __syscall_ustat(k_dev, ubuf);
}
--- NEW FILE: unlink.c ---
/* vi: set sw=4 ts=4: */
/*
* unlink() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall1(int, unlink, const char *, pathname);
--- NEW FILE: statfs.c ---
/* vi: set sw=4 ts=4: */
/*
* statfs() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <string.h>
#include <sys/param.h>
#include <sys/vfs.h>
#define __NR___syscall_statfs __NR_statfs
static inline _syscall2(int, __syscall_statfs,
const char *, path, struct statfs *, buf);
int statfs(const char *path, struct statfs * buf)
{
return __syscall_statfs(path, buf);
}
--- NEW FILE: sendfile.c ---
/* vi: set sw=4 ts=4: */
/*
* sendfile() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#include <sys/sendfile.h>
_syscall4(ssize_t, sendfile, int, out_fd, int, in_fd, __off_t *, offset,
size_t, count);
--- NEW FILE: capget.c ---
/* vi: set sw=4 ts=4: */
/*
* capget() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
# ifdef __NR_capget
_syscall2(int, capget, void *, header, void *, data);
# else
int capget(void *header, void *data)
{
__set_errno(ENOSYS);
return -1;
}
# endif
--- NEW FILE: chmod.c ---
/* vi: set sw=4 ts=4: */
/*
* chmod() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/stat.h>
#define __NR___syscall_chmod __NR_chmod
static inline _syscall2(int, __syscall_chmod, const char *, path, __kernel_mode_t, mode);
int chmod(const char *path, mode_t mode)
{
return __syscall_chmod(path, mode);
}
--- NEW FILE: mount.c ---
/* vi: set sw=4 ts=4: */
/*
* mount() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/mount.h>
_syscall5(int, mount, const char *, specialfile, const char *, dir,
const char *, filesystemtype, unsigned long, rwflag,
const void *, data);
--- NEW FILE: msync.c ---
/* vi: set sw=4 ts=4: */
/*
* msync() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#include <sys/mman.h>
#define __NR___libc_msync __NR_msync
_syscall3(int, __libc_msync, void *, addr, size_t, length, int, flags);
weak_alias(__libc_msync, msync);
--- NEW FILE: times.c ---
/* vi: set sw=4 ts=4: */
/*
* times() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/times.h>
_syscall1(clock_t, times, struct tms *, buf);
--- NEW FILE: getresuid.c ---
/* vi: set sw=4 ts=4: */
/*
* getresuid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#define __NR___syscall_getresuid __NR_getresuid
static inline _syscall3(int, __syscall_getresuid, __kernel_uid_t *, ruid,
__kernel_uid_t *, euid, __kernel_uid_t *, suid);
int getresuid(uid_t * ruid, uid_t * euid, uid_t * suid)
{
int result;
__kernel_uid_t k_ruid, k_euid, k_suid;
result = __syscall_getresuid(&k_ruid, &k_euid, &k_suid);
if (result == 0) {
*ruid = (uid_t) k_ruid;
*euid = (uid_t) k_euid;
*suid = (uid_t) k_suid;
}
return result;
}
--- NEW FILE: setresuid.c ---
/* vi: set sw=4 ts=4: */
/*
* setresuid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#define __NR___syscall_setresuid __NR_setresuid
static inline _syscall3(int, __syscall_setresuid,
__kernel_uid_t, rgid, __kernel_uid_t, egid, __kernel_uid_t, sgid);
int setresuid(uid_t ruid, uid_t euid, uid_t suid)
{
if (((ruid + 1) > (uid_t) ((__kernel_uid_t) - 1U))
|| ((euid + 1) > (uid_t) ((__kernel_uid_t) - 1U))
|| ((suid + 1) > (uid_t) ((__kernel_uid_t) - 1U))) {
__set_errno(EINVAL);
return -1;
}
return (__syscall_setresuid(ruid, euid, suid));
}
--- NEW FILE: lstat64.c ---
/* vi: set sw=4 ts=4: */
/*
* lstat64() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#if defined __UCLIBC_HAS_LFS__ && defined __NR_lstat64
#include <unistd.h>
#include <sys/stat.h>
#include <bits/kernel_stat.h>
#include "xstatconv.h"
#define __NR___syscall_lstat64 __NR_lstat64
static inline _syscall2(int, __syscall_lstat64, const char *, file_name,
struct kernel_stat64 *, buf);
int lstat64(const char *file_name, struct stat64 *buf)
{
int result;
struct kernel_stat64 kbuf;
result = __syscall_lstat64(file_name, &kbuf);
if (result == 0) {
__xstat64_conv(&kbuf, buf);
}
return result;
}
#endif /* __UCLIBC_HAS_LFS__ */
--- NEW FILE: fsync.c ---
/* vi: set sw=4 ts=4: */
/*
* fsync() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___libc_fsync __NR_fsync
_syscall1(int, __libc_fsync, int, fd);
weak_alias(__libc_fsync, fsync);
--- NEW FILE: fstat.c ---
/* vi: set sw=4 ts=4: */
/*
* fstat() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define _SYS_STAT_H
#include <bits/stat.h>
#include <bits/kernel_stat.h>
#include "xstatconv.h"
#define __NR___syscall_fstat __NR_fstat
static inline _syscall2(int, __syscall_fstat, int, fd, struct kernel_stat *, buf);
int fstat(int fd, struct stat *buf)
{
int result;
struct kernel_stat kbuf;
result = __syscall_fstat(fd, &kbuf);
if (result == 0) {
__xstat_conv(&kbuf, buf);
}
return result;
}
#if ! defined __NR_fstat64 && defined __UCLIBC_HAS_LFS__
weak_alias(fstat, fstat64);
#endif
--- NEW FILE: capset.c ---
/* vi: set sw=4 ts=4: */
/*
* capset() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
# ifdef __NR_capset
_syscall2(int, capset, void *, header, const void *, data);
# else
int capset(void *header, const void *data)
{
__set_errno(ENOSYS);
return -1;
}
# endif
--- NEW FILE: umount2.c ---
/* vi: set sw=4 ts=4: */
/*
* umount2() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
# ifdef __NR_umount2 /* Old kernels don't have umount2 */
# include <sys/mount.h>
_syscall2(int, umount2, const char *, special_file, int, flags);
# else
int umount2(const char *special_file, int flags)
{
__set_errno(ENOSYS);
return -1;
}
# endif
--- NEW FILE: setreuid.c ---
/* vi: set sw=4 ts=4: */
/*
* setreuid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___syscall_setreuid __NR_setreuid
static inline _syscall2(int, __syscall_setreuid,
__kernel_uid_t, ruid, __kernel_uid_t, euid);
int setreuid(uid_t ruid, uid_t euid)
{
if (((ruid + 1) > (uid_t) ((__kernel_uid_t) - 1U))
|| ((euid + 1) > (uid_t) ((__kernel_uid_t) - 1U))) {
__set_errno(EINVAL);
return -1;
}
return (__syscall_setreuid(ruid, euid));
}
--- NEW FILE: mlock.c ---
/* vi: set sw=4 ts=4: */
/*
* mlock() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/mman.h>
# if defined __ARCH_HAS_MMU__ && defined __NR_mlock
_syscall2(int, mlock, const void *, addr, size_t, len);
# endif
--- NEW FILE: link.c ---
/* vi: set sw=4 ts=4: */
/*
* link() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall2(int, link, const char *, oldpath, const char *, newpath);
--- NEW FILE: time.c ---
/* vi: set sw=4 ts=4: */
/*
* time() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <time.h>
#include <sys/time.h>
#ifdef __NR_time
_syscall1(time_t, time, time_t *, t);
#else
time_t time(time_t * t)
{
time_t result;
struct timeval tv;
if (gettimeofday(&tv, (struct timezone *) NULL)) {
result = (time_t) - 1;
} else {
result = (time_t) tv.tv_sec;
}
if (t != NULL) {
*t = result;
}
return result;
}
#endif
--- NEW FILE: lseek.c ---
/* vi: set sw=4 ts=4: */
/*
* lseek() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___libc_lseek __NR_lseek
_syscall3(__off_t, __libc_lseek, int, fildes, __off_t, offset, int, whence);
weak_alias(__libc_lseek, lseek);
--- NEW FILE: uselib.c ---
/* vi: set sw=4 ts=4: */
/*
* uselib() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall1(int, uselib, const char *, library);
--- NEW FILE: sysfs.c ---
/* vi: set sw=4 ts=4: */
/*
* sysfs() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
//_syscall3(int, sysfs, int, option, unsigned int, index, char addr);
--- NEW FILE: swapon.c ---
/* vi: set sw=4 ts=4: */
/*
* swapon() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/swap.h>
_syscall2(int, swapon, const char *, path, int, swapflags);
--- NEW FILE: setitimer.c ---
/* vi: set sw=4 ts=4: */
/*
* setitimer() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/time.h>
_syscall3(int, setitimer, __itimer_which_t, which,
const struct itimerval *, new, struct itimerval *, old);
--- NEW FILE: stat.c ---
/* vi: set sw=4 ts=4: */
/*
* stat() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define _SYS_STAT_H
#include <bits/stat.h>
#include "xstatconv.h"
#define __NR___syscall_stat __NR_stat
static inline _syscall2(int, __syscall_stat,
const char *, file_name, struct kernel_stat *, buf);
int stat(const char *file_name, struct stat *buf)
{
int result;
struct kernel_stat kbuf;
result = __syscall_stat(file_name, &kbuf);
if (result == 0) {
__xstat_conv(&kbuf, buf);
}
return result;
}
#if ! defined __NR_stat64 && defined __UCLIBC_HAS_LFS__
weak_alias(stat, stat64);
#endif
--- NEW FILE: sysctl.c ---
/* vi: set sw=4 ts=4: */
/*
* _sysctl() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
struct __sysctl_args {
int *name;
int nlen;
void *oldval;
size_t *oldlenp;
void *newval;
size_t newlen;
unsigned long __unused[4];
};
static inline
_syscall1(int, _sysctl, struct __sysctl_args *, args);
int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
void *newval, size_t newlen)
{
struct __sysctl_args args = {
name:name,
nlen:nlen,
oldval:oldval,
oldlenp:oldlenp,
newval:newval,
newlen:newlen
};
return _sysctl(&args);
}
--- NEW FILE: execve.c ---
/* vi: set sw=4 ts=4: */
/*
* execve() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#include <string.h>
#include <sys/param.h>
#define __NR___syscall_execve __NR_execve
static inline _syscall3(int, __syscall_execve, const char *, filename,
char *const *, argv, char *const *, envp);
int execve(const char * filename, char *const * argv, char *const * envp)
{
return __syscall_execve(filename, argv, envp);
}
--- NEW FILE: mkdir.c ---
/* vi: set sw=4 ts=4: */
/*
* mkdir() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/stat.h>
#define __NR___syscall_mkdir __NR_mkdir
static inline _syscall2(int, __syscall_mkdir, const char *, pathname,
__kernel_mode_t, mode);
int mkdir(const char *pathname, mode_t mode)
{
return (__syscall_mkdir(pathname, mode));
}
--- NEW FILE: mmap.c ---
/* vi: set sw=4 ts=4: */
/*
* _mmap() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#include <sys/mman.h>
#define __NR__mmap __NR_mmap
_syscall1(__ptr_t, _mmap, unsigned long *, buffer);
__ptr_t mmap(__ptr_t addr, size_t len, int prot,
int flags, int fd, __off_t offset)
{
unsigned long buffer[6];
buffer[0] = (unsigned long) addr;
buffer[1] = (unsigned long) len;
buffer[2] = (unsigned long) prot;
buffer[3] = (unsigned long) flags;
buffer[4] = (unsigned long) fd;
buffer[5] = (unsigned long) offset;
return (__ptr_t) _mmap(buffer);
}
--- NEW FILE: sched_yield.c ---
/* vi: set sw=4 ts=4: */
/*
* sched_yield() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sched.h>
_syscall0(int, sched_yield);
--- NEW FILE: sigaltstack.c ---
/* vi: set sw=4 ts=4: */
/*
* sigaltstack() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <signal.h>
_syscall2(int, sigaltstack, const struct sigaltstack *, ss,
struct sigaltstack *, oss);
--- NEW FILE: sched_get_priority_min.c ---
/* vi: set sw=4 ts=4: */
/*
* sched_get_priority_min() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sched.h>
_syscall1(int, sched_get_priority_min, int, policy);
--- unified_syscall_i386.h DELETED ---
--- NEW FILE: klogctl.c ---
/* vi: set sw=4 ts=4: */
/*
* klogctl() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR__syslog __NR_syslog
static inline _syscall3(int, _syslog, int, type, char *, buf, int, len);
int klogctl(int type, char *buf, int len)
{
return (_syslog(type, buf, len));
}
Index: ssp.c
===================================================================
RCS file: /var/cvs/uClibc/libc/sysdeps/linux/common/ssp.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ssp.c 2 Jan 2004 23:34:11 -0000 1.1
+++ ssp.c 21 Jan 2004 23:27:40 -0000 1.2
@@ -67,8 +67,8 @@
write (STDERR_FILENO, buf+3, len-3);
#if defined(HAVE_SYSLOG)
if ((LogFile = socket(AF_UNIX, SOCK_DGRAM, 0)) != -1) {
-
- /*
+
+ /*
* Send "found" message to the "/dev/log" path
*/
SyslogAddr.sun_family = AF_UNIX;
--- NEW FILE: __syscall_rt_sigaction.c ---
/* vi: set sw=4 ts=4: */
/*
* __syscall_rt_sigaction() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#ifdef __NR_rt_sigaction
#include <signal.h>
#define __NR___syscall_rt_sigaction __NR_rt_sigaction
#undef sigaction
_syscall4(int, __syscall_rt_sigaction, int, signum,
const struct sigaction *, act, struct sigaction *, oldact,
size_t, size);
#endif
--- NEW FILE: swapoff.c ---
/* vi: set sw=4 ts=4: */
/*
* swapoff() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/swap.h>
_syscall1(int, swapoff, const char *, path);
--- NEW FILE: delete_module.c ---
/* vi: set sw=4 ts=4: */
/*
* delete_module() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
# ifdef __NR_delete_module
_syscall1(int, delete_module, const char *, name);
# else
int delete_module(const char *name)
{
__set_errno(ENOSYS);
return -1;
}
# endif
--- NEW FILE: mlockall.c ---
/* vi: set sw=4 ts=4: */
/*
* mlockall() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/mman.h>
# if defined __ARCH_HAS_MMU__ && defined __NR_mlockall
_syscall1(int, mlockall, int, flags);
# endif
--- NEW FILE: read.c ---
/* vi: set sw=4 ts=4: */
/*
* read() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___libc_read __NR_read
_syscall3(ssize_t, __libc_read, int, fd, __ptr_t, buf, size_t, count);
weak_alias(__libc_read, read);
--- NEW FILE: quotactl.c ---
/* vi: set sw=4 ts=4: */
/*
* quotactl() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/quota.h>
_syscall4(int, quotactl, int, cmd, const char *, special,
int, id, caddr_t, addr);
--- NEW FILE: nanosleep.c ---
/* vi: set sw=4 ts=4: */
/*
* nanosleep() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <time.h>
#define __NR___libc_nanosleep __NR_nanosleep
_syscall2(int, __libc_nanosleep, const struct timespec *, req,
struct timespec *, rem);
weak_alias(__libc_nanosleep, nanosleep);
--- NEW FILE: kill.c ---
/* vi: set sw=4 ts=4: */
/*
* kill() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <signal.h>
#undef kill
#define __NR___syscall_kill __NR_kill
static inline _syscall2(int, __syscall_kill, __kernel_pid_t, pid, int, sig);
int kill(pid_t pid, int sig)
{
return (__syscall_kill(pid, sig));
}
--- NEW FILE: mremap.c ---
/* vi: set sw=4 ts=4: */
/*
* mremap() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#include <sys/mman.h>
_syscall4(__ptr_t, mremap, __ptr_t, old_address, size_t, old_size, size_t,
new_size, int, may_move);
--- NEW FILE: sched_setparam.c ---
/* vi: set sw=4 ts=4: */
/*
* sched_setparam() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sched.h>
#define __NR___syscall_sched_setparam __NR_sched_setparam
static inline _syscall2(int, __syscall_sched_setparam,
__kernel_pid_t, pid, const struct sched_param *, p);
int sched_setparam(pid_t pid, const struct sched_param *p)
{
return (__syscall_sched_setparam(pid, p));
}
--- NEW FILE: getrlimit.c ---
/* vi: set sw=4 ts=4: */
/*
* getrlimit() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#include <sys/resource.h>
#ifdef __NR_ugetrlimit
#define __NR___ugetrlimit __NR_ugetrlimit
_syscall2(int, __ugetrlimit, enum __rlimit_resource, resource,
struct rlimit *, rlim);
int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
{
return (__ugetrlimit(resource, rlimits));
}
#else /* __NR_ugetrlimit */
/* Only include the old getrlimit if the new one (ugetrlimit) is not around */
#define __NR___getrlimit __NR_getrlimit
static inline
_syscall2(int, __getrlimit, int, resource, struct rlimit *, rlim);
int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
{
int result;
result = __getrlimit(resource, rlimits);
if (result == -1)
return result;
/* We might have to correct the limits values. Since the old values
* were signed the infinity value is too small. */
if (rlimits->rlim_cur == RLIM_INFINITY >> 1)
rlimits->rlim_cur = RLIM_INFINITY;
if (rlimits->rlim_max == RLIM_INFINITY >> 1)
rlimits->rlim_max = RLIM_INFINITY;
return result;
}
#endif
--- NEW FILE: fdatasync.c ---
/* vi: set sw=4 ts=4: */
/*
* fdatasync() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall1(int, fdatasync, int, fd);
--- NEW FILE: setgid.c ---
/* vi: set sw=4 ts=4: */
/*
* setgid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___syscall_setgid __NR_setgid
static inline _syscall1(int, __syscall_setgid, __kernel_gid_t, gid);
int setgid(gid_t gid)
{
if (gid == (gid_t) ~ 0 || gid != (gid_t) ((__kernel_gid_t) gid)) {
__set_errno(EINVAL);
return -1;
}
return (__syscall_setgid(gid));
}
--- NEW FILE: uname.c ---
/* vi: set sw=4 ts=4: */
/*
* uname() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/utsname.h>
_syscall1(int, uname, struct utsname *, buf);
--- NEW FILE: getpid.c ---
/* vi: set sw=4 ts=4: */
/*
* getpid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#if defined (__alpha__)
#define __NR_getpid __NR_getxpid
#endif
#define __NR___libc_getpid __NR_getpid
_syscall0(pid_t, __libc_getpid);
weak_alias(__libc_getpid, getpid);
weak_alias(__libc_getpid, __getpid);
--- NEW FILE: open.c ---
/* vi: set sw=4 ts=4: */
/*
* open() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <stdlib.h>
#include <stdarg.h>
#include <fcntl.h>
#include <string.h>
#include <sys/param.h>
#define __NR___syscall_open __NR_open
static inline _syscall3(int, __syscall_open, const char *, file,
int, flags, __kernel_mode_t, mode);
int __libc_open(const char *file, int flags, ...)
{
/* gcc may warn about mode being uninitialized.
* Just ignore that, since gcc is wrong. */
mode_t mode;
if (flags & O_CREAT) {
va_list ap;
va_start(ap, flags);
mode = va_arg(ap, mode_t);
va_end(ap);
}
return __syscall_open(file, flags, mode);
}
weak_alias(__libc_open, open);
int creat(const char *file, mode_t mode)
{
return __libc_open(file, O_WRONLY | O_CREAT | O_TRUNC, mode);
}
--- NEW FILE: select.c ---
/* vi: set sw=4 ts=4: */
/*
* select() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#ifdef __NR__newselect
extern int _newselect(int n, fd_set * readfds, fd_set * writefds,
fd_set * exceptfds, struct timeval *timeout);
_syscall5(int, _newselect, int, n, fd_set *, readfds, fd_set *, writefds,
fd_set *, exceptfds, struct timeval *, timeout);
weak_alias(_newselect, select);
#else
//Used as a fallback if _newselect isn't available...
extern int select(int n, fd_set * readfds, fd_set * writefds,
fd_set * exceptfds, struct timeval *timeout);
_syscall5(int, select, int, n, fd_set *, readfds, fd_set *, writefds,
fd_set *, exceptfds, struct timeval *, timeout);
#endif
--- NEW FILE: setuid.c ---
/* vi: set sw=4 ts=4: */
/*
* setuid() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___syscall_setuid __NR_setuid
static inline _syscall1(int, __syscall_setuid, __kernel_uid_t, uid);
int setuid(uid_t uid)
{
if (uid == (uid_t) ~ 0 || uid != (uid_t) ((__kernel_uid_t) uid)) {
__set_errno(EINVAL);
return -1;
}
return (__syscall_setuid(uid));
}
--- NEW FILE: utimes.c ---
/* vi: set sw=4 ts=4: */
/*
* utimes() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <utime.h>
#ifdef __NR_utimes
_syscall2(int, utimes, const char *, file, const struct timeval *, tvp);
#else
#include <stdlib.h>
#include <sys/time.h>
int utimes(const char *file, const struct timeval tvp[2])
{
struct utimbuf buf, *times;
if (tvp) {
times = &buf;
times->actime = tvp[0].tv_sec;
times->modtime = tvp[1].tv_sec;
} else {
times = NULL;
}
return utime(file, times);
}
#endif
--- NEW FILE: bdflush.c ---
/* vi: set sw=4 ts=4: */
/*
* bdflush() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/kdaemon.h>
_syscall2(int, bdflush, int, __func, long int, __data);
--- NEW FILE: munmap.c ---
/* vi: set sw=4 ts=4: */
/*
* munmap() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#include <sys/mman.h>
_syscall2(int, munmap, void *, start, size_t, length);
--- NEW FILE: getpgrp.c ---
/* vi: set sw=4 ts=4: */
/*
* getpgrp() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
_syscall0(pid_t, getpgrp);
--- NEW FILE: setgroups.c ---
/* vi: set sw=4 ts=4: */
/*
* setgroups() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#include <grp.h>
#define __NR___syscall_setgroups __NR_setgroups
static inline _syscall2(int, __syscall_setgroups,
size_t, size, const __kernel_gid_t *, list);
int setgroups(size_t n, const gid_t * groups)
{
if (n > (size_t) sysconf(_SC_NGROUPS_MAX)) {
__set_errno(EINVAL);
return -1;
} else {
size_t i;
__kernel_gid_t kernel_groups[n];
for (i = 0; i < n; i++) {
kernel_groups[i] = (groups)[i];
if (groups[i] != (gid_t) ((__kernel_gid_t) groups[i])) {
__set_errno(EINVAL);
return -1;
}
}
return (__syscall_setgroups(n, kernel_groups));
}
}
--- NEW FILE: write.c ---
/* vi: set sw=4 ts=4: */
/*
* write() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <unistd.h>
#define __NR___libc_write __NR_write
_syscall3(ssize_t, __libc_write, int, fd, const __ptr_t, buf, size_t, count);
weak_alias(__libc_write, write);
/* Stupid libgcc.a from gcc 2.95.x uses __write in pure.o
* which is a blatent GNU libc-ism... */
weak_alias(__libc_write, __write);
--- NEW FILE: personality.c ---
/* vi: set sw=4 ts=4: */
/*
* personality() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/personality.h>
_syscall1(int, personality, unsigned long int, __persona);
--- NEW FILE: munlock.c ---
/* vi: set sw=4 ts=4: */
/*
* munlock() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sys/mman.h>
# if defined __ARCH_HAS_MMU__ && defined __NR_munlock
_syscall2(int, munlock, const void *, addr, size_t, len);
# endif
--- NEW FILE: sched_getparam.c ---
/* vi: set sw=4 ts=4: */
/*
* sched_getparam() for uClibc
*
* Copyright (C) 2000-2004 by Erik Andersen <andersen at codpoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
#include <sched.h>
#define __NR___syscall_sched_getparam __NR_sched_getparam
static inline _syscall2(int, __syscall_sched_getparam,
__kernel_pid_t, pid, struct sched_param *, p);
int sched_getparam(pid_t pid, struct sched_param *p)
{
return (__syscall_sched_getparam(pid, p));
}
- Previous message: [uClibc-cvs] uClibc/libc/misc/sysvipc ftok.c, 1.3, 1.4 ipc.h, 1.2, 1.3 msgq.c, 1.2, 1.3 sem.c, 1.4, 1.5 shm.c, 1.5, 1.6
- Next message: [uClibc-cvs] uClibc/libc/sysdeps/linux/i960 mmap.S, NONE, 1.1 _mmap.S, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the uClibc-cvs
mailing list