Example #1
0
static int
setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
	       sigset_t *set, struct pt_regs *regs)
{
	unsigned long oldsp, r26, err = 0;
	struct rt_sigframe __user *frame;

	oldsp = rdusp();
	frame = get_sigframe(ka, oldsp, sizeof(*frame));
	if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
		return -EFAULT;

	err |= copy_siginfo_to_user(&frame->info, info);

	/* Create the ucontext.  */
	err |= __put_user(0, &frame->uc.uc_flags);
	err |= __put_user(0, &frame->uc.uc_link);
	err |= __put_user(set->sig[0], &frame->uc.uc_osf_sigmask);
	err |= __save_altstack(&frame->uc.uc_stack, oldsp);
	err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, 
				set->sig[0], oldsp);
	err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
	if (err)
		return -EFAULT;

	/* Set up to return from userspace.  If provided, use a stub
	   already in userspace.  */
	if (ka->ka_restorer) {
		r26 = (unsigned long) ka->ka_restorer;
	} else {
		err |= __put_user(INSN_MOV_R30_R16, frame->retcode+0);
		err |= __put_user(INSN_LDI_R0+__NR_rt_sigreturn,
				  frame->retcode+1);
		err |= __put_user(INSN_CALLSYS, frame->retcode+2);
		imb();
		r26 = (unsigned long) frame->retcode;
	}

	if (err)
		return -EFAULT;

	/* "Return" to the handler */
	regs->r26 = r26;
	regs->r27 = regs->pc = (unsigned long) ka->sa.sa_handler;
	regs->r16 = sig;			  /* a0: signal number */
	regs->r17 = (unsigned long) &frame->info; /* a1: siginfo pointer */
	regs->r18 = (unsigned long) &frame->uc;	  /* a2: ucontext pointer */
	wrusp((unsigned long) frame);

#if DEBUG_SIG
	printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
		current->comm, current->pid, frame, regs->pc, regs->r26);
#endif

	return 0;
}
Example #2
0
static void
setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
            struct pt_regs *regs, struct switch_stack * sw)
{
    unsigned long oldsp, r26, err = 0;
    struct sigframe *frame;

    oldsp = rdusp();
    frame = get_sigframe(ka, oldsp, sizeof(*frame));
    if (verify_area(VERIFY_WRITE, frame, sizeof(*frame)))
        goto give_sigsegv;

    err |= setup_sigcontext(&frame->sc, regs, sw, set->sig[0], oldsp);
    if (_NSIG_WORDS > 1) {
        err |= __copy_to_user(frame->extramask, &set->sig[1],
                              sizeof(frame->extramask));
    }
    if (err)
        goto give_sigsegv;

    /* Set up to return from userspace.  If provided, use a stub
       already in userspace.  */
    if (ka->ka_restorer) {
        r26 = (unsigned long) ka->ka_restorer;
    } else {
        err |= __put_user(INSN_MOV_R30_R16, frame->retcode+0);
        err |= __put_user(INSN_LDI_R0+__NR_sigreturn, frame->retcode+1);
        err |= __put_user(INSN_CALLSYS, frame->retcode+2);
        imb();
        r26 = (unsigned long) frame->retcode;
    }

    /* Check that everything was written properly.  */
    if (err)
        goto give_sigsegv;

    /* "Return" to the handler */
    regs->r26 = r26;
    regs->r27 = regs->pc = (unsigned long) ka->sa.sa_handler;
    regs->r16 = sig;			/* a0: signal number */
    regs->r17 = 0;				/* a1: exception code */
    regs->r18 = (unsigned long) &frame->sc;	/* a2: sigcontext pointer */
    wrusp((unsigned long) frame);

#if DEBUG_SIG
    printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
           current->comm, current->pid, frame, regs->pc, regs->r26);
#endif

    return;

give_sigsegv:
    if (sig == SIGSEGV)
        ka->sa.sa_handler = SIG_DFL;
    force_sig(SIGSEGV, current);
}
Example #3
0
static int
setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
	    struct pt_regs *regs)
{
	unsigned long oldsp, r26, err = 0;
	struct sigframe __user *frame;

	oldsp = rdusp();
	frame = get_sigframe(ka, oldsp, sizeof(*frame));
	if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
		return -EFAULT;

	err |= setup_sigcontext(&frame->sc, regs, set->sig[0], oldsp);
	if (err)
		return -EFAULT;

	/* Set up to return from userspace.  If provided, use a stub
	   already in userspace.  */
	if (ka->ka_restorer) {
		r26 = (unsigned long) ka->ka_restorer;
	} else {
		err |= __put_user(INSN_MOV_R30_R16, frame->retcode+0);
		err |= __put_user(INSN_LDI_R0+__NR_sigreturn, frame->retcode+1);
		err |= __put_user(INSN_CALLSYS, frame->retcode+2);
		imb();
		r26 = (unsigned long) frame->retcode;
	}

	/* Check that everything was written properly.  */
	if (err)
		return err;

	/* "Return" to the handler */
	regs->r26 = r26;
	regs->r27 = regs->pc = (unsigned long) ka->sa.sa_handler;
	regs->r16 = sig;			/* a0: signal number */
	regs->r17 = 0;				/* a1: exception code */
	regs->r18 = (unsigned long) &frame->sc;	/* a2: sigcontext pointer */
	wrusp((unsigned long) frame);
	
#if DEBUG_SIG
	printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
		current->comm, current->pid, frame, regs->pc, regs->r26);
#endif
	return 0;
}
Example #4
0
int StartReplicServer (int hdl,  LPREPLICSERVERDATAMIN lpReplicServerDta )
{
	const LPCTSTR lpszIngresServiceName = _T("Ingres_Database_%s");
	const LPCTSTR lpszReplicServiceTempl = _T("Ingres_Replicator_%s_%d");
	int ires = RES_SUCCESS;
	TCHAR  tchszCommandLine[200];
	TCHAR* tchszCurLine;
	CString strVName = lpReplicServerDta->RunNode;
	CString msg;

#if !defined (MAINWIN)
	CString strLoc = LIBMON_getLocalHostName();
	if ( strVName.CompareNoCase(strLoc) == 0)
	{
		CString strReplicServiceName;
		CString strIngresServiceName;
		CString strII = INGRESII_QueryInstallationID(FALSE);

		if( strII.IsEmpty() )
		{
			AfxMessageBox (IDS_E_INSTALLATION_NOT_FOUND);
			return RES_ERR;
		}
		strReplicServiceName.Format(lpszReplicServiceTempl, (LPCTSTR)strII, lpReplicServerDta->serverno);
		strIngresServiceName.Format(lpszIngresServiceName,  (LPCTSTR)strII);

		if (!IsServiceInstalled ((LPCTSTR)strReplicServiceName)) 
		{
			// search max server no on local (run) node
			RESOURCEDATAMIN  ResDtaMin;
			REPLICSERVERDATAMIN ReplicSvrDta;
			int i,iservermax=0;
			LPUCHAR vnodeName = (LPUCHAR)GetVirtNodeName ( hdl );
			FillResStructFromDB(&ResDtaMin, lpReplicServerDta->ParentDataBaseName);

			/* 23-Dec-98 :  fixed "error system 3" when exiting the product, in the case       */
			/* VDBA detected that the replicator services were not installed, and proposed     */
			/* to install them automatically.                                                  */
			/* implementation: Replaced GetFirstMonInfo-GetNextMonInfo loop                    */
			/* with DBAGetFirstObject-DBAGetNextObject loop.                                   */
			/* this avoids using the cache for getting the list of servers                     */
			/* (for calculating the argument to be passed to "repinst"), because of a          */
			/* restriction of the cache for repl.servers: cache entries are attached to a node,*/
			/* but for repl.servers, the given entry needs to be connected to other nodes.     */
			/* A special management is implemented for "Monitor windows" attached cache        */
			/* entries, but in the current case, there isn't a monitor window open on the      */
			/* used node (which can be different from the open Monitor Window from which       */
			/* this stuff has been called.                                                     */

			int ires =DBAGetFirstObject (
				(LPUCHAR)vnodeName,
				OT_MON_REPLIC_SERVER,
				1,
				(LPUCHAR *)&ResDtaMin,
				TRUE,
				(LPUCHAR)&ReplicSvrDta,
				NULL,NULL);
			while (ires==RES_SUCCESS) 
			{
				if (! lstrcmpi((LPCTSTR)lpReplicServerDta->RunNode, (LPCTSTR)ReplicSvrDta.RunNode)) {
					if (ReplicSvrDta.serverno>iservermax)
						iservermax=ReplicSvrDta.serverno;
				}
				ires=DBAGetNextObject((LPUCHAR)&ReplicSvrDta,NULL,NULL);
			}
			if ( iservermax == 0 ) {
				//_T("Cannot retrieve number of server(s) - Install services Aborted."
				AfxMessageBox(IDS_E_NB_SERVERS);
				return RES_ERR;
			}
			//"The Ingres Replicator %d service is not installed.\n"
			//"Do you want to invoke 'repinst %d' in the background, "
			//"in order to install all Replicator services required by your replication scheme?"
			msg.Format(IDS_F_SERVICE_NOT_INSTALL,lpReplicServerDta->serverno,iservermax);
			int iansw;
			if (GVvista())
			{
				CMessageBox imb(NULL, msg);
				iansw=imb.DoModal();
			}
			else
				iansw = AfxMessageBox (msg, MB_YESNO|MB_ICONQUESTION);
			if (iansw == IDNO)
				return RES_ERR;
			CString Cmd;
			Cmd.Format(_T("repinst %d"),iservermax);
			if (LIBMON_Mysystem((LPTSTR)(LPCTSTR)Cmd)<0) {
				AfxMessageBox (IDS_E_REPINST_UTIL);//"Failure in invoking the repinst utility"
				return RES_ERR;
			}
			if (!IsServiceInstalled ((LPCTSTR)strReplicServiceName)) {
				AfxMessageBox (IDS_E_REPINST_INSTALL);//"The service has not been installed properly by the repinst utility"
				return RES_ERR;
			}
			//"DBA passwords are required for all services that have been created\n"
			//"Do you want to enter them now?\n"
			//"(If not, you will need to use the Control Panel Services option.)\n"
			//"(Some other settings for these services can only be changed through the control panel.)
			if (GVvista())
			{
				CString str;
				str.Format(IDS_I_PASSWORD_REQUIRED);
				CMessageBox imb(NULL, str);
				iansw = imb.DoModal();	
			}
			else
				iansw = AfxMessageBox (IDS_I_PASSWORD_REQUIRED, MB_YESNO|MB_ICONQUESTION);
			if (iansw == IDNO)
				return RES_ERR;
			// ask for user/password
			CaServiceConfig ServiceParms;
			if (!FillServiceConfig  (ServiceParms))
				return RES_ERR;
			BOOL bOK=TRUE;
			for (i=1;i<=iservermax;i++) {
				strReplicServiceName.Format(lpszReplicServiceTempl, (LPCTSTR)strII, i);
				if (GVvista())
				{
				     CString Cmd;
				     Cmd.Format(_T("repinst config %d -username:%s -password:%s"), iservermax, 
						ServiceParms.m_strAccount, ServiceParms.m_strPassword);
				     if (LIBMON_Mysystem((LPTSTR)(LPCTSTR)Cmd)<0)
				     {
				     	//"Failure in user/password setup for the 'Ingres Replicator %d' service"
					msg.Format(IDS_E_USER_PASSWORD_NB,i);
					AfxMessageBox (msg);
					bOK=FALSE;
				     }
				}
				else
				if (!SetServicePassword ((LPCTSTR) strReplicServiceName, ServiceParms)) {
					//"Failure in user/password setup for the 'Ingres Replicator %d' service"
					msg.Format(IDS_E_USER_PASSWORD_NB,i);
					AfxMessageBox (msg);
					bOK=FALSE;
				}
			}
			if (!bOK)
				return RES_ERR;
			if (!IsServiceRunning(strIngresServiceName)) {
				//"Ingres is currently not started as a service.\n"
				//"You must close all connections in VDBA (or Exit VDBA), "
				//"then stop Ingres, and restart it as a Service if you want "
				//"to start a replicator server on the local installation.\n"
				//"You must also make sure that the user/password for the Ingres service is correct.\n"
				//"Do you want to apply the user/password that you just entered for the replicator services?"
				iansw = AfxMessageBox (IDS_I_INGRES_NOT_STARTED, MB_YESNO|MB_ICONQUESTION);
				if (iansw == IDYES) {
					if (GVvista())
					{
					     CString Cmd;
					     Cmd.Format(_T("repinst config %d -username:%s -password:%s"), iservermax, 
							ServiceParms.m_strAccount, ServiceParms.m_strPassword);
					     if (LIBMON_Mysystem((LPTSTR)(LPCTSTR)Cmd)<0)
					     {
						//"Failure in user/password setup for the 'Ingres Replicator %d' service"
						msg.Format(IDS_E_USER_PASSWORD_NB,i);
						AfxMessageBox (msg);
						bOK=FALSE;
					     }
					}
					else
					if (!SetServicePassword ((LPCTSTR) strReplicServiceName, ServiceParms)) {
						//"Failure in user/password setup for the 'Ingres Replicator %d' service"
						msg.Format(IDS_E_USER_PASSWORD_NB,i);
						AfxMessageBox (msg);
						bOK=FALSE;
					}
				}
				return RES_ERR;
			}
		}
		if (!IsServiceRunning(strIngresServiceName)) {
			//"Ingres is currently not started as a service.\n"
			//"You must close all connections in VDBA (or Exit VDBA), "
			//"then stop Ingres, and restart it as a Service if you want "
			//"to start a replicator server on the local installation.\n"
			//"You must also make sure that the user/password for the Ingres service is correct.");
			AfxMessageBox (IDS_E_INGRES_NOT_STARTED);
			return RES_ERR;
		}
	}
#endif // MAINWIN

	// Verify if vnode name exist before start the remote command.
	VerifyAndUpdateVnodeName (&strVName);
	if (strVName.IsEmpty())
		return RES_ERR;

	_stprintf(tchszCommandLine, _T("ddstart %d"), lpReplicServerDta->serverno);

	if (!LIBMON_ExecRmcmdInBackground((TCHAR *)lpReplicServerDta->RunNode, tchszCommandLine, _T("")))
		return RES_ERR;

	// check for error (output line starting with a '*' character )
	ires=RES_SUCCESS;
	tchszCurLine=LIBMON_GetFirstTraceLine();
	while (tchszCurLine) {
		if (tchszCurLine[0]==_T('*'))
			CMnext(tchszCurLine);
		if (_tcslen(tchszCurLine)) {
			CString Msg;
			/* "Error from RMCMD server on '%s' :\n%s" */
			Msg.Format(IDS_E_ERROR_RMCMD, (LPCTSTR)strVName, tchszCurLine);
			AfxMessageBox(Msg, MB_ICONEXCLAMATION | MB_OK | MB_TASKMODAL);
			ires=RES_ERR;
		}
		tchszCurLine = LIBMON_GetNextSignificantTraceLine();
	}

	return ires;
}
Example #5
0
asmlinkage void
do_entIF(unsigned long type, struct pt_regs *regs)
{
	int signo, code;

	if ((regs->ps & ~IPL_MAX) == 0) {
		if (type == 1) {
			const unsigned int *data
			  = (const unsigned int *) regs->pc;
			printk("Kernel bug at %s:%d\n",
			       (const char *)(data[1] | (long)data[2] << 32), 
			       data[0]);
		}
#ifdef CONFIG_ALPHA_WTINT
		if (type == 4) {
			/* If CALL_PAL WTINT is totally unsupported by the
			   PALcode, e.g. MILO, "emulate" it by overwriting
			   the insn.  */
			unsigned int *pinsn
			  = (unsigned int *) regs->pc - 1;
			if (*pinsn == PAL_wtint) {
				*pinsn = 0x47e01400; /* mov 0,$0 */
				imb();
				regs->r0 = 0;
				return;
			}
		}
#endif /* ALPHA_WTINT */
		die_if_kernel((type == 1 ? "Kernel Bug" : "Instruction fault"),
			      regs, type, NULL);
	}

	switch (type) {
	      case 0: /* breakpoint */
		if (ptrace_cancel_bpt(current)) {
			regs->pc -= 4;	/* make pc point to former bpt */
		}

		send_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->pc, 0,
			       current);
		return;

	      case 1: /* bugcheck */
		send_sig_fault(SIGTRAP, TRAP_UNK, (void __user *) regs->pc, 0,
			       current);
		return;
		
	      case 2: /* gentrap */
		switch ((long) regs->r16) {
		case GEN_INTOVF:
			signo = SIGFPE;
			code = FPE_INTOVF;
			break;
		case GEN_INTDIV:
			signo = SIGFPE;
			code = FPE_INTDIV;
			break;
		case GEN_FLTOVF:
			signo = SIGFPE;
			code = FPE_FLTOVF;
			break;
		case GEN_FLTDIV:
			signo = SIGFPE;
			code = FPE_FLTDIV;
			break;
		case GEN_FLTUND:
			signo = SIGFPE;
			code = FPE_FLTUND;
			break;
		case GEN_FLTINV:
			signo = SIGFPE;
			code = FPE_FLTINV;
			break;
		case GEN_FLTINE:
			signo = SIGFPE;
			code = FPE_FLTRES;
			break;
		case GEN_ROPRAND:
			signo = SIGFPE;
			code = FPE_FLTUNK;
			break;

		case GEN_DECOVF:
		case GEN_DECDIV:
		case GEN_DECINV:
		case GEN_ASSERTERR:
		case GEN_NULPTRERR:
		case GEN_STKOVF:
		case GEN_STRLENERR:
		case GEN_SUBSTRERR:
		case GEN_RANGERR:
		case GEN_SUBRNG:
		case GEN_SUBRNG1:
		case GEN_SUBRNG2:
		case GEN_SUBRNG3:
		case GEN_SUBRNG4:
		case GEN_SUBRNG5:
		case GEN_SUBRNG6:
		case GEN_SUBRNG7:
		default:
			signo = SIGTRAP;
			code = TRAP_UNK;
			break;
		}

		send_sig_fault(signo, code, (void __user *) regs->pc, regs->r16,
			       current);
		return;

	      case 4: /* opDEC */
		if (implver() == IMPLVER_EV4) {
			long si_code;

			/* The some versions of SRM do not handle
			   the opDEC properly - they return the PC of the
			   opDEC fault, not the instruction after as the
			   Alpha architecture requires.  Here we fix it up.
			   We do this by intentionally causing an opDEC
			   fault during the boot sequence and testing if
			   we get the correct PC.  If not, we set a flag
			   to correct it every time through.  */
			regs->pc += opDEC_fix; 
			
			/* EV4 does not implement anything except normal
			   rounding.  Everything else will come here as
			   an illegal instruction.  Emulate them.  */
			si_code = alpha_fp_emul(regs->pc - 4);
			if (si_code == 0)
				return;
			if (si_code > 0) {
				send_sig_fault(SIGFPE, si_code,
					       (void __user *) regs->pc, 0,
					       current);
				return;
			}
		}
		break;

	      case 3: /* FEN fault */
		/* Irritating users can call PAL_clrfen to disable the
		   FPU for the process.  The kernel will then trap in
		   do_switch_stack and undo_switch_stack when we try
		   to save and restore the FP registers.

		   Given that GCC by default generates code that uses the
		   FP registers, PAL_clrfen is not useful except for DoS
		   attacks.  So turn the bleeding FPU back on and be done
		   with it.  */
		current_thread_info()->pcb.flags |= 1;
		__reload_thread(&current_thread_info()->pcb);
		return;

	      case 5: /* illoc */
	      default: /* unexpected instruction-fault type */
		      ;
	}

	send_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)regs->pc, 0, current);
}
void weiter(IString text)
{
   IMessageBox imb(IWindow::objectWindow());
   imb.setTitle("Profilebearbeitung-Info");
   imb.show(text, IMessageBox::okButton);
}
Boolean EDDocOpenDlg::command (ICommandEvent& event)
{
   Boolean dontPassOn = false;
   switch (event.commandId()) {
   case IDD_DOCNEW: {
         IString strName("");
         IString strFilePath("");
         EDDocNewDlg dlg(this, &strName, &strFilePath);

         if (strName != "") {
           /* Neuer Eintrag in Profile schreiben */
            try {
               profile->addOrReplaceElementWithKey("DSomServer", "NO", strName);
               profile->addOrReplaceElementWithKey("FilePath", strFilePath, strName);
              /* Neuer Eintrag in den Container eintragen */
               DocCnrObj *docObj = new DocCnrObj(strName, *profile);
               DocOpenCnr.addObject(docObj)
                         .sortByIconText();
            } /* end try */
            catch ( const IAccessError &exception  ) {
               weiter("Der Eintrag "+strName+" konnte nicht hinzugef�gt werden.");
            } /* end catch */
         } /* endif */
      }
      break;
   case IDD_DOCDEL: {
         DocCnrObj *docObj = (DocCnrObj *) DocOpenCnr.cursoredObject();
         IString strName = docObj->iconText();

         if (strName!="") {
            try {
               if (profile->elementWithKey("DSomServer",strName) != "NO") {
                 /* Server l�uft gerade, trotzdem l�schen ? */
                  IMessageBox imb(IWindow::objectWindow());
                  imb.setTitle("Profilebearbeitung-Info");
                  if (IMessageBox::ok != imb.show("Der Text wird noch von einem Server bearbeitet, Eintrag trotzdem l�schen? ", IMessageBox::okCancelButton))
                     break;
               } /* endif */
              /* Server-Eintrag l�schen */
               profile->deleteElementWithApplication(strName);
               DocOpenCnr.removeObject(docObj)
                         .sortByIconText();
            } /* end try */
            catch ( const IAccessError &exception  ) {
               weiter("Der Texteintag "+strName+" konnte nicht gel�scht werden.");
            } /* end catch */
         } /* endif */
      }
      break;
   case DID_OK: {
         DocCnrObj *docObj = (DocCnrObj *) DocOpenCnr.cursoredObject();
         *docName =  docObj->iconText();
         ((IFrameWindow*) (event.window()))->dismiss(event.commandId());
         dontPassOn = true;
      }
      break;
   case DID_CANCEL:
      ((IFrameWindow*) (event.window()))->dismiss(event.commandId());
      dontPassOn = true;
      break;
   } /* endswitch */
   return dontPassOn;
}
Example #8
0
int main() {
       // Allocate enough room for 100 copies of container
	const unsigned int size_buf = 100*4*5*CONTAINER_SIZE;
	char* buf = new char[size_buf];

        //all_tests to;
        containers_t< CONTAINER_SIZE > to;
        containers_t< CONTAINER_SIZE > from;
        to.init();

        {
          mem_buffer mb(buf, size_buf);
          BENBO_format<mem_buffer> xf(mb);
          obj_output<BENBO_format<mem_buffer> > os(xf);

          mem_buffer imb(buf, size_buf);
          BENBO_format<mem_buffer> ixf(imb);
          obj_input<BENBO_format<mem_buffer> > is(ixf);
	
          for(int j=0;j<ITERATIONS;j++) {
            xf.reset_buffer();
            ixf.reset_buffer();
            for(int i=0;i<100;i++)
            {
              os.simple(to);
            }
            for(int i=0;i<100;i++)
            {
              is.simple(from);
            }
          }

          std::cout << mb.size() << std::endl;
        }


        {
          mem_buffer mb(buf, size_buf);
          XDR_format<mem_buffer> xf(mb);
          obj_output<XDR_format<mem_buffer> > os(xf);

          mem_buffer imb(buf, size_buf);
          XDR_format<mem_buffer> ixf(imb);
          obj_input<XDR_format<mem_buffer> > is(ixf);
	
          for(int j=0;j<ITERATIONS;j++) {
            xf.reset_buffer();
            ixf.reset_buffer();
            for(int i=0;i<100;i++)
            {
              os.simple(to);
            }
            for(int i=0;i<100;i++)
            {
              is.simple(from);
            }
          }

          std::cout << mb.size() << std::endl;
        }
        
        delete[] buf;
}