Skip to content

Commit

Permalink
Change folder structure for library changes:
Browse files Browse the repository at this point in the history
- Move dialect sources to lib
- Move top level sources to lib and src
- Move headers to include folder
- Rename lsof.h to common.h
  • Loading branch information
jiegec committed Mar 27, 2023
1 parent 6292bfc commit c5259c5
Show file tree
Hide file tree
Showing 238 changed files with 4,520 additions and 1,738 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ jobs:
- run:
name: Install build tools
command: |
dnf -y install autoconf automake gcc git iproute make nmap-ncat pkg-config procps sudo || true
dnf -y install autoconf automake gcc git iproute libtool make nmap-ncat pkg-config procps sudo || true
dnf -y install libtirpc-devel || true
apt update || true
apt install -y autoconf automake gcc git groff iproute2 libtirpc-dev make ncat pkg-config procps sudo || true
pacman -Sy --noconfirm autoconf automake gcc git groff iproute2 make pkg-config procps sudo || true
zypper install -y autoconf automake gcc git groff gzip iproute2 make pkg-config procps sudo tar || true
apk add sudo autoconf automake bash gcc git groff gzip iproute2 linux-headers make musl-dev nmap-ncat pkgconf strace which || true
apt install -y autoconf automake gcc git groff iproute2 libtirpc-dev libtool make ncat pkg-config procps sudo || true
pacman -Sy --noconfirm autoconf automake gcc git groff iproute2 libtool make pkg-config procps sudo || true
zypper install -y autoconf automake gcc git groff gzip iproute2 libtool make pkg-config procps sudo tar || true
apk add sudo autoconf automake bash gcc git groff gzip iproute2 libtool linux-headers make musl-dev nmap-ncat pkgconf strace which || true
- when:
condition:
equal: [ fedora36, << parameters.distro >> ]
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
- run:
name: Install pkg-config
command: |
brew install pkg-config
brew install pkg-config libtool
- run:
name: Configure
command: |
Expand Down
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ task:
- image_family: freebsd-14-0-snap
- image_family: freebsd-13-1
- image_family: freebsd-12-3
install_script: pkg install -y bash git autoconf automake groff pkgconf
install_script: pkg install -y bash git autoconf automake libtool groff pkgconf
build_script:
- ./Configure -n freebsd
- make
Expand Down
49 changes: 39 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ dkms.conf
lib/Makefile
TAGS
lsof
lsof-netstat
tags
tests/config.*
version.h
Expand All @@ -74,14 +75,32 @@ lockf_owner.h
lockf.h
lsof.man
/site
lib/dialects/netbsd/include
/solaris11

#
# Symbolic links to lsof cli
#
/arg.c
/dprint.c
/main.c
/misc.c
/node.c
/print.c
/ptti.c
/store.c
/usage.c
/util.c

#
# Symbolic links to a dialect implementation
#
/ddev.c
/dfile.c
/dlsof.h
/dmnt.c
/dnode.c
/dnode1.c
/dproc.c
/dproto.h
/dsock.c
Expand All @@ -92,31 +111,36 @@ lsof.man
# Traditional test related files
#
LTbasic
LTbasic2
LTbigf
LTdnlc
LTlock
LTnfs
LTnlink
LTshm2
LTsock
LTszoff
LTszoff2
LTunix
LTunix2

#
# Dialect specific test related files
#
dialects/linux/tests/epoll
dialects/linux/tests/eventfd
dialects/linux/tests/mq_fork
dialects/linux/tests/mq_open
dialects/linux/tests/open_with_flags
dialects/linux/tests/pidfd
dialects/linux/tests/pipe
dialects/linux/tests/pty
dialects/linux/tests/ux
dialects/linux/tests/mmap
lib/dialects/linux/tests/epoll
lib/dialects/linux/tests/eventfd
lib/dialects/linux/tests/mq_fork
lib/dialects/linux/tests/mq_open
lib/dialects/linux/tests/open_with_flags
lib/dialects/linux/tests/pidfd
lib/dialects/linux/tests/pipe
lib/dialects/linux/tests/pty
lib/dialects/linux/tests/ux
lib/dialects/linux/tests/mmap

# automake
Makefile.in
.libs/
.deps/
.dirstamp
*.log
Expand All @@ -135,6 +159,11 @@ autom4te.cache
/configure
/depcomp
/install-sh
/libtool
/ltmain.sh
/missing
/stamp-h1
/test-driver

# Doxygen
/output
2 changes: 1 addition & 1 deletion 00MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ arg.c
dialects/
lib/
lsof.8
lsof.h
common.h
lsof.man
lsof_fields.h
main.c
Expand Down
6 changes: 3 additions & 3 deletions 00PORTING
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ These are the common function source files in lsof4/:

arg.c common argument processing functions

lsof.h common header file that #include's the dialect-specific
common.h common header file that #include's the dialect-specific
header files

main.c common main function for lsof 4
Expand Down Expand Up @@ -796,7 +796,7 @@ possibilities
f_open member in its file struct.

HASFSINO enables the inclusion of the fs_ino element
in the lfile structure definition in lsof.h.
in the lfile structure definition in common.h.
This contains the file system's inode number
and may be needed when searching the kernel
name cache. See dialects/osr/dproc.c for
Expand Down Expand Up @@ -889,7 +889,7 @@ possibilities

HASLFILEADD defines additional, dialect-specific elements

SETLFILEADD in the lfile structure (defined in lsof.h).
SETLFILEADD in the lfile structure (defined in common.h).
HASLFILEADD is a macro. The accompanying SETFILEADD
macro is used in the alloc_lfile() function of
proc.c to preset the additional elements.
Expand Down
94 changes: 49 additions & 45 deletions Configure
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ do
echo "rm -f dialects/sun/solaris10" # DEBUG -- for s10_44
rm -f dialects/hpux/kmem/hpux_mount.h
echo "rm -f dialects/hpux/kmem/hpux_mount.h"
rm -rf dialects/netbsd/include
echo "rm -rf dialects/netbsd/include"
rm -rf lib/dialects/netbsd/include
echo "rm -rf lib/dialects/netbsd/include"
rm -f dialects/uw/uw7/vm/swap.h
echo "rm -f dialects/uw/uw7/vm/swap.h"
rm -f ${LSOF_LIB}/${LSOF_LIBMKF}
Expand Down Expand Up @@ -3314,13 +3314,13 @@ return(0); }

# Build special header files, as required.

rm -rf dialects/netbsd/include
rm -rf lib/dialects/netbsd/include
if test "X$NETBSD_UVM" = "XY" -o "X$NETBSD_UVM" = "Xy" # {
then
mkdir dialects/netbsd/include
touch dialects/netbsd/include/opt_uvmhist.h
touch dialects/netbsd/include/opt_lockdebug.h
LSOF_CFGF="$LSOF_CFGF -DUVM -I`pwd`/dialects/netbsd/include"
mkdir lib/dialects/netbsd/include
touch lib/dialects/netbsd/include/opt_uvmhist.h
touch lib/dialects/netbsd/include/opt_lockdebug.h
LSOF_CFGF="$LSOF_CFGF -DUVM -I`pwd`/lib/dialects/netbsd/include"
if test -d ${LSOF_INCLUDE}/uvm # {
then
LSOF_CFGF="$LSOF_CFGF -DHAS_UVM_INCL"
Expand All @@ -3347,10 +3347,10 @@ return(0); }
LSOF_TMP1=${LSOF_TMPC}.edscr
LSOF_TMP2=${LSOF_TMPC}.netcred
LSOF_TMP3=${LSOF_TMPC}.netexport
LSOF_TMP4=dialects/netbsd/include/netexport.h
if test ! -d dialects/netbsd/include # {
LSOF_TMP4=lib/dialects/netbsd/include/netexport.h
if test ! -d lib/dialects/netbsd/include # {
then
mkdir dialects/netbsd/include
mkdir lib/dialects/netbsd/include
fi # }
rm -f $LSOF_TMP1 $LSOF_TMP2 $LSOF_TMP3 $LSOF_TMP4
echo "/^struct netcred" > $LSOF_TMP1
Expand Down Expand Up @@ -3386,74 +3386,74 @@ return(0); }
fi # }
echo "#endif /* !defined(NETEXPORT_H) */" >> $LSOF_TMP4
rm -f $LSOF_TMP1 $LSOF_TMP2 $LSOF_TMP3
echo $LSOF_CFGF | grep /dialects/netbsd/include > /dev/null 2>&1
echo $LSOF_CFGF | grep /lib/dialects/netbsd/include > /dev/null 2>&1
if test $? -ne 0 # {
then
LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/netbsd/include"
LSOF_CFGF="$LSOF_CFGF -I`pwd`/lib/dialects/netbsd/include"
fi # }
fi # }
if test $LSOF_NBSD_BUFQH -eq 1 # {
then

# Make a local copy of $NETBSD_SYS/sys/bufq.h.

if test ! -d dialects/netbsd/include # {
if test ! -d lib/dialects/netbsd/include # {
then
mkdir dialects/netbsd/include
mkdir lib/dialects/netbsd/include
fi # }
if test ! -d dialects/netbsd/include/sys # {
if test ! -d lib/dialects/netbsd/include/sys # {
then
mkdir dialects/netbsd/include/sys
mkdir lib/dialects/netbsd/include/sys
fi # }
cp $NETBSD_SYS/sys/bufq.h dialects/netbsd/include/sys
echo $LSOF_CFGF | grep /dialects/netbsd/include > /dev/null 2>&1
cp $NETBSD_SYS/sys/bufq.h lib/dialects/netbsd/include/sys
echo $LSOF_CFGF | grep lib/dialects/netbsd/include > /dev/null 2>&1
if test $? -ne 0 # {
then
LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/netbsd/include"
LSOF_CFGF="$LSOF_CFGF -I`pwd`lib/dialects/netbsd/include"
fi # }
fi # }
if test $LSOF_NBSD_PTYFS -eq 1 # {
then

# Make a local copy of $NETBSD_SYS/sys/fs/ptyfs/.

if test ! -d dialects/netbsd/include # {
if test ! -d lib/dialects/netbsd/include # {
then
mkdir dialects/netbsd/include
mkdir lib/dialects/netbsd/include
fi # }
if test ! -d dialects/netbsd/include/fs # {
if test ! -d lib/dialects/netbsd/include/fs # {
then
mkdir dialects/netbsd/include/fs
mkdir lib/dialects/netbsd/include/fs
fi # }
rm -rf dialects/netbsd/include/fs/ptyfs
mkdir dialects/netbsd/include/fs/ptyfs
cp $NETBSD_SYS/fs/ptyfs/*.h dialects/netbsd/include/fs/ptyfs
echo $LSOF_CFGF | grep /dialects/netbsd/include > /dev/null 2>&1
rm -rf lib/dialects/netbsd/include/fs/ptyfs
mkdir lib/dialects/netbsd/include/fs/ptyfs
cp $NETBSD_SYS/fs/ptyfs/*.h lib/dialects/netbsd/include/fs/ptyfs
echo $LSOF_CFGF | grep lib/dialects/netbsd/include > /dev/null 2>&1
if test $? -ne 0 # {
then
LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/netbsd/include"
LSOF_CFGF="$LSOF_CFGF -I`pwd`/lib/dialects/netbsd/include"
fi # }
fi # }
if test $LSOF_NBSD_TMPFS -eq 1 # {
then

# Make a local copy of $NETBSD_SYS/sys/fs/tmpfs/tmpfs.h.

if test ! -d dialects/netbsd/include # {
if test ! -d lib/dialects/netbsd/include # {
then
mkdir dialects/netbsd/include
mkdir lib/dialects/netbsd/include
fi # }
if test ! -d dialects/netbsd/include/fs # {
if test ! -d lib/dialects/netbsd/include/fs # {
then
mkdir dialects/netbsd/include/fs
mkdir lib/dialects/netbsd/include/fs
fi # }
rm -rf dialects/netbsd/include/fs/tmpfs
mkdir dialects/netbsd/include/fs/tmpfs
cp $NETBSD_SYS/fs/tmpfs/tmpfs.h dialects/netbsd/include/fs/tmpfs
echo $LSOF_CFGF | grep /dialects/netbsd/include > /dev/null 2>&1
rm -rf lib/dialects/netbsd/include/fs/tmpfs
mkdir lib/dialects/netbsd/include/fs/tmpfs
cp $NETBSD_SYS/fs/tmpfs/tmpfs.h lib/dialects/netbsd/include/fs/tmpfs
echo $LSOF_CFGF | grep lib/dialects/netbsd/include > /dev/null 2>&1
if test $? -ne 0 # {
then
LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/netbsd/include"
LSOF_CFGF="$LSOF_CFGF -I`pwd`lib/dialects/netbsd/include"
fi # }
fi # }

Expand Down Expand Up @@ -4824,18 +4824,18 @@ fi # }

# Make sure target directory exists.

if test ! -d ./dialects/$LSOF_DIALECT_DIR # {
if test ! -d ./lib/dialects/$LSOF_DIALECT_DIR # {
then
echo "Can't configure for $LSOF_TGT -- ./dialects/$LSOF_DIALECT_DIR doesn't exist."
echo "Can't configure for $LSOF_TGT -- ./lib/dialects/$LSOF_DIALECT_DIR doesn't exist."
rm -f $LSOF_HLP
exit 1
fi # }

# Make sure $LSOF_MK exists in the target directory.

if test ! -r ./dialects/$LSOF_DIALECT_DIR/$LSOF_MK # {
if test ! -r ./lib/dialects/$LSOF_DIALECT_DIR/$LSOF_MK # {
then
echo "Can't configure for $LSOF_TGT -- ./dialects/$LSOF_DIALECT_DIR/$LSOF_MK doesn't exist."
echo "Can't configure for $LSOF_TGT -- ./lib/dialects/$LSOF_DIALECT_DIR/$LSOF_MK doesn't exist."
rm -f $LSOF_HLP
exit 1
fi # }
Expand All @@ -4855,9 +4855,9 @@ then
else
LSOF_REST=$LSOF_TMP1
fi # }
if test ! -r ./dialects/$LSOF_DIALECT_DIR/$LSOF_REST # {
if test ! -r ./lib/dialects/$LSOF_DIALECT_DIR/$LSOF_REST # {
then
echo "Can't configure for $LSOF_TGT -- ./dialects/$LSOF_DIALECT_DIR/$LSOF_REST doesn't exist."
echo "Can't configure for $LSOF_TGT -- ./lib/dialects/$LSOF_DIALECT_DIR/$LSOF_REST doesn't exist."
rm -f $LSOF_HLP
exit 1
fi # }
Expand Down Expand Up @@ -4943,7 +4943,7 @@ if test "X$LSOF_MKC" = "X" # {
then
LSOF_MKC="ln -s"
fi # }
LSOF_MKC=$LSOF_MKC ./dialects/$LSOF_DIALECT_DIR/$LSOF_MK $LSOF_TGT $LSOF_VERS
LSOF_MKC=$LSOF_MKC ./lib/dialects/$LSOF_DIALECT_DIR/$LSOF_MK $LSOF_TGT $LSOF_VERS

# Make $LSOF_MKFC and ${LSOF_LIB}/$LSOF_LIBMKF.

Expand Down Expand Up @@ -5024,12 +5024,14 @@ then
echo "" >> $LSOF_MKFC
echo "KVM= $LSOF_DISTRIBKVM" >> $LSOF_MKFC
fi # }
echo "" >> $LSOF_MKFC
echo "DIALECT_DIR= $LSOF_DIALECT_DIR" >> $LSOF_MKFC
rm -f ${LSOF_LIB}/$LSOF_LIBMKF
if test "X$LSOF_LIB_NO" = "X" # {
then
cp $LSOF_MKFC ${LSOF_LIB}/$LSOF_LIBMKF
fi # }
cat ./dialects/$LSOF_DIALECT_DIR/$LSOF_REST >> $LSOF_MKFC
cat ./lib/dialects/$LSOF_DIALECT_DIR/$LSOF_REST >> $LSOF_MKFC
if test "X$LSOF_CFLAGS_OVERRIDE" != "X" # {
then
sed -i -e 's/^CFLAGS=/override CFLAGS=/' $LSOF_MKFC
Expand All @@ -5043,6 +5045,8 @@ then
#
# Add the library Makefile skeleton section.

echo "" >> ${LSOF_LIB}/$LSOF_LIBMKF
echo "DIALECT_DIR= $LSOF_DIALECT_DIR" >> ${LSOF_LIB}/$LSOF_LIBMKF
echo "" >> ${LSOF_LIB}/$LSOF_LIBMKF
if test "X$LSOF_AR" = "X" # {
then
Expand Down
Loading

0 comments on commit c5259c5

Please sign in to comment.