Skip to content

Commit cd3421f

Browse files
committed
gpkg/glibc: global update
- added the glibc32 subpackage - updated fakesyscall handling scheme - added all disabled syscalls to fakesyscall list - added new syscalls to fakesyscall list - disabled removal of old locales in `locale-gen` - implemented syslog function, which is configured to work with the android log system - implemented analog variables `LD_*` to customize glibc environment without affecting bionic environment - improved source code for flexible glibc compilation
1 parent 65096c0 commit cd3421f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2003
-947
lines changed

get-build-package.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Script that installs build-package.sh to compile glibc packages
44

5-
BRANCH="master"
5+
BRANCH="adding-glibc32-prefix"
66

77
git clone --depth 1 -b ${BRANCH} --single-branch https://github.com/termux/termux-packages.git
88

gpkg/glibc/_Fork.c.patch

-11
This file was deleted.

gpkg/glibc/accept.c.patch

-16
This file was deleted.

gpkg/glibc/android_passwd_group.c

+15-21
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
structures are created.
44
*/
55

6-
#ifndef _ANDROID_PASSWD_GROUP
7-
#define _ANDROID_PASSWD_GROUP
8-
96
#include <stdio.h>
10-
#include <unistd.h>
11-
#include <stdlib.h>
127
#include <string.h>
138
#include <ctype.h>
9+
#include "android_ids.h"
1410
#include "android_passwd_group.h"
1511

1612
struct android_id_info * find_android_id_info_by_id(unsigned id) {
@@ -67,7 +63,7 @@ int is_valid_id_android(id_t id, int is_group) {
6763
return 0;
6864
}
6965

70-
static id_t oem_id_from_name_android(const char* name) {
66+
id_t oem_id_from_name_android(const char* name) {
7167
unsigned int id;
7268
if (sscanf(name, "oem_%u", &id) != 1) {
7369
return 0;
@@ -78,7 +74,7 @@ static id_t oem_id_from_name_android(const char* name) {
7874
return (id_t)id;
7975
}
8076

81-
static id_t app_id_from_name_android(const char* name, int is_group) {
77+
id_t app_id_from_name_android(const char* name, int is_group) {
8278
char* end;
8379
unsigned long userid;
8480
struct android_id_info* info;
@@ -87,7 +83,7 @@ static id_t app_id_from_name_android(const char* name, int is_group) {
8783
if (is_group && name[0] == 'a' && name[1] == 'l' && name[2] == 'l') {
8884
end = malloc(strlen(name));
8985
for (int i=3; i<strlen(name); i++)
90-
sprintf(end, "%s%c", end, name[i]);
86+
strncat(end, &name[i], 1);
9187
userid = 0;
9288
is_shared_gid = 1;
9389
} else if (name[0] == 'u' && isdigit(name[1])) {
@@ -186,27 +182,27 @@ void get_name_by_gid_android(gid_t gid, char *name_g) {
186182
}
187183
}
188184

189-
struct passwd * get_passwd_android(char* name, uid_t uid) {
185+
struct passwd * get_passwd_android(const char* name, uid_t uid) {
190186
static struct passwd res;
191187

192-
res.pw_name = name;
193-
res.pw_passwd = "*";
188+
res.pw_name = (char *)name;
189+
res.pw_passwd = (char *)"*";
194190
res.pw_uid = uid;
195191
res.pw_gid = uid;
196-
res.pw_gecos = "";
197-
res.pw_dir = APP_HOME_DIR;
198-
res.pw_shell = APP_PREFIX_DIR "/bin/login";
192+
res.pw_gecos = (char *)"";
193+
res.pw_dir = (char *)APP_HOME_DIR;
194+
res.pw_shell = (char *)(APP_PREFIX_DIR "/bin/login");
199195

200196
return &res;
201197
}
202198

203-
struct group * get_group_android(char* name, gid_t gid) {
199+
struct group * get_group_android(const char* name, gid_t gid) {
204200
static struct group res;
205201

206-
res.gr_name = name;
202+
res.gr_name = (char *)name;
207203
res.gr_passwd = NULL;
208204
res.gr_gid = gid;
209-
res.gr_mem = (char *[2]){(char *)name, NULL};
205+
res.gr_mem = *(char **[2]){(char **)name, NULL};
210206

211207
return &res;
212208
}
@@ -243,7 +239,7 @@ struct group * getgrgid_android(gid_t gid) {
243239
return get_group_android(name_res, gid);
244240
}
245241

246-
struct passwd * getpwnam_android(char* name) {
242+
struct passwd * getpwnam_android(const char* name) {
247243
uid_t uid;
248244
struct android_id_info* info;
249245

@@ -262,7 +258,7 @@ struct passwd * getpwnam_android(char* name) {
262258
return NULL;
263259
}
264260

265-
struct group * getgrnam_android(char* name) {
261+
struct group * getgrnam_android(const char* name) {
266262
gid_t gid;
267263
struct android_id_info* info;
268264

@@ -280,5 +276,3 @@ struct group * getgrnam_android(char* name) {
280276

281277
return NULL;
282278
}
283-
284-
#endif // _ANDROID_PASSWD_GROUP

gpkg/glibc/android_passwd_group.h

+6-7
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@
33

44
#include <pwd.h>
55
#include <grp.h>
6-
#include "android_ids.h"
76

87
struct android_id_info * find_android_id_info_by_id(unsigned id);
98
struct android_id_info * find_android_id_info_by_name(const char* name);
109
int is_oem_id_android(id_t id);
1110
int is_valid_id_android(id_t id, int is_group);
12-
static id_t oem_id_from_name_android(const char* name);
13-
static id_t app_id_from_name_android(const char* name, int is_group);
11+
id_t oem_id_from_name_android(const char* name);
12+
id_t app_id_from_name_android(const char* name, int is_group);
1413
void get_name_by_uid_android(uid_t uid, char *name_u);
1514
void get_name_by_gid_android(gid_t gid, char *name_g);
16-
struct passwd * get_passwd_android(char* name, uid_t uid);
17-
struct group * get_group_android(char* name, gid_t gid);
15+
struct passwd * get_passwd_android(const char* name, uid_t uid);
16+
struct group * get_group_android(const char* name, gid_t gid);
1817
struct passwd * getpwuid_android(uid_t uid);
1918
struct group * getgrgid_android(gid_t gid);
20-
struct passwd * getpwnam_android(char* name);
21-
struct group * getgrnam_android(char* name);
19+
struct passwd * getpwnam_android(const char* name);
20+
struct group * getgrnam_android(const char* name);
2221

2322
#endif // _ANDROID_PASSWD_GROUP_H

0 commit comments

Comments
 (0)