aboutsummaryrefslogtreecommitdiff
path: root/include/mingw.h
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2015-02-26 15:50:39 +0000
committerRon Yorston <rmy@pobox.com>2015-02-26 15:50:39 +0000
commit59abbf391be4ddaab0e0335b4f3691cc48590574 (patch)
treeceeea37fd680410c15689ce42e19ec62b7f5e69b /include/mingw.h
parent63dbf1908bc51918d9d963f4d9b7657306b2970d (diff)
downloadbusybox-w32-59abbf391be4ddaab0e0335b4f3691cc48590574.tar.gz
busybox-w32-59abbf391be4ddaab0e0335b4f3691cc48590574.tar.bz2
busybox-w32-59abbf391be4ddaab0e0335b4f3691cc48590574.zip
Make uid/gid handling more consistent
Various fake POSIX routines returned different values for uid/gid: getuid/getgid used 1, stat used 0 and getpwuid used 1000. Standardise on 1000. Also, add fake getgrgid.
Diffstat (limited to 'include/mingw.h')
-rw-r--r--include/mingw.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/include/mingw.h b/include/mingw.h
index 090dd1776..970b689fd 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -13,6 +13,9 @@ typedef int pid_t;
13typedef __int64 pid_t; 13typedef __int64 pid_t;
14#endif 14#endif
15 15
16#define DEFAULT_UID 1000
17#define DEFAULT_GID 1000
18
16/* 19/*
17 * arpa/inet.h 20 * arpa/inet.h
18 */ 21 */
@@ -42,7 +45,7 @@ struct group {
42 char **gr_mem; 45 char **gr_mem;
43}; 46};
44IMPL(getgrnam,struct group *,NULL,const char *name UNUSED_PARAM); 47IMPL(getgrnam,struct group *,NULL,const char *name UNUSED_PARAM);
45IMPL(getgrgid,struct group *,NULL,gid_t gid UNUSED_PARAM); 48struct group *getgrgid(gid_t gid);
46NOIMPL(initgroups,const char *group UNUSED_PARAM,gid_t gid UNUSED_PARAM); 49NOIMPL(initgroups,const char *group UNUSED_PARAM,gid_t gid UNUSED_PARAM);
47static inline void endgrent(void) {} 50static inline void endgrent(void) {}
48 51
@@ -71,6 +74,7 @@ struct sockaddr_un {
71 */ 74 */
72struct passwd { 75struct passwd {
73 char *pw_name; 76 char *pw_name;
77 char *pw_passwd;
74 char *pw_gecos; 78 char *pw_gecos;
75 char *pw_dir; 79 char *pw_dir;
76 char *pw_shell; 80 char *pw_shell;
@@ -79,7 +83,7 @@ struct passwd {
79}; 83};
80 84
81IMPL(getpwnam,struct passwd *,NULL,const char *name UNUSED_PARAM); 85IMPL(getpwnam,struct passwd *,NULL,const char *name UNUSED_PARAM);
82struct passwd *getpwuid(int uid); 86struct passwd *getpwuid(uid_t uid);
83static inline void setpwent(void) {} 87static inline void setpwent(void) {}
84static inline void endpwent(void) {} 88static inline void endpwent(void) {}
85IMPL(getpwent_r,int,ENOENT,struct passwd *pwbuf UNUSED_PARAM,char *buf UNUSED_PARAM,size_t buflen UNUSED_PARAM,struct passwd **pwbufp UNUSED_PARAM); 89IMPL(getpwent_r,int,ENOENT,struct passwd *pwbuf UNUSED_PARAM,char *buf UNUSED_PARAM,size_t buflen UNUSED_PARAM,struct passwd **pwbufp UNUSED_PARAM);
@@ -360,13 +364,13 @@ int mingw_dup2 (int fd, int fdto);
360char *mingw_getcwd(char *pointer, int len); 364char *mingw_getcwd(char *pointer, int len);
361 365
362 366
363IMPL(getgid,int,1,void); 367IMPL(getgid,int,DEFAULT_GID,void);
364NOIMPL(getgroups,int n UNUSED_PARAM,gid_t *groups UNUSED_PARAM); 368NOIMPL(getgroups,int n UNUSED_PARAM,gid_t *groups UNUSED_PARAM);
365IMPL(getppid,int,1,void); 369IMPL(getppid,int,1,void);
366IMPL(getegid,int,1,void); 370IMPL(getegid,int,DEFAULT_GID,void);
367IMPL(geteuid,int,1,void); 371IMPL(geteuid,int,DEFAULT_UID,void);
368NOIMPL(getsid,pid_t pid UNUSED_PARAM); 372NOIMPL(getsid,pid_t pid UNUSED_PARAM);
369IMPL(getuid,int,1,void); 373IMPL(getuid,int,DEFAULT_UID,void);
370int fcntl(int fd, int cmd, ...); 374int fcntl(int fd, int cmd, ...);
371#define fork() -1 375#define fork() -1
372IMPL(fsync,int,0,int fd UNUSED_PARAM); 376IMPL(fsync,int,0,int fd UNUSED_PARAM);