OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [sys/] [linux/] [inode.c] - Blame information for rev 262

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/* libc/sys/linux/inode.c - Inode-related system calls */
2
 
3
/* Written 2000 by Werner Almesberger */
4
 
5
 
6
#include <unistd.h>
7
#include <fcntl.h>
8
#include <sys/types.h>
9
#include <sys/stat.h>
10
#include <sys/utime.h>
11
#include <dirent.h>
12
#include <machine/syscall.h>
13
 
14
#define _LIBC 1
15
#include <sys/lock.h>
16
 
17
 
18
#define __NR___umask __NR_umask
19
 
20
_syscall2(int,link,const char *,oldpath,const char *,newpath)
21
_syscall1(int,unlink,const char *,pathname)
22
_syscall1(int,chdir,const char *,path)
23
_syscall1(int,fchdir,int,fd)
24
_syscall2(int,access,const char *,filename,int,mode)
25
_syscall2(int,mkdir,const char *,pathname,mode_t,mode)
26
_syscall1(int,rmdir,const char *,pathname)
27
_syscall1(int,chroot,const char *,path)
28
_syscall2(int,stat,const char *,file_name,struct stat *,buf)
29
_syscall2(int,statfs,const char *,file_name,struct statfs *,buf)
30
_syscall2(int,fstat,int,filedes,struct stat *,buf)
31
_syscall2(int,fstatfs,int,filedes,struct statfs *,buf)
32
_syscall3(int,getdents,int,fd,struct dirent *,dirp,unsigned int,count)
33
 
34
#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2
35
_syscall2(int,chmod,const char *,path,mode_t,mode)
36
_syscall3(int,chown,const char *,path,uid_t,owner,gid_t,group)
37
_syscall2(int,fchmod,int,filedes,mode_t,mode)
38
_syscall3(int,lchown,const char *,path,uid_t,owner,gid_t,group)
39
_syscall2(int,lstat,const char *,file_name,struct stat *,buf)
40
_syscall3(int,readlink,const char *,path,char *,buf,size_t,bufsiz)
41
_syscall2(int,symlink,const char *,oldpath,const char *,newpath)
42
_syscall2(int,utime,const char *,filename,const struct utimbuf *,buf)
43
#endif
44
 
45
#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 3
46
_syscall1(int,pipe,int *,filedes)
47
#endif
48
 
49
#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 4
50
_syscall3(int,mknod,const char *,pathname,mode_t,mode,dev_t,dev)
51
#endif
52
 
53
weak_alias(__libc_statfs,__statfs)
54
weak_alias(__libc_fstatfs,__fstatfs)
55
 
56
static _syscall3(int,fchown32,int,fd,uid_t,owner,gid_t,group)
57
 
58
int
59
fchown (int fd, uid_t owner, gid_t group)
60
{
61
  return __libc_fchown32 (fd, owner, group);
62
}
63
 
64
#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2
65
 
66
__LOCK_INIT(static, umask_lock);
67
 
68
_syscall1(mode_t,__umask,mode_t,mask)
69
 
70
mode_t
71
umask (mode_t mask)
72
{
73
  mode_t old_mask;
74
 
75
  /* we need to lock so as to not interfere with getumask */
76
  __lock_acquire(umask_lock);
77
  old_mask = __umask (mask);
78
  __lock_release(umask_lock);
79
 
80
  return old_mask;
81
}
82
 
83
mode_t
84
getumask (void)
85
{
86
  mode_t mask;
87
 
88
  __lock_acquire(umask_lock);
89
 
90
  mask = __umask (0);
91
  mask = __umask (mask);
92
 
93
  __lock_release(umask_lock);
94
 
95
  return mask;
96
}
97
 
98
#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 2 */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.