summaryrefslogtreecommitdiffstats
path: root/newlib/libc/sys/linux/inode.c
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2002-07-04 22:51:08 +0000
committerJeff Johnston <jjohnstn@redhat.com>2002-07-04 22:51:08 +0000
commitae6c4c84212f196efc9e65f5f6de9beb226f78dc (patch)
tree7adce04cbbf71ef935ef490c551962a66c46473e /newlib/libc/sys/linux/inode.c
parent3e35e424d7b9b0036d93fc7314288c94063b513f (diff)
downloadcygnal-ae6c4c84212f196efc9e65f5f6de9beb226f78dc.tar.gz
cygnal-ae6c4c84212f196efc9e65f5f6de9beb226f78dc.tar.bz2
cygnal-ae6c4c84212f196efc9e65f5f6de9beb226f78dc.zip
2002-07-04 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/utime.h: Add include of <_ansi.h>. * libc/sys/linux/Makefile.am: Add utimes.c. * libc/sys/linux/Makefile.in: Regenerated. * libc/sys/linux/inode.c(__umask): New static routine. (umask): Written to use __umask and attempt to thread lock. (getumask): New function written to use __umask and thread lock. * libc/sys/linux/utimes.c: New file. * libc/sys/linux/sys/time.h: Fix utimes prototype. * libc/sys/linux/sys/utime.h: New file.
Diffstat (limited to 'newlib/libc/sys/linux/inode.c')
-rw-r--r--newlib/libc/sys/linux/inode.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/newlib/libc/sys/linux/inode.c b/newlib/libc/sys/linux/inode.c
index f6d89469c..e2f4ab16e 100644
--- a/newlib/libc/sys/linux/inode.c
+++ b/newlib/libc/sys/linux/inode.c
@@ -9,8 +9,12 @@
#include <sys/stat.h>
#include <sys/utime.h>
#include <linux/dirent.h>
+#include <sys/lock.h>
#include <machine/syscall.h>
+__LOCK_INIT(static, umask_lock);
+
+#define __NR___umask __NR_umask
_syscall2(int,link,const char *,oldpath,const char *,newpath)
_syscall1(int,unlink,const char *,pathname)
@@ -22,7 +26,6 @@ _syscall2(int,access,const char *,filename,int,mode)
_syscall2(int,mkdir,const char *,pathname,mode_t,mode)
_syscall1(int,rmdir,const char *,pathname)
_syscall1(int,pipe,int *,filedes)
-_syscall1(mode_t,umask,mode_t,mask)
_syscall1(int,chroot,const char *,path)
_syscall2(int,symlink,const char *,oldpath,const char *,newpath)
_syscall3(int,readlink,const char *,path,char *,buf,size_t,bufsiz)
@@ -30,3 +33,41 @@ _syscall2(int,stat,const char *,file_name,struct stat *,buf)
_syscall2(int,lstat,const char *,file_name,struct stat *,buf)
_syscall2(int,fstat,int,filedes,struct stat *,buf)
_syscall3(int,getdents,int,fd,struct dirent *,dirp,unsigned int,count)
+_syscall1(mode_t,__umask,mode_t,mask)
+
+static _syscall3(int,fchown32,int,fd,uid_t,owner,gid_t,group)
+
+int
+fchown (int fd, uid_t owner, gid_t group)
+{
+ return __libc_fchown32 (fd, owner, group);
+}
+
+mode_t
+umask (mode_t mask)
+{
+ mode_t old_mask;
+
+ /* we need to lock so as to not interfere with getumask */
+ __lock_acquire(umask_lock);
+ old_mask = __umask (mask);
+ __lock_release(umask_lock);
+
+ return old_mask;
+}
+
+mode_t
+getumask (void)
+{
+ mode_t mask;
+
+ __lock_acquire(umask_lock);
+
+ mask = __umask (0);
+ mask = __umask (mask);
+
+ __lock_release(umask_lock);
+
+ return mask;
+}
+