diff options
author | Chris Johns <chrisj@rtems.org> | 2008-04-11 22:57:54 +0000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2008-04-11 22:57:54 +0000 |
commit | 55c64fc9cd8ddd7a3d4b3207b9c9c698c7a9ec4b (patch) | |
tree | 6a00319f7a8793a8dfd64e1732ae7cdff7a82787 /cpukit/libcsupport | |
parent | 2008-04-09 Madhusudan.C.S <madhusudancs@gmail.com> (diff) | |
download | rtems-55c64fc9cd8ddd7a3d4b3207b9c9c698c7a9ec4b.tar.bz2 |
2008-04-12 Chris Johns <chrisj@rtems.org>
* libmisc/shell/shell.c, libmisc/shell/shell.h,
libmisc/shell/shell_script.c: Add support to echo the commands to
stdout. This is useful with the -v script option to show commands
as the run. Also added support to chdir to the directory the task
invoking the script is in.
* libmisc/shell/extern-cp.h, libmisc/shell/main_cp.c,
libmisc/shell/utils-cp.c: Update tro the latest FreeBSD version.
* libcsupport/Makefile.am, libcsupport/src/fchown.c: Add fchown
support.
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r-- | cpukit/libcsupport/Makefile.am | 4 | ||||
-rw-r--r-- | cpukit/libcsupport/src/fchown.c | 45 |
2 files changed, 47 insertions, 2 deletions
diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am index f62c9f96ac..dae118e2cf 100644 --- a/cpukit/libcsupport/Makefile.am +++ b/cpukit/libcsupport/Makefile.am @@ -58,8 +58,8 @@ TERMIOS_C_FILES = src/cfgetispeed.c src/cfgetospeed.c src/cfsetispeed.c \ SYSTEM_CALL_C_FILES = src/open.c src/close.c src/read.c src/write.c \ src/write_r.c \ src/lseek.c src/ioctl.c src/mkdir.c src/mknod.c src/mkfifo.c src/rmdir.c \ - src/chdir.c src/chmod.c src/fchdir.c src/fchmod.c src/chown.c src/link.c \ - src/unlink.c src/umask.c src/ftruncate.c src/utime.c src/fstat.c \ + src/chdir.c src/chmod.c src/fchdir.c src/fchmod.c src/fchown.c src/chown.c \ + src/link.c src/unlink.c src/umask.c src/ftruncate.c src/utime.c src/fstat.c \ src/fcntl.c src/fpathconf.c src/getdents.c src/fsync.c src/fdatasync.c \ src/pipe.c src/dup.c src/dup2.c src/symlink.c src/readlink.c src/creat.c \ src/chroot.c src/sync.c src/_rename_r.c diff --git a/cpukit/libcsupport/src/fchown.c b/cpukit/libcsupport/src/fchown.c new file mode 100644 index 0000000000..b066037717 --- /dev/null +++ b/cpukit/libcsupport/src/fchown.c @@ -0,0 +1,45 @@ +/* + * fchown() - POSIX 1003.1b 5.6.5 - Change Owner and Group of a File + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/stat.h> +#include <errno.h> + +#include <rtems.h> +#include <rtems/libio.h> + +#include <rtems/libio_.h> +#include <rtems/seterr.h> + +int fchown( + int fd, + uid_t owner, + gid_t group +) +{ + rtems_libio_t *iop; + + rtems_libio_check_fd( fd ); + iop = rtems_libio_iop( fd ); + rtems_libio_check_is_open(iop); + + rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE ); + + if ( !iop->pathinfo.ops->chown_h ) + rtems_set_errno_and_return_minus_one( ENOTSUP ); + + return (*iop->pathinfo.ops->chown_h)( &iop->pathinfo, owner, group ); +} |