Example #1
0
int sys_abort(int how)
{
/* Something awful has happened. Abandon ship. */
	kipc_msg_t m;
	m.ABRT_HOW = how;
	return(ktaskcall(SYSTASK, SYS_ABORT, &m));
}
Example #2
0
/* Semaphore control operation.  */
int semctl(int semid, int semnum, int cmd, ...)
{
	kipc_msg_t m;
	endpoint_t ipc_pt;
	va_list ap;
	int r;

	if (get_ipc_endpt(&ipc_pt) != 0) {
		errno = -ENOSYS;
		return -1;
	}

	m.SEMCTL_ID = semid;
	m.SEMCTL_NUM = semnum;
	m.SEMCTL_CMD = cmd;
	va_start(ap, cmd);
	if (cmd == IPC_STAT || cmd == IPC_SET || cmd == IPC_INFO ||
		cmd == SEM_INFO || cmd == SEM_STAT || cmd == GETALL ||
		cmd == SETALL || cmd == SETVAL)
		m.SEMCTL_OPT = (long) va_arg(ap, long);
	va_end(ap); 

	r = ktaskcall(ipc_pt, IPC_SEMCTL, &m);
	if ((r != -1) && (cmd == GETNCNT || cmd == GETZCNT || cmd == GETPID ||
		cmd == GETVAL || cmd == IPC_INFO || cmd == SEM_INFO ||
		cmd == SEM_STAT))
		return m.SHMCTL_RET;
	return r;
}
Example #3
0
int getpprocnr()
{
  kipc_msg_t m;
  m.m_data1 = -1;			/* don't pass pid to search for */
  m.m_data2 = 0;			/* don't pass name to search for */
  if (ktaskcall(PM_PROC_NR, KCNR_GETPROCNR, &m) < 0) return(-1);
  return(m.m_data2);		/* return parent process number */
}
Example #4
0
int sys_privctl(endpoint_t proc_ep, int request, void *p)
{
  kipc_msg_t m;

  m.CTL_ENDPT = proc_ep;
  m.CTL_REQUEST = request;
  m.CTL_ARG_PTR = p;

  return ktaskcall(SYSTASK, SYS_PRIVCTL, &m);
}
Example #5
0
int sys_privquery_mem(endpoint_t proc_ep, phys_bytes start, phys_bytes len)
{
  kipc_msg_t m;

  m.CTL_ENDPT = proc_ep;
  m.CTL_REQUEST = SYS_PRIV_QUERY_MEM;
  m.CTL_PHYSSTART = start;
  m.CTL_PHYSLEN = len;

  return ktaskcall(SYSTASK, SYS_PRIVCTL, &m);
}
Example #6
0
int sys_sysctl(int code, char *arg1, int arg2)
{
  kipc_msg_t m;

  m.SYSCTL_CODE = code;
  m.SYSCTL_ARG1 = arg1;
  m.SYSCTL_ARG2 = arg2;

  return(ktaskcall(SYSTASK, SYS_SYSCTL, &m));

}
Example #7
0
/*===========================================================================*
 *                                vm_allocmem				     *
 *===========================================================================*/
int vm_allocmem(phys_clicks bytes, phys_clicks *retmembase)
{
    kipc_msg_t m;
    int result;

    m.VMAM_BYTES = (char *) bytes;
    result = ktaskcall(VM_PROC_NR, VM_ALLOCMEM, &m);
    if(result == 0)
        *retmembase = m.VMAM_MEMBASE;

    return result;
}
Example #8
0
/**
 * @brief
 * @param sp  where to put it
 */
int getsigset(sigset_t *sp)
{
	kipc_msg_t m;
	m.m_data1 = ENDPT_SELF;			/* request own signal set */

	if (ktaskcall(PM_PROC_NR, KCNR_PROCSTAT, &m) < 0)
		return(-1);

	*sp = m.m_data4;

	return(0);
}
Example #9
0
/*===========================================================================*
 *                                vm_umap				     *
 *===========================================================================*/
int vm_umap(int seg, vir_bytes offset, vir_bytes len, phys_bytes *addr)
{
    kipc_msg_t m;
    int result;

    m.VMU_SEG = seg;
    m.VMU_OFFSET = (char *) offset;
    m.VMU_LENGTH = (char *) len;
    result = ktaskcall(VM_PROC_NR, VM_UMAP, &m);
    *addr = (phys_bytes) m.VMU_RETADDR;

    return result;
}
Example #10
0
int sys_memset(unsigned long pattern, phys_bytes base, phys_bytes bytes)
{
/* Zero a block of data.  */
  kipc_msg_t mess;

  if (bytes == 0L) return 0;

  mess.MEM_PTR = (char *) base;
  mess.MEM_COUNT   = bytes;
  mess.MEM_PATTERN = pattern;

  return(ktaskcall(SYSTASK, SYS_MEMSET, &mess));
}
Example #11
0
u8_t vm_getrefcount(int endpt, void *addr)
{
	kipc_msg_t m;
	u8_t ret;
	int r;

	m.VMREFCNT_ENDPT = endpt;
	m.VMREFCNT_ADDR = (long) addr;

	r = ktaskcall(VM_PROC_NR, VM_GETREF, &m);
	if (r != 0)
		return (u8_t) -1;
	return (u8_t) m.VMREFCNT_RETC;
}
Example #12
0
/* Operate on semaphore.  */
int semop(int semid, struct sembuf *sops, size_t nsops)
{
	kipc_msg_t m;
	endpoint_t ipc_pt;

	if (get_ipc_endpt(&ipc_pt) != 0) {
		errno = -ENOSYS;
		return -1;
	}

	m.SEMOP_ID = semid;
	m.SEMOP_OPS = (long) sops;
	m.SEMOP_SIZE = nsops;

	return ktaskcall(ipc_pt, IPC_SEMOP, &m);
}
Example #13
0
int minix_rs_lookup(const char *name, endpoint_t *value)
{
	int r;
	kipc_msg_t m;
	size_t len_key;

	len_key = strlen(name)+1;

	m.RS_NAME = (char *) name;
	m.RS_NAME_LEN = len_key;

	r = ktaskcall(RS_PROC_NR, RS_LOOKUP, &m);

	if(r == 0) {
		*value = m.RS_ENDPOINT;
	}

	return r;
}
Example #14
0
int sys_safecopyto(endpoint_t dst_e,
	cp_grant_id_t gr_id, vir_bytes offset,
	vir_bytes address, size_t bytes,
	int my_seg)
{
/* Transfer a block of data for which the other process has previously
 * given permission. 
 */

  kipc_msg_t copy_mess;

  copy_mess.SCP_FROM_TO = dst_e;
  copy_mess.SCP_INFO = SCP_MAKEINFO(my_seg);
  copy_mess.SCP_GID = gr_id;
  copy_mess.SCP_OFFSET = (long) offset;
  copy_mess.SCP_ADDRESS = (char *) address;
  copy_mess.SCP_BYTES = (long) bytes;

  return(ktaskcall(SYSTASK, SYS_SAFECOPYTO, &copy_mess));

}
Example #15
0
/* Get semaphore.  */
int semget(key_t key, int nsems, int semflag)
{
	kipc_msg_t m;
	endpoint_t ipc_pt;
	int r;

	if (get_ipc_endpt(&ipc_pt) != 0) {
		errno = -ENOSYS;
		return -1;
	}

	m.SEMGET_KEY = key;
	m.SEMGET_NR = nsems;
	m.SEMGET_FLAG = semflag;

	r = ktaskcall(ipc_pt, IPC_SEMGET, &m);
	if (r != 0)
		return r;

	return m.SEMGET_RETID;
}