本文整理汇总了C++中ros_syscall函数的典型用法代码示例。如果您正苦于以下问题:C++ ros_syscall函数的具体用法?C++ ros_syscall怎么用?C++ ros_syscall使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ros_syscall函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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");
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
}
示例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;
}
示例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);
}