Description: Changes needed for Hurd-i1386 support
Author: Alastair McKinstry <mckinstry@debian.org>
Last-Updated: 2020-12-08
Forwarded: no

Index: cctools-7.13.1/work_queue/src/work_queue.c
===================================================================
--- cctools-7.13.1.orig/work_queue/src/work_queue.c
+++ cctools-7.13.1/work_queue/src/work_queue.c
@@ -61,6 +61,10 @@ See the file COPYING for details.
 #include <string.h>
 #include <time.h>
 
+#ifndef PATH_MAX // Hurd
+#define PATH_MAX 1024
+#endif
+
 // The default tasks capacity reported before information is available.
 // Default capacity also implies 1 core, 1024 MB of disk and 512 memory per task.
 #define WORK_QUEUE_DEFAULT_CAPACITY_TASKS 10
Index: cctools-7.13.1/work_queue/src/work_queue_process.c
===================================================================
--- cctools-7.13.1.orig/work_queue/src/work_queue_process.c
+++ cctools-7.13.1/work_queue/src/work_queue_process.c
@@ -36,6 +36,10 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#ifndef PATH_MAX // Hurd
+#define PATH_MAX 1024
+#endif
+
 /*
 Create the task sandbox directory.  If disk allocation is enabled,
 make an allocation, otherwise just make a directory.
Index: cctools-7.13.1/work_queue/src/work_queue_worker.c
===================================================================
--- cctools-7.13.1.orig/work_queue/src/work_queue_worker.c
+++ cctools-7.13.1/work_queue/src/work_queue_worker.c
@@ -77,6 +77,10 @@ See the file COPYING for details.
 #include <sys/utsname.h>
 #include <sys/wait.h>
 
+#ifndef PATH_MAX // Hurd
+#define PATH_MAX 1024
+#endif
+
 typedef enum {
 	WORKER_MODE_WORKER,
 	WORKER_MODE_FOREMAN
Index: cctools-7.13.1/resource_monitor/src/resource_monitor.c
===================================================================
--- cctools-7.13.1.orig/resource_monitor/src/resource_monitor.c
+++ cctools-7.13.1/resource_monitor/src/resource_monitor.c
@@ -160,6 +160,10 @@ See the file COPYING for details.
 #include <sys/ioctl.h>
 #endif
 
+#ifndef PATH_MAX // Not defined on Hurd
+#define PATH_MAX 1024
+#endif
+
 #include "rmonitor_helper_comm.h"
 #include "rmonitor_piggyback.h"
 
Index: cctools-7.13.1/resource_monitor/src/rmonitor_helper_comm.c
===================================================================
--- cctools-7.13.1.orig/resource_monitor/src/rmonitor_helper_comm.c
+++ cctools-7.13.1/resource_monitor/src/rmonitor_helper_comm.c
@@ -25,6 +25,10 @@ See the file COPYING for details.
 
 #include "rmonitor_helper_comm.h"
 
+#ifndef PATH_MAX // Not defined on Hurd
+#define PATH_MAX 1024
+#endif
+
 #include "debug.h"
 // #define debug fprintf
 // #define D_RMON stderr
Index: cctools-7.13.1/makeflow/src/dag_visitors.c
===================================================================
--- cctools-7.13.1.orig/makeflow/src/dag_visitors.c
+++ cctools-7.13.1/makeflow/src/dag_visitors.c
@@ -35,6 +35,9 @@ See the file COPYING for details.
 #include "dag_visitors.h"
 #include "rmsummary.h"
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
 /*
  * BUG: Error handling is not very good.
  * BUG: Integrate more with dttools (use DEBUG, etc.)
Index: cctools-7.13.1/makeflow/src/makeflow_analyze.c
===================================================================
--- cctools-7.13.1.orig/makeflow/src/makeflow_analyze.c
+++ cctools-7.13.1/makeflow/src/makeflow_analyze.c
@@ -47,6 +47,10 @@ See the file COPYING for details.
 #include "dag_visitors.h"
 #include "parser.h"
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 /* Display options */
 enum { SHOW_INPUT_FILES = 2,
 	   SHOW_OUTPUT_FILES,
Index: cctools-7.13.1/makeflow/src/makeflow_linker.c
===================================================================
--- cctools-7.13.1.orig/makeflow/src/makeflow_linker.c
+++ cctools-7.13.1/makeflow/src/makeflow_linker.c
@@ -25,6 +25,10 @@ See the file COPYING for details.
 #include "stringtools.h"
 #include "xxmalloc.h"
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 #define MAKEFLOW_PATH "makeflow_analyze"
 #define MAKEFLOW_BUNDLE_FLAG "-b"
 
Index: cctools-7.13.1/makeflow/src/makeflow_log.c
===================================================================
--- cctools-7.13.1.orig/makeflow/src/makeflow_log.c
+++ cctools-7.13.1/makeflow/src/makeflow_log.c
@@ -23,6 +23,10 @@ See the file COPYING for details.
 #include <string.h>
 #include <errno.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 #define MAX_BUFFER_SIZE 4096
 
 /*
Index: cctools-7.13.1/makeflow/src/makeflow_mounts.c
===================================================================
--- cctools-7.13.1.orig/makeflow/src/makeflow_mounts.c
+++ cctools-7.13.1/makeflow/src/makeflow_mounts.c
@@ -32,6 +32,10 @@ See the file COPYING for details.
 #include "unlink_recursive.h"
 #include "xxmalloc.h"
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 #define HTTP_TIMEOUT 300
 
 /* create_link creates a link from link_name to link_target.
Index: cctools-7.13.1/grow/src/grow_fuse.c
===================================================================
--- cctools-7.13.1.orig/grow/src/grow_fuse.c
+++ cctools-7.13.1/grow/src/grow_fuse.c
@@ -26,6 +26,10 @@
 #include "copy_stream.h"
 #include "jx_pretty_print.h"
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 #ifndef O_PATH
 #define O_PATH O_RDONLY
 #endif
Index: cctools-7.13.1/dttools/src/auth_ticket.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/auth_ticket.c
+++ cctools-7.13.1/dttools/src/auth_ticket.c
@@ -22,6 +22,10 @@ See the file COPYING for details.
 #include "stringtools.h"
 #include "xxmalloc.h"
 
+#ifndef PATH_MAX // Hurd
+#define PATH_MAX 1024
+#endif
+
 #include <sys/stat.h>
 
 #include <assert.h>
Index: cctools-7.13.1/parrot/src/pfs_service_ext.cc
===================================================================
--- cctools-7.13.1.orig/parrot/src/pfs_service_ext.cc
+++ cctools-7.13.1/parrot/src/pfs_service_ext.cc
@@ -16,6 +16,10 @@ See the file COPYING for details.
 #include <sys/types.h>
 #include <dirent.h>
 
+#ifndef PATH_MAX // Hurd
+#define PATH_MAX 1024
+#endif
+
 #include "pfs_service.h"
 
 extern "C" {
Index: cctools-7.13.1/parrot/test/TR_parrot_mmap.sh
===================================================================
--- cctools-7.13.1.orig/parrot/test/TR_parrot_mmap.sh
+++ cctools-7.13.1/parrot/test/TR_parrot_mmap.sh
@@ -32,6 +32,10 @@ prepare()
 #include <stdlib.h>
 #include <string.h>
 
+#ifndef PATH_MAX // Hurd
+#define PATH_MAX 1024
+#endif
+
 void dumpmaps (void)
 {
 	char buf[65536] = "";
Index: cctools-7.13.1/batch_job/src/work_queue_factory.c
===================================================================
--- cctools-7.13.1.orig/batch_job/src/work_queue_factory.c
+++ cctools-7.13.1/batch_job/src/work_queue_factory.c
@@ -50,6 +50,10 @@ See the file COPYING for details.
 #include <unistd.h>
 #include <signal.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 #define CCTOOLS_RUNOS_PATH "/afs/crc.nd.edu/group/ccl/software/runos/runos"
 
 typedef enum {
Index: cctools-7.13.1/chirp/src/chirp_group.h
===================================================================
--- cctools-7.13.1.orig/chirp/src/chirp_group.h
+++ cctools-7.13.1/chirp/src/chirp_group.h
@@ -10,6 +10,10 @@ See the file COPYING for details.
 
 #include <limits.h>
 
+#ifndef PATH_MAX // Hurd
+#define MATH_MAX 1024
+#endif
+
 extern char chirp_group_base_url[PATH_MAX];
 extern int  chirp_group_cache_time;
 
Index: cctools-7.13.1/chirp/src/chirp_acl.c
===================================================================
--- cctools-7.13.1.orig/chirp/src/chirp_acl.c
+++ cctools-7.13.1/chirp/src/chirp_acl.c
@@ -31,6 +31,10 @@ See the file COPYING for details.
 #include <fcntl.h>
 #include <dirent.h>
 
+#ifndef PATH_MAX // Hurd
+#define PATH_MAX 1024
+#endif
+
 const char *chirp_super_user = "";
 
 static int read_only_mode = 0;
Index: cctools-7.13.1/chirp/src/chirp_job.c
===================================================================
--- cctools-7.13.1.orig/chirp/src/chirp_job.c
+++ cctools-7.13.1/chirp/src/chirp_job.c
@@ -14,6 +14,10 @@ meant as a placeholder while we work out
 #include <errno.h>
 #include <unistd.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 unsigned chirp_job_concurrency = 0;
 int      chirp_job_enabled = 0;
 pid_t    chirp_job_schedd = 0;
Index: cctools-7.13.1/chirp/src/chirp_server.c
===================================================================
--- cctools-7.13.1.orig/chirp/src/chirp_server.c
+++ cctools-7.13.1/chirp/src/chirp_server.c
@@ -74,6 +74,10 @@
 
 #define GC_TIMEOUT  (86400)
 
+#ifndef PATH_MAX // Hurd
+#define PATH_MAX 1024
+#endif
+
 /* The maximum chunk of memory the server will allocate to handle I/O */
 #define MAX_BUFFER_SIZE (16*1024*1024)
 
Index: cctools-7.13.1/dttools/src/elfheader.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/elfheader.c
+++ cctools-7.13.1/dttools/src/elfheader.c
@@ -31,6 +31,10 @@ typedef int64_t Elf32_Sxword;
 typedef uint64_t Elf64_Xword;
 typedef int64_t Elf64_Sxword;
 
+#ifndef PATH_MAX // Hurd
+#define PATH_MAX 1024
+#endif
+
 #define EI_NIDENT 16
 #define ELFMAG \
 	"\x7f" \
@@ -49,6 +53,10 @@ typedef int64_t Elf64_Sxword;
 #define ELFCLASS32 1
 #define ELFCLASS64 2
 
+#ifndef PATH_MAX // Hurd
+#define PATH_MAX 1024
+#endif
+
 typedef struct {
 	unsigned char e_ident[EI_NIDENT];
 	Elf32_Half e_type;
Index: cctools-7.13.1/dttools/src/elfheader.h
===================================================================
--- cctools-7.13.1.orig/dttools/src/elfheader.h
+++ cctools-7.13.1/dttools/src/elfheader.h
@@ -9,6 +9,10 @@ See the file COPYING for details.
 
 #include <limits.h>
 
+#ifndef PATH_MAX // Hurd
+#define PATH_MAX 1024
+#endif
+
 /** Get the interpreter (PT_INTERP) for the executable.
  *
  * @param fd The open file descriptor to the executable.
Index: cctools-7.13.1/chirp/src/chirp_filesystem.c
===================================================================
--- cctools-7.13.1.orig/chirp/src/chirp_filesystem.c
+++ cctools-7.13.1/chirp/src/chirp_filesystem.c
@@ -33,6 +33,10 @@ See the file COPYING for details.
 #include <stdio.h>
 #include <string.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 #define CHIRP_FILESYSTEM_BUFFER  65536
 
 struct chirp_filesystem *cfs = NULL;
Index: cctools-7.13.1/chirp/src/chirp_group.c
===================================================================
--- cctools-7.13.1.orig/chirp/src/chirp_group.c
+++ cctools-7.13.1/chirp/src/chirp_group.c
@@ -17,6 +17,9 @@ See the file COPYING for details.
 #include <errno.h>
 #include <sys/stat.h>
 
+#ifndef PATH_MAX // Hurd
+#define PATH_MAX 1024
+#endif
 
 extern char chirp_transient_path[PATH_MAX];
 
Index: cctools-7.13.1/dttools/src/memfdexe.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/memfdexe.c
+++ cctools-7.13.1/dttools/src/memfdexe.c
@@ -14,6 +14,10 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 int memfdexe(const char *name, const char *extradir)
 {
 	int fd;
Index: cctools-7.13.1/dttools/src/path_disk_size_info.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/path_disk_size_info.c
+++ cctools-7.13.1/dttools/src/path_disk_size_info.c
@@ -18,6 +18,10 @@ See the file COPYING for details.
 #include "stringtools.h"
 #include "xxmalloc.h"
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 struct DIR_with_name {
 	DIR *dir;
 	char *name;
Index: cctools-7.13.1/dttools/src/clean_dir.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/clean_dir.c
+++ cctools-7.13.1/dttools/src/clean_dir.c
@@ -15,6 +15,10 @@ See the file COPYING for details.
 #include <string.h>
 #include <unistd.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 int clean_dir(const char *dirname, const char *delete_pattern)
 {
 	char subdir[PATH_MAX];
Index: cctools-7.13.1/dttools/src/compat-at.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/compat-at.c
+++ cctools-7.13.1/dttools/src/compat-at.c
@@ -22,6 +22,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 static int getfullpath(int dirfd, const char *path, char fullpath[PATH_MAX])
 {
 	char dirpath[PATH_MAX] = ".";
Index: cctools-7.13.1/dttools/src/copy_stream.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/copy_stream.c
+++ cctools-7.13.1/dttools/src/copy_stream.c
@@ -23,6 +23,10 @@ See the file COPYING for details.
 #include <stdlib.h>
 #include <string.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 #define COPY_BUFFER_SIZE (1 << 16)
 
 int64_t copy_fd_to_stream(int fd, FILE *output)
Index: cctools-7.13.1/dttools/src/copy_tree.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/copy_tree.c
+++ cctools-7.13.1/dttools/src/copy_tree.c
@@ -22,6 +22,10 @@
 #include "path.h"
 #include "xxmalloc.h"
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 static mode_t default_dirmode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
 
 int copy_dir_real(const char *source, const char *target);
Index: cctools-7.13.1/dttools/src/debug.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/debug.c
+++ cctools-7.13.1/dttools/src/debug.c
@@ -23,6 +23,10 @@ See the file COPYING for details.
 
 #include <stdio.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 extern void debug_stderr_write(int64_t flags, const char *str);
 extern void debug_stdout_write(int64_t flags, const char *str);
 
Index: cctools-7.13.1/dttools/src/debug_file.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/debug_file.c
+++ cctools-7.13.1/dttools/src/debug_file.c
@@ -21,6 +21,10 @@ See the file COPYING for details.
 #include <stdlib.h>
 #include <string.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 static int file_fd = -1;
 static struct stat file_stat;
 static char file_path[PATH_MAX];
Index: cctools-7.13.1/dttools/src/file_cache.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/file_cache.c
+++ cctools-7.13.1/dttools/src/file_cache.c
@@ -24,6 +24,10 @@ See the file COPYING for details.
 #include <time.h>
 #include <unistd.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 /* Cygwin does not have 64-bit I/O, while Darwin & FreeBSD have it by default. */
 
 #if defined(CCTOOLS_OPSYS_DARWIN) || defined(CCTOOLS_OPSYS_FREEBSD)
Index: cctools-7.13.1/dttools/src/mkdir_recursive.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/mkdir_recursive.c
+++ cctools-7.13.1/dttools/src/mkdir_recursive.c
@@ -20,6 +20,10 @@ See the file COPYING for details.
 #include <stdlib.h>
 #include <string.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 int mkdirat_recursive(int fd, const char *path, mode_t mode)
 {
 	int rc;
Index: cctools-7.13.1/dttools/src/path.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/path.c
+++ cctools-7.13.1/dttools/src/path.c
@@ -24,6 +24,10 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 void path_absolute(const char *src, char *dest, int exist)
 {
 	struct stat buf;
Index: cctools-7.13.1/dttools/src/rmonitor_poll.c
===================================================================
--- cctools-7.13.1.orig/dttools/src/rmonitor_poll.c
+++ cctools-7.13.1/dttools/src/rmonitor_poll.c
@@ -25,6 +25,10 @@ See the file COPYING for details.
 #include "path_disk_size_info.h"
 #include "rmonitor_poll_internal.h"
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 /***
  * Helper functions
  ***/
Index: cctools-7.13.1/dttools/test/TR_path_dirname.sh
===================================================================
--- cctools-7.13.1.orig/dttools/test/TR_path_dirname.sh
+++ cctools-7.13.1/dttools/test/TR_path_dirname.sh
@@ -13,6 +13,10 @@ prepare()
 #include <string.h>
 #include "path.h"
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 void test (const char *in, const char *expected)
 {
 	char out[PATH_MAX];
Index: cctools-7.13.1/parrot/src/irods_reli.cc
===================================================================
--- cctools-7.13.1.orig/parrot/src/irods_reli.cc
+++ cctools-7.13.1/parrot/src/irods_reli.cc
@@ -38,6 +38,10 @@ extern "C" {
 #include "stringtools.h"
 }
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 #include <string>
 
 extern int pfs_irods_debug_level;
Index: cctools-7.13.1/parrot/src/parrot_package_create.c
===================================================================
--- cctools-7.13.1.orig/parrot/src/parrot_package_create.c
+++ cctools-7.13.1/parrot/src/parrot_package_create.c
@@ -17,6 +17,9 @@
 #include <time.h>
 #include <limits.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
 
 #include "copy_stream.h"
 #include "debug.h"
Index: cctools-7.13.1/parrot/src/pfs_channel.c
===================================================================
--- cctools-7.13.1.orig/parrot/src/pfs_channel.c
+++ cctools-7.13.1/parrot/src/pfs_channel.c
@@ -22,6 +22,10 @@ See the file COPYING for details.
 #include <stdlib.h>
 #include <string.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 struct entry {
 	char *name;
 	pfs_size_t start;
Index: cctools-7.13.1/parrot/src/pfs_dispatch64.cc
===================================================================
--- cctools-7.13.1.orig/parrot/src/pfs_dispatch64.cc
+++ cctools-7.13.1/parrot/src/pfs_dispatch64.cc
@@ -68,6 +68,10 @@ extern "C" {
 #include <string.h>
 #include <time.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 #ifndef EFD_CLOEXEC
 #	define EFD_CLOEXEC 02000000
 #endif
Index: cctools-7.13.1/parrot/src/pfs_dispatch.cc
===================================================================
--- cctools-7.13.1.orig/parrot/src/pfs_dispatch.cc
+++ cctools-7.13.1/parrot/src/pfs_dispatch.cc
@@ -59,6 +59,10 @@ extern "C" {
 #include <string.h>
 #include <time.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 #ifndef EFD_CLOEXEC
 #	define EFD_CLOEXEC 02000000
 #endif
Index: cctools-7.13.1/parrot/src/pfs_main.cc
===================================================================
--- cctools-7.13.1.orig/parrot/src/pfs_main.cc
+++ cctools-7.13.1/parrot/src/pfs_main.cc
@@ -75,6 +75,10 @@ extern "C" {
 
 #include <vector>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 #define SIG_ISSTOP(s) (s == SIGTTIN || s == SIGTTOU || s == SIGSTOP || s == SIGTSTP)
 
 FILE *namelist_file;
Index: cctools-7.13.1/parrot/src/pfs_process.cc
===================================================================
--- cctools-7.13.1.orig/parrot/src/pfs_process.cc
+++ cctools-7.13.1/parrot/src/pfs_process.cc
@@ -31,6 +31,10 @@ extern "C" {
 #include <stdlib.h>
 #include <string.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 pfs_pid_mode_t pfs_pid_mode = PFS_PID_MODE_NORMAL;
 
 int emulated_pid = 12345;
Index: cctools-7.13.1/parrot/src/pfs_table.cc
===================================================================
--- cctools-7.13.1.orig/parrot/src/pfs_table.cc
+++ cctools-7.13.1/parrot/src/pfs_table.cc
@@ -63,6 +63,10 @@ extern "C" {
 #include <stdlib.h>
 #include <string.h>
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 #ifndef O_CLOEXEC
 #	define O_CLOEXEC 02000000
 #endif
