kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 91b839f355ec367b779804103f7073f5d862beb5
parent 2c1352b226e5b5890ce53f62d845ec31d4f8963d
Author: Joris Vink <joris@coders.se>
Date:   Wed, 17 Jul 2013 20:17:00 +0200

Add OSX support, buildable via "make osx".
Make sure you have OpenSSL 1.0.0d+ (available from Macports) installed.

Based on diff from Vaibhav Bhembre via github

Diffstat:
Makefile | 3+++
src/bsd.c | 2++
src/worker.c | 10++++++++--
3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile @@ -22,6 +22,9 @@ linux: bsd: @S_SRC=src/bsd.c make kore +osx: + @LDFLAGS="-L/opt/local/lib" CFLAGS="-I/opt/local/include/" make bsd + kore: $(S_OBJS) $(CC) $(CFLAGS) $(S_OBJS) $(LDFLAGS) -o $(BIN) diff --git a/src/bsd.c b/src/bsd.c @@ -147,5 +147,7 @@ kore_platform_disable_accept(void) void kore_platform_proctitle(char *title) { +#ifndef __MACH__ setproctitle("%s", title); +#endif } diff --git a/src/worker.c b/src/worker.c @@ -179,8 +179,14 @@ kore_worker_entry(struct kore_worker *kw) fatal("cannot chroot(): %s", errno_s); if (chdir("/") == -1) fatal("cannot chdir(): %s", errno_s); - if (setgroups(1, &pw->pw_gid) || setresgid(pw->pw_gid, pw->pw_gid, - pw->pw_gid) || setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid)) + if (setgroups(1, &pw->pw_gid) || +#ifdef __MACH__ + setgid(pw->pw_gid) || setegid(pw->pw_gid) || + setuid(pw->pw_uid) || seteuid(pw->pw_uid)) +#else + setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) || + setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid)) +#endif fatal("unable to drop privileges"); snprintf(buf, sizeof(buf), "kore [wrk %d]", kw->id);