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 <machine/vmparam.h> 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 <minix/dirent.h>, 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/ansi.h>

- minix/paths.h: Add Minix-specific paths.
- minix/dirent.h: ADD, keep only "direct" and "flex"definitions.
- minix/types.h: include <minix/ansi.h>

- sys/Makefile: add sys/dirent.h and statfs.h (forgot!)
- minix/Makefile: add minix/dirent.h

   nbsd_include/minix-port.patch updated accordingly.
This commit is contained in:
Gianluca Guida 2011-03-04 23:15:48 +00:00
parent 693842c855
commit f19a4bf1c4
19 changed files with 340 additions and 36 deletions

View file

@ -41,18 +41,6 @@
* Machine dependent constants for Intel 386. * Machine dependent constants for Intel 386.
*/ */
#ifdef _KERNEL
#include <machine/cpu.h>
#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 * Round p (pointer or byte index) up to a correctly-aligned value
* for all data types (int, long, ...). The result is u_int and * 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_btop(x) ((paddr_t)(x) >> PGSHIFT)
#define x86_ptob(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 <machine/vmparam.h>
#define trunc_page(x) x86_trunc_page(x)
#define round_page(x) x86_round_page(x)
#endif
#endif /* _I386_PARAM_H_ */ #endif /* _I386_PARAM_H_ */

View file

@ -43,16 +43,20 @@
*/ */
#include <sys/dirent.h> #include <sys/dirent.h>
#ifndef __minix
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
#define d_ino d_fileno /* backward compatibility */ #define d_ino d_fileno /* backward compatibility */
#endif #endif
#endif /* !__minix */
typedef struct _dirdesc DIR; typedef struct _dirdesc DIR;
#if defined(_NETBSD_SOURCE) #if defined(_NETBSD_SOURCE)
#ifndef __minix
/* definitions for library routines operating on directories. */ /* definitions for library routines operating on directories. */
#define DIRBLKSIZ 1024 #define DIRBLKSIZ 1024
#endif
/* structure describing an open directory. */ /* structure describing an open directory. */
struct _dirdesc { struct _dirdesc {

View file

@ -113,4 +113,9 @@
#include <machine/limits.h> #include <machine/limits.h>
#include <sys/syslimits.h> #include <sys/syslimits.h>
#ifdef __minix
#define SYMLOOP_MAX 16
#define SYMLINK_MAX 1024
#endif
#endif /* !_LIMITS_H_ */ #endif /* !_LIMITS_H_ */

View file

@ -1,6 +1,6 @@
diff -ru /home/netbsd/src/include/Makefile ./Makefile diff -ru /home/netbsd/src/include/Makefile ./Makefile
--- /home/netbsd/src/include/Makefile 2010-08-01 03:01:48.000000000 +0000 --- /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 @@ @@ -7,6 +7,24 @@
# Missing: mp.h # 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 \ INCS+= arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/nameser_compat.h \
arpa/telnet.h arpa/tftp.h arpa/telnet.h arpa/tftp.h
INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \ INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \
@@ -40,10 +59,27 @@ @@ -40,10 +59,28 @@
.include <bsd.own.mk> .include <bsd.own.mk>
@ -56,15 +56,40 @@ diff -ru /home/netbsd/src/include/Makefile ./Makefile
+ +
+.if defined(__MINIX) +.if defined(__MINIX)
+.include "${MINIXSRCDIR}/common/include/Makefile.inc" +.include "${MINIXSRCDIR}/common/include/Makefile.inc"
+SUBDIR+= arch/${MACHINE}
+SUBDIR+= arch sys minix +SUBDIR+= arch sys minix
+SUBDIR+= net netinet netinet6 +SUBDIR+= net netinet netinet6
+.endif +.endif
.include <bsd.prog.mk> .include <bsd.prog.mk>
.include <bsd.subdir.mk> .include <bsd.subdir.mk>
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 <sys/dirent.h>
+#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 diff -ru /home/netbsd/src/include/fts.h ./fts.h
--- /home/netbsd/src/include/fts.h 2009-08-19 20:23:46.000000000 +0000 --- /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 @@ @@ -75,7 +75,9 @@
#define FTS_PHYSICAL 0x010 /* physical walk */ #define FTS_PHYSICAL 0x010 /* physical walk */
#define FTS_SEEDOT 0x020 /* return dot and dot-dot */ #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_OPTIONMASK 0x0ff /* valid user option mask */
#define FTS_NAMEONLY 0x100 /* (private) child names only */ #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 <machine/limits.h>
#include <sys/syslimits.h>
+#ifdef __minix
+#define SYMLOOP_MAX 16
+#define SYMLINK_MAX 1024
+#endif
+
#endif /* !_LIMITS_H_ */
diff -ru /home/netbsd/src/include/paths.h ./paths.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 --- /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 @@ @@ -124,5 +124,9 @@
#define _PATH_VI "/usr/bin/vi" #define _PATH_VI "/usr/bin/vi"
#endif #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 diff -ru /home/netbsd/src/include/rpc/Makefile ./rpc/Makefile
--- /home/netbsd/src/include/rpc/Makefile 2003-01-11 13:28:43.000000000 +0000 --- /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 @@ @@ -7,7 +7,11 @@
svc.h svc_auth.h svc_soc.h types.h xdr.h svc.h svc_auth.h svc_soc.h types.h xdr.h
RPC_INCS= rpcb_prot.h RPC_INCS= rpcb_prot.h
@ -105,7 +143,7 @@ diff -ru /home/netbsd/src/include/rpc/Makefile ./rpc/Makefile
.include <bsd.prog.mk> .include <bsd.prog.mk>
diff -ru /home/netbsd/src/include/sched.h ./sched.h diff -ru /home/netbsd/src/include/sched.h ./sched.h
--- /home/netbsd/src/include/sched.h 2009-01-11 03:05:43.000000000 +0000 --- /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 @@ @@ -29,6 +29,9 @@
* POSSIBILITY OF SUCH DAMAGE. * 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 diff -ru /home/netbsd/src/include/signal.h ./signal.h
--- /home/netbsd/src/include/signal.h 2010-08-28 03:00:54.000000000 +0000 --- /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 @@ @@ -62,6 +62,7 @@
int __libc_sigaction14(int, const struct sigaction * __restrict, int __libc_sigaction14(int, const struct sigaction * __restrict,
struct sigaction * __restrict); struct sigaction * __restrict);
@ -184,7 +222,7 @@ diff -ru /home/netbsd/src/include/signal.h ./signal.h
#endif /* _NETBSD_SOURCE */ #endif /* _NETBSD_SOURCE */
diff -ru /home/netbsd/src/include/stdio.h ./stdio.h diff -ru /home/netbsd/src/include/stdio.h ./stdio.h
--- /home/netbsd/src/include/stdio.h 2010-09-25 03:01:11.000000000 +0000 --- /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 @@ @@ -274,7 +274,7 @@
__printflike(2, 0); __printflike(2, 0);
#endif #endif
@ -196,8 +234,20 @@ diff -ru /home/netbsd/src/include/stdio.h ./stdio.h
int rename (const char *, const char *); int rename (const char *, const char *);
diff -ru /home/netbsd/src/include/stdlib.h ./stdlib.h diff -ru /home/netbsd/src/include/stdlib.h ./stdlib.h
--- /home/netbsd/src/include/stdlib.h 2010-12-23 03:03:09.000000000 +0000 --- /home/netbsd/src/include/stdlib.h 2010-12-23 03:03:09.000000000 +0000
+++ ./stdlib.h 2011-02-14 17:04:58.000000000 +0000 +++ ./stdlib.h 2011-02-24 02:42:48.000000000 +0000
@@ -280,7 +280,9 @@ @@ -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 humanize_number(char *, size_t, int64_t, const char *, int, int);
int dehumanize_number(const char *, int64_t *); 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); int getenv_r(const char *, char *, size_t);
diff -ru /home/netbsd/src/include/time.h ./time.h diff -ru /home/netbsd/src/include/time.h ./time.h
--- /home/netbsd/src/include/time.h 2010-12-17 03:01:54.000000000 +0000 --- /home/netbsd/src/include/time.h 2010-12-17 03:01:54.000000000 +0000
+++ ./time.h 2011-02-14 17:04:58.000000000 +0000 +++ ./time.h 2011-03-02 07:10:52.000000000 +0000
@@ -110,7 +110,11 @@ @@ -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 * need to include unistd.h
*/ */
long __sysconf(int); long __sysconf(int);
@ -222,7 +291,7 @@ diff -ru /home/netbsd/src/include/time.h ./time.h
#endif #endif
#endif #endif
@@ -143,22 +147,28 @@ @@ -143,22 +153,28 @@
struct sigevent; struct sigevent;
struct itimerspec; struct itimerspec;
#ifndef __LIBC12_SOURCE__ #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 || ... */ #endif /* _POSIX_C_SOURCE >= 199309 || _XOPEN_SOURCE >= 500 || ... */
#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \ #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
@@ -205,6 +215,10 @@ @@ -205,6 +221,10 @@
#endif /* _NETBSD_SOURCE */ #endif /* _NETBSD_SOURCE */
@ -264,7 +333,16 @@ diff -ru /home/netbsd/src/include/time.h ./time.h
#endif /* !_TIME_H_ */ #endif /* !_TIME_H_ */
diff -ru /home/netbsd/src/include/unistd.h ./unistd.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 --- /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 @@ @@ -133,7 +133,9 @@
#endif #endif
int rmdir(const char *); int rmdir(const char *);
@ -295,6 +373,15 @@ diff -ru /home/netbsd/src/include/unistd.h ./unistd.h
#endif #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 @@ @@ -253,29 +259,37 @@
int gethostname(char *, size_t); int gethostname(char *, size_t);
__pure int __pure int
@ -383,3 +470,68 @@ diff -ru /home/netbsd/src/include/unistd.h ./unistd.h
int syscall(int, ...); int syscall(int, ...);
quad_t __syscall(quad_t, ...); quad_t __syscall(quad_t, ...);
int undelete(const char *); 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 *);

View file

@ -4,7 +4,7 @@ NOOBJ= # defined
INCSDIR= /usr/netbsd/include/minix 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/sys/Makefile.mount.inc"
.include "${MINIXSRCDIR}/common/include/Makefile.termios.inc" .include "${MINIXSRCDIR}/common/include/Makefile.termios.inc"

View file

@ -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 <sys/cdefs.h>
#include <minix/dir.h>
/* _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 */

View file

@ -4,4 +4,16 @@
#define _PATH_SERVICE "/bin/service" #define _PATH_SERVICE "/bin/service"
#define _PATH_PROC "/proc/" #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_ */ #endif /* _MINIX_PATHS_H_ */

View file

@ -2,6 +2,7 @@
#define _MINIX_TYPES_H_ #define _MINIX_TYPES_H_
/* Dummy file used in legacy (and shared) minix includes. */ /* Dummy file used in legacy (and shared) minix includes. */
#include <minix/ansi.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/sigtypes.h> #include <sys/sigtypes.h>

View file

@ -265,9 +265,11 @@ int cgetustr(char *, const char *, char **);
void csetexpandtc(int); void csetexpandtc(int);
int daemon(int, int); int daemon(int, int);
#ifndef __minix
#ifndef __LIBC12_SOURCE__ #ifndef __LIBC12_SOURCE__
__aconst char *devname(dev_t, mode_t) __RENAME(__devname50); __aconst char *devname(dev_t, mode_t) __RENAME(__devname50);
#endif #endif
#endif /* !__minix */
#define HN_DECIMAL 0x01 #define HN_DECIMAL 0x01
#define HN_NOSPACE 0x02 #define HN_NOSPACE 0x02

View file

@ -7,12 +7,12 @@ INCSDIR= /usr/netbsd/include/sys
# Present only in minix # Present only in minix
INCS+= ioc_net.h INCS+= ioc_net.h statfs.h
INCS+= ansi.h atomic.h \ INCS+= ansi.h atomic.h \
bitops.h bswap.h \ bitops.h bswap.h \
cdefs.h cdefs_aout.h ctype_bits.h ctype_inline.h \ cdefs.h cdefs_aout.h ctype_bits.h ctype_inline.h \
dirent.h \ dir.h dirent.h \
endian.h errno.h \ endian.h errno.h \
fcntl.h fd_set.h featuretest.h file.h \ fcntl.h fd_set.h featuretest.h file.h \
float_ieee754.h gcq.h gmon.h hash.h \ float_ieee754.h gcq.h gmon.h hash.h \

View file

@ -482,4 +482,9 @@
#define __CAST(__dt, __st) ((__dt)(__st)) #define __CAST(__dt, __st) ((__dt)(__st))
#endif #endif
#ifdef _MINIX
/* If compiling in Minix tree, Minix ANSI definitions are always useful. */
#include <minix/ansi.h>
#endif
#endif /* !_SYS_CDEFS_H_ */ #endif /* !_SYS_CDEFS_H_ */

11
nbsd_include/sys/dir.h Normal file
View file

@ -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 <minix/dir.h>
#endif

View file

@ -1,10 +1,9 @@
#ifndef _SYS_DIRENT_H_ #ifndef _SYS_DIRENT_H_
#define _SYS_DIRENT_H_ #define _SYS_DIRENT_H_
#include <sys/cdefs.h>
#include <sys/featuretest.h> #include <sys/featuretest.h>
#include <minix/dirent.h>
/* Redefine d_ino here. */
#define d_ino d_fileno
/* /*
* The dirent structure defines the format of directory entries returned by * 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 */ 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. */ #define _DIRENT_NAME_LEN 61 /* Backward compatibility with Minix. */
#if defined(_NETBSD_SOURCE) #if defined(_NETBSD_SOURCE)
#define MAXNAMLEN _DIRENT_NAME_LEN #define MAXNAMLEN _DIRENT_NAME_LEN

View file

@ -36,6 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/featuretest.h> #include <sys/featuretest.h>
#include <sys/syslimits.h>
#include <machine/int_types.h> #include <machine/int_types.h>
/* /*
@ -57,7 +58,7 @@ typedef __int32_t __fd_mask;
* be enough for most uses. * be enough for most uses.
*/ */
#ifndef FD_SETSIZE #ifndef FD_SETSIZE
#define FD_SETSIZE 256 #define FD_SETSIZE __MINIX_OPEN_MAX
#endif #endif
typedef struct fd_set { typedef struct fd_set {

View file

@ -6,7 +6,9 @@
*/ */
#define BSD 199506 /* System version (year & month). */ #define BSD 199506 /* System version (year & month). */
#define BSD4_3 1 #define BSD4_3 1
#ifndef __minix
#define BSD4_4 1 #define BSD4_4 1
#endif
/* /*
* #define __NetBSD_Version__ MMmmrrpp00 * #define __NetBSD_Version__ MMmmrrpp00

View file

@ -64,13 +64,24 @@ int pollsock(struct socket *, const struct timespec *, int);
__BEGIN_DECLS __BEGIN_DECLS
#ifndef __LIBC12_SOURCE__ #ifndef __LIBC12_SOURCE__
#ifndef __minix
int pselect(int, fd_set * __restrict, fd_set * __restrict, int pselect(int, fd_set * __restrict, fd_set * __restrict,
fd_set * __restrict, const struct timespec * __restrict, fd_set * __restrict, const struct timespec * __restrict,
const sigset_t * __restrict) __RENAME(__pselect50); const sigset_t * __restrict) __RENAME(__pselect50);
#endif /* !__minix */
int select(int, fd_set * __restrict, fd_set * __restrict, int select(int, fd_set * __restrict, fd_set * __restrict,
fd_set * __restrict, struct timeval * __restrict) __RENAME(__select50); fd_set * __restrict, struct timeval * __restrict) __RENAME(__select50);
#endif /* __LIBC12_SOURCE__ */ #endif /* __LIBC12_SOURCE__ */
__END_DECLS __END_DECLS
#endif /* _KERNEL */ #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_ */ #endif /* !_SYS_SELECT_H_ */

View file

@ -65,12 +65,18 @@ typedef _BSD_CLOCKID_T_ clockid_t;
#undef _BSD_CLOCKID_T_ #undef _BSD_CLOCKID_T_
#endif #endif
#ifndef __minix
#ifdef _BSD_TIMER_T_ #ifdef _BSD_TIMER_T_
typedef _BSD_TIMER_T_ timer_t; typedef _BSD_TIMER_T_ timer_t;
#undef _BSD_TIMER_T_ #undef _BSD_TIMER_T_
#endif #endif
#endif /* !__minix */
#ifdef __minix
#define CLOCKS_PER_SEC 60
#else
#define CLOCKS_PER_SEC 100 #define CLOCKS_PER_SEC 100
#endif
struct tm { struct tm {
int tm_sec; /* seconds after the minute [0-61] */ int tm_sec; /* seconds after the minute [0-61] */

View file

@ -88,7 +88,7 @@ __dead void _exit(int);
int access(const char *, int); int access(const char *, int);
unsigned int alarm(unsigned int); unsigned int alarm(unsigned int);
int chdir(const char *); 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); int chown(const char *, uid_t, gid_t) __RENAME(__posix_chown);
#else #else
int chown(const char *, uid_t, gid_t); int chown(const char *, uid_t, gid_t);
@ -249,7 +249,7 @@ typedef __intptr_t intptr_t;
int brk(void *); int brk(void *);
int fchdir(int); int fchdir(int);
#if defined(_XOPEN_SOURCE) #if !defined(__minix) && defined(_XOPEN_SOURCE)
int fchown(int, uid_t, gid_t) __RENAME(__posix_fchown); int fchown(int, uid_t, gid_t) __RENAME(__posix_fchown);
#else #else
int fchown(int, uid_t, gid_t); int fchown(int, uid_t, gid_t);

View file

@ -39,12 +39,26 @@
#ifndef _UTMP_H_ #ifndef _UTMP_H_
#define _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_UTMP "/var/run/utmp"
#define _PATH_WTMP "/var/log/wtmp" #define _PATH_WTMP "/var/log/wtmp"
#define _PATH_LASTLOG "/var/log/lastlog" #define _PATH_LASTLOG "/var/log/lastlog"
#endif
#define UT_NAMESIZE 8 #define UT_NAMESIZE 8
#ifdef __minix
#define UT_LINESIZE 12
#else
#define UT_LINESIZE 8 #define UT_LINESIZE 8
#endif
#define UT_HOSTSIZE 16 #define UT_HOSTSIZE 16
struct lastlog { struct lastlog {
@ -53,12 +67,34 @@ struct lastlog {
char ll_host[UT_HOSTSIZE]; 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 { struct utmp {
char ut_line[UT_LINESIZE]; char ut_line[UT_LINESIZE];
char ut_name[UT_NAMESIZE]; char ut_name[UT_NAMESIZE];
char ut_host[UT_HOSTSIZE]; char ut_host[UT_HOSTSIZE];
time_t ut_time; time_t ut_time;
}; };
#endif /* __minix */
__BEGIN_DECLS __BEGIN_DECLS
int utmpname(const char *); int utmpname(const char *);