diff options
Diffstat (limited to '')
12 files changed, 580 insertions, 29 deletions
diff --git a/sysutils/slurm-wlm/Makefile b/sysutils/slurm-wlm/Makefile index b7002208382b..a676f4bb7ad2 100644 --- a/sysutils/slurm-wlm/Makefile +++ b/sysutils/slurm-wlm/Makefile @@ -1,6 +1,6 @@ PORTNAME= slurm DISTVERSION= 23.11.7 -PORTREVISION= 7 +PORTREVISION= 10 CATEGORIES= sysutils MASTER_SITES= https://download.schedmd.com/slurm/ PKGNAMESUFFIX= -wlm @@ -115,6 +115,8 @@ PROC2FIX= common/callerid.c common/fd.c common/fetch_config.c \ plugins/switch/cray_aries/scaling.c \ plugins/task/affinity/affinity.c slurmd/common/set_oomadj.c \ slurmd/common/xcpuinfo.c slurmd/slurmstepd/pdebug.c \ + slurmctld/controller.c \ + slurmd/slurmd/slurmd.c \ slurmd/slurmstepd/req.c LLD2FIX= api plugins/openapi sacctmgr sackd scontrol scrontab scrun \ @@ -122,6 +124,12 @@ LLD2FIX= api plugins/openapi sacctmgr sackd scontrol scrontab scrun \ .include <bsd.port.options.mk> +post-extract: + @${MKDIR} ${WRKSRC}/src/plugins/task/pgid +# Use an existing plugin's Makefile.in as a template + @${CP} ${WRKSRC}/src/plugins/task/cray_aries/Makefile.in \ + ${WRKSRC}/src/plugins/task/pgid/Makefile.in + # Hack around nonfunctional --disable-gtktest flag pre-configure-GUI-off: ${REINPLACE_CMD} -e 's|min_gtk_version=.*|min_gtk_version=2000.0.0|' \ diff --git a/sysutils/slurm-wlm/files/patch-configure b/sysutils/slurm-wlm/files/patch-configure index 51cf89bd4981..f95b552a6dab 100644 --- a/sysutils/slurm-wlm/files/patch-configure +++ b/sysutils/slurm-wlm/files/patch-configure @@ -1,4 +1,4 @@ ---- configure.orig 2023-11-21 22:33:29 UTC +--- configure.orig 2024-05-21 17:19:51 UTC +++ configure @@ -5513,7 +5513,7 @@ _ACEOF /* end confdefs.h. */ @@ -240,3 +240,12 @@ else printf "%s\n" "#define H5_USE_18_API 1" >>confdefs.h +@@ -28035,7 +28030,7 @@ printf "%s\n" "${x_ac_deprecated=no}" >&6; } + + + +-ac_config_files="$ac_config_files Makefile auxdir/Makefile contribs/Makefile contribs/cray/Makefile contribs/cray/csm/Makefile contribs/cray/slurmsmwd/Makefile contribs/lua/Makefile contribs/nss_slurm/Makefile contribs/openlava/Makefile contribs/pam/Makefile contribs/pam_slurm_adopt/Makefile contribs/perlapi/Makefile contribs/perlapi/libslurm/Makefile contribs/perlapi/libslurm/perl/Makefile.PL contribs/perlapi/libslurmdb/Makefile contribs/perlapi/libslurmdb/perl/Makefile.PL contribs/pmi/Makefile contribs/pmi2/Makefile contribs/seff/Makefile contribs/sgather/Makefile contribs/sjobexit/Makefile contribs/torque/Makefile doc/Makefile doc/html/Makefile doc/html/configurator.easy.html doc/html/configurator.html doc/man/Makefile doc/man/man1/Makefile doc/man/man5/Makefile doc/man/man8/Makefile etc/Makefile src/Makefile src/api/Makefile src/bcast/Makefile src/common/Makefile src/database/Makefile src/interfaces/Makefile src/lua/Makefile src/plugins/Makefile src/plugins/accounting_storage/Makefile src/plugins/accounting_storage/common/Makefile src/plugins/accounting_storage/mysql/Makefile src/plugins/accounting_storage/slurmdbd/Makefile src/plugins/acct_gather_energy/Makefile src/plugins/acct_gather_energy/gpu/Makefile src/plugins/acct_gather_energy/ibmaem/Makefile src/plugins/acct_gather_energy/ipmi/Makefile src/plugins/acct_gather_energy/pm_counters/Makefile src/plugins/acct_gather_energy/rapl/Makefile src/plugins/acct_gather_energy/xcc/Makefile src/plugins/acct_gather_filesystem/Makefile src/plugins/acct_gather_filesystem/lustre/Makefile src/plugins/acct_gather_interconnect/Makefile src/plugins/acct_gather_interconnect/ofed/Makefile src/plugins/acct_gather_interconnect/sysfs/Makefile src/plugins/acct_gather_profile/Makefile src/plugins/acct_gather_profile/hdf5/Makefile src/plugins/acct_gather_profile/hdf5/sh5util/Makefile src/plugins/acct_gather_profile/influxdb/Makefile src/plugins/auth/Makefile src/plugins/auth/jwt/Makefile src/plugins/auth/munge/Makefile src/plugins/auth/none/Makefile src/plugins/auth/slurm/Makefile src/plugins/burst_buffer/Makefile src/plugins/burst_buffer/common/Makefile src/plugins/burst_buffer/datawarp/Makefile src/plugins/burst_buffer/lua/Makefile src/plugins/cgroup/Makefile src/plugins/cgroup/common/Makefile src/plugins/cgroup/v1/Makefile src/plugins/cgroup/v2/Makefile src/plugins/cli_filter/Makefile src/plugins/cli_filter/common/Makefile src/plugins/cli_filter/lua/Makefile src/plugins/cli_filter/syslog/Makefile src/plugins/cli_filter/user_defaults/Makefile src/plugins/core_spec/Makefile src/plugins/core_spec/cray_aries/Makefile src/plugins/cred/Makefile src/plugins/cred/common/Makefile src/plugins/cred/munge/Makefile src/plugins/cred/none/Makefile src/plugins/data_parser/Makefile src/plugins/data_parser/v0.0.39/Makefile src/plugins/data_parser/v0.0.40/Makefile src/plugins/ext_sensors/Makefile src/plugins/ext_sensors/rrd/Makefile src/plugins/gpu/Makefile src/plugins/gpu/common/Makefile src/plugins/gpu/generic/Makefile src/plugins/gpu/nrt/Makefile src/plugins/gpu/nvml/Makefile src/plugins/gpu/oneapi/Makefile src/plugins/gpu/rsmi/Makefile src/plugins/gres/Makefile src/plugins/gres/common/Makefile src/plugins/gres/gpu/Makefile src/plugins/gres/mps/Makefile src/plugins/gres/nic/Makefile src/plugins/gres/shard/Makefile src/plugins/hash/Makefile src/plugins/hash/k12/Makefile src/plugins/job_container/Makefile src/plugins/job_container/cncu/Makefile src/plugins/job_container/tmpfs/Makefile src/plugins/job_submit/Makefile src/plugins/job_submit/all_partitions/Makefile src/plugins/job_submit/cray_aries/Makefile src/plugins/job_submit/defaults/Makefile src/plugins/job_submit/logging/Makefile src/plugins/job_submit/lua/Makefile src/plugins/job_submit/partition/Makefile src/plugins/job_submit/pbs/Makefile src/plugins/job_submit/require_timelimit/Makefile src/plugins/job_submit/throttle/Makefile src/plugins/jobacct_gather/Makefile src/plugins/jobacct_gather/cgroup/Makefile src/plugins/jobacct_gather/common/Makefile src/plugins/jobacct_gather/linux/Makefile src/plugins/jobcomp/Makefile src/plugins/jobcomp/common/Makefile src/plugins/jobcomp/elasticsearch/Makefile src/plugins/jobcomp/filetxt/Makefile src/plugins/jobcomp/kafka/Makefile src/plugins/jobcomp/lua/Makefile src/plugins/jobcomp/mysql/Makefile src/plugins/jobcomp/script/Makefile src/plugins/mcs/Makefile src/plugins/mcs/account/Makefile src/plugins/mcs/group/Makefile src/plugins/mcs/user/Makefile src/plugins/mpi/Makefile src/plugins/mpi/cray_shasta/Makefile src/plugins/mpi/pmi2/Makefile src/plugins/mpi/pmix/Makefile src/plugins/node_features/Makefile src/plugins/node_features/helpers/Makefile src/plugins/node_features/knl_cray/Makefile src/plugins/node_features/knl_generic/Makefile src/plugins/power/Makefile src/plugins/power/common/Makefile src/plugins/power/cray_aries/Makefile src/plugins/preempt/Makefile src/plugins/preempt/partition_prio/Makefile src/plugins/preempt/qos/Makefile src/plugins/prep/Makefile src/plugins/prep/script/Makefile src/plugins/priority/Makefile src/plugins/priority/basic/Makefile src/plugins/priority/multifactor/Makefile src/plugins/proctrack/Makefile src/plugins/proctrack/cgroup/Makefile src/plugins/proctrack/cray_aries/Makefile src/plugins/proctrack/linuxproc/Makefile src/plugins/proctrack/pgid/Makefile src/plugins/sched/Makefile src/plugins/sched/backfill/Makefile src/plugins/sched/builtin/Makefile src/plugins/select/Makefile src/plugins/select/cons_tres/Makefile src/plugins/select/cray_aries/Makefile src/plugins/select/linear/Makefile src/plugins/select/other/Makefile src/plugins/serializer/Makefile src/plugins/serializer/json/Makefile src/plugins/serializer/url-encoded/Makefile src/plugins/serializer/yaml/Makefile src/plugins/site_factor/Makefile src/plugins/site_factor/example/Makefile src/plugins/switch/Makefile src/plugins/switch/cray_aries/Makefile src/plugins/switch/hpe_slingshot/Makefile src/plugins/task/Makefile src/plugins/task/affinity/Makefile src/plugins/task/cgroup/Makefile src/plugins/task/cray_aries/Makefile src/plugins/topology/Makefile src/plugins/topology/3d_torus/Makefile src/plugins/topology/block/Makefile src/plugins/topology/common/Makefile src/plugins/topology/default/Makefile src/plugins/topology/tree/Makefile src/sacct/Makefile src/sackd/Makefile src/sacctmgr/Makefile src/salloc/Makefile src/sattach/Makefile src/scrun/Makefile src/sbatch/Makefile src/sbcast/Makefile src/scancel/Makefile src/scontrol/Makefile src/scrontab/Makefile src/sdiag/Makefile src/sinfo/Makefile src/slurmctld/Makefile src/slurmd/Makefile src/slurmd/common/Makefile src/slurmd/slurmd/Makefile src/slurmd/slurmstepd/Makefile src/slurmdbd/Makefile src/slurmrestd/Makefile src/slurmrestd/plugins/Makefile src/slurmrestd/plugins/auth/Makefile src/slurmrestd/plugins/auth/jwt/Makefile src/slurmrestd/plugins/auth/local/Makefile src/slurmrestd/plugins/openapi/Makefile src/slurmrestd/plugins/openapi/dbv0.0.38/Makefile src/slurmrestd/plugins/openapi/dbv0.0.39/Makefile src/slurmrestd/plugins/openapi/slurmctld/Makefile src/slurmrestd/plugins/openapi/slurmdbd/Makefile src/slurmrestd/plugins/openapi/v0.0.38/Makefile src/slurmrestd/plugins/openapi/v0.0.39/Makefile src/sprio/Makefile src/squeue/Makefile src/sreport/Makefile src/srun/Makefile src/sshare/Makefile src/sstat/Makefile src/strigger/Makefile src/sview/Makefile testsuite/Makefile testsuite/testsuite.conf.sample testsuite/expect/Makefile testsuite/slurm_unit/Makefile testsuite/slurm_unit/common/Makefile testsuite/slurm_unit/common/bitstring/Makefile testsuite/slurm_unit/common/hostlist/Makefile testsuite/slurm_unit/common/slurm_protocol_defs/Makefile testsuite/slurm_unit/common/slurm_protocol_pack/Makefile testsuite/slurm_unit/common/slurmdb_defs/Makefile testsuite/slurm_unit/common/slurmdb_pack/Makefile" ++ac_config_files="$ac_config_files Makefile auxdir/Makefile contribs/Makefile contribs/cray/Makefile contribs/cray/csm/Makefile contribs/cray/slurmsmwd/Makefile contribs/lua/Makefile contribs/nss_slurm/Makefile contribs/openlava/Makefile contribs/pam/Makefile contribs/pam_slurm_adopt/Makefile contribs/perlapi/Makefile contribs/perlapi/libslurm/Makefile contribs/perlapi/libslurm/perl/Makefile.PL contribs/perlapi/libslurmdb/Makefile contribs/perlapi/libslurmdb/perl/Makefile.PL contribs/pmi/Makefile contribs/pmi2/Makefile contribs/seff/Makefile contribs/sgather/Makefile contribs/sjobexit/Makefile contribs/torque/Makefile doc/Makefile doc/html/Makefile doc/html/configurator.easy.html doc/html/configurator.html doc/man/Makefile doc/man/man1/Makefile doc/man/man5/Makefile doc/man/man8/Makefile etc/Makefile src/Makefile src/api/Makefile src/bcast/Makefile src/common/Makefile src/database/Makefile src/interfaces/Makefile src/lua/Makefile src/plugins/Makefile src/plugins/accounting_storage/Makefile src/plugins/accounting_storage/common/Makefile src/plugins/accounting_storage/mysql/Makefile src/plugins/accounting_storage/slurmdbd/Makefile src/plugins/acct_gather_energy/Makefile src/plugins/acct_gather_energy/gpu/Makefile src/plugins/acct_gather_energy/ibmaem/Makefile src/plugins/acct_gather_energy/ipmi/Makefile src/plugins/acct_gather_energy/pm_counters/Makefile src/plugins/acct_gather_energy/rapl/Makefile src/plugins/acct_gather_energy/xcc/Makefile src/plugins/acct_gather_filesystem/Makefile src/plugins/acct_gather_filesystem/lustre/Makefile src/plugins/acct_gather_interconnect/Makefile src/plugins/acct_gather_interconnect/ofed/Makefile src/plugins/acct_gather_interconnect/sysfs/Makefile src/plugins/acct_gather_profile/Makefile src/plugins/acct_gather_profile/hdf5/Makefile src/plugins/acct_gather_profile/hdf5/sh5util/Makefile src/plugins/acct_gather_profile/influxdb/Makefile src/plugins/auth/Makefile src/plugins/auth/jwt/Makefile src/plugins/auth/munge/Makefile src/plugins/auth/none/Makefile src/plugins/auth/slurm/Makefile src/plugins/burst_buffer/Makefile src/plugins/burst_buffer/common/Makefile src/plugins/burst_buffer/datawarp/Makefile src/plugins/burst_buffer/lua/Makefile src/plugins/cgroup/Makefile src/plugins/cgroup/common/Makefile src/plugins/cgroup/v1/Makefile src/plugins/cgroup/v2/Makefile src/plugins/cli_filter/Makefile src/plugins/cli_filter/common/Makefile src/plugins/cli_filter/lua/Makefile src/plugins/cli_filter/syslog/Makefile src/plugins/cli_filter/user_defaults/Makefile src/plugins/core_spec/Makefile src/plugins/core_spec/cray_aries/Makefile src/plugins/cred/Makefile src/plugins/cred/common/Makefile src/plugins/cred/munge/Makefile src/plugins/cred/none/Makefile src/plugins/data_parser/Makefile src/plugins/data_parser/v0.0.39/Makefile src/plugins/data_parser/v0.0.40/Makefile src/plugins/ext_sensors/Makefile src/plugins/ext_sensors/rrd/Makefile src/plugins/gpu/Makefile src/plugins/gpu/common/Makefile src/plugins/gpu/generic/Makefile src/plugins/gpu/nrt/Makefile src/plugins/gpu/nvml/Makefile src/plugins/gpu/oneapi/Makefile src/plugins/gpu/rsmi/Makefile src/plugins/gres/Makefile src/plugins/gres/common/Makefile src/plugins/gres/gpu/Makefile src/plugins/gres/mps/Makefile src/plugins/gres/nic/Makefile src/plugins/gres/shard/Makefile src/plugins/hash/Makefile src/plugins/hash/k12/Makefile src/plugins/job_container/Makefile src/plugins/job_container/cncu/Makefile src/plugins/job_container/tmpfs/Makefile src/plugins/job_submit/Makefile src/plugins/job_submit/all_partitions/Makefile src/plugins/job_submit/cray_aries/Makefile src/plugins/job_submit/defaults/Makefile src/plugins/job_submit/logging/Makefile src/plugins/job_submit/lua/Makefile src/plugins/job_submit/partition/Makefile src/plugins/job_submit/pbs/Makefile src/plugins/job_submit/require_timelimit/Makefile src/plugins/job_submit/throttle/Makefile src/plugins/jobacct_gather/Makefile src/plugins/jobacct_gather/cgroup/Makefile src/plugins/jobacct_gather/common/Makefile src/plugins/jobacct_gather/linux/Makefile src/plugins/jobcomp/Makefile src/plugins/jobcomp/common/Makefile src/plugins/jobcomp/elasticsearch/Makefile src/plugins/jobcomp/filetxt/Makefile src/plugins/jobcomp/kafka/Makefile src/plugins/jobcomp/lua/Makefile src/plugins/jobcomp/mysql/Makefile src/plugins/jobcomp/script/Makefile src/plugins/mcs/Makefile src/plugins/mcs/account/Makefile src/plugins/mcs/group/Makefile src/plugins/mcs/user/Makefile src/plugins/mpi/Makefile src/plugins/mpi/cray_shasta/Makefile src/plugins/mpi/pmi2/Makefile src/plugins/mpi/pmix/Makefile src/plugins/node_features/Makefile src/plugins/node_features/helpers/Makefile src/plugins/node_features/knl_cray/Makefile src/plugins/node_features/knl_generic/Makefile src/plugins/power/Makefile src/plugins/power/common/Makefile src/plugins/power/cray_aries/Makefile src/plugins/preempt/Makefile src/plugins/preempt/partition_prio/Makefile src/plugins/preempt/qos/Makefile src/plugins/prep/Makefile src/plugins/prep/script/Makefile src/plugins/priority/Makefile src/plugins/priority/basic/Makefile src/plugins/priority/multifactor/Makefile src/plugins/proctrack/Makefile src/plugins/proctrack/cgroup/Makefile src/plugins/proctrack/cray_aries/Makefile src/plugins/proctrack/linuxproc/Makefile src/plugins/proctrack/pgid/Makefile src/plugins/sched/Makefile src/plugins/sched/backfill/Makefile src/plugins/sched/builtin/Makefile src/plugins/select/Makefile src/plugins/select/cons_tres/Makefile src/plugins/select/cray_aries/Makefile src/plugins/select/linear/Makefile src/plugins/select/other/Makefile src/plugins/serializer/Makefile src/plugins/serializer/json/Makefile src/plugins/serializer/url-encoded/Makefile src/plugins/serializer/yaml/Makefile src/plugins/site_factor/Makefile src/plugins/site_factor/example/Makefile src/plugins/switch/Makefile src/plugins/switch/cray_aries/Makefile src/plugins/switch/hpe_slingshot/Makefile src/plugins/task/Makefile src/plugins/task/affinity/Makefile src/plugins/task/cgroup/Makefile src/plugins/task/cray_aries/Makefile src/plugins/task/pgid/Makefile src/plugins/topology/Makefile src/plugins/topology/3d_torus/Makefile src/plugins/topology/block/Makefile src/plugins/topology/common/Makefile src/plugins/topology/default/Makefile src/plugins/topology/tree/Makefile src/sacct/Makefile src/sackd/Makefile src/sacctmgr/Makefile src/salloc/Makefile src/sattach/Makefile src/scrun/Makefile src/sbatch/Makefile src/sbcast/Makefile src/scancel/Makefile src/scontrol/Makefile src/scrontab/Makefile src/sdiag/Makefile src/sinfo/Makefile src/slurmctld/Makefile src/slurmd/Makefile src/slurmd/common/Makefile src/slurmd/slurmd/Makefile src/slurmd/slurmstepd/Makefile src/slurmdbd/Makefile src/slurmrestd/Makefile src/slurmrestd/plugins/Makefile src/slurmrestd/plugins/auth/Makefile src/slurmrestd/plugins/auth/jwt/Makefile src/slurmrestd/plugins/auth/local/Makefile src/slurmrestd/plugins/openapi/Makefile src/slurmrestd/plugins/openapi/dbv0.0.38/Makefile src/slurmrestd/plugins/openapi/dbv0.0.39/Makefile src/slurmrestd/plugins/openapi/slurmctld/Makefile src/slurmrestd/plugins/openapi/slurmdbd/Makefile src/slurmrestd/plugins/openapi/v0.0.38/Makefile src/slurmrestd/plugins/openapi/v0.0.39/Makefile src/sprio/Makefile src/squeue/Makefile src/sreport/Makefile src/srun/Makefile src/sshare/Makefile src/sstat/Makefile src/strigger/Makefile src/sview/Makefile testsuite/Makefile testsuite/testsuite.conf.sample testsuite/expect/Makefile testsuite/slurm_unit/Makefile testsuite/slurm_unit/common/Makefile testsuite/slurm_unit/common/bitstring/Makefile testsuite/slurm_unit/common/hostlist/Makefile testsuite/slurm_unit/common/slurm_protocol_defs/Makefile testsuite/slurm_unit/common/slurm_protocol_pack/Makefile testsuite/slurm_unit/common/slurmdb_defs/Makefile testsuite/slurm_unit/common/slurmdb_pack/Makefile" + + + cat >confcache <<\_ACEOF diff --git a/sysutils/slurm-wlm/files/patch-src_common_conmgr.c b/sysutils/slurm-wlm/files/patch-src_common_conmgr.c index 4a536f2854cc..4c2b9a256d57 100644 --- a/sysutils/slurm-wlm/files/patch-src_common_conmgr.c +++ b/sysutils/slurm-wlm/files/patch-src_common_conmgr.c @@ -1,4 +1,4 @@ ---- src/common/conmgr.c.orig 2023-11-21 22:33:29 UTC +--- src/common/conmgr.c.orig 2024-05-21 17:19:51 UTC +++ src/common/conmgr.c @@ -47,6 +47,8 @@ #include <sys/stat.h> @@ -9,3 +9,41 @@ #include <time.h> #include <unistd.h> +@@ -2616,8 +2618,15 @@ static int _create_socket(void *x, void *arg) + + /* set value of socket path */ + strlcpy(addr.sun_path, unixsock, sizeof(addr.sun_path)); +- if ((rc = bind(fd, (const struct sockaddr *) &addr, +- sizeof(addr)))) ++ /* Bind UNIX socket: compute correct length */ ++ { ++ socklen_t len = SUN_LEN(&addr); ++ #if defined(__FreeBSD__) ++ addr.sun_len = (uint8_t)len; ++ #endif ++ rc = bind(fd, (const struct sockaddr *)&addr, len); ++ } ++ if (rc) + fatal("%s: [%s] Unable to bind UNIX socket: %m", + __func__, hostport); + +@@ -2675,6 +2684,19 @@ static int _create_socket(void *x, void *arg) + &one, sizeof(one))) + fatal("%s: [%s] setsockopt(SO_REUSEADDR) failed: %m", + __func__, addrinfo_to_string(addr)); ++ ++ /* For INET/INET6, set *_len on FreeBSD; ai_addrlen is already correct */ ++ #if defined(__FreeBSD__) ++ if (addr->ai_addr) { ++ if (addr->ai_addr->sa_family == AF_INET) { ++ ((struct sockaddr_in *)addr->ai_addr)->sin_len = ++ (uint8_t)sizeof(struct sockaddr_in); ++ } else if (addr->ai_addr->sa_family == AF_INET6) { ++ ((struct sockaddr_in6 *)addr->ai_addr)->sin6_len = ++ (uint8_t)sizeof(struct sockaddr_in6); ++ } ++ } ++ #endif + + if (bind(fd, addr->ai_addr, addr->ai_addrlen) != 0) + fatal("%s: [%s] Unable to bind socket: %m", diff --git a/sysutils/slurm-wlm/files/patch-src_common_net.c b/sysutils/slurm-wlm/files/patch-src_common_net.c new file mode 100644 index 000000000000..8bfdea648018 --- /dev/null +++ b/sysutils/slurm-wlm/files/patch-src_common_net.c @@ -0,0 +1,68 @@ +--- src/common/net.c.orig 2024-05-21 17:19:51 UTC ++++ src/common/net.c +@@ -75,6 +75,29 @@ + #include "src/common/xstring.h" + + /* ++ * Compute correct namelen + sa_len for AF_INET/AF_INET6 ++ */ ++#if defined(__FreeBSD__) ++static inline socklen_t _bsd_sockaddr_len_fix(struct sockaddr *sa) ++{ ++ if (!sa) return 0; ++ switch (sa->sa_family) { ++ case AF_INET: { ++ struct sockaddr_in *in = (struct sockaddr_in *)sa; ++ in->sin_len = (uint8_t)sizeof(*in); ++ return sizeof(*in); ++ } ++ case AF_INET6: { ++ struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)sa; ++ in6->sin6_len = (uint8_t)sizeof(*in6); ++ return sizeof(*in6); ++ } ++ default: return sizeof(*sa); ++ } ++} ++#endif ++ ++/* + * Define slurm-specific aliases for use by plugins, see slurm_xlator.h + * for details. + */ +@@ -96,12 +119,18 @@ int net_stream_listen(int *fd, uint16_t *port) + /* bind ephemeral port */ + slurm_setup_addr(&sin, 0); + ++#if defined(__FreeBSD__) ++ socklen_t blen = _bsd_sockaddr_len_fix((struct sockaddr *)&sin); ++#else ++ socklen_t blen = sizeof(sin); ++#endif + if ((*fd = socket(sin.ss_family, SOCK_STREAM, IPPROTO_TCP)) < 0) + return -1; + + if (setsockopt(*fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) + goto cleanup; +- if (bind(*fd, (struct sockaddr *) &sin, len) < 0) ++ /* Single bind(): pass platform-correct namelen */ ++ if (bind(*fd, (struct sockaddr *) &sin, blen) < 0) + goto cleanup; + if (getsockname(*fd, (struct sockaddr *) &sin, &len) < 0) + goto cleanup; +@@ -219,7 +248,15 @@ static bool _is_port_ok(int s, uint16_t port, bool loc + return false; + } + ++/* ++ * compute correct socket length and pass it to bind() as blen on FreeBSD ++ */ ++#if defined(__FreeBSD__) ++ socklen_t blen = _bsd_sockaddr_len_fix((struct sockaddr *)&addr); ++ if (bind(s, (struct sockaddr *) &addr, blen) < 0) { ++#else + if (bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { ++#endif + log_flag(NET, "%s: bind() failed on port:%d fd:%d: %m", + __func__, port, s); + return false; diff --git a/sysutils/slurm-wlm/files/patch-src_common_sack__api.c b/sysutils/slurm-wlm/files/patch-src_common_sack__api.c new file mode 100644 index 000000000000..fe7520fde339 --- /dev/null +++ b/sysutils/slurm-wlm/files/patch-src_common_sack__api.c @@ -0,0 +1,28 @@ +--- src/common/sack_api.c.orig 2024-05-21 17:19:51 UTC ++++ src/common/sack_api.c +@@ -38,6 +38,8 @@ + #include <sys/socket.h> + #include <sys/types.h> + #include <sys/un.h> ++#include <string.h> ++#include <stddef.h> + #include <unistd.h> + + #include "src/common/fd.h" +@@ -63,7 +65,15 @@ static int _sack_try_connection(struct sockaddr_un *ad + static int _sack_try_connection(struct sockaddr_un *addr) + { + int fd; +- size_t len = strlen(addr->sun_path) + 1 + sizeof(addr->sun_family); ++ socklen_t len; ++ ++/* FreeBSD requires sun_len and a correct namelen */ ++#if defined(__FreeBSD__) ++ len = (socklen_t)SUN_LEN(addr); ++ addr->sun_len = (uint8_t)len; ++#else ++ len = (socklen_t)(strlen(addr->sun_path) + 1 + sizeof(addr->sun_family)); ++#endif + + if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { + debug3("%s: socket() failed: %m", __func__); diff --git a/sysutils/slurm-wlm/files/patch-src_common_slurm__protocol__socket.c b/sysutils/slurm-wlm/files/patch-src_common_slurm__protocol__socket.c index d5ae5ef84c32..b4197166e32d 100644 --- a/sysutils/slurm-wlm/files/patch-src_common_slurm__protocol__socket.c +++ b/sysutils/slurm-wlm/files/patch-src_common_slurm__protocol__socket.c @@ -1,39 +1,66 @@ --- src/common/slurm_protocol_socket.c.orig 2024-05-21 17:19:51 UTC +++ src/common/slurm_protocol_socket.c -@@ -491,6 +491,27 @@ extern int slurm_init_msg_engine(slurm_addr_t *addr, b - extern int slurm_init_msg_engine(slurm_addr_t *addr, bool quiet) - { - int rc; +@@ -53,7 +53,9 @@ + #include <sys/socket.h> + #include <sys/time.h> + #include <sys/types.h> ++#include <sys/un.h> + #include <unistd.h> ++#include <fcntl.h> + + #include "slurm/slurm_errno.h" + #include "src/common/read_config.h" +@@ -74,6 +76,28 @@ + #define RANDOM_USER_PORT ((uint16_t) ((lrand48() % \ + (MAX_USER_PORT - MIN_USER_PORT + 1)) + MIN_USER_PORT)) + ++#if defined(__FreeBSD__) ++/* Normalize sockaddr length on FreeBSD and return the proper namelen */ ++static inline socklen_t _bsd_sockaddr_len_fix(struct sockaddr *sa) ++{ ++ if (!sa) return 0; ++ switch (sa->sa_family) { ++ case AF_INET: { ++ struct sockaddr_in *in = (struct sockaddr_in *)sa; ++ in->sin_len = (uint8_t)sizeof(*in); ++ return sizeof(*in); ++ } ++ case AF_INET6: { ++ struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)sa; ++ in6->sin6_len = (uint8_t)sizeof(*in6); ++ return sizeof(*in6); ++ } ++ default: ++ return sizeof(*sa); ++ } ++} ++#endif + + /* Static functions */ + static int _slurm_connect(int __fd, struct sockaddr const * __addr, + socklen_t __len); +@@ -115,8 +139,13 @@ static void _sock_bind_wild(int sockfd) + + slurm_setup_addr(&sin, RANDOM_USER_PORT); + ++ socklen_t blen = _bsd_sockaddr_len_fix((struct sockaddr *)&sin); + for (retry=0; retry < PORT_RETRIES ; retry++) { + #if defined(__FreeBSD__) -+ /* -+ * FreeBSD requires the sa_len field to be set correctly in -+ * struct sockaddr_in / sockaddr_in6 before calling bind(). -+ * If it is unset, bind() may fail with EINVAL. -+ * -+ * This adjustment ensures the correct length is set based -+ * on the address family before bind() is called. -+ */ -+ if (addr->ss_family == AF_INET) { -+ ((struct sockaddr_in *)addr)->sin_len = sizeof(struct sockaddr_in); -+ } else if (addr->ss_family == AF_INET6) { -+ ((struct sockaddr_in6 *)addr)->sin6_len = sizeof(struct sockaddr_in6); -+ } -+ -+ /* Track the correct length for bind() */ -+ socklen_t bind_len = (addr->ss_family == AF_INET6) -+ ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in); ++ rc = bind(sockfd, (struct sockaddr *) &sin, blen); ++ #else + rc = bind(sockfd, (struct sockaddr *) &sin, sizeof(sin)); + #endif -+ - int fd; - int log_lvl = LOG_LEVEL_ERROR; - const int one = 1; -@@ -511,7 +532,11 @@ extern int slurm_init_msg_engine(slurm_addr_t *addr, b + if (rc >= 0) + break; + slurm_set_port(&sin, RANDOM_USER_PORT); +@@ -511,7 +540,13 @@ extern int slurm_init_msg_engine(slurm_addr_t *addr, b goto error; } - rc = bind(fd, (struct sockaddr const *) addr, sizeof(*addr)); + #if defined(__FreeBSD__) ++ /* FreeBSD: normalize sa_len and pass the exact namelen to bind() */ ++ socklen_t bind_len = _bsd_sockaddr_len_fix((struct sockaddr *)addr); + rc = bind(fd, (struct sockaddr const *) addr, bind_len); + #else + rc = bind(fd, (struct sockaddr const *) addr, sizeof(*addr)); @@ -41,3 +68,31 @@ if (rc < 0) { format_print(log_lvl, "Error binding slurm stream socket: %m"); goto error; +@@ -666,7 +701,27 @@ static int _slurm_connect (int __fd, struct sockaddr c + if (fcntl(__fd, F_SETFL, flags | O_NONBLOCK) < 0) + error("%s: fcntl(F_SETFL) error: %m", __func__); + ++/* FreeBSD requires correct sa_len/namelen; recompute here */ ++#if defined(__FreeBSD__) ++ { ++ struct sockaddr *sa = (struct sockaddr *)__addr; ++ socklen_t namelen; ++ switch (sa->sa_family) { ++ case AF_UNIX: { ++ struct sockaddr_un *un = (struct sockaddr_un *)sa; ++ namelen = (socklen_t)SUN_LEN(un); ++ un->sun_len = (uint8_t)namelen; ++ break; ++ } ++ default: ++ namelen = _bsd_sockaddr_len_fix(sa); ++ break; ++ } ++ rc = connect(__fd, sa, namelen); ++ } ++#else + rc = connect(__fd , __addr , __len); ++#endif + if ((rc < 0) && (errno != EINPROGRESS)) + return errno; + if (rc == 0) diff --git a/sysutils/slurm-wlm/files/patch-src_common_stepd__api.c b/sysutils/slurm-wlm/files/patch-src_common_stepd__api.c new file mode 100644 index 000000000000..c01bbebffe33 --- /dev/null +++ b/sysutils/slurm-wlm/files/patch-src_common_stepd__api.c @@ -0,0 +1,36 @@ +--- src/common/stepd_api.c.orig 2024-05-21 17:19:51 UTC ++++ src/common/stepd_api.c +@@ -48,6 +48,7 @@ + #include <signal.h> + #include <stdlib.h> + #include <string.h> ++#include <stddef.h> + #include <sys/socket.h> + #include <sys/stat.h> + #include <sys/time.h> +@@ -146,7 +147,7 @@ _step_connect(const char *directory, const char *noden + slurm_step_id_t *step_id) + { + int fd; +- int len; ++ socklen_t len; + struct sockaddr_un addr; + char *name = NULL, *pos = NULL; + uint32_t stepid = step_id->step_id; +@@ -177,7 +178,15 @@ _step_connect(const char *directory, const char *noden + memset(&addr, 0, sizeof(addr)); + addr.sun_family = AF_UNIX; + strlcpy(addr.sun_path, name, sizeof(addr.sun_path)); +- len = strlen(addr.sun_path) + 1 + sizeof(addr.sun_family); ++ ++#if defined(__FreeBSD__) ++ /* Compute exact namelen from the populated path */ ++ len = (socklen_t)SUN_LEN(&addr); ++ /* FreeBSD requires sun_len to match the exact length */ ++ addr.sun_len = (uint8_t)len; ++#else ++ len = (socklen_t)(strlen(addr.sun_path) + 1 + sizeof(addr.sun_family)); ++#endif + + if (connect(fd, (struct sockaddr *) &addr, len) < 0) { + /* Can indicate race condition at step termination */ diff --git a/sysutils/slurm-wlm/files/patch-src_common_xsystemd.c b/sysutils/slurm-wlm/files/patch-src_common_xsystemd.c new file mode 100644 index 000000000000..91e7dc9b41ac --- /dev/null +++ b/sysutils/slurm-wlm/files/patch-src_common_xsystemd.c @@ -0,0 +1,25 @@ +--- src/common/xsystemd.c.orig 2024-05-21 17:19:51 UTC ++++ src/common/xsystemd.c +@@ -36,6 +36,9 @@ + + #include <sys/socket.h> + #include <sys/un.h> ++#include <string.h> ++#include <stdlib.h> ++#include <stddef.h> + + #include "src/common/log.h" + #include "src/common/slurm_protocol_defs.h" +@@ -57,7 +60,12 @@ extern void xsystemd_change_mainpid(pid_t pid) + } + + strlcpy(addr.sun_path, notify_socket, sizeof(addr.sun_path)); ++#if defined(__FreeBSD__) ++ len = (socklen_t)SUN_LEN(&addr); ++ addr.sun_len = (uint8_t)len; ++#else + len = strlen(addr.sun_path) + 1 + sizeof(addr.sun_family); ++#endif + + if ((fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) { + error("%s: socket() failed: %m", __func__); diff --git a/sysutils/slurm-wlm/files/patch-src_plugins_auth_slurm_sack.c b/sysutils/slurm-wlm/files/patch-src_plugins_auth_slurm_sack.c new file mode 100644 index 000000000000..f0ee2bac99e6 --- /dev/null +++ b/sysutils/slurm-wlm/files/patch-src_plugins_auth_slurm_sack.c @@ -0,0 +1,17 @@ +--- src/plugins/auth/slurm/sack.c.orig 2024-05-21 17:19:51 UTC ++++ src/plugins/auth/slurm/sack.c +@@ -278,8 +278,12 @@ extern void init_sack_conmgr(void) + + /* set value of socket path */ + mask = umask(0); +- if ((rc = bind(fd, (const struct sockaddr *) &addr, +- sizeof(addr)))) ++/* AF_UNIX length handling */ ++ socklen_t len = SUN_LEN(&addr); ++#if defined(__FreeBSD__) ++ addr.sun_len = (uint8_t)len; ++#endif ++ if ((rc = bind(fd, (const struct sockaddr *)&addr, len))) + fatal("%s: [%s] Unable to bind UNIX socket: %m", + __func__, addr.sun_path); + umask(mask); diff --git a/sysutils/slurm-wlm/files/patch-src_plugins_task_pgid_Makefile.in b/sysutils/slurm-wlm/files/patch-src_plugins_task_pgid_Makefile.in new file mode 100644 index 000000000000..39c103c910ac --- /dev/null +++ b/sysutils/slurm-wlm/files/patch-src_plugins_task_pgid_Makefile.in @@ -0,0 +1,97 @@ +--- src/plugins/task/pgid/Makefile.in.orig 2025-09-03 23:57:14 UTC ++++ src/plugins/task/pgid/Makefile.in +@@ -181,16 +181,16 @@ LTLIBRARIES = $(pkglib_LTLIBRARIES) + } + am__installdirs = "$(DESTDIR)$(pkglibdir)" + LTLIBRARIES = $(pkglib_LTLIBRARIES) +-task_cray_aries_la_LIBADD = +-am_task_cray_aries_la_OBJECTS = task_cray_aries.lo +-task_cray_aries_la_OBJECTS = $(am_task_cray_aries_la_OBJECTS) ++task_pgid_la_LIBADD = ++am_task_pgid_la_OBJECTS = task_pgid.lo ++task_pgid_la_OBJECTS = $(am_task_pgid_la_OBJECTS) + AM_V_lt = $(am__v_lt_@AM_V@) + am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) + am__v_lt_0 = --silent + am__v_lt_1 = +-task_cray_aries_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ ++task_pgid_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ +- $(AM_CFLAGS) $(CFLAGS) $(task_cray_aries_la_LDFLAGS) \ ++ $(AM_CFLAGS) $(CFLAGS) $(task_pgid_la_LDFLAGS) \ + $(LDFLAGS) -o $@ + AM_V_P = $(am__v_P_@AM_V@) + am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +@@ -207,7 +207,7 @@ am__maybe_remake_depfiles = depfiles + DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I$(top_builddir)/slurm + depcomp = $(SHELL) $(top_srcdir)/auxdir/depcomp + am__maybe_remake_depfiles = depfiles +-am__depfiles_remade = ./$(DEPDIR)/task_cray_aries.Plo ++am__depfiles_remade = ./$(DEPDIR)/task_pgid.Plo + am__mv = mv -f + COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +@@ -227,7 +227,7 @@ am__v_CCLD_1 = + am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) + am__v_CCLD_0 = @echo " CCLD " $@; + am__v_CCLD_1 = +-SOURCES = $(task_cray_aries_la_SOURCES) ++SOURCES = $(task_pgid_la_SOURCES) + am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ +@@ -514,12 +514,12 @@ PLUGIN_FLAGS = -module -avoid-version --export-dynamic + top_srcdir = @top_srcdir@ + AUTOMAKE_OPTIONS = foreign + PLUGIN_FLAGS = -module -avoid-version --export-dynamic +-AM_CPPFLAGS = -DSLURM_PLUGIN_DEBUG -I$(top_srcdir) -I$(top_srcdir)/src/common $(CRAY_TASK_CPPFLAGS) +-pkglib_LTLIBRARIES = task_cray_aries.la ++AM_CPPFLAGS = -DSLURM_PLUGIN_DEBUG -I$(top_srcdir) -I$(top_srcdir)/src/common $(CRAY_TASK_CPPFLAGS) -I$(top_srcdir)/src/interfaces -I$(top_srcdir)/src/plugins/task -I$(top_srcdir)/src/slurmd -I$(top_srcdir)/src/slurmd/slurmstepd ++pkglib_LTLIBRARIES = task_pgid.la + + # Null task plugin. +-task_cray_aries_la_SOURCES = task_cray_aries.c +-task_cray_aries_la_LDFLAGS = $(PLUGIN_FLAGS) $(CRAY_TASK_LDFLAGS) \ ++task_pgid_la_SOURCES = task_pgid.c ++task_pgid_la_LDFLAGS = $(PLUGIN_FLAGS) $(CRAY_TASK_LDFLAGS) \ + $(NUMA_LIBS) + + all: all-am +@@ -591,8 +591,8 @@ clean-pkglibLTLIBRARIES: + rm -f $${locs}; \ + } + +-task_cray_aries.la: $(task_cray_aries_la_OBJECTS) $(task_cray_aries_la_DEPENDENCIES) $(EXTRA_task_cray_aries_la_DEPENDENCIES) +- $(AM_V_CCLD)$(task_cray_aries_la_LINK) -rpath $(pkglibdir) $(task_cray_aries_la_OBJECTS) $(task_cray_aries_la_LIBADD) $(LIBS) ++task_pgid.la: $(task_pgid_la_OBJECTS) $(task_pgid_la_DEPENDENCIES) $(EXTRA_task_pgid_la_DEPENDENCIES) ++ $(AM_V_CCLD)$(task_pgid_la_LINK) -rpath $(pkglibdir) $(task_pgid_la_OBJECTS) $(task_pgid_la_LIBADD) $(LIBS) + + mostlyclean-compile: + -rm -f *.$(OBJEXT) +@@ -600,7 +600,7 @@ distclean-compile: + distclean-compile: + -rm -f *.tab.c + +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/task_cray_aries.Plo@am__quote@ # am--include-marker ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/task_pgid.Plo@am__quote@ # am--include-marker + + $(am__depfiles_remade): + @$(MKDIR_P) $(@D) +@@ -729,7 +729,7 @@ distclean: distclean-am + mostlyclean-am + + distclean: distclean-am +- -rm -f ./$(DEPDIR)/task_cray_aries.Plo ++ -rm -f ./$(DEPDIR)/task_pgid.Plo + -rm -f Makefile + distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags +@@ -775,7 +775,7 @@ maintainer-clean: maintainer-clean-am + installcheck-am: + + maintainer-clean: maintainer-clean-am +- -rm -f ./$(DEPDIR)/task_cray_aries.Plo ++ -rm -f ./$(DEPDIR)/task_pgid.Plo + -rm -f Makefile + maintainer-clean-am: distclean-am maintainer-clean-generic + diff --git a/sysutils/slurm-wlm/files/patch-src_plugins_task_pgid_task__pgid.c b/sysutils/slurm-wlm/files/patch-src_plugins_task_pgid_task__pgid.c new file mode 100644 index 000000000000..0433aeaab02f --- /dev/null +++ b/sysutils/slurm-wlm/files/patch-src_plugins_task_pgid_task__pgid.c @@ -0,0 +1,155 @@ +--- src/plugins/task/pgid/task_pgid.c.orig 2025-09-03 23:58:57 UTC ++++ src/plugins/task/pgid/task_pgid.c +@@ -0,0 +1,152 @@ ++#include "slurm_xlator.h" ++#include "log.h" ++#include "xmalloc.h" ++#include "task.h" /* interface declarations */ ++ ++/* these two pull in batch_job_launch_msg_t, launch_tasks_request_msg_t, ++ stepd_step_task_info_t, etc. */ ++#include "src/common/slurm_protocol_api.h" ++#include "src/slurmd/slurmstepd/slurmstepd_job.h" ++ ++#include <sys/types.h> ++#include <signal.h> ++#include <unistd.h> ++#include <errno.h> ++#include <string.h> ++ ++/* Required plugin identifiers (exported) */ ++__attribute__((visibility("default"))) const char plugin_name[] = "PGID task plugin for FreeBSD"; ++__attribute__((visibility("default"))) const char plugin_type[] = "task/pgid"; ++__attribute__((visibility("default"))) const uint32_t plugin_version = SLURM_VERSION_NUMBER; ++ ++/* Required generic plugin entry points */ ++int init(void) { slurm_info("task/pgid: init"); return SLURM_SUCCESS; } ++int fini(void) { slurm_info("task/pgid: fini"); return SLURM_SUCCESS; } ++ ++static pid_t job_pgid = -1; ++ ++/* ==== Required task_* API (must all be present) ==== */ ++ ++/* Called when slurmd receives a batch launch request */ ++int task_p_slurmd_batch_request(batch_job_launch_msg_t *req) ++{ ++ (void)req; ++ return SLURM_SUCCESS; ++} ++ ++/* Called when slurmd receives a general launch request */ ++int task_p_slurmd_launch_request(launch_tasks_request_msg_t *req, ++ uint32_t node_id, char **err_msg) ++{ ++ (void)req; (void)node_id; (void)err_msg; ++ return SLURM_SUCCESS; ++} ++ ++int task_p_slurmd_suspend_job(uint32_t job_id) ++{ ++ (void)job_id; ++ return SLURM_SUCCESS; ++} ++ ++int task_p_slurmd_resume_job(uint32_t job_id) ++{ ++ (void)job_id; ++ return SLURM_SUCCESS; ++} ++ ++/* Before setuid to the job user */ ++int task_p_pre_setuid(stepd_step_rec_t *step) ++{ ++ (void)step; ++ return SLURM_SUCCESS; ++} ++ ++/* Called in privileged context before launch */ ++int task_p_pre_launch_priv(stepd_step_rec_t *step, ++ uint32_t node_tid, uint32_t global_tid) ++{ ++ (void)step; (void)node_tid; (void)global_tid; ++ return SLURM_SUCCESS; ++} ++ ++int task_p_pre_launch(stepd_step_rec_t *step) ++{ ++ pid_t cur = getpid(); ++ ++ /* Case A: no PGID recorded yet for this step -> become the group leader */ ++ if (step->pgid <= 0) { ++ if (setpgid(0, 0) < 0) { ++ /* If a sibling beat us to it, join that PGID instead */ ++ if (errno == EACCES || errno == EPERM || errno == EEXIST) { ++ /* Someone created a group already; query our pgid and store it */ ++ pid_t pg = getpgid(0); ++ if (pg < 0) { ++ slurm_error("task/pgid: getpgid failed after race: %s", strerror(errno)); ++ return SLURM_ERROR; ++ } ++ step->pgid = pg; ++ slurm_debug("task/pgid: joined existing PGID %d (race)", step->pgid); ++ return SLURM_SUCCESS; ++ } ++ slurm_error("task/pgid: setpgid(0,0) failed for leader pid=%d: %s", (int)cur, strerror(errno)); ++ return SLURM_ERROR; ++ } ++ step->pgid = getpgid(0); ++ if (step->pgid < 0) { ++ slurm_error("task/pgid: getpgid failed after creating group: %s", strerror(errno)); ++ return SLURM_ERROR; ++ } ++ slurm_debug("task/pgid: created step PGID %d (leader pid=%d)", step->pgid, (int)cur); ++ return SLURM_SUCCESS; ++ } ++ ++ /* Case B: PGID exists -> join it */ ++ if (setpgid(0, step->pgid) < 0) { ++ /* ESRCH: parent/leader not visible yet; tiny retry helps on fast forks */ ++ if (errno == ESRCH) { ++ usleep(1000); /* 1 ms backoff */ ++ if (setpgid(0, step->pgid) == 0) { ++ slurm_debug("task/pgid: joined PGID %d after retry", step->pgid); ++ return SLURM_SUCCESS; ++ } ++ } ++ slurm_error("task/pgid: setpgid(0,%d) failed: %s", step->pgid, strerror(errno)); ++ return SLURM_ERROR; ++ } ++ slurm_debug("task/pgid: joined existing PGID %d", step->pgid); ++ return SLURM_SUCCESS; ++} ++ ++/* After a task terminates */ ++int task_p_post_term(stepd_step_rec_t *step, stepd_step_task_info_t *task) ++{ ++ (void)step; (void)task; ++ return SLURM_SUCCESS; ++} ++ ++/* After the whole step finishes */ ++int task_p_post_step(stepd_step_rec_t *step) ++{ ++ (void)step; ++ return SLURM_SUCCESS; ++} ++ ++/* Allow plugin to track additional PIDs if needed */ ++int task_p_add_pid(pid_t pid) ++{ ++ (void)pid; ++ return SLURM_SUCCESS; ++} ++ ++int task_p_signal(stepd_step_rec_t *step, int sig) ++{ ++ if (step && step->pgid > 1) { ++ slurm_debug("task/pgid: sending signal %d to PGID %d", sig, step->pgid); ++ if (killpg((pid_t)step->pgid, sig) < 0) { ++ slurm_error("task/pgid: killpg(%d) failed: %s", step->pgid, strerror(errno)); ++ return SLURM_ERROR; ++ } ++ } ++ return SLURM_SUCCESS; ++} ++int task_p_fini(stepd_step_rec_t *step) { (void)step; return SLURM_SUCCESS; } diff --git a/sysutils/slurm-wlm/files/patch-src_slurmd_slurmstepd_req.c b/sysutils/slurm-wlm/files/patch-src_slurmd_slurmstepd_req.c new file mode 100644 index 000000000000..0e5b06d1dacf --- /dev/null +++ b/sysutils/slurm-wlm/files/patch-src_slurmd_slurmstepd_req.c @@ -0,0 +1,15 @@ +--- src/slurmd/slurmstepd/req.c.orig 2024-05-21 17:19:51 UTC ++++ src/slurmd/slurmstepd/req.c +@@ -176,7 +176,11 @@ _create_socket(const char *name) + memset(&addr, 0, sizeof(addr)); + addr.sun_family = AF_UNIX; + strlcpy(addr.sun_path, name, sizeof(addr.sun_path)); +- len = strlen(addr.sun_path)+1 + sizeof(addr.sun_family); ++/* AF_UNIX length handling */ ++ len = SUN_LEN(&addr); ++#if defined(__FreeBSD__) ++ addr.sun_len = (uint8_t)len; ++#endif + + /* bind the name to the descriptor */ + if (bind(fd, (struct sockaddr *) &addr, len) < 0) { |