.if defined(__MINIX)
CPPFLAGS+= -DHOSTPROG
-CPPFLAGS+= -Dlchown=chown -Dlchmod=chmod
MLINKS+= pax.1 bsdtar.1
.endif # defined(__MINIX)
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);
# 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"
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
/* 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 <sys/stat.h>
/* 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 <sys/stat.h>
#include <errno.h>
#include <unistd.h>
+#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)
{
LDADD+=-lutil
DPADD+=${LIBUTIL}
-.if defined(__MINIX)
-CPPFLAGS+= -Dlchown=chown -Dlchmod=chmod
-.endif # defined(__MINIX)
-
.include <bsd.prog.mk>
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