Skip to content

Commit

Permalink
Merge branches 'htop-updates' and 'windows-builds'
Browse files Browse the repository at this point in the history
  • Loading branch information
natoscott committed Apr 10, 2024
3 parents cfdc9d0 + 3450a12 + 0b95f87 commit 1fa3843
Show file tree
Hide file tree
Showing 36 changed files with 724 additions and 312 deletions.
13 changes: 5 additions & 8 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,21 +226,18 @@ cross-compilation. Currently packaging is no longer performed,
although previously MSI builds were possible. Work on tackling
this short-coming would be most welcome.

Base package list needed for Fedora (26+) cross-compilation:
Base package list needed for Fedora (39+) cross-compilation:
mingw64-gcc
mingw64-binutils
mingw64-qt5-qttools-tools
mingw64-qt5-qtbase-devel
mingw64-qt6-qttools
mingw64-qt6-qtsvg
mingw64-qt6-qt3d
mingw64-pkg-config
mingw64-readline
mingw64-xz-libs
mingw64-qt5-qtsvg
mingw64-pdcurses
mingw64-libgnurx

Since Fedora 28, there are also Python packages available:

mingw64-python2
mingw64-python3

### 2. Account creation

Expand Down
4 changes: 2 additions & 2 deletions Makepkgs
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ in
mingw|mingw64|windows)
target=mingw
dorpm=false
configopts="$configopts --disable-ssp --without-qt3d"
configopts="$configopts --disable-ssp --without-python3"
export configure="/usr/bin/mingw64-configure"
export MAKE="/usr/bin/mingw64-make"
export QMAKE="/usr/bin/mingw64-qmake-qt5"
export QMAKE="/usr/bin/mingw64-qmake-qt6"
export PKG_CONFIG="/usr/bin/mingw64-pkg-config"
;;
linux)
Expand Down
2 changes: 1 addition & 1 deletion src/collectl2pcp/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ HFILES = metrics.h
CFILES = collectl2pcp.c cpu.c disk.c net.c load.c timestamp.c util.c \
metrics.c header.c generic.c proc.c

CMDTARGET = collectl2pcp
CMDTARGET = collectl2pcp$(EXECSUFFIX)
LLDLIBS = -L$(TOPDIR)/src/libpcp_import/src -lpcp_import $(PCPLIB)
# LCFLAGS += -pg

Expand Down
8 changes: 4 additions & 4 deletions src/find-filter/find-filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ main(int argc, char **argv)
switch (pred) {
case PRED_CTIME:
#if defined(HAVE_ST_MTIME_WITH_E) && defined(HAVE_STAT_TIME_T)
check.tv_sec = sbuf.st_ctime.tv_sec;
check.tv_usec = sbuf.st_ctime.tv_usec;
check.tv_sec = sbuf.st_ctime;
check.tv_usec = 0;
#elif defined(HAVE_ST_MTIME_WITH_SPEC)
check.tv_sec = sbuf.st_ctimespec.tv_sec;
check.tv_usec = sbuf.st_ctimespec.tv_nsec / 1000;
Expand All @@ -198,8 +198,8 @@ main(int argc, char **argv)

case PRED_MTIME:
#if defined(HAVE_ST_MTIME_WITH_E) && defined(HAVE_STAT_TIME_T)
check.tv_sec = sbuf.st_mtime.tv_sec;
check.tv_usec = sbuf.st_mtime.tv_usec;
check.tv_sec = sbuf.st_mtime;
check.tv_usec = 0;
#elif defined(HAVE_ST_MTIME_WITH_SPEC)
check.tv_sec = sbuf.st_mtimespec.tv_sec;
check.tv_usec = sbuf.st_mtimespec.tv_nsec / 1000;
Expand Down
1 change: 1 addition & 0 deletions src/include/pcp/platform_defs.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ extern const char *wsastrerror(int);
#define S_IRWXO 0
#endif
#define S_ISVTX 0
#define S_ISLNK(mode) 0 /* no symlink support */

#define fcntl(f, cmd, ...) 0
#define mkdir2(path, mode) mkdir(path)
Expand Down
26 changes: 16 additions & 10 deletions src/libpcp/src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -3176,9 +3176,11 @@ inodetype(mode_t st_mode)
case S_IFCHR: return "character device";
case S_IFDIR: return "directory";
case S_IFIFO: return "FIFO/pipe";
case S_IFLNK: return "symlink";
case S_IFREG: return "regular file";
#if !defined(IS_MINGW)
case S_IFLNK: return "symlink";
case S_IFSOCK: return "socket";
#endif
default: return "unknown?";
}
}
Expand Down Expand Up @@ -3229,20 +3231,22 @@ check_map_name(const char *path, const char *name, const char *link, const char
}
return 0;
}
if (kill(pid, 0) < 0) {
if (oserror() == ESRCH) {
if (pmDebugOptions.appl9) {
fprintf(stderr, "__pmCleanMapDir: %s", path);
if (link) fprintf(stderr, " -> %s (%s)", link, link_pid);
fprintf(stderr, ": remove: process does not exist\n");
}
return 0;
if (!__pmProcessExists(pid)) {
if (pmDebugOptions.appl9) {
fprintf(stderr, "__pmCleanMapDir: %s", path);
if (link) fprintf(stderr, " -> %s (%s)", link, link_pid);
fprintf(stderr, ": remove: process does not exist\n");
}
return 0;
}

return 1;
}

#if defined(IS_MINGW)
#define lstat(p,s) stat(p,s)
#endif

/*
* remove old files from a map directory
* - use -Dappl9 for verbose diagnostics
Expand Down Expand Up @@ -3278,6 +3282,7 @@ __pmCleanMapDir(const char *dirname, const char * special)
return sts;
}

#if !defined(IS_MINGW)
if (sbuf.st_uid != geteuid()) {
sts = -EPERM;
PM_UNLOCK(__pmLock_extcall);
Expand All @@ -3295,6 +3300,7 @@ __pmCleanMapDir(const char *dirname, const char * special)
dirname, sbuf.st_gid, getegid(), pmErrStr_r(sts, errmsg, sizeof(errmsg)));
return sts;
}
#endif

if ((dirp = opendir(dirname)) == NULL) {
sts = -oserror();
Expand Down Expand Up @@ -3331,7 +3337,7 @@ __pmCleanMapDir(const char *dirname, const char * special)
path, pmErrStr_r(sts, errmsg, sizeof(errmsg)));
goto unlink;
}
if ((sbuf.st_mode & S_IFMT) != S_IFLNK) {
if (!S_ISLNK(sbuf.st_mode)) {
if (pmDebugOptions.appl9)
fprintf(stderr, "__pmCleanMapDir: %s [special]: remove: is a %s, expected a symlink\n",
path, inodetype(sbuf.st_mode));
Expand Down
4 changes: 2 additions & 2 deletions src/pmdas/apache/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ build-me: $(TARGETS)
install: build-me
$(INSTALL) -m 755 -d $(PMDAADMDIR)
$(INSTALL) -m 755 -d $(PMDAVARDIR)
$(INSTALL) -m 755 -t $(PMDAVARDIR)/pmda$(IAM) $(IAM) $(PMDAADMDIR)/pmda$(IAM)
$(INSTALL) -m 755 -t $(PMDAVARDIR)/pmda$(IAM) $(TARGETS) $(PMDAADMDIR)/pmda$(IAM)
$(INSTALL) -m 755 -t $(PMDAVARDIR) $(SCRIPTS) $(PMDAADMDIR)
$(INSTALL) -m 644 -t $(PMDAVARDIR) $(DFILES) pmns help root domain.h $(PMDAADMDIR)
ifeq "$(ENABLE_QT)" "true"
Expand All @@ -55,7 +55,7 @@ endif
$(INSTALL) -m 644 -t $(PMLOGCONFVARDIR)/summary pmlogconf.summary $(PMLOGCONFETCDIR)/summary
$(INSTALL) -m 644 -t $(PMLOGCONFVARDIR)/uptime pmlogconf.uptime $(PMLOGCONFETCDIR)/uptime

$(IAM)$(EXECSUFFIX): $(OBJECTS)
$(TARGETS): $(OBJECTS)

$(OBJECTS): domain.h

Expand Down
17 changes: 13 additions & 4 deletions src/pmdas/zimbra/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ include $(TOPDIR)/src/include/builddefs

IAM = zimbra
LDIRT = domain.h root pmns *.log
LDIRT += runaszimbra

PMDAADMDIR = $(PCP_PMDASADM_DIR)/$(IAM)
PMDATMPDIR = $(PCP_PMDAS_DIR)/$(IAM)
Expand All @@ -29,17 +28,27 @@ MAN_SECTION = 1
MAN_PAGES = pmda$(IAM).$(MAN_SECTION)
MAN_DEST = $(PCP_MAN_DIR)/man$(MAN_SECTION)

default: build-me check_domain runaszimbra
ifneq "$(TARGET_OS)" "mingw"
RUNASZIMBRA = runaszimbra
else
RUNASZIMBRA =
endif
LDIRT += $(RUNASZIMBRA)

default: build-me check_domain

include $(BUILDRULES)

ifeq "$(HAVE_PERL)" "true"
build-me:
build-me: $(RUNASZIMBRA)
install: default
$(INSTALL) -m 755 -d $(PMDAADMDIR)
$(INSTALL) -m 755 -d $(PMDATMPDIR)
$(INSTALL) -m 755 -t $(PMDATMPDIR) runaszimbra Install Remove $(PMDAADMDIR)
$(INSTALL) -m 755 -t $(PMDATMPDIR) Install Remove $(PMDAADMDIR)
ifneq "$(TARGET_OS)" "mingw"
$(INSTALL) -m 755 -t $(PMDATMPDIR)/runaszimbra runaszimbra $(PMDAADMDIR)/runaszimbra
$(INSTALL) -m 755 -t $(PMDATMPDIR)/zimbraprobe zimbraprobe.sh $(PMDAADMDIR)/zimbraprobe
endif
$(INSTALL) -m 644 -t $(PMDATMPDIR)/pmda$(IAM).pl pmda$(IAM).pl $(PMDAADMDIR)/pmda$(IAM).pl
@$(INSTALL_MAN)
$(INSTALL) -m 755 -d $(LOGCONFDIR)
Expand Down
9 changes: 3 additions & 6 deletions src/pmdas/zimbra/runaszimbra.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@
* the single argument is a sh(1) command to be run under the uid of the
* zimbra "user".
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <pmapi.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif


int main(int argc, char **argv)
Expand Down
4 changes: 2 additions & 2 deletions src/pmlogger/src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ do_dir(char *dname, char *result)
if (*p == sep) {
*p = '\0';
if (chdir(result) < 0) {
if (mkdir(result, 0777) < 0) {
if (mkdir2(result, 0777) < 0) {
sts = -oserror();
fprintf(stderr, "do_dir(%s, ...): mkdir(%s, ...) failed: %s\n", dname, result, pmErrStr(sts));
*p = sep;
Expand All @@ -189,7 +189,7 @@ do_dir(char *dname, char *result)
}
/* try again ... */
if (chdir(result) < 0) {
if (mkdir(result, 0777) < 0) {
if (mkdir2(result, 0777) < 0) {
sts = -oserror();
fprintf(stderr, "do_dir(%s, ...): mkdir(%s, ...) failed: %s\n", dname, result, pmErrStr(sts));
goto restore;
Expand Down
2 changes: 1 addition & 1 deletion src/pmlogrewrite/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ LFILES = lex.l
YFILES = gram.y

CMDTARGET = pmlogrewrite$(EXECSUFFIX)
LLDLIBS = $(PCP_ARCHIVELIB) $(PCPLIB) $(LIB_FOR_MATH)
LLDLIBS = $(PCP_ARCHIVELIB) $(PCPLIB) $(LIB_FOR_MATH) $(LIB_FOR_REGEX)
LDIRT += $(YFILES:%.y=%.tab.?)

default: $(CMDTARGET)
Expand Down
12 changes: 4 additions & 8 deletions src/pmlogrewrite/pmlogrewrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,8 @@ nextlog(void)
return old_vol == acp->ac_curvol ? 0 : 1;
}

#ifdef IS_MINGW
#define S_ISLINK(mode) 0 /* no symlink support */
#else
#ifndef S_ISLINK
#define S_ISLINK(mode) ((mode & S_IFMT) == S_IFLNK)
#endif
#ifndef S_ISLNK
#define S_ISLNK(mode) ((mode & S_IFMT) == S_IFLNK)
#endif

/*
Expand All @@ -303,7 +299,7 @@ parseargs(int argc, char *argv[])
opts.errors++;
break;
}
if (S_ISREG(sbuf.st_mode) || S_ISLINK(sbuf.st_mode)) {
if (S_ISREG(sbuf.st_mode) || S_ISLNK(sbuf.st_mode)) {
if ((cp = (char **)realloc(conf, (nconf+1)*sizeof(conf[0]))) != NULL) {
conf = cp;
conf[nconf++] = opts.optarg;
Expand All @@ -326,7 +322,7 @@ parseargs(int argc, char *argv[])
pmprintf("%s: %s: %s\n", pmGetProgname(), path, osstrerror());
opts.errors++;
}
else if (S_ISREG(sbuf.st_mode) || S_ISLINK(sbuf.st_mode)) {
else if (S_ISREG(sbuf.st_mode) || S_ISLNK(sbuf.st_mode)) {
if ((cp = (char **)realloc(conf, (nconf+1)*sizeof(conf[0]))) == NULL)
break;
conf = cp;
Expand Down
4 changes: 3 additions & 1 deletion src/python/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ ENV += CC="$(CC)"
ENV += LD="$(LD)"
ENV += LDSHARED="$(CC) -shared -fstack-protector"
ENV += PYTHONCPREFIX="/usr/x86_64-w64-mingw32/sys-root/mingw/"
EXTRA_PY_INCLUDES = :/usr/x86_64-w64-mingw32/sys-root/mingw/include:/usr/x86_64-w64-mingw32/sys-root/mingw/include/python2.7
# investigate pkgconfig for this (version-specific currently & missing libs?)
# /usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig/python3-embed.pc
EXTRA_PY_INCLUDES = :/usr/x86_64-w64-mingw32/sys-root/mingw/include:/usr/x86_64-w64-mingw32/sys-root/mingw/include/python3.11
endif
ifeq "$(HAVE_PYTHON_SETUPTOOLS)" "true"
SETUP_PY = setup.py
Expand Down
8 changes: 7 additions & 1 deletion src/runaspcp/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@ CFILES = runaspcp.c
CMDTARGET = runaspcp$(EXECSUFFIX)
LLDLIBS = $(PCPLIB)

default: $(CMDTARGET)
default: build-me

include $(BUILDRULES)

ifneq "$(TARGET_OS)" "mingw"
build-me: $(CMDTARGET)
install: default
$(INSTALL) -m 755 $(CMDTARGET) $(PCP_BINADM_DIR)/$(CMDTARGET)
else
build-me:
install:
endif

default_pcp: default

Expand Down
12 changes: 5 additions & 7 deletions src/runaspcp/runaspcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
* This simple wrapper has to be run as root and the single argument is a
* sh(1) command to be run under the uid and gid of the pcp "user".
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <pcp/pmapi.h>
#ifdef HAVE_GRP_H
#include <grp.h>
#include <sys/types.h>
#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
#include <pcp/pmapi.h>
#endif

static pmLongOptions longopts[] = {
PMAPI_OPTIONS_HEADER("Options"),
Expand Down
2 changes: 1 addition & 1 deletion src/telnet-probe/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TOPDIR = ../..
include $(TOPDIR)/src/include/builddefs

CFILES = telnet-probe.c
CMDTARGET = telnet-probe
CMDTARGET = telnet-probe$(EXECSUFFIX)
LLDLIBS = -lpcp

default: $(CMDTARGET)
Expand Down
16 changes: 9 additions & 7 deletions vendor/github.com/htop-dev/htop/Hashtable.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/htop-dev/htop/Machine.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vendor/github.com/htop-dev/htop/Makefile.am

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1fa3843

Please sign in to comment.