Skip to content

Commit

Permalink
Merge pull request #5194 from ognevny/update-util-linux
Browse files Browse the repository at this point in the history
util-linux: update to 2.40.2
  • Loading branch information
jeremyd2019 authored Feb 9, 2025
2 parents ccd7bf3 + e00b44a commit ad57f04
Show file tree
Hide file tree
Showing 20 changed files with 421 additions and 247 deletions.
49 changes: 0 additions & 49 deletions util-linux/2.24.2-agetty.patch

This file was deleted.

45 changes: 0 additions & 45 deletions util-linux/2.24.2-libblkid-topology.patch

This file was deleted.

46 changes: 0 additions & 46 deletions util-linux/2.25.1-cygwin-include.patch

This file was deleted.

14 changes: 0 additions & 14 deletions util-linux/2.32.1-testsuite.patch

This file was deleted.

10 changes: 0 additions & 10 deletions util-linux/2.33.1-cygwin-cpuset.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
--- origsrc/util-linux-2.33.1/lib/cpuset.c 2018-06-04 00:57:02.792445800 -0700
+++ src/util-linux-2.33.1/lib/cpuset.c 2020-01-11 00:37:39.126054200 -0800
@@ -20,7 +20,9 @@
#include <errno.h>
#include <string.h>
#include <ctype.h>
+#ifndef __CYGWIN__
#include <sys/syscall.h>
+#endif

#include "cpuset.h"
#include "c.h"
@@ -60,7 +60,7 @@ static const char *nexttoken(const char
*/
int get_max_number_of_cpus(void)
Expand Down
18 changes: 0 additions & 18 deletions util-linux/2.33.1-cygwin-ionice.patch

This file was deleted.

27 changes: 0 additions & 27 deletions util-linux/2.33.1-cygwin-taskset.patch

This file was deleted.

40 changes: 40 additions & 0 deletions util-linux/2.39.3-cygwin-fallocate.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--- origsrc/util-linux-2.33.1/configure.ac 2024-01-23 22:58:06.478114400 -0800
+++ src/util-linux-2.33.1/configure.ac 2024-01-23 23:51:03.975479300 -0800
@@ -1290,7 +1290,6 @@ AC_ARG_ENABLE([fallocate],
[], [UL_DEFAULT_ENABLE([fallocate], [check])]
)
UL_BUILD_INIT([fallocate])
-UL_REQUIRES_LINUX([fallocate])
UL_REQUIRES_SYSCALL_CHECK([fallocate], [UL_CHECK_SYSCALL([fallocate])])
AM_CONDITIONAL([BUILD_FALLOCATE], [test "x$build_fallocate" = xyes])

--- origsrc/util-linux-2.39.3/sys-utils/fallocate.c 2023-12-01 03:25:16.021047300 -0800
+++ src/util-linux-2.39.3/sys-utils/fallocate.c 2024-03-07 22:10:21.660207700 -0800
@@ -417,21 +417,22 @@ int main(int argc, char **argv)
if (verbose) {
char *str = size_to_human_string(SIZE_SUFFIX_3LETTER | SIZE_SUFFIX_SPACE, length);

+ uintmax_t ulength = (uintmax_t) length;
if (mode & FALLOC_FL_PUNCH_HOLE)
fprintf(stdout, _("%s: %s (%ju bytes) hole created.\n"),
- filename, str, length);
+ filename, str, ulength);
else if (mode & FALLOC_FL_COLLAPSE_RANGE)
fprintf(stdout, _("%s: %s (%ju bytes) removed.\n"),
- filename, str, length);
+ filename, str, ulength);
else if (mode & FALLOC_FL_INSERT_RANGE)
fprintf(stdout, _("%s: %s (%ju bytes) inserted.\n"),
- filename, str, length);
+ filename, str, ulength);
else if (mode & FALLOC_FL_ZERO_RANGE)
fprintf(stdout, _("%s: %s (%ju bytes) zeroed.\n"),
- filename, str, length);
+ filename, str, ulength);
else
fprintf(stdout, _("%s: %s (%ju bytes) allocated.\n"),
- filename, str, length);
+ filename, str, ulength);
free(str);
}
}
27 changes: 27 additions & 0 deletions util-linux/2.39.3-cygwin-include.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--- origsrc/util-linux-2.39.3/include/blkdev.h 2023-11-21 00:46:50.040993300 -0800
+++ src/util-linux-2.39.3/include/blkdev.h 2024-03-06 21:49:24.330239000 -0800
@@ -23,6 +23,10 @@

#define DEFAULT_SECTOR_SIZE 512

+#ifdef __CYGWIN__
+#include <cygwin/fs.h>
+#endif
+
#ifdef __linux__
/* very basic ioctls, should be available everywhere */
# ifndef BLKROSET
--- origsrc/util-linux-2.39.3/include/ttyutils.h 2023-12-01 03:25:15.854048300 -0800
+++ src/util-linux-2.39.3/include/ttyutils.h 2024-03-07 02:05:32.567596700 -0800
@@ -164,7 +164,11 @@ static inline void reset_virtual_console
tp->c_oflag &= ~(OLCUC | OCRNL | ONOCR | ONLRET | OFILL | \
NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY);
tp->c_lflag |= (ISIG | ICANON | IEXTEN | ECHO|ECHOE|ECHOK|ECHOKE|ECHOCTL);
+#ifdef ECHOPRT
tp->c_lflag &= ~(ECHONL|ECHOPRT | NOFLSH | TOSTOP);
+#else
+ tp->c_lflag &= ~(ECHONL| NOFLSH | TOSTOP);
+#endif

if ((flags & UL_TTY_KEEPCFLAGS) == 0) {
tp->c_cflag |= (CREAD | CS8 | HUPCL);
24 changes: 24 additions & 0 deletions util-linux/2.39.3-cygwin-more.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--- origsrc/util-linux-2.39.3/configure.ac 2024-03-06 22:38:09.882861600 -0800
+++ src/util-linux-2.39.3/configure.ac 2024-03-07 01:27:42.682134800 -0800
@@ -2367,7 +2367,7 @@ AC_ARG_ENABLE([more],
)
UL_BUILD_INIT([more])
UL_REQUIRES_HAVE([more], [ncursesw, ncurses], [ncursesw or ncurses libraries])
-UL_REQUIRES_LINUX([more])
+# Cygwin OK here too! UL_REQUIRES_LINUX([more])
AM_CONDITIONAL([BUILD_MORE], [test "x$build_more" = xyes])


--- origsrc/util-linux-2.39.3/text-utils/more.c 2023-12-01 03:25:16.037047200 -0800
+++ src/util-linux-2.39.3/text-utils/more.c 2024-03-07 02:29:48.127056400 -0800
@@ -57,7 +57,9 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/file.h>
-#include <sys/ttydefaults.h>
+#ifdef HAVE_SYS_TTYDEFAULTS_H
+# include <sys/ttydefaults.h>
+#endif
#include <sys/wait.h>
#include <regex.h>
#include <assert.h>
18 changes: 18 additions & 0 deletions util-linux/2.39.3-testsuite.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- origsrc/util-linux-2.39.3/tests/helpers/test_tiocsti.c 2023-11-21 00:46:50.245992100 -0800
+++ src/util-linux-2.39.3/tests/helpers/test_tiocsti.c 2024-03-06 22:26:34.506716700 -0800
@@ -11,6 +11,7 @@

int main(void)
{
+#ifdef TIOCSTI
int rc = 0;
char *cmd = "id -u -n\n";

@@ -18,4 +19,7 @@ int main(void)
rc += ioctl(0, TIOCSTI, cmd++);

exit(rc ? EXIT_FAILURE : EXIT_SUCCESS);
+#else
+ return 77;
+#endif
}
48 changes: 48 additions & 0 deletions util-linux/2.40.2-agetty.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
--- origsrc/util-linux-2.40.2/term-utils/agetty.c 2024-07-04 00:54:41.396241100 -0700
+++ src/util-linux-2.40.2/term-utils/agetty.c 2024-10-24 21:24:07.465151300 -0700
@@ -83,7 +83,7 @@
#ifdef __linux__
# include <sys/kd.h>
# define USE_SYSLOG
-#elif defined(__GNU__)
+#elif defined(__GNU__) || defined(__CYGWIN__)
# define USE_SYSLOG
#endif

@@ -1029,7 +1029,9 @@ static void update_utmp(struct options *
ut.ut_tv.tv_sec = t;
ut.ut_type = LOGIN_PROCESS;
ut.ut_pid = pid;
+#ifndef __CYGWIN__
ut.ut_session = sid;
+#endif

pututxline(&ut);
endutxent();
@@ -1101,8 +1103,12 @@ static void open_tty(const char *tty, st

if (op->flags & F_HANGUP) {

+#ifdef TIOCNOTTY
if (ioctl(fd, TIOCNOTTY))
debug("TIOCNOTTY ioctl failed\n");
+#else
+ setsid();
+#endif

/*
* Let's close all file descriptors before vhangup
@@ -2349,11 +2355,11 @@ static void termio_final(struct options
tp->c_cc[VQUIT] = DEF_QUIT;
tp->c_cc[VEOF] = DEF_EOF;
tp->c_cc[VEOL] = DEF_EOL;
-#ifdef __linux__
+#if defined(__linux__) || defined(__CYGWIN__)
tp->c_cc[VSWTC] = DEF_SWITCH;
#elif defined(VSWTCH)
tp->c_cc[VSWTCH] = DEF_SWITCH;
-#endif /* __linux__ */
+#endif /* __linux__ || __CYGWIN__ */

/* Account for special characters seen in input. */
if (cp->eol == CR) {
14 changes: 14 additions & 0 deletions util-linux/2.40.2-col.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- origsrc/util-linux-2.40.2/configure.ac 2025-02-02 18:00:40.679521900 -0800
+++ src/util-linux-2.40.2/configure.ac 2025-02-02 18:08:21.224583300 -0800
@@ -2225,8 +2225,9 @@ UL_REQUIRES_HAVE([scriptlive], [pty], [o
AM_CONDITIONAL([BUILD_SCRIPTLIVE], [test "x$build_scriptlive" = xyes])


-UL_BUILD_INIT([col], [check])
-UL_REQUIRES_COMPILE([col], [#include <limits.h>], [__GLIBC__], [building for glibc])
+UL_BUILD_INIT([col], [yes])
+#Cygwin OK here too! UL_BUILD_INIT([col], [check])
+#Cygwin OK here too! UL_REQUIRES_COMPILE([col], [#include <limits.h>], [__GLIBC__], [building for glibc])
AM_CONDITIONAL([BUILD_COL], [test "x$build_col" = xyes])

UL_BUILD_INIT([colcrt], [yes])
Loading

0 comments on commit ad57f04

Please sign in to comment.