changeset 2836:2339c3df80dd

* src/file.cxx: add a chmod() call, implemented by calling cyg_fs_setinfo with parameter FS_INFO_CHMOD
author asl
date Mon, 02 Mar 2009 20:54:10 +0000
parents 3940c09dd3fe
children 221027e214f7
files packages/io/fileio/current/ChangeLog packages/io/fileio/current/include/fileio.h packages/io/fileio/current/src/file.cxx
diffstat 3 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/fileio/current/ChangeLog
+++ b/packages/io/fileio/current/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-18  Rutger Hofman <rutger@cs.vu.nl>
+
+	* src/file.cxx: add a chmod() call, implemented by calling
+	cyg_fs_setinfo with parameter FS_INFO_CHMOD
+
 2008-12-11  Nick Garnett  <nickg@ecoscentric.com>
 
 	* src/fd.cxx (fp_ucount_dec, fd_close): Fix locking strategy so
--- a/packages/io/fileio/current/include/fileio.h
+++ b/packages/io/fileio/current/include/fileio.h
@@ -161,6 +161,8 @@ struct cyg_fstab_entry
 #ifdef  CYGSEM_FILEIO_INFO_DISK_USAGE
 #define FS_INFO_DISK_USAGE      6       /* get_disk_usage()    */
 #endif
+#define FS_INFO_CHMOD           7       /* chmod() */
+
 //-----------------------------------------------------------------------------
 // Types for link()
 
--- a/packages/io/fileio/current/src/file.cxx
+++ b/packages/io/fileio/current/src/file.cxx
@@ -41,6 +41,7 @@
 //
 // Author(s):           nickg
 // Contributors:        nickg
+// Contributors:        rutger at cs dot vu dot nl: chmod()
 // Date:                2000-05-25
 // Purpose:             Fileio file operations
 // Description:         These are the functions that operate on files as a whole,
@@ -901,5 +902,19 @@ extern int 	access(const char *path, int
     FILEIO_RETURN(ret);
 }
 
+//==========================================================================
+// chmod
+
+__externC int chmod(const char *path, mode_t mode)
+{
+    int ret;
+
+    FILEIO_ENTRY();
+
+    ret = cyg_fs_setinfo(path, FS_INFO_CHMOD, &mode, sizeof(mode));
+
+    FILEIO_RETURN(ret);
+}
+
 // -------------------------------------------------------------------------
 // EOF file.cxx