Unix to Windows Porting Dictionary for HPC

Links

Function List

chown


Unix

header files: unistd.h

int chown (const char *path, uid_t owner, gid_t group);
int wcs_chown (const wchar_t *path, uid_t owner, gid_t group);
int fchown (int fildes, uid_t owner, gid_t group);
int lchown (const char *path, uid_t owner, gid_t group);
int wcs_lchown (const wchar_t *path, uid_t owner, gid_t group);

Windows

header file: n/a

Purpose

Change owner and group of a file or directory.

Discussion

There are a collection of Unix functions for changing file ownership as shown above. There is not a direct mapping of these functions to Windows functions because of the different security and permissions models used between the two systems. Traditional Unix code (and most code still) use a simpler model than the more advanced ACL (Access Control List). This will necessitate a significant change in the source code. You may either update the change in-place or create a helper function to perform the same intent. Because of the greater complexity of ACLs the Windows source code is more complex and lengthy. Therefore it is usually better to create helper functions, particularly when the functionality will be used more than one time.

blog comments powered by Disqus