From f19a4bf1c4268b5fdd695fe1acbfa7e10d401ed6 Mon Sep 17 00:00:00 2001 From: Gianluca Guida Date: Fri, 4 Mar 2011 23:15:48 +0000 Subject: [PATCH] Various fixes for NBSD include. This patch include various fixes to NBSD includes. - unistd.h: Avoid different linkages on non-_NETBSD_SOURCE compilation; - stdlib.h: remove devname declaration. - sys/select.h: Add _MINIX specific flags. - limits.h: Add SYMLOOP_MAX and SYMLINK_MAX - time.h: Fix CLOCKS_PER_SEC and remove BSD's timer_t, as it confuses minix own specific timers. - utmp.h: Set Minix-specific paths and use Minix utmp format. - param.h: Do not set BSD4_4, as this mostly means sa_len in struct sock_addr. - arch/i386/include/param.h: include to add PAGE_SIZE and related macros, defined round_page() and trunc_page() for minix compatibility. - dirent.h: remove DIRBLKSIZ and fix d_ino/d_fileno. - sys/dir.h: ADD from existing includes and edit include conditions. - sys/dirent.h: include , fix d_ino/d_fileno. - sys/fd_set.h: set default FD_SETSIZE at __MINIX_OPENMAX, as the default NetBSD value is too big and cause vfs to return an error. - sys/cdefs.h: Always include - minix/paths.h: Add Minix-specific paths. - minix/dirent.h: ADD, keep only "direct" and "flex"definitions. - minix/types.h: include - sys/Makefile: add sys/dirent.h and statfs.h (forgot!) - minix/Makefile: add minix/dirent.h nbsd_include/minix-port.patch updated accordingly. --- nbsd_include/arch/i386/include/param.h | 21 ++- nbsd_include/dirent.h | 4 + nbsd_include/limits.h | 5 + nbsd_include/minix-port.patch | 182 +++++++++++++++++++++++-- nbsd_include/minix/Makefile | 2 +- nbsd_include/minix/dirent.h | 56 ++++++++ nbsd_include/minix/paths.h | 12 ++ nbsd_include/minix/types.h | 1 + nbsd_include/stdlib.h | 2 + nbsd_include/sys/Makefile | 4 +- nbsd_include/sys/cdefs.h | 5 + nbsd_include/sys/dir.h | 11 ++ nbsd_include/sys/dirent.h | 9 +- nbsd_include/sys/fd_set.h | 3 +- nbsd_include/sys/param.h | 2 + nbsd_include/sys/select.h | 11 ++ nbsd_include/time.h | 6 + nbsd_include/unistd.h | 4 +- nbsd_include/utmp.h | 36 +++++ 19 files changed, 340 insertions(+), 36 deletions(-) create mode 100644 nbsd_include/minix/dirent.h create mode 100644 nbsd_include/sys/dir.h diff --git a/nbsd_include/arch/i386/include/param.h b/nbsd_include/arch/i386/include/param.h index 3d0f98644..f37db3dca 100644 --- a/nbsd_include/arch/i386/include/param.h +++ b/nbsd_include/arch/i386/include/param.h @@ -41,18 +41,6 @@ * Machine dependent constants for Intel 386. */ -#ifdef _KERNEL -#include -#endif - -#ifndef _MINIX -#define _MACHINE i386 -#define MACHINE "i386" -#define _MACHINE_ARCH i386 -#define MACHINE_ARCH "i386" -#define MID_MACHINE MID_I386 -#endif - /* * Round p (pointer or byte index) up to a correctly-aligned value * for all data types (int, long, ...). The result is u_int and @@ -87,4 +75,13 @@ #define x86_btop(x) ((paddr_t)(x) >> PGSHIFT) #define x86_ptob(x) ((paddr_t)(x) << PGSHIFT) +#ifdef __minix +/* Minix expect to find in this file PAGE_* defines. */ +#include + +#define trunc_page(x) x86_trunc_page(x) +#define round_page(x) x86_round_page(x) + +#endif + #endif /* _I386_PARAM_H_ */ diff --git a/nbsd_include/dirent.h b/nbsd_include/dirent.h index 6598b0e1f..81d9fee49 100644 --- a/nbsd_include/dirent.h +++ b/nbsd_include/dirent.h @@ -43,16 +43,20 @@ */ #include +#ifndef __minix #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) #define d_ino d_fileno /* backward compatibility */ #endif +#endif /* !__minix */ typedef struct _dirdesc DIR; #if defined(_NETBSD_SOURCE) +#ifndef __minix /* definitions for library routines operating on directories. */ #define DIRBLKSIZ 1024 +#endif /* structure describing an open directory. */ struct _dirdesc { diff --git a/nbsd_include/limits.h b/nbsd_include/limits.h index dd633b152..447fa8acc 100644 --- a/nbsd_include/limits.h +++ b/nbsd_include/limits.h @@ -113,4 +113,9 @@ #include #include +#ifdef __minix +#define SYMLOOP_MAX 16 +#define SYMLINK_MAX 1024 +#endif + #endif /* !_LIMITS_H_ */ diff --git a/nbsd_include/minix-port.patch b/nbsd_include/minix-port.patch index 6f9dc5b0d..76a2f29f5 100644 --- a/nbsd_include/minix-port.patch +++ b/nbsd_include/minix-port.patch @@ -1,6 +1,6 @@ diff -ru /home/netbsd/src/include/Makefile ./Makefile --- /home/netbsd/src/include/Makefile 2010-08-01 03:01:48.000000000 +0000 -+++ ./Makefile 2011-02-15 12:52:02.000000000 +0000 ++++ ./Makefile 2011-02-21 16:03:25.000000000 +0000 @@ -7,6 +7,24 @@ # Missing: mp.h @@ -34,7 +34,7 @@ diff -ru /home/netbsd/src/include/Makefile ./Makefile INCS+= arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/nameser_compat.h \ arpa/telnet.h arpa/tftp.h INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \ -@@ -40,10 +59,27 @@ +@@ -40,10 +59,28 @@ .include @@ -56,15 +56,40 @@ diff -ru /home/netbsd/src/include/Makefile ./Makefile + +.if defined(__MINIX) +.include "${MINIXSRCDIR}/common/include/Makefile.inc" ++SUBDIR+= arch/${MACHINE} +SUBDIR+= arch sys minix +SUBDIR+= net netinet netinet6 +.endif .include .include +diff -ru /home/netbsd/src/include/dirent.h ./dirent.h +--- /home/netbsd/src/include/dirent.h 2010-09-26 03:01:02.000000000 +0000 ++++ ./dirent.h 2011-02-24 09:08:12.000000000 +0000 +@@ -43,16 +43,20 @@ + */ + #include + ++#ifndef __minix + #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) + #define d_ino d_fileno /* backward compatibility */ + #endif ++#endif /* !__minix */ + + typedef struct _dirdesc DIR; + + #if defined(_NETBSD_SOURCE) + ++#ifndef __minix + /* definitions for library routines operating on directories. */ + #define DIRBLKSIZ 1024 ++#endif + + /* structure describing an open directory. */ + struct _dirdesc { diff -ru /home/netbsd/src/include/fts.h ./fts.h --- /home/netbsd/src/include/fts.h 2009-08-19 20:23:46.000000000 +0000 -+++ ./fts.h 2011-02-14 17:04:58.000000000 +0000 ++++ ./fts.h 2011-02-21 16:03:25.000000000 +0000 @@ -75,7 +75,9 @@ #define FTS_PHYSICAL 0x010 /* physical walk */ #define FTS_SEEDOT 0x020 /* return dot and dot-dot */ @@ -75,9 +100,22 @@ diff -ru /home/netbsd/src/include/fts.h ./fts.h #define FTS_OPTIONMASK 0x0ff /* valid user option mask */ #define FTS_NAMEONLY 0x100 /* (private) child names only */ +diff -ru /home/netbsd/src/include/limits.h ./limits.h +--- /home/netbsd/src/include/limits.h 2010-06-08 03:01:32.000000000 +0000 ++++ ./limits.h 2011-03-04 11:24:14.000000000 +0000 +@@ -113,4 +113,9 @@ + #include + #include + ++#ifdef __minix ++#define SYMLOOP_MAX 16 ++#define SYMLINK_MAX 1024 ++#endif ++ + #endif /* !_LIMITS_H_ */ diff -ru /home/netbsd/src/include/paths.h ./paths.h --- /home/netbsd/src/include/paths.h 2010-12-30 03:02:34.000000000 +0000 -+++ ./paths.h 2011-02-14 17:04:58.000000000 +0000 ++++ ./paths.h 2011-02-21 16:03:25.000000000 +0000 @@ -124,5 +124,9 @@ #define _PATH_VI "/usr/bin/vi" #endif @@ -90,7 +128,7 @@ diff -ru /home/netbsd/src/include/paths.h ./paths.h diff -ru /home/netbsd/src/include/rpc/Makefile ./rpc/Makefile --- /home/netbsd/src/include/rpc/Makefile 2003-01-11 13:28:43.000000000 +0000 -+++ ./rpc/Makefile 2011-02-15 12:36:08.000000000 +0000 ++++ ./rpc/Makefile 2011-02-21 16:03:24.000000000 +0000 @@ -7,7 +7,11 @@ svc.h svc_auth.h svc_soc.h types.h xdr.h RPC_INCS= rpcb_prot.h @@ -105,7 +143,7 @@ diff -ru /home/netbsd/src/include/rpc/Makefile ./rpc/Makefile .include diff -ru /home/netbsd/src/include/sched.h ./sched.h --- /home/netbsd/src/include/sched.h 2009-01-11 03:05:43.000000000 +0000 -+++ ./sched.h 2011-02-14 17:04:58.000000000 +0000 ++++ ./sched.h 2011-02-21 16:03:25.000000000 +0000 @@ -29,6 +29,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ @@ -118,7 +156,7 @@ diff -ru /home/netbsd/src/include/sched.h ./sched.h diff -ru /home/netbsd/src/include/signal.h ./signal.h --- /home/netbsd/src/include/signal.h 2010-08-28 03:00:54.000000000 +0000 -+++ ./signal.h 2011-02-15 12:11:57.000000000 +0000 ++++ ./signal.h 2011-02-21 16:03:25.000000000 +0000 @@ -62,6 +62,7 @@ int __libc_sigaction14(int, const struct sigaction * __restrict, struct sigaction * __restrict); @@ -184,7 +222,7 @@ diff -ru /home/netbsd/src/include/signal.h ./signal.h #endif /* _NETBSD_SOURCE */ diff -ru /home/netbsd/src/include/stdio.h ./stdio.h --- /home/netbsd/src/include/stdio.h 2010-09-25 03:01:11.000000000 +0000 -+++ ./stdio.h 2011-02-14 17:04:58.000000000 +0000 ++++ ./stdio.h 2011-02-21 16:03:25.000000000 +0000 @@ -274,7 +274,7 @@ __printflike(2, 0); #endif @@ -196,8 +234,20 @@ diff -ru /home/netbsd/src/include/stdio.h ./stdio.h int rename (const char *, const char *); diff -ru /home/netbsd/src/include/stdlib.h ./stdlib.h --- /home/netbsd/src/include/stdlib.h 2010-12-23 03:03:09.000000000 +0000 -+++ ./stdlib.h 2011-02-14 17:04:58.000000000 +0000 -@@ -280,7 +280,9 @@ ++++ ./stdlib.h 2011-02-24 02:42:48.000000000 +0000 +@@ -265,9 +265,11 @@ + void csetexpandtc(int); + + int daemon(int, int); ++#ifndef __minix + #ifndef __LIBC12_SOURCE__ + __aconst char *devname(dev_t, mode_t) __RENAME(__devname50); + #endif ++#endif /* !__minix */ + + #define HN_DECIMAL 0x01 + #define HN_NOSPACE 0x02 +@@ -280,7 +282,9 @@ int humanize_number(char *, size_t, int64_t, const char *, int, int); int dehumanize_number(const char *, int64_t *); @@ -209,8 +259,27 @@ diff -ru /home/netbsd/src/include/stdlib.h ./stdlib.h int getenv_r(const char *, char *, size_t); diff -ru /home/netbsd/src/include/time.h ./time.h --- /home/netbsd/src/include/time.h 2010-12-17 03:01:54.000000000 +0000 -+++ ./time.h 2011-02-14 17:04:58.000000000 +0000 -@@ -110,7 +110,11 @@ ++++ ./time.h 2011-03-02 07:10:52.000000000 +0000 +@@ -65,12 +65,18 @@ + #undef _BSD_CLOCKID_T_ + #endif + ++#ifndef __minix + #ifdef _BSD_TIMER_T_ + typedef _BSD_TIMER_T_ timer_t; + #undef _BSD_TIMER_T_ + #endif ++#endif /* !__minix */ + ++#ifdef __minix ++#define CLOCKS_PER_SEC 60 ++#else + #define CLOCKS_PER_SEC 100 ++#endif + + struct tm { + int tm_sec; /* seconds after the minute [0-61] */ +@@ -110,7 +116,11 @@ * need to include unistd.h */ long __sysconf(int); @@ -222,7 +291,7 @@ diff -ru /home/netbsd/src/include/time.h ./time.h #endif #endif -@@ -143,22 +147,28 @@ +@@ -143,22 +153,28 @@ struct sigevent; struct itimerspec; #ifndef __LIBC12_SOURCE__ @@ -251,7 +320,7 @@ diff -ru /home/netbsd/src/include/time.h ./time.h #endif /* _POSIX_C_SOURCE >= 199309 || _XOPEN_SOURCE >= 500 || ... */ #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \ -@@ -205,6 +215,10 @@ +@@ -205,6 +221,10 @@ #endif /* _NETBSD_SOURCE */ @@ -264,7 +333,16 @@ diff -ru /home/netbsd/src/include/time.h ./time.h #endif /* !_TIME_H_ */ diff -ru /home/netbsd/src/include/unistd.h ./unistd.h --- /home/netbsd/src/include/unistd.h 2011-01-20 03:02:09.000000000 +0000 -+++ ./unistd.h 2011-02-15 12:17:07.000000000 +0000 ++++ ./unistd.h 2011-03-03 15:29:11.000000000 +0000 +@@ -88,7 +88,7 @@ + int access(const char *, int); + unsigned int alarm(unsigned int); + int chdir(const char *); +-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) ++#if !defined(__minix) && (defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)) + int chown(const char *, uid_t, gid_t) __RENAME(__posix_chown); + #else + int chown(const char *, uid_t, gid_t); @@ -133,7 +133,9 @@ #endif int rmdir(const char *); @@ -295,6 +373,15 @@ diff -ru /home/netbsd/src/include/unistd.h ./unistd.h #endif +@@ -243,7 +249,7 @@ + + int brk(void *); + int fchdir(int); +-#if defined(_XOPEN_SOURCE) ++#if !defined(__minix) && defined(_XOPEN_SOURCE) + int fchown(int, uid_t, gid_t) __RENAME(__posix_fchown); + #else + int fchown(int, uid_t, gid_t); @@ -253,29 +259,37 @@ int gethostname(char *, size_t); __pure int @@ -383,3 +470,68 @@ diff -ru /home/netbsd/src/include/unistd.h ./unistd.h int syscall(int, ...); quad_t __syscall(quad_t, ...); int undelete(const char *); +diff -ru /home/netbsd/src/include/utmp.h ./utmp.h +--- /home/netbsd/src/include/utmp.h 2009-01-11 03:05:43.000000000 +0000 ++++ ./utmp.h 2011-03-01 12:59:49.000000000 +0000 +@@ -39,12 +39,26 @@ + #ifndef _UTMP_H_ + #define _UTMP_H_ + ++#ifdef __minix ++#define _PATH_UTMP "/etc/utmp" ++#define _PATH_WTMP "/usr/adm/wtmp" ++#define _PATH_BTMP "/usr/adm/btmp" ++#define _PATH_LASTLOG "/usr/adm/lastlog" ++#define UTMP _PATH_UTMP ++#define WTMP _PATH_WTMP ++#define BTMP _PATH_BTMP ++#else + #define _PATH_UTMP "/var/run/utmp" + #define _PATH_WTMP "/var/log/wtmp" + #define _PATH_LASTLOG "/var/log/lastlog" ++#endif + + #define UT_NAMESIZE 8 ++#ifdef __minix ++#define UT_LINESIZE 12 ++#else + #define UT_LINESIZE 8 ++#endif + #define UT_HOSTSIZE 16 + + struct lastlog { +@@ -53,12 +67,34 @@ + char ll_host[UT_HOSTSIZE]; + }; + ++#ifdef __minix ++struct utmp { ++ char ut_name[UT_NAMESIZE]; /* user name */ ++ char ut_id[4]; /* /etc/inittab ID */ ++ char ut_line[UT_LINESIZE]; /* terminal name */ ++ char ut_host[UT_HOSTSIZE]; /* host name, when remote */ ++ short ut_pid; /* process id */ ++ short int ut_type; /* type of entry */ ++ long ut_time; /* login/logout time */ ++}; ++ ++/* Definitions for ut_type. */ ++#define RUN_LVL 1 /* this is a RUN_LEVEL record */ ++#define BOOT_TIME 2 /* this is a REBOOT record */ ++#define INIT_PROCESS 5 /* this process was spawned by INIT */ ++#define LOGIN_PROCESS 6 /* this is a 'getty' process waiting */ ++#define USER_PROCESS 7 /* any other user process */ ++#define DEAD_PROCESS 8 /* this process has died (wtmp only) */ ++ ++#else /* !__minix */ ++ + struct utmp { + char ut_line[UT_LINESIZE]; + char ut_name[UT_NAMESIZE]; + char ut_host[UT_HOSTSIZE]; + time_t ut_time; + }; ++#endif /* __minix */ + + __BEGIN_DECLS + int utmpname(const char *); diff --git a/nbsd_include/minix/Makefile b/nbsd_include/minix/Makefile index 10a5c5faa..f59fa6ae6 100644 --- a/nbsd_include/minix/Makefile +++ b/nbsd_include/minix/Makefile @@ -4,7 +4,7 @@ NOOBJ= # defined INCSDIR= /usr/netbsd/include/minix -INCS+= paths.h types.h +INCS+= dirent.h paths.h types.h .include "${MINIXSRCDIR}/common/include/sys/Makefile.mount.inc" .include "${MINIXSRCDIR}/common/include/Makefile.termios.inc" diff --git a/nbsd_include/minix/dirent.h b/nbsd_include/minix/dirent.h new file mode 100644 index 000000000..a0ac5783f --- /dev/null +++ b/nbsd_include/minix/dirent.h @@ -0,0 +1,56 @@ +/* dirent.h - Declarations for directory reading routines. + * Author: Kees J. Bot + * 24 Apr 1989 + * + * Note: The V7 format directory entries used under Minix must be transformed + * into a struct dirent with a d_name of at least 15 characters. Given that + * we have to transform V7 entries anyhow it is little trouble to let the + * routines understand the so-called "flex" directory format too. + */ + +#ifndef _DIRENT_H +#define _DIRENT_H + +#include +#include + +/* _fl_direct is a flexible directory entry. Actually it's a union of 8 + * characters and the 3 fields defined below. + */ + +/* Flexible directory entry: */ +struct _fl_direct { /* First slot in an entry */ + ino_t d_ino; + unsigned char d_extent; + char d_name[3]; /* two characters for the shortest name */ +}; + + /* Name of length len needs _EXTENT(len) extra slots. */ +#define _EXTENT(len) (((len) + 5) >> 3) + +/* Version 7 directory entry: */ +struct _v7_direct { + ino_t d_ino; + char d_name[DIRSIZ]; +}; + +/* The block size must be at least 1024 bytes, because otherwise + * the superblock (at 1024 bytes) overlaps with other filesystem data. + */ +#define _MIN_BLOCK_SIZE 1024 + +/* The below is allocated in some parts of the system as the largest + * a filesystem block can be. For instance, the boot monitor allocates + * 3 of these blocks and has to fit within 64kB, so this can't be + * increased without taking that into account. + */ +#define _MAX_BLOCK_SIZE 4096 + +/* This is the block size for the fixed versions of the filesystem (V1/V2) */ +#define _STATIC_BLOCK_SIZE 1024 + +#define _STATIC_FLEX_PER_BLOCK (_STATIC_BLOCK_SIZE/sizeof(struct _fl_direct)) +#define _FLEX_PER_V7 (_EXTENT(DIRSIZ) + 1) +#define _FLEX_PER_BLOCK (_STATIC_BLOCK_SIZE/sizeof(struct _fl_direct)) + +#endif /* _DIRENT_H */ diff --git a/nbsd_include/minix/paths.h b/nbsd_include/minix/paths.h index f359103a6..9d3cead17 100644 --- a/nbsd_include/minix/paths.h +++ b/nbsd_include/minix/paths.h @@ -4,4 +4,16 @@ #define _PATH_SERVICE "/bin/service" #define _PATH_PROC "/proc/" +#define _PATH_SYSTEM_CONF "/etc/system.conf" +#define _PATH_SYSTEM_CONF_DIR "/etc/system.conf.d" + +#define _PATH_DHCPCONF "/etc/dhcp.conf" +#define _PATH_DHCPPID "/usr/run/dhcpd.pid" +#define _PATH_DHCPCACHE "/usr/adm/dhcp.cache" +#define _PATH_DHCPPOOL "/usr/adm/dhcp.pool" + +#define _PATH_MOTD "/etc/motd" + +#define _PATH_RAMDISK "/dev/ram" + #endif /* _MINIX_PATHS_H_ */ diff --git a/nbsd_include/minix/types.h b/nbsd_include/minix/types.h index b7e2c43c2..68c6b6788 100644 --- a/nbsd_include/minix/types.h +++ b/nbsd_include/minix/types.h @@ -2,6 +2,7 @@ #define _MINIX_TYPES_H_ /* Dummy file used in legacy (and shared) minix includes. */ +#include #include #include diff --git a/nbsd_include/stdlib.h b/nbsd_include/stdlib.h index a9e6044ec..b52d3741b 100644 --- a/nbsd_include/stdlib.h +++ b/nbsd_include/stdlib.h @@ -265,9 +265,11 @@ int cgetustr(char *, const char *, char **); void csetexpandtc(int); int daemon(int, int); +#ifndef __minix #ifndef __LIBC12_SOURCE__ __aconst char *devname(dev_t, mode_t) __RENAME(__devname50); #endif +#endif /* !__minix */ #define HN_DECIMAL 0x01 #define HN_NOSPACE 0x02 diff --git a/nbsd_include/sys/Makefile b/nbsd_include/sys/Makefile index cc5930275..056ce2aac 100644 --- a/nbsd_include/sys/Makefile +++ b/nbsd_include/sys/Makefile @@ -7,12 +7,12 @@ INCSDIR= /usr/netbsd/include/sys # Present only in minix -INCS+= ioc_net.h +INCS+= ioc_net.h statfs.h INCS+= ansi.h atomic.h \ bitops.h bswap.h \ cdefs.h cdefs_aout.h ctype_bits.h ctype_inline.h \ - dirent.h \ + dir.h dirent.h \ endian.h errno.h \ fcntl.h fd_set.h featuretest.h file.h \ float_ieee754.h gcq.h gmon.h hash.h \ diff --git a/nbsd_include/sys/cdefs.h b/nbsd_include/sys/cdefs.h index d4345690a..3dee9c6b0 100644 --- a/nbsd_include/sys/cdefs.h +++ b/nbsd_include/sys/cdefs.h @@ -482,4 +482,9 @@ #define __CAST(__dt, __st) ((__dt)(__st)) #endif +#ifdef _MINIX +/* If compiling in Minix tree, Minix ANSI definitions are always useful. */ +#include +#endif + #endif /* !_SYS_CDEFS_H_ */ diff --git a/nbsd_include/sys/dir.h b/nbsd_include/sys/dir.h new file mode 100644 index 000000000..c58974155 --- /dev/null +++ b/nbsd_include/sys/dir.h @@ -0,0 +1,11 @@ +/* + * this files resolves conflicts between the file of the host system and + * the minix specific one. This file is included directly only on Minix + * and it is an error to do so on any other system + */ + +#if !defined(_MINIX) || !defined(__minix) +#error "Including Minix specific file in program targeted for other system" +#else +#include +#endif diff --git a/nbsd_include/sys/dirent.h b/nbsd_include/sys/dirent.h index 5129c7d55..49db5d70f 100644 --- a/nbsd_include/sys/dirent.h +++ b/nbsd_include/sys/dirent.h @@ -1,10 +1,9 @@ #ifndef _SYS_DIRENT_H_ #define _SYS_DIRENT_H_ +#include #include - -/* Redefine d_ino here. */ -#define d_ino d_fileno +#include /* * The dirent structure defines the format of directory entries returned by @@ -18,6 +17,10 @@ struct dirent { /* Largest entry (8 slots) */ char d_name[1]; /* Null terminated name */ }; +#if defined(_NETBSD_SOURCE) +#define d_fileno d_ino +#endif + #define _DIRENT_NAME_LEN 61 /* Backward compatibility with Minix. */ #if defined(_NETBSD_SOURCE) #define MAXNAMLEN _DIRENT_NAME_LEN diff --git a/nbsd_include/sys/fd_set.h b/nbsd_include/sys/fd_set.h index 5ed7a4612..9bfd9c413 100644 --- a/nbsd_include/sys/fd_set.h +++ b/nbsd_include/sys/fd_set.h @@ -36,6 +36,7 @@ #include #include +#include #include /* @@ -57,7 +58,7 @@ typedef __int32_t __fd_mask; * be enough for most uses. */ #ifndef FD_SETSIZE -#define FD_SETSIZE 256 +#define FD_SETSIZE __MINIX_OPEN_MAX #endif typedef struct fd_set { diff --git a/nbsd_include/sys/param.h b/nbsd_include/sys/param.h index ff6aef823..b750a3ecf 100644 --- a/nbsd_include/sys/param.h +++ b/nbsd_include/sys/param.h @@ -6,7 +6,9 @@ */ #define BSD 199506 /* System version (year & month). */ #define BSD4_3 1 +#ifndef __minix #define BSD4_4 1 +#endif /* * #define __NetBSD_Version__ MMmmrrpp00 diff --git a/nbsd_include/sys/select.h b/nbsd_include/sys/select.h index a54af4f50..e4ba9ce60 100644 --- a/nbsd_include/sys/select.h +++ b/nbsd_include/sys/select.h @@ -64,13 +64,24 @@ int pollsock(struct socket *, const struct timespec *, int); __BEGIN_DECLS #ifndef __LIBC12_SOURCE__ +#ifndef __minix int pselect(int, fd_set * __restrict, fd_set * __restrict, fd_set * __restrict, const struct timespec * __restrict, const sigset_t * __restrict) __RENAME(__pselect50); +#endif /* !__minix */ int select(int, fd_set * __restrict, fd_set * __restrict, fd_set * __restrict, struct timeval * __restrict) __RENAME(__select50); #endif /* __LIBC12_SOURCE__ */ __END_DECLS #endif /* _KERNEL */ +#ifdef _MINIX +/* possible select() operation types; read, write, errors */ +/* (FS/driver internal use only) */ +#define SEL_RD (1 << 0) +#define SEL_WR (1 << 1) +#define SEL_ERR (1 << 2) +#define SEL_NOTIFY (1 << 3) /* not a real select operation */ +#endif + #endif /* !_SYS_SELECT_H_ */ diff --git a/nbsd_include/time.h b/nbsd_include/time.h index 66a7d259e..8dd65863a 100644 --- a/nbsd_include/time.h +++ b/nbsd_include/time.h @@ -65,12 +65,18 @@ typedef _BSD_CLOCKID_T_ clockid_t; #undef _BSD_CLOCKID_T_ #endif +#ifndef __minix #ifdef _BSD_TIMER_T_ typedef _BSD_TIMER_T_ timer_t; #undef _BSD_TIMER_T_ #endif +#endif /* !__minix */ +#ifdef __minix +#define CLOCKS_PER_SEC 60 +#else #define CLOCKS_PER_SEC 100 +#endif struct tm { int tm_sec; /* seconds after the minute [0-61] */ diff --git a/nbsd_include/unistd.h b/nbsd_include/unistd.h index 61bf3be57..d3624d85d 100644 --- a/nbsd_include/unistd.h +++ b/nbsd_include/unistd.h @@ -88,7 +88,7 @@ __dead void _exit(int); int access(const char *, int); unsigned int alarm(unsigned int); int chdir(const char *); -#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) +#if !defined(__minix) && (defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)) int chown(const char *, uid_t, gid_t) __RENAME(__posix_chown); #else int chown(const char *, uid_t, gid_t); @@ -249,7 +249,7 @@ typedef __intptr_t intptr_t; int brk(void *); int fchdir(int); -#if defined(_XOPEN_SOURCE) +#if !defined(__minix) && defined(_XOPEN_SOURCE) int fchown(int, uid_t, gid_t) __RENAME(__posix_fchown); #else int fchown(int, uid_t, gid_t); diff --git a/nbsd_include/utmp.h b/nbsd_include/utmp.h index a489cb34f..dd23b0856 100644 --- a/nbsd_include/utmp.h +++ b/nbsd_include/utmp.h @@ -39,12 +39,26 @@ #ifndef _UTMP_H_ #define _UTMP_H_ +#ifdef __minix +#define _PATH_UTMP "/etc/utmp" +#define _PATH_WTMP "/usr/adm/wtmp" +#define _PATH_BTMP "/usr/adm/btmp" +#define _PATH_LASTLOG "/usr/adm/lastlog" +#define UTMP _PATH_UTMP +#define WTMP _PATH_WTMP +#define BTMP _PATH_BTMP +#else #define _PATH_UTMP "/var/run/utmp" #define _PATH_WTMP "/var/log/wtmp" #define _PATH_LASTLOG "/var/log/lastlog" +#endif #define UT_NAMESIZE 8 +#ifdef __minix +#define UT_LINESIZE 12 +#else #define UT_LINESIZE 8 +#endif #define UT_HOSTSIZE 16 struct lastlog { @@ -53,12 +67,34 @@ struct lastlog { char ll_host[UT_HOSTSIZE]; }; +#ifdef __minix +struct utmp { + char ut_name[UT_NAMESIZE]; /* user name */ + char ut_id[4]; /* /etc/inittab ID */ + char ut_line[UT_LINESIZE]; /* terminal name */ + char ut_host[UT_HOSTSIZE]; /* host name, when remote */ + short ut_pid; /* process id */ + short int ut_type; /* type of entry */ + long ut_time; /* login/logout time */ +}; + +/* Definitions for ut_type. */ +#define RUN_LVL 1 /* this is a RUN_LEVEL record */ +#define BOOT_TIME 2 /* this is a REBOOT record */ +#define INIT_PROCESS 5 /* this process was spawned by INIT */ +#define LOGIN_PROCESS 6 /* this is a 'getty' process waiting */ +#define USER_PROCESS 7 /* any other user process */ +#define DEAD_PROCESS 8 /* this process has died (wtmp only) */ + +#else /* !__minix */ + struct utmp { char ut_line[UT_LINESIZE]; char ut_name[UT_NAMESIZE]; char ut_host[UT_HOSTSIZE]; time_t ut_time; }; +#endif /* __minix */ __BEGIN_DECLS int utmpname(const char *); -- 2.44.0