diff --git a/bin/pax/Makefile b/bin/pax/Makefile index 0e6e13e13..9b2f6a6db 100644 --- a/bin/pax/Makefile +++ b/bin/pax/Makefile @@ -53,7 +53,6 @@ DPADD+= ${LIBRMT} .if defined(__MINIX) CPPFLAGS+= -DHOSTPROG -CPPFLAGS+= -Dlchown=chown -Dlchmod=chmod MLINKS+= pax.1 bsdtar.1 .endif # defined(__MINIX) diff --git a/include/unistd.h b/include/unistd.h index c8aa39c8c..6ab39eb56 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -259,12 +259,12 @@ __pure int getpagesize(void); /* legacy */ #if !defined(__minix) pid_t getpgid(pid_t); +#endif /* !defined(__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 /* !defined(__minix) */ int lockf(int, int, off_t); #if __SSP_FORTIFY_LEVEL == 0 ssize_t readlink(const char * __restrict, char * __restrict, size_t); diff --git a/lib/libc/sys-minix/Makefile.inc b/lib/libc/sys-minix/Makefile.inc index 2dea8f10d..b7d38d153 100644 --- a/lib/libc/sys-minix/Makefile.inc +++ b/lib/libc/sys-minix/Makefile.inc @@ -27,4 +27,9 @@ SRCS+= accept.c access.c adjtime.c bind.c brk.c sbrk.c m_closefrom.c getsid.c \ # Minix specific syscalls / utils. SRCS+= cprofile.c sprofile.c stack_utils.c _mcontext.c +# Emulation for missing lchown/lchmod +OBJS+= lchown.o lchmod.o +lchown.o lchown.pico lchown.bc: ${NETBSDSRCDIR}/tools/compat/lchown.c +lchmod.o lchmod.pico lchmod.bc: ${NETBSDSRCDIR}/tools/compat/lchmod.c + .include "${ARCHDIR}/sys-minix/Makefile.inc" diff --git a/lib/libpuffs/Makefile b/lib/libpuffs/Makefile index fd47ff51f..138d7a504 100644 --- a/lib/libpuffs/Makefile +++ b/lib/libpuffs/Makefile @@ -22,7 +22,6 @@ LINTFLAGS+=-S -w SRCS+= inode.c link.c misc.c mount.c open.c path.c path_puffs.c \ protect.c read.c stadir.c time.c utility.c table.c -CPFFLAGS+=-Dlchown=chown -Dlchmod=chmod CPPFLAGS+= -D_MINIX_SYSTEM NOGCCERROR=yes diff --git a/tools/compat/lchmod.c b/tools/compat/lchmod.c index 459f77ae4..3d11ed284 100644 --- a/tools/compat/lchmod.c +++ b/tools/compat/lchmod.c @@ -32,7 +32,9 @@ /* Emulate lchmod(2), checking path with lstat(2) first to ensure that * it's not a symlink, and then call chmod(2) */ +#if !defined(__minix) && !defined(_LIBC) #include "nbtool_config.h" +#endif /* !defined(__minix) && !defined(_LIBC) */ #if !HAVE_LCHMOD #include diff --git a/tools/compat/lchown.c b/tools/compat/lchown.c index c99148dc5..ddd17e8f9 100644 --- a/tools/compat/lchown.c +++ b/tools/compat/lchown.c @@ -32,13 +32,19 @@ /* Emulate lchown(2), checking path with lstat(2) first to ensure that * it's not a symlink, and then call chown(2) */ +#if !defined(__minix) && !defined(_LIBC) #include "nbtool_config.h" +#endif /* !defined(__minix) && !defined(_LIBC) */ #if !HAVE_LCHOWN #include #include #include +#if defined(__minix) && defined(__weak_alias) && defined(_LIBC) +__weak_alias(__posix_lchown, lchown) +#endif /* defined(__minix) && defined(__weak_alias) && defined(_LIBC) */ + int lchown(const char *path, uid_t owner, gid_t group) { diff --git a/usr.bin/sort/Makefile b/usr.bin/sort/Makefile index 9219a2255..fd177c57f 100644 --- a/usr.bin/sort/Makefile +++ b/usr.bin/sort/Makefile @@ -8,8 +8,4 @@ SRCS+= radix_sort.c LDADD+=-lutil DPADD+=${LIBUTIL} -.if defined(__MINIX) -CPPFLAGS+= -Dlchown=chown -Dlchmod=chmod -.endif # defined(__MINIX) - .include diff --git a/usr.sbin/mtree/Makefile b/usr.sbin/mtree/Makefile index e2dea5f8c..3613e141a 100644 --- a/usr.sbin/mtree/Makefile +++ b/usr.sbin/mtree/Makefile @@ -10,9 +10,6 @@ MAN= mtree.8 SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c specspec.c \ verify.c getid.c pack_dev.c only.c .if (${HOSTPROG:U} == "") -.if defined(__MINIX) -CPPFLAGS+= -Dlchown=chown -Dlchmod=chmod -.endif DPADD+= ${LIBUTIL} LDADD+= -lutil .endif