VirtualBox

Ignore:
Timestamp:
Nov 7, 2023 11:16:52 AM (15 months ago)
Author:
vboxsync
Message:

libs/xpcom: Remove an unused code and locks (still being created) in nsprpub, bugref:10545

Location:
trunk/src/libs/xpcom18a4/nsprpub/pr
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/nsprpub/pr/include/md/_unixos.h

    r101874 r101930  
    351351extern PRInt32  _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info);
    352352extern PRInt32  _MD_rename(const char *from, const char *to);
    353 extern PRInt32  _MD_access(const char *name, PRAccessHow how);
    354353extern PRInt32  _MD_mkdir(const char *name, PRIntn mode);
    355354extern PRInt32  _MD_rmdir(const char *name);
     
    372371#define _MD_GETOPENFILEINFO64(fd, info) _MD_getopenfileinfo64(fd, info)
    373372#define _MD_RENAME(from, to)                _MD_rename(from, to)
    374 #define _MD_ACCESS(name, how)               _MD_access(name, how)
    375373#define _MD_MKDIR(name, mode)               _MD_mkdir(name, mode)
    376374#define _MD_MAKE_DIR(name, mode)                _MD_mkdir(name, mode)
  • trunk/src/libs/xpcom18a4/nsprpub/pr/include/prio.h

    r101891 r101930  
    5454#define PR_GetInheritedFD VBoxNsprPR_GetInheritedFD
    5555#define PR_SetFDInheritable VBoxNsprPR_SetFDInheritable
    56 #define PR_Access VBoxNsprPR_Access
    5756#define PR_Open VBoxNsprPR_Open
    5857#define PR_Read VBoxNsprPR_Read
     
    9190#define PR_Writev VBoxNsprPR_Writev
    9291#define PR_Delete VBoxNsprPR_Delete
    93 #define PR_Rename VBoxNsprPR_Rename
    9492#define PR_GetFileInfo VBoxNsprPR_GetFileInfo
    9593#define PR_GetFileInfo64 VBoxNsprPR_GetFileInfo64
     
    9896#define PR_Available VBoxNsprPR_Available
    9997#define PR_Sync VBoxNsprPR_Sync
    100 #define PR_MkDir VBoxNsprPR_MkDir
    101 #define PR_MakeDir VBoxNsprPR_MakeDir
    102 #define PR_RmDir VBoxNsprPR_RmDir
    10398#define PR_OpenTCPSocket VBoxNsprPR_OpenTCPSocket
    10499#define PR_ConnectContinue VBoxNsprPR_ConnectContinue
     
    891886
    892887/*
    893  **************************************************************************
    894  * FUNCTION: PR_Rename
    895  * DESCRIPTION:
    896  *     Rename a file from the old name 'from' to the new name 'to'.
    897  * INPUTS:
    898  *     const char *from
    899  *         The old name of the file to be renamed.
    900  *     const char *to
    901  *         The new name of the file.
    902  * OUTPUTS:
    903  *     None.
    904  * RETURN: PRStatus
    905  **************************************************************************
    906  */
    907 
    908 NSPR_API(PRStatus)    PR_Rename(const char *from, const char *to);
    909 
    910 /*
    911  *************************************************************************
    912  * FUNCTION: PR_Access
    913  * DESCRIPTION:
    914  *     Determine accessibility of a file.
    915  * INPUTS:
    916  *     const char *name
    917  *         path name of the file
    918  *     PRAccessHow how
    919  *         specifies which access permission to check for.
    920  *         It can be one of the following values:
    921  *             PR_ACCESS_READ_OK       Test for read permission
    922  *             PR_ACCESS_WRITE_OK      Test for write permission
    923  *             PR_ACCESS_EXISTS        Check existence of file
    924  * OUTPUTS:
    925  *     None.
    926  * RETURN: PRStatus
    927  *     PR_SUCCESS is returned if the requested access is permitted.
    928  *     Otherwise, PR_FAILURE is returned. Additional information
    929  *     regarding the reason for the failure may be retrieved from
    930  *     PR_GetError().
    931  *************************************************************************
    932  */
    933 
    934 typedef enum PRAccessHow {
    935     PR_ACCESS_EXISTS = 1,
    936     PR_ACCESS_WRITE_OK = 2,
    937     PR_ACCESS_READ_OK = 3
    938 } PRAccessHow;
    939 
    940 NSPR_API(PRStatus) PR_Access(const char *name, PRAccessHow how);
    941 
    942 /*
    943888 *************************************************************************
    944889 * FUNCTION: PR_Seek, PR_Seek64
     
    11031048/*
    11041049 *************************************************************************
    1105  * FUNCTION: PR_MkDir
    1106  * DESCRIPTION:
    1107  *     Create a new directory with the given name and access mode.
    1108  * INPUTS:
    1109  *     const char *name
    1110  *        The name of the directory to be created. All the path components
    1111  *        up to but not including the leaf component must already exist.
    1112  *     PRIntn mode
    1113  *        See 'mode' definiton in PR_Open().
    1114  * OUTPUTS:
    1115  *     None
    1116  * RETURN: PRStatus
    1117  *        If successful, will return a status of PR_SUCCESS. Otherwise
    1118  *        a value of PR_FAILURE. The reason for the failure may be re-
    1119  *        trieved using PR_GetError().
    1120  *************************************************************************
    1121  */
    1122 
    1123 NSPR_API(PRStatus) PR_MkDir(const char *name, PRIntn mode);
    1124 
    1125 /*
    1126  *************************************************************************
    1127  * FUNCTION: PR_MakeDir
    1128  * DESCRIPTION:
    1129  *     Create a new directory with the given name and access mode.
    1130  *     PR_MakeDir has the same prototype as PR_MkDir but implements
    1131  *     the specified access mode where possible.
    1132  *************************************************************************
    1133  */
    1134 
    1135 NSPR_API(PRStatus) PR_MakeDir(const char *name, PRIntn mode);
    1136 
    1137 /*
    1138  *************************************************************************
    1139  * FUNCTION: PR_RmDir
    1140  * DESCRIPTION:
    1141  *     Remove a directory by the given name.
    1142  * INPUTS:
    1143  *     const char *name
    1144  *        The name of the directory to be removed. All the path components
    1145  *        must already exist. Only the leaf component will be removed.
    1146  * OUTPUTS:
    1147  *     None
    1148  * RETURN: PRStatus
    1149  *        If successful, will return a status of PR_SUCCESS. Otherwise
    1150  *        a value of PR_FAILURE. The reason for the failure may be re-
    1151  *        trieved using PR_GetError().
    1152  **************************************************************************
    1153  */
    1154 
    1155 NSPR_API(PRStatus) PR_RmDir(const char *name);
    1156 
    1157 /*
    1158  *************************************************************************
    11591050 * FUNCTION: PR_OpenTCPSocket
    11601051 * DESCRIPTION:
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptio.c

    r101891 r101930  
    116116    PRIntn osfd, PRDescType type, PRBool isAcceptedSocket, PRBool imported);
    117117
    118 static PRLock *_pr_flock_lock;  /* For PR_LockFile() etc. */
    119 static PRCondVar *_pr_flock_cv;  /* For PR_LockFile() etc. */
    120118static PRLock *_pr_rename_lock;  /* For PR_Rename() */
    121119
     
    621619#endif
    622620
    623     _pr_flock_lock = PR_NewLock();
    624     PR_ASSERT(NULL != _pr_flock_lock);
    625     _pr_flock_cv = PR_NewCondVar(_pr_flock_lock);
    626     PR_ASSERT(NULL != _pr_flock_cv);
    627621    _pr_rename_lock = PR_NewLock();
    628622    PR_ASSERT(NULL != _pr_rename_lock);
     
    668662    _PR_CleanupFdCache();
    669663
    670     if (_pr_flock_cv)
    671     {
    672         PR_DestroyCondVar(_pr_flock_cv);
    673         _pr_flock_cv = NULL;
    674     }
    675     if (_pr_flock_lock)
    676     {
    677         PR_DestroyLock(_pr_flock_lock);
    678         _pr_flock_lock = NULL;
    679     }
    680664    if (_pr_rename_lock)
    681665    {
     
    21012085}  /* PR_Delete */
    21022086
    2103 PR_IMPLEMENT(PRStatus) PR_Access(const char *name, PRAccessHow how)
    2104 {
    2105     PRIntn rv;
    2106 
    2107     if (pt_TestAbort()) return PR_FAILURE;
    2108 
    2109     switch (how)
    2110     {
    2111     case PR_ACCESS_READ_OK:
    2112         rv =  access(name, R_OK);
    2113         break;
    2114     case PR_ACCESS_WRITE_OK:
    2115         rv = access(name, W_OK);
    2116         break;
    2117     case PR_ACCESS_EXISTS:
    2118     default:
    2119         rv = access(name, F_OK);
    2120     }
    2121     if (0 == rv) return PR_SUCCESS;
    2122     pt_MapError(_PR_MD_MAP_ACCESS_ERROR, errno);
    2123     return PR_FAILURE;
    2124 
    2125 }  /* PR_Access */
    2126 
    21272087PR_IMPLEMENT(PRStatus) PR_GetFileInfo(const char *fn, PRFileInfo *info)
    21282088{
     
    21392099    return (0 == rv) ? PR_SUCCESS : PR_FAILURE;
    21402100}  /* PR_GetFileInfo64 */
    2141 
    2142 PR_IMPLEMENT(PRStatus) PR_Rename(const char *from, const char *to)
    2143 {
    2144     PRIntn rv = -1;
    2145 
    2146     if (pt_TestAbort()) return PR_FAILURE;
    2147 
    2148     /*
    2149     ** We have to acquire a lock here to stiffle anybody trying to create
    2150     ** a new file at the same time. And we have to hold that lock while we
    2151     ** test to see if the file exists and do the rename. The other place
    2152     ** where the lock is held is in PR_Open() when possibly creating a
    2153     ** new file.
    2154     */
    2155 
    2156     PR_Lock(_pr_rename_lock);
    2157     rv = access(to, F_OK);
    2158     if (0 == rv)
    2159     {
    2160         PR_SetError(PR_FILE_EXISTS_ERROR, 0);
    2161         rv = -1;
    2162     }
    2163     else
    2164     {
    2165         rv = rename(from, to);
    2166         if (rv == -1)
    2167             pt_MapError(_PR_MD_MAP_RENAME_ERROR, errno);
    2168     }
    2169     PR_Unlock(_pr_rename_lock);
    2170     return (-1 == rv) ? PR_FAILURE : PR_SUCCESS;
    2171 }  /* PR_Rename */
    21722101
    21732102PR_IMPLEMENT(PRStatus) PR_CloseDir(PRDir *dir)
     
    21872116    return PR_SUCCESS;
    21882117}  /* PR_CloseDir */
    2189 
    2190 PR_IMPLEMENT(PRStatus) PR_MakeDir(const char *name, PRIntn mode)
    2191 {
    2192     PRInt32 rv = -1;
    2193 
    2194     if (pt_TestAbort()) return PR_FAILURE;
    2195 
    2196     /*
    2197     ** This lock is used to enforce rename semantics as described
    2198     ** in PR_Rename.
    2199     */
    2200     if (NULL !=_pr_rename_lock)
    2201         PR_Lock(_pr_rename_lock);
    2202     rv = mkdir(name, mode);
    2203     if (-1 == rv)
    2204         pt_MapError(_PR_MD_MAP_MKDIR_ERROR, errno);
    2205     if (NULL !=_pr_rename_lock)
    2206         PR_Unlock(_pr_rename_lock);
    2207 
    2208     return (-1 == rv) ? PR_FAILURE : PR_SUCCESS;
    2209 }  /* PR_Makedir */
    2210 
    2211 PR_IMPLEMENT(PRStatus) PR_MkDir(const char *name, PRIntn mode)
    2212 {
    2213     return PR_MakeDir(name, mode);
    2214 }  /* PR_Mkdir */
    2215 
    2216 PR_IMPLEMENT(PRStatus) PR_RmDir(const char *name)
    2217 {
    2218     PRInt32 rv;
    2219 
    2220     if (pt_TestAbort()) return PR_FAILURE;
    2221 
    2222     rv = rmdir(name);
    2223     if (0 == rv) {
    2224     return PR_SUCCESS;
    2225     } else {
    2226     pt_MapError(_PR_MD_MAP_RMDIR_ERROR, errno);
    2227     return PR_FAILURE;
    2228     }
    2229 }  /* PR_Rmdir */
    2230 
    22312118
    22322119PR_IMPLEMENT(PRDir*) PR_OpenDir(const char *name)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette