Changeset 1940 for trunk


Ignore:
Timestamp:
May 1, 2005, 5:42:35 AM (20 years ago)
Author:
bird
Message:

Added fchmod and reimplemented chmod and lchmod.

Location:
trunk/src/emx
Files:
6 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/InnoTekLIBC/backend.h

    • Property cvs2svn:cvs-rev changed from 1.19 to 1.20
    r1939 r1940  
    288288
    289289/**
     290 * Sets the file access mode of a file.
     291 *
     292 * @returns 0 on success.
     293 * @returns Negative error code (errno.h) on failure.
     294 * @param   pszPath The path to the file to set the mode of.
     295 * @param   Mode    The filemode.
     296 */
     297int __libc_Back_fsSymlinkModeSet(const char *pszPath, mode_t Mode);
     298
     299/**
    290300 * Stats a file.
    291301 *
     
    307317 */
    308318int __libc_Back_fsFileStatFH(int fh, struct stat *pStat);
     319
     320/**
     321 * Sets the file access mode of a file.
     322 *
     323 * @returns 0 on success.
     324 * @returns Negative error code (errno.h) on failure.
     325 * @param   pszPath The path to the file to set the mode of.
     326 * @param   Mode    The filemode.
     327 */
     328int __libc_Back_fsFileModeSet(const char *pszPath, mode_t Mode);
     329
     330/**
     331 * Sets the file access mode of a file by filehandle.
     332 *
     333 * @returns 0 on success.
     334 * @returns Negative error code (errno.h) on failure.
     335 * @param   fh      Handle to file.
     336 * @param   Mode    The filemode.
     337 */
     338int __libc_Back_fsFileModeSetFH(int fh, mode_t Mode);
    309339
    310340/**
  • trunk/src/emx/include/sys/stat.h

    • Property cvs2svn:cvs-rev changed from 1.7 to 1.8
    r1939 r1940  
    337337#if __BSD_VISIBLE
    338338/** @todo int   fchflags(int, unsigned long); */
    339 /** @todo int   fchmod(int, mode_t); */
     339int     fchmod(int, mode_t);
    340340#endif
    341341int     fstat(int, struct stat *);
  • trunk/src/emx/src/lib/io/lchmod.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1939 r1940  
    1 /* chmod.c (libc) -- Copyright (c) 2003 by Knut St. Osmundsen */
     1/* $Id$ */
     2/** @file
     3 *
     4 * LIBC - lchmod().
     5 *
     6 * Copyright (c) 2005 knut st. osmundsen <bird@anduin.net>
     7 *
     8 *
     9 * This file is part of InnoTek LIBC.
     10 *
     11 * InnoTek LIBC is free software; you can redistribute it and/or modify
     12 * it under the terms of the GNU Lesser General Public License as published
     13 * by the Free Software Foundation; either version 2 of the License, or
     14 * (at your option) any later version.
     15 *
     16 * InnoTek LIBC is distributed in the hope that it will be useful,
     17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     19 * GNU Lesser General Public License for more details.
     20 *
     21 * You should have received a copy of the GNU Lesser General Public License
     22 * along with InnoTek LIBC; if not, write to the Free Software
     23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     24 *
     25 */
    226
     27
     28/*******************************************************************************
     29*   Header Files                                                               *
     30*******************************************************************************/
    331#include "libc-alias.h"
    4 #include <sys/types.h>
    532#include <sys/stat.h>
     33#include <errno.h>
     34#include <InnoTekLIBC/backend.h>
     35#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_IO
     36#include <InnoTekLIBC/logstrict.h>
    637
    7 int lchmod(const char *name, mode_t mode)
     38
     39/**
     40 * Sets the mode of a file without solving any symlink found in the last component.
     41 *
     42 * @returns 0 on success.
     43 * @returns -1 and errno on failure.
     44 * @param   path    Path to the file to change the mode of.
     45 * @param   mode    The new mode.
     46 */
     47int _STD(lchmod)(const char *path, mode_t mode)
    848{
    9     return chmod(name, mode);
     49    LIBCLOG_ENTER("path=%p:{%s} mode=%#x\n", (void *)path, path, mode);
     50    int rc = __libc_Back_fsSymlinkModeSet(path, mode);
     51    if (!rc)
     52        LIBCLOG_RETURN_INT(0);
     53    errno = -rc;
     54    LIBCLOG_RETURN_INT(-1);
    1055}
    1156
  • trunk/src/emx/src/lib/libc.def

    • Property cvs2svn:cvs-rev changed from 1.105 to 1.106
    r1939 r1940  
    12051205    "_isupper" @1218
    12061206    "_isxdigit" @1219
    1207     "_lchmod" @1220
     1207    "__std_lchmod" @1220
    12081208    "_mergesort" @1221
    12091209    "_mpool_close" @1222
     
    15061506    "__std_sysctlbyname" @1511
    15071507    "_sysctlnametomib" @1512
     1508    "___libc_Back_fsFileModeSet" @1513
     1509    "___libc_Back_fsFileModeSetFH" @1514
     1510    "___libc_Back_fsSymlinkModeSet" @1515
     1511    "__std_fchmod" @1516
  • trunk/src/emx/src/lib/libc06b4.def

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1939 r1940  
    12031203    "_isupper" @1218
    12041204    "_isxdigit" @1219
    1205     "_lchmod" @1220
     1205    "_lchmod" = "__std_lchmod" @1220
    12061206    "_mergesort" @1221
    12071207    "_mpool_close" @1222
  • trunk/src/emx/src/lib/sys/b_fs.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r1939 r1940  
    201201
    202202/**
     203 * Sets the file access mode of a native file.
     204 *
     205 * @returns 0 on success.
     206 * @returns Negative error code (errno.h) on failure.
     207 * @param   fh      Handle to file.
     208 * @param   Mode    The filemode.
     209 */
     210int __libc_back_fsNativeFileModeSet(const char *pszNativePath, mode_t Mode);
     211
     212/**
    203213 * Calc the Inode and Dev based on native path.
    204214 *
Note: See TracChangeset for help on using the changeset viewer.