12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334 |
- #include <errno.h>
- #include <features.h>
- #include <sys/types.h>
- #include <sys/syscall.h>
- #ifdef L__exit
- #define __NR__exit __NR_exit
- #ifdef __STR_NR_exit
- #define __STR_NR__exit __STR_NR_exit
- #endif
- _syscall1(void, _exit, int, status);
- #endif
- #ifdef L_fork
- #include <unistd.h>
- # ifdef __UCLIBC_HAS_MMU__
- _syscall0(pid_t, fork);
- # else
- pid_t fork(void)
- {
- __set_errno(ENOSYS);
- return -1;
- }
- # endif
- #endif
- #ifdef L_read
- #include <unistd.h>
- _syscall3(ssize_t, read, int, fd, __ptr_t, buf, size_t, count);
- #endif
- #ifdef L_write
- #include <unistd.h>
- _syscall3(ssize_t, write, int, fd, const __ptr_t, buf, size_t, count);
- weak_alias(write, __write);
- #endif
- #ifdef L___open
- #include <stdarg.h>
- #include <fcntl.h>
- #define __NR___open __NR_open
- #ifdef __STR_NR_open
- #define __STR_NR___open __STR_NR_open
- #endif
- _syscall3(int, __open, const char *, fn, int, flags, mode_t, mode);
- int open(const char *file, int oflag, ...)
- {
- int mode = 0;
- if (oflag & O_CREAT) {
- va_list args;
- va_start(args, oflag);
- mode = va_arg(args, int);
- va_end(args);
- }
- return __open(file, oflag, mode);
- }
- #endif
- #ifdef L_close
- #include <unistd.h>
- _syscall1(int, close, int, fd);
- #endif
- #ifdef L_creat
- #include <fcntl.h>
- _syscall2(int, creat, const char *, file, mode_t, mode);
- #endif
- #ifdef L_link
- #include <unistd.h>
- _syscall2(int, link, const char *, oldpath, const char *, newpath);
- #endif
- #ifdef L_unlink
- #include <unistd.h>
- _syscall1(int, unlink, const char *, pathname);
- #endif
- #ifdef L_execve
- #include <unistd.h>
- _syscall3(int, execve, const char *, filename, char *const *, argv,
- char *const *, envp);
- #endif
- #ifdef L_chdir
- #include <unistd.h>
- _syscall1(int, chdir, const char *, path);
- #endif
- #ifdef L_time
- #include <time.h>
- _syscall1(time_t, time, time_t *, t);
- #endif
- #ifdef L_mknod
- #include <unistd.h>
- extern int mknod(const char *pathname, mode_t mode, dev_t dev);
- _syscall3(int, mknod, const char *, pathname, mode_t, mode, dev_t, dev);
- int __xmknod (int version, const char * path, mode_t mode, dev_t *dev)
- {
- switch(version)
- {
- case 1:
- return mknod (path, mode, *dev);
- default:
- __set_errno(EINVAL);
- return -1;
- }
- }
- #endif
- #ifdef L_chmod
- #include <sys/stat.h>
- _syscall2(int, chmod, const char *, path, mode_t, mode);
- #endif
- #ifndef __NR_lchown
- #define __NR_lchown __NR_chown
- #endif
- #ifdef L_lchown
- #include <unistd.h>
- _syscall3(int, lchown, const char *, path, uid_t, owner, gid_t, group);
- #endif
- #ifdef L_lseek
- #include <unistd.h>
- _syscall3(off_t, lseek, int, fildes, off_t, offset, int, whence);
- #endif
- #ifdef L_getpid
- #include <unistd.h>
- _syscall0(pid_t, getpid);
- #endif
- #ifdef L_mount
- #include <sys/mount.h>
- _syscall5(int, mount, const char *, specialfile, const char *, dir,
- const char *, filesystemtype, unsigned long, rwflag,
- const void *, data);
- #endif
- #ifdef L_umount
- #include <sys/mount.h>
- _syscall1(int, umount, const char *, specialfile);
- #endif
- #ifdef L_setuid
- #include <unistd.h>
- _syscall1(int, setuid, uid_t, uid);
- #endif
- #ifdef L_getuid
- #include <unistd.h>
- _syscall0(gid_t, getuid);
- #endif
- #ifdef L_stime
- #include <time.h>
- _syscall1(int, stime, const time_t *, t);
- #endif
- #ifdef L___ptrace
- #include <sys/ptrace.h>
- #define __NR___ptrace __NR_ptrace
- #ifdef __STR_NR_ptrace
- #define __STR_NR___ptrace __STR_NR_ptrace
- #endif
- _syscall4(long, __ptrace, enum __ptrace_request, request, pid_t, pid,
- void*, addr, void*, data);
- #endif
- #ifdef L_alarm
- #include <unistd.h>
- _syscall1(unsigned int, alarm, unsigned int, seconds);
- #endif
- #ifdef L_pause
- #include <unistd.h>
- _syscall0(int, pause);
- #endif
- #ifdef L_utime
- #include <utime.h>
- _syscall2(int, utime, const char *, filename, const struct utimbuf *, buf);
- #endif
- #ifdef L_access
- #include <unistd.h>
- _syscall2(int, access, const char *, pathname, int, mode);
- #endif
- #ifdef L_nice
- #include <unistd.h>
- _syscall1(int, nice, int, inc);
- #endif
- #ifdef L_sync
- #include <unistd.h>
- _syscall0(void, sync);
- #endif
- #ifdef L_kill
- #include <signal.h>
- #undef kill
- _syscall2(int, kill, pid_t, pid, int, sig);
- #endif
- #ifdef L_rename
- #include <stdio.h>
- _syscall2(int, rename, const char *, oldpath, const char *, newpath);
- #endif
- #ifdef L_mkdir
- #include <sys/stat.h>
- _syscall2(int, mkdir, const char *, pathname, mode_t, mode);
- #endif
- #ifdef L_rmdir
- #include <unistd.h>
- _syscall1(int, rmdir, const char *, pathname);
- #endif
- #ifdef L_dup
- #include <unistd.h>
- _syscall1(int, dup, int, oldfd);
- #endif
- #ifdef L_pipe
- #include <unistd.h>
- #if !defined(__sh__)
- _syscall1(int, pipe, int *, filedes);
- #endif
- #endif
- #ifdef L_times
- #include <sys/times.h>
- _syscall1(clock_t, times, struct tms *, buf);
- #endif
- #ifdef L_setgid
- #include <unistd.h>
- _syscall1(int, setgid, gid_t, gid);
- #endif
- #ifdef L_getgid
- #include <unistd.h>
- _syscall0(gid_t, getgid);
- #endif
- #ifdef L_geteuid
- # ifdef __NR_geteuid
- # include <unistd.h>
- _syscall0(uid_t, geteuid);
- # else
- uid_t geteuid(void)
- {
- return (getuid());
- }
- # endif
- #endif
- #ifdef L_getegid
- # ifdef __NR_getegid
- # include <unistd.h>
- _syscall0(gid_t, getegid);
- # else
- gid_t getegid(void)
- {
- return (getgid());
- }
- # endif
- #endif
- #ifdef L_umount2
- # ifdef __NR_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
- #endif
- #ifdef L__ioctl
- #include <stdarg.h>
- #include <sys/ioctl.h>
- #define __NR__ioctl __NR_ioctl
- #ifdef __STR_NR_ioctl
- #define __STR_NR__ioctl __STR_NR_ioctl
- #endif
- extern int _ioctl(int fd, int request, void *arg);
- _syscall3(int, _ioctl, int, fd, int, request, void *, arg);
- int ioctl(int fd, unsigned long int request, ...)
- {
- void *arg;
- va_list list;
- va_start(list, request);
- arg = va_arg(list, void *);
- va_end(list);
- return _ioctl(fd, request, arg);
- }
- #endif
- #ifdef L__fcntl
- #include <stdarg.h>
- #include <fcntl.h>
- #define __NR__fcntl __NR_fcntl
- #ifdef __STR_NR_fcntl
- #define __STR_NR__fcntl __STR_NR_fcntl
- #endif
- extern int _fcntl(int fd, int cmd, long arg);
- _syscall3(int, _fcntl, int, fd, int, cmd, long, arg);
- int fcntl(int fd, int command, ...)
- {
- long arg;
- va_list list;
- va_start(list, command);
- arg = va_arg(list, long);
- va_end(list);
- return _fcntl(fd, command, arg);
- }
- #endif
- #ifdef L_setpgid
- #include <unistd.h>
- _syscall2(int, setpgid, pid_t, pid, pid_t, pgid);
- #endif
- #ifdef L_umask
- #include <sys/stat.h>
- _syscall1(mode_t, umask, mode_t, mask);
- #endif
- #ifdef L_chroot
- #include <unistd.h>
- _syscall1(int, chroot, const char *, path);
- #endif
- #ifdef L_dup2
- #include <unistd.h>
- _syscall2(int, dup2, int, oldfd, int, newfd);
- #endif
- #ifdef L_getppid
- # include <unistd.h>
- # ifdef __NR_getppid
- _syscall0(pid_t, getppid);
- # else
- pid_t getppid(void)
- {
- return (getpid());
- }
- # endif
- #endif
- #ifdef L_getpgrp
- #include <unistd.h>
- _syscall0(pid_t, getpgrp);
- #endif
- #ifdef L_setsid
- #include <unistd.h>
- _syscall0(pid_t, setsid);
- #endif
- #ifdef L_sigaction
- #include <signal.h>
- #undef sigaction
- _syscall3(int, sigaction, int, signum, const struct sigaction *, act,
- struct sigaction *, oldact);
- #endif
- #ifdef L_setreuid
- #include <unistd.h>
- _syscall2(int, setreuid, uid_t, ruid, uid_t, euid);
- #endif
- #ifdef L_setregid
- #include <unistd.h>
- _syscall2(int, setregid, gid_t, rgid, gid_t, egid);
- #endif
- #ifdef L_sigsuspend
- #include <signal.h>
- #undef sigsuspend
- _syscall1(int, sigsuspend, const sigset_t *, mask);
- #endif
- #ifdef L_sigpending
- #include <signal.h>
- #undef sigpending
- _syscall1(int, sigpending, sigset_t *, set);
- #endif
- #ifdef L_sethostname
- #include <unistd.h>
- _syscall2(int, sethostname, const char *, name, size_t, len);
- #endif
- #ifdef L_setrlimit
- #include <unistd.h>
- #include <sys/resource.h>
- _syscall2(int, setrlimit, int, resource, const struct rlimit *, rlim);
- #endif
- #ifdef L_getrlimit
- #include <unistd.h>
- #include <sys/resource.h>
- _syscall2(int, getrlimit, int, resource, struct rlimit *, rlim);
- #endif
- #ifdef L_getrusage
- #include <unistd.h>
- #include <wait.h>
- _syscall2(int, getrusage, int, who, struct rusage *, usage);
- #endif
- #ifdef L_gettimeofday
- #include <sys/time.h>
- _syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz);
- #endif
- #ifdef L_settimeofday
- #include <sys/time.h>
- _syscall2(int, settimeofday, const struct timeval *, tv,
- const struct timezone *, tz);
- #endif
- #ifdef L_getgroups
- #include <unistd.h>
- _syscall2(int, getgroups, int, size, gid_t *, list);
- #endif
- #ifdef L_setgroups
- #include <unistd.h>
- #include <grp.h>
- _syscall2(int, setgroups, size_t, size, const gid_t *, list);
- #endif
- #ifdef L_symlink
- #include <unistd.h>
- _syscall2(int, symlink, const char *, oldpath, const char *, newpath);
- #endif
- #ifdef L_readlink
- #include <unistd.h>
- _syscall3(int, readlink, const char *, path, char *, buf, size_t, bufsiz);
- #endif
- #ifdef L_uselib
- #include <unistd.h>
- _syscall1(int, uselib, const char *, library);
- #endif
- #ifdef L_swapon
- #include <sys/swap.h>
- _syscall2(int, swapon, const char *, path, int, swapflags);
- #endif
- #ifdef L__reboot
- #define __NR__reboot __NR_reboot
- #ifdef __STR_NR_reboot
- #define __STR_NR__reboot __STR_NR_reboot
- #endif
- extern int _reboot(int magic, int magic2, int flag);
- _syscall3(int, _reboot, int, magic, int, magic2, int, flag);
- int reboot(int flag)
- {
- return (_reboot((int) 0xfee1dead, 672274793, flag));
- }
- #endif
- #ifdef L__mmap
- #define __NR__mmap __NR_mmap
- #ifdef __STR_NR_mmap
- #define __STR_NR__mmap __STR_NR_mmap
- #endif
- #include <unistd.h>
- #include <sys/mman.h>
- extern __ptr_t _mmap(unsigned long *buffer);
- _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);
- }
- #endif
- #ifdef L_munmap
- #include <unistd.h>
- #include <sys/mman.h>
- _syscall2(int, munmap, void *, start, size_t, length);
- #endif
- #ifdef L_truncate
- #include <unistd.h>
- _syscall2(int, truncate, const char *, path, off_t, length);
- #endif
- #ifdef L_ftruncate
- #include <unistd.h>
- _syscall2(int, ftruncate, int, fd, off_t, length);
- #endif
- #ifdef L_fchmod
- #include <sys/stat.h>
- _syscall2(int, fchmod, int, fildes, mode_t, mode);
- #endif
- #ifdef L_fchown
- #include <unistd.h>
- _syscall3(int, fchown, int, fd, uid_t, owner, gid_t, group);
- #endif
- #ifdef L_getpriority
- #include <sys/resource.h>
- _syscall2(int, getpriority, __priority_which_t, which, id_t, who);
- #endif
- #ifdef L_setpriority
- #include <sys/resource.h>
- _syscall3(int, setpriority, __priority_which_t, which, id_t, who, int, prio);
- #endif
- #ifdef L_statfs
- #include <sys/vfs.h>
- _syscall2(int, statfs, const char *, path, struct statfs *, buf);
- #endif
- #ifdef L_fstatfs
- #include <sys/vfs.h>
- _syscall2(int, fstatfs, int, fd, struct statfs *, buf);
- #endif
- #ifdef L_ioperm
- #include <sys/io.h>
- # if defined __UCLIBC_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
- #endif
- #ifdef L_socketcall
- _syscall2(int, socketcall, int, call, unsigned long *, args);
- #endif
- #ifdef L__syslog
- #include <unistd.h>
- #define __NR__syslog __NR_syslog
- #ifdef __STR_NR_syslog
- #define __STR_NR__syslog __STR_NR_syslog
- #endif
- extern int _syslog(int type, char *buf, int len);
- _syscall3(int, _syslog, int, type, char *, buf, int, len);
- int klogctl(int type, char *buf, int len)
- {
- return (_syslog(type, buf, len));
- }
- #endif
- #ifdef L_setitimer
- #include <sys/time.h>
- _syscall3(int, setitimer, __itimer_which_t, which,
- const struct itimerval *, new, struct itimerval *, old);
- #endif
- #ifdef L_getitimer
- #include <sys/time.h>
- _syscall2(int, getitimer, __itimer_which_t, which, struct itimerval *, value);
- #endif
- #ifdef L___stat
- #include <unistd.h>
- #include "statfix.h"
- #define __NR___stat __NR_stat
- #ifdef __STR_NR_stat
- #define __STR_NR___stat __STR_NR_stat
- #endif
- extern int __stat(const char *file_name, struct kernel_stat *buf);
- _syscall2(int, __stat, const char *, file_name, struct kernel_stat *, buf);
- int __xstat(int version, const char * file_name, struct libc_stat * cstat)
- {
- struct kernel_stat kstat;
- int result = __stat(file_name, &kstat);
- if (result == 0) {
- statfix(cstat, &kstat);
- }
- return result;
- }
- int stat(const char *file_name, struct libc_stat *buf)
- {
- return(__xstat(0, file_name, buf));
- }
- #endif
- #ifdef L___lstat
- #include <unistd.h>
- #include "statfix.h"
- #define __NR___lstat __NR_lstat
- #ifdef __STR_NR_lstat
- #define __STR_NR___lstat __STR_NR_lstat
- #endif
- extern int __lstat(const char *file_name, struct kernel_stat *buf);
- _syscall2(int, __lstat, const char *, file_name, struct kernel_stat *, buf);
- int __lxstat(int version, const char * file_name, struct libc_stat * cstat)
- {
- struct kernel_stat kstat;
- int result = __lstat(file_name, &kstat);
- if (result == 0) {
- statfix(cstat, &kstat);
- }
- return result;
- }
- int lstat(const char *file_name, struct libc_stat *buf)
- {
- return(__lxstat(0, file_name, buf));
- }
- #endif
- #ifdef L___fstat
- #include <unistd.h>
- #include "statfix.h"
- #define __NR___fstat __NR_fstat
- #ifdef __STR_NR_fstat
- #define __STR_NR___fstat __STR_NR_fstat
- #endif
- extern int __fstat(int filedes, struct kernel_stat *buf);
- _syscall2(int, __fstat, int, filedes, struct kernel_stat *, buf);
- int __fxstat(int version, int fd, struct libc_stat * cstat)
- {
- struct kernel_stat kstat;
- int result = __fstat(fd, &kstat);
- if (result == 0) {
- statfix(cstat, &kstat);
- }
- return result;
- }
- int fstat(int filedes, struct libc_stat *buf)
- {
- return(__fxstat(0, filedes, buf));
- }
- #endif
- #ifdef L_iopl
- #include <sys/io.h>
- # if defined __UCLIBC_HAS_MMU__ && defined __NR_iopl
- _syscall1(int, iopl, int, level);
- # else
- int iopl(int level)
- {
- __set_errno(ENOSYS);
- return -1;
- }
- # endif
- #endif
- #ifdef L_vhangup
- #include <unistd.h>
- _syscall0(int, vhangup);
- #endif
- #ifdef L_wait4
- _syscall4(int, wait4, pid_t, pid, int *, status, int, opts, void *, rusage);
- #endif
- #ifdef L_swapoff
- #include <sys/swap.h>
- _syscall1(int, swapoff, const char *, path);
- #endif
- #ifdef L_sysinfo
- #include <sys/sysinfo.h>
- _syscall1(int, sysinfo, struct sysinfo *, info);
- #endif
- #ifdef L___ipc
- #define __NR___ipc __NR_ipc
- #ifdef __STR_NR_ipc
- #define __STR_NR___ipc __STR_NR_ipc
- #endif
- _syscall5(int, __ipc, unsigned int, call, int, first, int, second, int, third, void *, ptr);
- #endif
- #ifdef L_fsync
- #include <unistd.h>
- _syscall1(int, fsync, int, fd);
- #endif
- #ifdef L_setdomainname
- #include <unistd.h>
- _syscall2(int, setdomainname, const char *, name, size_t, len);
- #endif
- #ifdef L_uname
- #include <sys/utsname.h>
- _syscall1(int, uname, struct utsname *, buf);
- #endif
- #ifdef L_adjtimex
- #include <sys/timex.h>
- _syscall1(int, adjtimex, struct timex *, buf);
- #endif
- #ifdef L_mprotect
- #include <sys/mman.h>
- _syscall3(int, mprotect, void *, addr, size_t, len, int, prot);
- #endif
- #ifdef L_sigprocmask
- #include <signal.h>
- #undef sigprocmask
- _syscall3(int, sigprocmask, int, how, const sigset_t *, set, sigset_t *,
- oldset);
- #endif
- #ifdef L_init_module
- _syscall5(int, init_module, void *, first, void *, second, void *, third,
- void *, fourth, void *, fifth);
- #endif
- #ifdef L_delete_module
- # ifdef __NR_delete_module
- _syscall1(int, delete_module, const char *, name);
- # else
- int delete_module(const char * name)
- {
- __set_errno(ENOSYS);
- return -1;
- }
- # endif
- #endif
- #ifdef L_getpgid
- _syscall1(pid_t, getpgid, pid_t, pid);
- #endif
- #ifdef L_fchdir
- #include <unistd.h>
- _syscall1(int, fchdir, int, fd);
- #endif
- #ifdef L_bdflush
- #include <sys/kdaemon.h>
- _syscall2(int, bdflush, int, __func, long int, __data);
- #endif
- #ifdef L__llseek
- extern int _llseek(int fd, off_t hoff, off_t loff, loff_t *res, int whence);
- _syscall5(int, _llseek, int, fd, off_t, hoff, off_t, loff, loff_t *, res,
- int, whence);
- loff_t llseek(int fd, loff_t offset, int whence)
- {
- int ret;
- loff_t result;
- ret = _llseek(fd, (off_t) (offset >> 32),
- (off_t) (offset & 0xffffffff), &result, whence);
- return ret ? (loff_t) ret : result;
- }
- #ifdef __UCLIBC_HAVE_LFS__
- weak_alias(llseek, lseek64);
- #endif
- #endif
- #ifdef L_getdents
- #include <unistd.h>
- #include <dirent.h>
- _syscall3(int, getdents, int, fd, char *, dirp, size_t, count);
- #endif
- #ifdef L__newselect
- #include <unistd.h>
- 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);
- int select(int n, fd_set * readfds, fd_set * writefds, fd_set * exceptfds,
- struct timeval *timeout)
- {
- return (_newselect(n, readfds, writefds, exceptfds, timeout));
- }
- #endif
- #ifdef L_flock
- #include <sys/file.h>
- _syscall2(int,flock,int,fd, int,operation);
- #endif
- #ifdef L_readv
- #include <sys/uio.h>
- _syscall3(ssize_t, readv, int, filedes, const struct iovec *, vector, int,
- count);
- #endif
- #ifdef L_writev
- #include <sys/uio.h>
- _syscall3(ssize_t, writev, int, filedes, const struct iovec *, vector, int,
- count);
- #endif
- #ifdef L_getsid
- #include <unistd.h>
- _syscall1(pid_t, getsid, pid_t, pid);
- #endif
- #ifdef L_mlock
- #include <sys/mman.h>
- # if defined __UCLIBC_HAS_MMU__ && defined __NR_mlock
- _syscall2(int, mlock, const void *, addr, size_t, len);
- # endif
- #endif
- #ifdef L_munlock
- #include <sys/mman.h>
- # if defined __UCLIBC_HAS_MMU__ && defined __NR_munlock
- _syscall2(int, munlock, const void *, addr, size_t, len);
- # endif
- #endif
- #ifdef L_mlockall
- #include <sys/mman.h>
- # if defined __UCLIBC_HAS_MMU__ && defined __NR_mlockall
- _syscall1(int, mlockall, int, flags);
- # endif
- #endif
- #ifdef L_munlockall
- #include <sys/mman.h>
- # if defined __UCLIBC_HAS_MMU__ && defined L_munlockall
- _syscall0(int, munlockall);
- # endif
- #endif
- #ifdef L_nanosleep
- #include <time.h>
- _syscall2(int, nanosleep, const struct timespec *, req, struct timespec *, rem);
- #endif
- #ifdef L_mremap
- #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);
- #endif
- #ifdef L_query_module
- # 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
- #endif
- #if defined(L_poll) && defined(__NR_poll)
- #include <sys/poll.h>
- _syscall3(int, poll, struct pollfd *, fds, unsigned long int, nfds, int, timeout);
- #endif
- #ifdef L_chown
- #include <unistd.h>
- _syscall3(int, chown, const char *, path, uid_t, owner, gid_t, group);
- #endif
- #ifdef L_capget
- # ifdef __NR_capget
- _syscall2(int, capget, void*, header, void*, data);
- # else
- int capget(void* header, void* data)
- {
- __set_errno(ENOSYS);
- return -1;
- }
- # endif
- #endif
- #ifdef L_capset
- # 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
- #endif
- #ifdef __UCLIBC_HAVE_LFS__
- #ifdef L_truncate64
- #include <unistd.h>
- _syscall2(int, truncate64, const char *, path, __off64_t, length);
- #endif
- #ifdef L_ftruncate64
- #include <unistd.h>
- _syscall2(int, ftruncate64, int, fd, __off64_t, length);
- #endif
- #ifdef L___stat64
- #include <unistd.h>
- #include "statfix64.h"
- #define __NR___stat64 __NR_stat64
- #ifdef __STR_NR_stat64
- #define __STR_NR___stat64 __STR_NR_stat64
- #endif
- extern int __stat64(const char *file_name, struct kernel_stat64 *buf);
- _syscall2(int, __stat64, const char *, file_name, struct kernel_stat64 *, buf);
- int __xstat64(int version, const char * file_name, struct libc_stat64 * cstat)
- {
- struct kernel_stat64 kstat;
- int result = __stat64(file_name, &kstat);
- if (result == 0) {
- statfix64(cstat, &kstat);
- }
- return result;
- }
- int stat64(const char *file_name, struct libc_stat64 *buf)
- {
- return(__xstat64(0, file_name, buf));
- }
- #endif
- #ifdef L___lstat64
- #include <unistd.h>
- #include "statfix64.h"
- #define __NR___lstat64 __NR_lstat64
- #ifdef __STR_NR_lstat64
- #define __STR_NR___lstat64 __STR_NR_lstat64
- #endif
- extern int __lstat64(const char *file_name, struct kernel_stat64 *buf);
- _syscall2(int, __lstat64, const char *, file_name, struct kernel_stat64 *, buf);
- int __lxstat64(int version, const char * file_name, struct libc_stat64 * cstat)
- {
- struct kernel_stat64 kstat;
- int result = __lstat64(file_name, &kstat);
- if (result == 0) {
- statfix64(cstat, &kstat);
- }
- return result;
- }
- int lstat64(const char *file_name, struct libc_stat64 *buf)
- {
- return(__lxstat64(0, file_name, buf));
- }
- #endif
- #ifdef L___fstat64
- #include <unistd.h>
- #include "statfix64.h"
- #define __NR___fstat64 __NR_fstat64
- #ifdef __STR_NR_fstat64
- #define __STR_NR___fstat64 __STR_NR_fstat64
- #endif
- extern int __fstat64(int filedes, struct kernel_stat64 *buf);
- _syscall2(int, __fstat64, int, filedes, struct kernel_stat64 *, buf);
- int __fxstat64(int version, int fd, struct libc_stat64 * cstat)
- {
- struct kernel_stat64 kstat;
- int result = __fstat64(fd, &kstat);
- if (result == 0) {
- statfix64(cstat, &kstat);
- }
- return result;
- }
- int fstat64(int filedes, struct libc_stat64 *buf)
- {
- return(__fxstat64(0, filedes, buf));
- }
- #endif
- #endif
|