Skip to content

Commit f4f9cd5

Browse files
committed
options: add --nice process-priority controls
1 parent be12460 commit f4f9cd5

14 files changed

Lines changed: 913 additions & 6 deletions

File tree

‎Makefile.in‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ OBJS1_NO_MAIN=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.
4949
OBJS1=$(OBJS1_NO_MAIN) main.o
5050
OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
5151
usage.o fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
52-
OBJS3=progress.o pipe.o @MD5_ASM@ @ROLL_SIMD@ @ROLL_ASM@
52+
OBJS3=progress.o pipe.o niceness.o @MD5_ASM@ @ROLL_SIMD@ @ROLL_ASM@
5353
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
5454
popt_OBJS= popt/popt.o popt/poptconfig.o \
5555
popt/popthelp.o popt/poptparse.o popt/poptint.o

‎NEWS.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
excludes.
1313

1414
### ENHANCEMENTS:
15+
- Added `--nice` to adjust CPU and I/O scheduling priorities for local and
16+
remote rsync processes. Daemon clients and rrsync cannot raise server-side
17+
priorities.
1518
- Human-readable output now uses dynamic precision to show three significant
1619
digits and appends `i` to binary unit suffixes. `--progress` uses the same
1720
formatter for transfer rates and labels byte counts and rates with `B` and
@@ -73,6 +76,7 @@ test improvements.
7376
- Updated platform tests and fleet-test coverage for the 3.5.0 fixes.
7477

7578
------------------------------------------------------------------------------
79+
7680
# NEWS for rsync 3.5.0 (13 Aug 2026)
7781

7882
## Changes in this version:

‎clientserver.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,7 @@ int start_daemon(int f_in, int f_out)
14421442
* (when rsync is run by init and run by a remote shell). */
14431443
if (!load_config(0))
14441444
exit_cleanup(RERR_SYNTAX);
1445+
niceness_apply();
14451446

14461447
/* Bound the handshake before ANY peer input is read -- the PROXY-protocol
14471448
* header below is peer-supplied too, and was previously unbounded. An
@@ -1802,6 +1803,7 @@ int daemon_main(void)
18021803
exit_cleanup(RERR_SYNTAX);
18031804
}
18041805
set_dparams(0);
1806+
niceness_apply();
18051807

18061808
/* "proxy protocol = true" with no trusted-proxy list rejects every
18071809
* connection as an untrusted proxy peer (fail-closed). That is intended,

‎configure.ac‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ AC_CHECK_HEADERS(poll.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h
1313
sys/acl.h acl/libacl.h attr/xattr.h sys/xattr.h sys/extattr.h dl.h \
1414
popt.h popt/popt.h linux/falloc.h netinet/in_systm.h netgroup.h \
1515
zlib.h xxhash.h openssl/md4.h openssl/md5.h zstd.h lz4.h sys/file.h \
16-
sys/resource.h bsd/string.h idn2.h wchar.h)
16+
sys/resource.h bsd/string.h idn2.h wchar.h linux/ioprio.h sys/syscall.h)
1717
AC_CHECK_HEADERS([netinet/ip.h], [], [], [[#include <netinet/in.h>]])
1818
AC_HEADER_MAJOR_FIXED
1919

@@ -978,7 +978,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd chown chmod lchmod mknod mkfifo fdopendir \
978978
seteuid strerror putenv iconv_open locale_charset nl_langinfo getxattr \
979979
extattr_get_link sigaction sigprocmask setattrlist getgrouplist \
980980
initgroups utimensat futimens posix_fallocate attropen setvbuf nanosleep usleep \
981-
setenv unsetenv mbrtowc)
981+
setenv unsetenv mbrtowc getpriority setpriority)
982982

983983
dnl dirfd() is a macro or static inline on several systems (the BSDs), so the
984984
dnl default AC_CHECK_FUNCS link probe -- which declares `char dirfd(void);` and

‎main.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,6 +1309,7 @@ void start_server(int f_in, int f_out, int argc, char *argv[])
13091309

13101310
if (protocol_version >= 23)
13111311
io_start_multiplex_out(f_out);
1312+
niceness_apply();
13121313
if (am_daemon && io_timeout && protocol_version >= 31)
13131314
send_msg_int(MSG_IO_TIMEOUT, io_timeout);
13141315

@@ -1344,6 +1345,7 @@ int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[])
13441345
int exit_code = 0, exit_code2 = 0;
13451346
char *local_name = NULL;
13461347

1348+
niceness_apply();
13471349
cleanup_child_pid = pid;
13481350
if (!read_batch) {
13491351
set_nonblocking(f_in);

0 commit comments

Comments
 (0)