JNIEXPORT void JNICALL Java_org_zeromq_czmq_Zproc__1_1runAs (JNIEnv *env, jclass c, jstring lockfile, jstring group, jstring user) { char *lockfile_ = (char *) (*env)->GetStringUTFChars (env, lockfile, NULL); char *group_ = (char *) (*env)->GetStringUTFChars (env, group, NULL); char *user_ = (char *) (*env)->GetStringUTFChars (env, user, NULL); zproc_run_as (lockfile_, group_, user_); (*env)->ReleaseStringUTFChars (env, lockfile, lockfile_); (*env)->ReleaseStringUTFChars (env, group, group_); (*env)->ReleaseStringUTFChars (env, user, user_); }
/// // Drop the process ID into the lockfile, with exclusive lock, and // switch the process to the specified group and/or user. Any of the // arguments may be null, indicating a no-op. Returns 0 on success, // -1 on failure. Note if you combine this with zsys_daemonize, run // after, not before that method, or the lockfile will hold the wrong // process ID. void QmlZprocAttached::runAs (const QString &lockfile, const QString &group, const QString &user) { zproc_run_as (lockfile.toUtf8().data(), group.toUtf8().data(), user.toUtf8().data()); };