Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set resource max limit to 10240 on macOS #1796

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions etc/afpd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ static int setlimits(void)
LOG(log_warning, logtype_afpd, "setlimits: reading current limits failed: %s", strerror(errno));
return -1;
}
if (rlim.rlim_cur != RLIM_INFINITY && rlim.rlim_cur < 65535) {
rlim.rlim_cur = 65535;
if (rlim.rlim_max != RLIM_INFINITY && rlim.rlim_max < 65535)
rlim.rlim_max = 65535;
if (rlim.rlim_cur != RLIM_INFINITY && rlim.rlim_cur < RLIM_MAX) {
rlim.rlim_cur = RLIM_MAX;
if (rlim.rlim_max != RLIM_INFINITY && rlim.rlim_max < RLIM_MAX)
rlim.rlim_max = RLIM_MAX;
if (setrlimit(RLIMIT_NOFILE, &rlim) != 0) {
LOG(log_warning, logtype_afpd, "setlimits: increasing limits failed: %s", strerror(errno));
return -1;
Expand Down
8 changes: 4 additions & 4 deletions etc/cnid_dbd/cnid_metad.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,10 @@ static int setlimits(void)
LOG(log_error, logtype_afpd, "setlimits: %s", strerror(errno));
exit(1);
}
if (rlim.rlim_cur != RLIM_INFINITY && rlim.rlim_cur < 65535) {
rlim.rlim_cur = 65535;
if (rlim.rlim_max != RLIM_INFINITY && rlim.rlim_max < 65535)
rlim.rlim_max = 65535;
if (rlim.rlim_cur != RLIM_INFINITY && rlim.rlim_cur < RLIM_MAX) {
rlim.rlim_cur = RLIM_MAX;
if (rlim.rlim_max != RLIM_INFINITY && rlim.rlim_max < RLIM_MAX)
rlim.rlim_max = RLIM_MAX;
if (setrlimit(RLIMIT_NOFILE, &rlim) != 0) {
LOG(log_error, logtype_afpd, "setlimits: %s", strerror(errno));
exit(1);
Expand Down
8 changes: 8 additions & 0 deletions include/atalk/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
#include <atalk/cnid.h>
#include <atalk/unicode.h>

#ifndef RLIM_MAX
#ifdef __APPLE__
#define RLIM_MAX 10240
#else
#define RLIM_MAX 65535
#endif
#endif

/* exit error codes */
#define EXITERR_CLNT 1 /* client related error */
#define EXITERR_CONF 2 /* error in config files/cmd line parameters */
Expand Down
Loading