• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ros_syscall函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ros_syscall函数的典型用法代码示例。如果您正苦于以下问题:C++ ros_syscall函数的具体用法?C++ ros_syscall怎么用?C++ ros_syscall使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ros_syscall函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: __kill

/* Send signal SIG to process number PID.  If PID is zero,
   send SIG to all processes in the current process's process group.
   If PID is < -1, send SIG to all processes in process group - PID.
   If SIG is SIGKILL, kill the process. */
int __kill (int pid, int sig)
{
	struct event_msg local_msg = {0};
	if (pid <= 0) {
		errno = ENOSYS;
		return -1;
	}
	if (sig == SIGKILL)
		return ros_syscall(SYS_proc_destroy, pid, 0, 0, 0, 0, 0);
	local_msg.ev_type = EV_POSIX_SIGNAL;
	local_msg.ev_arg1 = sig;
	return ros_syscall(SYS_notify, pid, EV_POSIX_SIGNAL, &local_msg, 0, 0, 0);
}
开发者ID:7perl,项目名称:akaros,代码行数:17,代码来源:kill.c


示例2: __sched_yield

/* Yield the processor.  */
int
__sched_yield (void)
{
  /* TRUE tells the kernel we simply want to let someone else process, and not
   * that we are waiting on an event. */
  return ros_syscall(SYS_yield, TRUE, 0, 0, 0, 0, 0);
}
开发者ID:7perl,项目名称:akaros,代码行数:8,代码来源:sched_yield.c


示例3: __libc_lseek64

/* Seek to OFFSET on FD, starting from WHENCE.  */
off64_t
__libc_lseek64 (int fd, off64_t offset, int whence)
{
	off64_t retoff = 0;
	off_t hi = 0;
	off_t lo = 0;
	int ret;
	if (fd < 0) {
		__set_errno (EBADF);
		return -1;
	}
	switch (whence) {
		case SEEK_SET:
		case SEEK_CUR:
		case SEEK_END:
			break;
		default:
			__set_errno (EINVAL);
			return -1;
	}
	hi = offset >> 32;
	lo = offset & 0xffffffff;
	ret = ros_syscall(SYS_llseek, fd, hi, lo, &retoff, whence, 0);
	if (ret) {
		assert(ret == -1);	/* catch odd bugs */
		return ret;
	}
	return retoff;
}
开发者ID:7perl,项目名称:akaros,代码行数:30,代码来源:lseek64.c


示例4: sys_shared_page_alloc

ssize_t sys_shared_page_alloc(void** addr, pid_t p2, 
                              int p1_flags, int p2_flags
                             ) 
{
	return ros_syscall(SYS_shared_page_alloc, addr, 
	               p2, p1_flags, p2_flags, 0, 0);
}
开发者ID:dhootha,项目名称:akaros,代码行数:7,代码来源:syscall.c


示例5: __getcwd

/* Get the pathname of the current working directory,
   and put it in SIZE bytes of BUF.  Returns NULL if the
   directory couldn't be determined or SIZE was too small.
   If successful, returns BUF.  In GNU, if BUF is NULL,
   an array is allocated with `malloc'; the array is SIZE
   bytes long, unless SIZE <= 0, in which case it is as
   big as necessary.  */
char *
__getcwd (char *buf, size_t size)
{
  int allocated = 0;
  if(buf == NULL)
  {
    // Linux ABI requires we allocate a buffer if NULL is passed.
    // If size is passed as 0, it means "as big as necessary"
    if(size == 0)
      size = PGSIZE;

    buf = (char*)malloc(size);
    if(buf == NULL)
    {
      errno = ENOMEM;
      return NULL;
    }
    allocated = 1;
  }

  int ret = ros_syscall(SYS_getcwd, buf, size, 0, 0, 0, 0);

  if(ret == -1 && allocated)
  {
    free(buf);
    return NULL;
  }

  return buf;
}
开发者ID:7perl,项目名称:akaros,代码行数:37,代码来源:getcwd.c


示例6: while

void *timer_thread(void *arg)
{
	while (1) {
		set_posted_interrupt(0xef);
		ros_syscall(SYS_vmm_poke_guest, 0, 0, 0, 0, 0, 0);
		uthread_usleep(100000);
	}
	fprintf(stderr, "SENDING TIMER\n");
}
开发者ID:ihategit,项目名称:akaros,代码行数:9,代码来源:vmrunkernel.c


示例7: __pipe2

/* Create a one-way communication channel (__pipe).  If successful,
   two file descriptors are stored in PIPEDES; bytes written on
   PIPEDES[1] can be read from PIPEDES[0].  Apply FLAGS to the new
   file descriptors.  Returns 0 if successful, -1 if not.  */
int __pipe2(int pipedes[2], int flags)
{
	if (pipedes == NULL) {
		__set_errno (EINVAL);
		return -1;
	}

	__set_errno (ENOSYS);
	return ros_syscall(SYS_pipe, pipedes, flags, 0, 0, 0, 0);
}
开发者ID:7perl,项目名称:akaros,代码行数:14,代码来源:pipe2.c


示例8: __lxstat

/* Get file information about FILE in BUF.  */
int
__lxstat (int vers, const char *file, struct stat *buf)
{
  if (vers != _STAT_VER || file == NULL || buf == NULL)
  {
    __set_errno (EINVAL);
    return -1;
  }

  int ret = (int)ros_syscall(SYS_lstat, file, strlen(file), buf, 0, 0, 0);
  return ret;
}
开发者ID:7perl,项目名称:akaros,代码行数:13,代码来源:lxstat.c


示例9: sys_proc_create

int sys_proc_create(char *path, size_t path_l, char *argv[], char *envp[],
                    int flags)
{
	struct serialized_data *sd = serialize_argv_envp(argv, envp);
	if (!sd) {
		errno = ENOMEM;
		return -1;
	}
	int ret = ros_syscall(SYS_proc_create, path, path_l,
	                      sd->buf, sd->len, flags, 0);
	free_serialized_data(sd);
	return ret;
}
开发者ID:dhootha,项目名称:akaros,代码行数:13,代码来源:syscall.c


示例10: fcntl

int fcntl(int fd, int cmd, ...)
{
	int ret, arg;
	va_list vl;
	va_start(vl, cmd);
	switch (cmd) {
		case F_GETFL:
			ret = ros_syscall(SYS_fcntl, fd, cmd, 0, 0, 0, 0);
			if (ret != -1)
				ret |= get_nonblock_status(fd);
			break;
		case F_SETFL:
			arg = va_arg(vl, int);
			if ((ret = set_nonblock_status(fd, &arg)))
				return ret;
			ret = ros_syscall(SYS_fcntl, fd, cmd, arg, 0, 0, 0);
			break;
		default:
			ret = __vfcntl(fd, cmd, vl);
	}
	va_end(vl);
	return ret;
}
开发者ID:anandab,项目名称:akaros,代码行数:23,代码来源:fcntl-ext.c


示例11: syscall

long int syscall(long int num, ...)
{
	va_list vl;
	va_start(vl, num);
	long int a0 = va_arg(vl, long int);
	long int a1 = va_arg(vl, long int);
	long int a2 = va_arg(vl, long int);
	long int a3 = va_arg(vl, long int);
	long int a4 = va_arg(vl, long int);
	long int a5 = va_arg(vl, long int);
	va_end(vl);
	
	return ros_syscall(num, a0, a1, a2, a3, a4, a5);
}
开发者ID:windyuuy,项目名称:akaros,代码行数:14,代码来源:syscall.c


示例12: __chmod

/* Change the protections of FILE to MODE.  */
int
__chmod (const char* file, mode_t mode)
{
  struct dir dir;
  size_t mlen;
  char mbuf[STATFIXLEN];
  int ret;

  if (file == NULL)
  {
    __set_errno (EINVAL);
    return -1;
  }

  init_empty_dir(&dir);
  dir.mode = mode;
  mlen = convD2M(&dir, mbuf, STATFIXLEN);
  ret = ros_syscall(SYS_wstat, file, strlen(file), mbuf, mlen, WSTAT_MODE, 0);
  return (ret == mlen ? 0 : -1);
}
开发者ID:7perl,项目名称:akaros,代码行数:21,代码来源:chmod.c


示例13: __fcntl

/* Perform file control operations on FD.  */
int
__fcntl(int fd, int cmd, ...)
{
  va_list vl;
  va_start(vl,cmd);
  int arg = va_arg(vl,int);
  va_end(vl);

  switch(cmd)
  {
    case F_DUPFD:
    case F_GETFD:
    case F_SETFD:
    case F_GETFL:
    case F_SETFL:
      return ros_syscall(SYS_fcntl, fd, cmd, arg, 0, 0, 0);
    default:
      errno = ENOSYS;
      return -1;
  }
}
开发者ID:7perl,项目名称:akaros,代码行数:22,代码来源:fcntl.c


示例14: __fork

/* Clone the calling process, creating an exact copy.
   Return -1 for errors, 0 to the new process,
   and the process ID of the new process to the old process.  */
int
__fork ()
{
  int ret = -1;
  __libc_lock_lock(__fork_lock);

  if(child_list_size == child_list_capacity)
  {
    int newcap = child_list_capacity ? 2*child_list_capacity : 1;
    int* tmp = realloc(child_list,newcap*sizeof(int));
    if(!tmp)
      goto out;
    child_list_capacity = newcap;
    child_list = tmp;
  }

  ret = ros_syscall(SYS_fork,0,0,0,0,0);
  if(ret > 0)
    child_list[child_list_size++] = ret;

out:
  __libc_lock_unlock(__fork_lock);
  return ret;
}
开发者ID:kstraube,项目名称:rampgold_fixed,代码行数:27,代码来源:fork.c


示例15: __close

/* Write NBYTES of BUF to FD.  Return the number written, or -1.  */
int
__close (int fd)
{
  return ros_syscall(SYS_close,fd,0,0,0,0);
}
开发者ID:kstraube,项目名称:rampgold_fixed,代码行数:6,代码来源:close.c


示例16: accept

int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
	return ros_syscall(SYS_accept, sockfd, addr, addrlen, 0, 0, 0);
}
开发者ID:ajbetteridge,项目名称:akaros,代码行数:3,代码来源:accept.c


示例17: is

/* Wait for a child matching PID to die.
   If PID is greater than 0, match any process whose process ID is PID.
   If PID is (pid_t) -1, match any process.
   If PID is (pid_t) 0, match any process with the
   same process group as the current process.
   If PID is less than -1, match any process whose
   process group is the absolute value of PID.
   If the WNOHANG bit is set in OPTIONS, and that child
   is not already dead, return (pid_t) 0.  If successful,
   return PID and store the dead child's status in STAT_LOC.
   Return (pid_t) -1 for errors.  If the WUNTRACED bit is set in OPTIONS,
   return status for stopped children; otherwise don't.  */
pid_t __libc_waitpid(pid_t pid, int *stat_loc, int options)
{
	return ros_syscall(SYS_waitpid, pid, stat_loc, options, 0, 0, 0);
}
开发者ID:7perl,项目名称:akaros,代码行数:16,代码来源:waitpid.c


示例18: default_term_handler

/* These are the default handlers for each posix signal.  They are listed in
 * SIGNAL(7) of the Linux Programmer's Manual.  We run them as default
 * sigactions, instead of the older handlers, so that we have access to the
 * faulting context.
 *
 * Exit codes are set as suggested in the following link.  I wish I could find
 * the definitive source, but this will have to do for now.
 * http://unix.stackexchange.com/questions/99112/default-exit-code-when-process-is-terminated
 * */
static void default_term_handler(int signr, siginfo_t *info, void *ctx)
{
	ros_syscall(SYS_proc_destroy, __procinfo.pid, signr, 0, 0, 0, 0);
}
开发者ID:AlffiTheBerry,项目名称:akaros,代码行数:13,代码来源:signal.c


示例19: __libc_read

/* Write NBYTES of BUF to FD.  Return the number written, or -1.  */
ssize_t
__libc_read (int fd, void *buf, size_t nbytes)
{
  return ros_syscall(SYS_read,fd,buf,nbytes,0,0);
}
开发者ID:kstraube,项目名称:rampgold_fixed,代码行数:6,代码来源:read.c


示例20: sizeof

void *consin(void *arg)
{
	struct virtio_threadarg *a = arg;
	char *line, *outline;
	static char consline[128];
	static struct scatterlist iov[32];
	static struct scatterlist out[] = { {NULL, sizeof(outline)}, };
	static struct scatterlist in[] = { {NULL, sizeof(line)}, };

	static unsigned int inlen, outlen, conslen;
	struct virtqueue *v = a->arg->virtio;
	fprintf(stderr, "consin thread ..\n");
	uint16_t head, gaveit = 0, gotitback = 0;
	uint32_t vv;
	int i;
	int num;
	//char c[1];

	if (debug) fprintf(stderr, "Spin on console being read, print num queues, halt\n");

	for(num = 0;! quit;num++) {
		//int debug = 1;
		/* host: use any buffers we should have been sent. */
		head = wait_for_vq_desc(v, iov, &outlen, &inlen);
		if (debug)
			fprintf(stderr, "vq desc head %d, gaveit %d gotitback %d\n", head, gaveit, gotitback);
		for(i = 0; debug && i < outlen + inlen; i++)
			fprintf(stderr, "v[%d/%d] v %p len %d\n", i, outlen + inlen, iov[i].v, iov[i].length);
		if (debug)
			fprintf(stderr, "outlen is %d; inlen is %d\n", outlen, inlen);
		/* host: fill in the writeable buffers. */
		for (i = outlen; i < outlen + inlen; i++) {
			/* host: read a line. */
			memset(consline, 0, 128);
			if (read(0, consline, 1) < 0) {
				exit(0);
			}
			if (debug) fprintf(stderr, "CONSIN: GOT A LINE:%s:\n", consline);
			if (debug) fprintf(stderr, "CONSIN: OUTLEN:%d:\n", outlen);
			if (strlen(consline) < 3 && consline[0] == 'q' ) {
				quit = 1;
				break;
			}

			memmove(iov[i].v, consline, strlen(consline)+ 1);
			iov[i].length = strlen(consline) + 1;
		}
		if (debug) fprintf(stderr, "call add_used\n");
		/* host: now ack that we used them all. */
		add_used(v, head, outlen+inlen);
		/* turn off consdata - the IRQ injection isn't right */
		//consdata = 1;
		if (debug) fprintf(stderr, "DONE call add_used\n");

		// Send spurious for testing (Gan)
		set_posted_interrupt(0xE5);
		virtio_mmio_set_vring_irq();

		ros_syscall(SYS_vmm_poke_guest, 0, 0, 0, 0, 0, 0);
	}
	fprintf(stderr, "All done\n");
	return NULL;
}
开发者ID:ihategit,项目名称:akaros,代码行数:63,代码来源:vmrunkernel.c



注:本文中的ros_syscall函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rotateLeft函数代码示例发布时间:2022-05-30
下一篇:
C++ rootObject函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap