From 58153774b19f9c6f8c0ce509a935730afa7b53db Mon Sep 17 00:00:00 2001 From: Gianluca Guida Date: Tue, 15 Feb 2011 12:03:42 +0000 Subject: [PATCH] This patch modifies the NetBSD basic includes to be Minix compatible. There are also changes in the make file, mostly to let them install in /usr/netbsd/include. --- nbsd_include/Makefile | 16 +++++++++++----- nbsd_include/fts.h | 2 ++ nbsd_include/paths.h | 4 ++++ nbsd_include/rpc/Makefile | 2 +- nbsd_include/sched.h | 3 +++ nbsd_include/signal.h | 11 +++++++++++ nbsd_include/stdio.h | 2 +- nbsd_include/stdlib.h | 2 ++ nbsd_include/time.h | 14 ++++++++++++++ nbsd_include/unistd.h | 34 ++++++++++++++++++++++++++++++++-- 10 files changed, 81 insertions(+), 9 deletions(-) diff --git a/nbsd_include/Makefile b/nbsd_include/Makefile index bb2f8ca6d..c4d1c967b 100644 --- a/nbsd_include/Makefile +++ b/nbsd_include/Makefile @@ -11,9 +11,9 @@ INCS= a.out.h aio.h ar.h assert.h atomic.h \ bitstring.h bm.h cdbr.h cdbw.h complex.h cpio.h ctype.h \ db.h dirent.h disktab.h dlfcn.h err.h errno.h fenv.h fmtmsg.h fnmatch.h \ fstab.h fts.h ftw.h getopt.h glob.h grp.h ifaddrs.h iconv.h \ - inttypes.h iso646.h kvm.h langinfo.h libgen.h \ + inttypes.h iso646.h langinfo.h libgen.h \ limits.h link.h link_aout.h link_elf.h locale.h \ - login_cap.h lwp.h malloc.h math.h md2.h \ + login_cap.h malloc.h math.h md2.h \ memory.h mntopts.h monetary.h mpool.h mqueue.h \ ndbm.h netconfig.h netdb.h netgroup.h nlist.h nl_types.h nsswitch.h \ paths.h pwd.h randomid.h ranlib.h re_comp.h regex.h regexp.h \ @@ -40,10 +40,16 @@ INCS+= ieeefp.h .include -INCSDIR= /usr/include +INCSDIR= /usr/netbsd/include -SUBDIR= rpc -SUBDIR+= ../common/include/prop +.include "${MINIXSRCDIR}/common/include/Makefile.inc" + +#SUBDIR= rpc +SUBDIR+= #../common/include/prop + + +SUBDIR+= arch sys minix +SUBDIR+= net netinet netinet6 .include .include diff --git a/nbsd_include/fts.h b/nbsd_include/fts.h index 394948c51..36301b4e1 100644 --- a/nbsd_include/fts.h +++ b/nbsd_include/fts.h @@ -75,7 +75,9 @@ typedef struct { #define FTS_PHYSICAL 0x010 /* physical walk */ #define FTS_SEEDOT 0x020 /* return dot and dot-dot */ #define FTS_XDEV 0x040 /* don't cross devices */ +#ifndef __minix #define FTS_WHITEOUT 0x080 /* return whiteout information */ +#endif #define FTS_OPTIONMASK 0x0ff /* valid user option mask */ #define FTS_NAMEONLY 0x100 /* (private) child names only */ diff --git a/nbsd_include/paths.h b/nbsd_include/paths.h index 00e4f6b18..410f92092 100644 --- a/nbsd_include/paths.h +++ b/nbsd_include/paths.h @@ -124,5 +124,9 @@ #define _PATH_VI "/usr/bin/vi" #endif +#ifdef __minix +#include +#endif /* !__minix */ + #endif /* !_PATHS_H_ */ diff --git a/nbsd_include/rpc/Makefile b/nbsd_include/rpc/Makefile index b37d99d96..12f589b75 100644 --- a/nbsd_include/rpc/Makefile +++ b/nbsd_include/rpc/Makefile @@ -7,7 +7,7 @@ INCS= auth.h auth_unix.h clnt.h clnt_soc.h nettype.h \ svc.h svc_auth.h svc_soc.h types.h xdr.h RPC_INCS= rpcb_prot.h -INCSDIR= /usr/include/rpc +INCSDIR= /usr/netbsd/include/rpc .include .include diff --git a/nbsd_include/sched.h b/nbsd_include/sched.h index 0a3e423fd..3ac9ac63c 100644 --- a/nbsd_include/sched.h +++ b/nbsd_include/sched.h @@ -29,6 +29,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef __minix +#define _SCHED_H_ +#endif /* !__minix */ #ifndef _SCHED_H_ #define _SCHED_H_ diff --git a/nbsd_include/signal.h b/nbsd_include/signal.h index eddb2f499..8245a96cc 100644 --- a/nbsd_include/signal.h +++ b/nbsd_include/signal.h @@ -62,6 +62,7 @@ int kill(pid_t, int); int __libc_sigaction14(int, const struct sigaction * __restrict, struct sigaction * __restrict); +#ifndef __minix #if (_POSIX_C_SOURCE - 0L) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \ defined(_NETBSD_SOURCE) int pthread_sigmask(int, const sigset_t * __restrict, @@ -73,6 +74,7 @@ int __libc_thr_sigsetmask(int, const sigset_t * __restrict, #define pthread_sigmask __libc_thr_sigsetmask #endif /* __LIBPTHREAD_SOURCE__ */ #endif +#endif /* __minix */ #ifndef __LIBC12_SOURCE__ int sigaction(int, const struct sigaction * __restrict, @@ -160,11 +162,13 @@ sigfillset(sigset_t *set) (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE) int killpg(pid_t, int); int siginterrupt(int, int); +#ifndef __minix int sigstack(const struct sigstack *, struct sigstack *); #ifndef __LIBC12_SOURCE__ int sigaltstack(const stack_t * __restrict, stack_t * __restrict) __RENAME(__sigaltstack14); #endif +#endif /* !__minix */ int sighold(int); int sigignore(int); int sigpause(int); @@ -178,10 +182,13 @@ void (*sigset (int, void (*)(int)))(int); */ #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \ defined(_NETBSD_SOURCE) +#ifndef __minix int sigwait (const sigset_t * __restrict, int * __restrict); int sigwaitinfo(const sigset_t * __restrict, siginfo_t * __restrict); +#endif /* !__minix */ void psiginfo(const siginfo_t *, const char *); +#ifndef __minix #ifndef __LIBC12_SOURCE__ struct timespec; int sigtimedwait(const sigset_t * __restrict, @@ -191,15 +198,19 @@ int __sigtimedwait(const sigset_t * __restrict, siginfo_t * __restrict, struct timespec * __restrict) __RENAME(____sigtimedwait50); #endif +#endif /* !__minix */ #endif /* _POSIX_C_SOURCE >= 200112 || _XOPEN_SOURCE_EXTENDED || ... */ + #if defined(_NETBSD_SOURCE) +#ifndef __minix #ifndef __PSIGNAL_DECLARED #define __PSIGNAL_DECLARED /* also in unistd.h */ void psignal(int, const char *); #endif /* __PSIGNAL_DECLARED */ +#endif /* !__minix */ int sigblock(int); int sigsetmask(int); #endif /* _NETBSD_SOURCE */ diff --git a/nbsd_include/stdio.h b/nbsd_include/stdio.h index 31bdb0497..0f977a21a 100644 --- a/nbsd_include/stdio.h +++ b/nbsd_include/stdio.h @@ -274,7 +274,7 @@ int vsprintf(char * __restrict, const char * __restrict, __printflike(2, 0); #endif -#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) +#if !defined(__minix) && (defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)) int rename (const char *, const char *) __RENAME(__posix_rename); #else int rename (const char *, const char *); diff --git a/nbsd_include/stdlib.h b/nbsd_include/stdlib.h index 1ef7d0b7d..a9e6044ec 100644 --- a/nbsd_include/stdlib.h +++ b/nbsd_include/stdlib.h @@ -280,7 +280,9 @@ __aconst char *devname(dev_t, mode_t) __RENAME(__devname50); int humanize_number(char *, size_t, int64_t, const char *, int, int); int dehumanize_number(const char *, int64_t *); +#ifndef __minix devmajor_t getdevmajor(const char *, mode_t); +#endif /* !__minix */ int getloadavg(double [], int); int getenv_r(const char *, char *, size_t); diff --git a/nbsd_include/time.h b/nbsd_include/time.h index 8108eff4f..66a7d259e 100644 --- a/nbsd_include/time.h +++ b/nbsd_include/time.h @@ -110,7 +110,11 @@ size_t strftime(char * __restrict, size_t, const char * __restrict, * need to include unistd.h */ long __sysconf(int); +#ifdef __minix +#define CLK_TCK (__sysconf(3)) +#else #define CLK_TCK (__sysconf(39)) +#endif /* !__minix */ #endif #endif @@ -143,22 +147,28 @@ extern int getdate_err; struct sigevent; struct itimerspec; #ifndef __LIBC12_SOURCE__ +#ifndef __minix int clock_getres(clockid_t, struct timespec *) __RENAME(__clock_getres50); int clock_gettime(clockid_t, struct timespec *) __RENAME(__clock_gettime50); int clock_settime(clockid_t, const struct timespec *) __RENAME(__clock_settime50); +#endif /* !__minix */ int nanosleep(const struct timespec *, struct timespec *) __RENAME(__nanosleep50); +#ifndef __minix int timer_gettime(timer_t, struct itimerspec *) __RENAME(__timer_gettime50); int timer_settime(timer_t, int, const struct itimerspec * __restrict, struct itimerspec * __restrict) __RENAME(__timer_settime50); +#endif /* !__minix */ #endif +#ifndef __minix int timer_create(clockid_t, struct sigevent * __restrict, timer_t * __restrict); int timer_delete(timer_t); int timer_getoverrun(timer_t); +#endif /* __minix */ #endif /* _POSIX_C_SOURCE >= 199309 || _XOPEN_SOURCE >= 500 || ... */ #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \ @@ -205,6 +215,10 @@ size_t strftime_z(const timezone_t, char * __restrict, size_t, #endif /* _NETBSD_SOURCE */ +#ifdef _MINIX +int stime(time_t *_top); +#endif /* _MINIX */ + __END_DECLS #endif /* !_TIME_H_ */ diff --git a/nbsd_include/unistd.h b/nbsd_include/unistd.h index 32dbb29ad..4440e07ca 100644 --- a/nbsd_include/unistd.h +++ b/nbsd_include/unistd.h @@ -133,7 +133,9 @@ ssize_t read(int, void *, size_t); #endif int rmdir(const char *); int setgid(gid_t); +#ifndef __minix int setpgid(pid_t, pid_t); +#endif /* !__minix */ pid_t setsid(void); int setuid(uid_t); unsigned int sleep(unsigned int); @@ -181,7 +183,7 @@ int truncate(const char *, off_t); */ #if (_POSIX_C_SOURCE - 0) >= 199309L || \ (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \ - (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE) + (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE) int ftruncate(int, off_t); #endif #endif /* __OFF_T_SYSCALLS_DECLARED */ @@ -192,7 +194,9 @@ int ftruncate(int, off_t); */ #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \ defined(_NETBSD_SOURCE) +#ifndef __minix int fdatasync(int); +#endif /* !__minix */ int fsync(int); #endif @@ -222,7 +226,9 @@ int nice(int); __aconst char *crypt(const char *, const char *); int encrypt(char *, int); char *getpass(const char *); +#ifndef __minix pid_t getsid(pid_t); +#endif /* !__minix */ #endif @@ -253,29 +259,37 @@ long gethostid(void); int gethostname(char *, size_t); __pure int getpagesize(void); /* legacy */ +#ifndef __minix pid_t getpgid(pid_t); +#endif /* !__minix */ +#ifndef __minix #if defined(_XOPEN_SOURCE) int lchown(const char *, uid_t, gid_t) __RENAME(__posix_lchown); #else int lchown(const char *, uid_t, gid_t); #endif +#endif /* !__minix */ int lockf(int, int, off_t); #if __SSP_FORTIFY_LEVEL == 0 ssize_t readlink(const char * __restrict, char * __restrict, size_t); #endif void *sbrk(intptr_t); +#ifndef __minix /* XXX prototype wrong! */ int setpgrp(pid_t, pid_t); /* obsoleted by setpgid() */ int setregid(gid_t, gid_t); int setreuid(uid_t, uid_t); +#endif /* !__minix */ void swab(const void * __restrict, void * __restrict, ssize_t); int symlink(const char *, const char *); void sync(void); useconds_t ualarm(useconds_t, useconds_t); int usleep(useconds_t); -#ifndef __LIBC12_SOURCE__ +#ifndef __minix +#ifndef __LIBC12_SOURCE__ pid_t vfork(void) __RENAME(__vfork14); #endif +#endif /* !__minix */ #ifndef __AUDIT__ char *getwd(char *); /* obsoleted by getcwd() */ @@ -295,8 +309,14 @@ ssize_t pwrite(int, const void *, size_t, off_t); /* * Implementation-defined extensions */ +#if defined(__minix) +int lseek64(int fd, u64_t _offset, int _whence, u64_t *_newpos); +#endif /* !__minix */ + #if defined(_NETBSD_SOURCE) +#ifndef __minix int acct(const char *); +#endif /* !__minix */ int closefrom(int); int des_cipher(const char *, char *, long, int); int des_setkey(const char *); @@ -315,15 +335,23 @@ int initgroups(const char *, gid_t); int iruserok(uint32_t, int, const char *, const char *); int issetugid(void); int nfssvc(int, void *); +#ifndef __minix int profil(char *, size_t, u_long, u_int); #ifndef __PSIGNAL_DECLARED #define __PSIGNAL_DECLARED /* also in signal.h */ void psignal(int, const char *); #endif /* __PSIGNAL_DECLARED */ +#endif /* !__minix */ int rcmd(char **, int, const char *, const char *, const char *, int *); +#ifdef __minix +int reboot(int, ...); +#else int reboot(int, char *); +#endif +#ifndef __minix int revoke(const char *); +#endif int rresvport(int *); int ruserok(const char *, int, const char *, const char *); int setdomainname(const char *, size_t); @@ -341,8 +369,10 @@ void strmode(mode_t, char *); /* backwards-compatibility; also in string.h */ __aconst char *strsignal(int); #endif /* __STRSIGNAL_DECLARED */ +#ifndef __minix int swapctl(int, void *, int); int swapon(const char *); /* obsoleted by swapctl() */ +#endif /* !__minix */ int syscall(int, ...); quad_t __syscall(quad_t, ...); int undelete(const char *); -- 2.44.0