int *
amqproc_setopt_1(void *argp, struct svc_req *rqstp)
{
    static int rc;

    amq_setopt *opt = (amq_setopt *) argp;

    rc = 0;
    switch (opt->as_opt) {
    case AMOPT_DEBUG:
#ifdef DEBUG
        if (debug_option(opt->as_str))
            rc = EINVAL;
#else
        rc = EINVAL;
#endif /* DEBUG */
        break;

    case AMOPT_LOGFILE:
#ifdef not_yet
        if (switch_to_logfile(opt->as_str))
            rc = EINVAL;
#else
        rc = EACCES;
#endif /* not_yet */
        break;

    case AMOPT_XLOG:
        if (switch_option(opt->as_str))
            rc = EINVAL;
        break;

    case AMOPT_FLUSHMAPC:
        if (amd_state == Run) {
            plog(XLOG_INFO, "amq says flush cache");
            do_mapc_reload = 0;
            flush_nfs_fhandle_cache((fserver *) 0);
            flush_srvr_nfs_cache();
        }
        break;
    }
    return &rc;
}
示例#2
0
int *
amqproc_setopt_1_svc(voidp argp, struct svc_req *rqstp)
{
  static int rc;
  amq_setopt *opt = (amq_setopt *) argp;

  rc = 0;

  switch (opt->as_opt) {

  case AMOPT_DEBUG:
    if (debug_option(opt->as_str))
      rc = EINVAL;
    break;

  case AMOPT_LOGFILE:
    if (gopt.logfile && opt->as_str
	&& STREQ(gopt.logfile, opt->as_str)) {
      if (switch_to_logfile(opt->as_str, orig_umask, 0))
	rc = EINVAL;
    } else {
      rc = EACCES;
    }
    break;

  case AMOPT_XLOG:
    if (switch_option(opt->as_str))
      rc = EINVAL;
    break;

  case AMOPT_FLUSHMAPC:
    if (amd_state == Run) {
      plog(XLOG_INFO, "amq says flush cache");
      do_mapc_reload = 0;
      flush_nfs_fhandle_cache((fserver *) NULL);
      flush_srvr_nfs_cache((fserver *) NULL);
    }
    break;
  }

  return &rc;
}