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/src | |
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/src')
-rw-r--r-- | cpukit/libcsupport/src/fchown.c | 45 |
1 files changed, 45 insertions, 0 deletions
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 ); +} |