mirror of
https://github.com/opnsense/src.git
synced 2026-02-17 09:39:26 -05:00
- fchmod(2),
- fchown(2),
- fchflags(2),
- fstat(2),
- ftruncate(2),
- fpathconf(2),
- lpathconf(2).
Make write(2) syscall to take descriptor instead of file name.
We implement descriptors by keeping track of open files and allowing to
reference them by the following syscalls. Because pjdfstest already supports
executing multiple syscalls from one command it works pretty well.
For example, the following command:
pjdfstest open foo "O_CREAT,O_RDWR" 0 : open bar "O_CREAT,O_RDONLY" 640 : fchmod 0 0666 : fchown 0 -1 20 : fchmod 1 0444
is equivalent of (error checking omitted):
int fd[2];
fd[0] = open("foo", O_CREAT | O_RDWR, 0);
fd[1] = open("bar", O_CREAT | O_RDONLY, 0640);
fchmod(fd[0], 0666);
fchown(fd[0], -1, 20);
fchmod(fd[1], 0444);
26 lines
710 B
Makefile
26 lines
710 B
Makefile
# $FreeBSD$
|
|
|
|
PROG= pjdfstest
|
|
|
|
${PROG}: ${PROG}.c
|
|
@OSTYPE=`uname`; \
|
|
CFLAGS=-D__OS_$${OSTYPE}__; \
|
|
if [ $$OSTYPE = "FreeBSD" ]; then \
|
|
CFLAGS="$$CFLAGS -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_FCHFLAGS -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL"; \
|
|
elif [ $$OSTYPE = "SunOS" ]; then \
|
|
CFLAGS="$$CFLAGS -DHAS_TRUNCATE64 -DHAS_STAT64"; \
|
|
CFLAGS="$$CFLAGS -lsocket"; \
|
|
elif [ $$OSTYPE = "Darwin" ]; then \
|
|
CFLAGS="$$CFLAGS -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS"; \
|
|
elif [ $$OSTYPE == "Linux" ]; then \
|
|
CFLAGS="$$CFLAGS -D_GNU_SOURCE"; \
|
|
else \
|
|
echo "Unsupported operating system: ${OSTYPE}."; \
|
|
exit 1; \
|
|
fi; \
|
|
cmd="gcc -Wall $$CFLAGS ${PROG}.c -o ${PROG}"; \
|
|
echo $$cmd; \
|
|
$$cmd
|
|
|
|
clean:
|
|
rm -f ${PROG}
|