Skip to content

Commit

Permalink
gpkg/glibc: global update
Browse files Browse the repository at this point in the history
 - 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
  • Loading branch information
Maxython committed Dec 30, 2024
1 parent 65096c0 commit cd3421f
Show file tree
Hide file tree
Showing 57 changed files with 2,003 additions and 947 deletions.
2 changes: 1 addition & 1 deletion get-build-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

BRANCH="master"
BRANCH="adding-glibc32-prefix"

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

Expand Down
11 changes: 0 additions & 11 deletions gpkg/glibc/_Fork.c.patch

This file was deleted.

16 changes: 0 additions & 16 deletions gpkg/glibc/accept.c.patch

This file was deleted.

36 changes: 15 additions & 21 deletions gpkg/glibc/android_passwd_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
structures are created.
*/

#ifndef _ANDROID_PASSWD_GROUP
#define _ANDROID_PASSWD_GROUP

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "android_ids.h"
#include "android_passwd_group.h"

struct android_id_info * find_android_id_info_by_id(unsigned id) {
Expand Down Expand Up @@ -67,7 +63,7 @@ int is_valid_id_android(id_t id, int is_group) {
return 0;
}

static id_t oem_id_from_name_android(const char* name) {
id_t oem_id_from_name_android(const char* name) {
unsigned int id;
if (sscanf(name, "oem_%u", &id) != 1) {
return 0;
Expand All @@ -78,7 +74,7 @@ static id_t oem_id_from_name_android(const char* name) {
return (id_t)id;
}

static id_t app_id_from_name_android(const char* name, int is_group) {
id_t app_id_from_name_android(const char* name, int is_group) {
char* end;
unsigned long userid;
struct android_id_info* info;
Expand All @@ -87,7 +83,7 @@ static id_t app_id_from_name_android(const char* name, int is_group) {
if (is_group && name[0] == 'a' && name[1] == 'l' && name[2] == 'l') {
end = malloc(strlen(name));
for (int i=3; i<strlen(name); i++)
sprintf(end, "%s%c", end, name[i]);
strncat(end, &name[i], 1);
userid = 0;
is_shared_gid = 1;
} else if (name[0] == 'u' && isdigit(name[1])) {
Expand Down Expand Up @@ -186,27 +182,27 @@ void get_name_by_gid_android(gid_t gid, char *name_g) {
}
}

struct passwd * get_passwd_android(char* name, uid_t uid) {
struct passwd * get_passwd_android(const char* name, uid_t uid) {
static struct passwd res;

res.pw_name = name;
res.pw_passwd = "*";
res.pw_name = (char *)name;
res.pw_passwd = (char *)"*";
res.pw_uid = uid;
res.pw_gid = uid;
res.pw_gecos = "";
res.pw_dir = APP_HOME_DIR;
res.pw_shell = APP_PREFIX_DIR "/bin/login";
res.pw_gecos = (char *)"";
res.pw_dir = (char *)APP_HOME_DIR;
res.pw_shell = (char *)(APP_PREFIX_DIR "/bin/login");

return &res;
}

struct group * get_group_android(char* name, gid_t gid) {
struct group * get_group_android(const char* name, gid_t gid) {
static struct group res;

res.gr_name = name;
res.gr_name = (char *)name;
res.gr_passwd = NULL;
res.gr_gid = gid;
res.gr_mem = (char *[2]){(char *)name, NULL};
res.gr_mem = *(char **[2]){(char **)name, NULL};

return &res;
}
Expand Down Expand Up @@ -243,7 +239,7 @@ struct group * getgrgid_android(gid_t gid) {
return get_group_android(name_res, gid);
}

struct passwd * getpwnam_android(char* name) {
struct passwd * getpwnam_android(const char* name) {
uid_t uid;
struct android_id_info* info;

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

struct group * getgrnam_android(char* name) {
struct group * getgrnam_android(const char* name) {
gid_t gid;
struct android_id_info* info;

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

return NULL;
}

#endif // _ANDROID_PASSWD_GROUP
13 changes: 6 additions & 7 deletions gpkg/glibc/android_passwd_group.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@

#include <pwd.h>
#include <grp.h>
#include "android_ids.h"

struct android_id_info * find_android_id_info_by_id(unsigned id);
struct android_id_info * find_android_id_info_by_name(const char* name);
int is_oem_id_android(id_t id);
int is_valid_id_android(id_t id, int is_group);
static id_t oem_id_from_name_android(const char* name);
static id_t app_id_from_name_android(const char* name, int is_group);
id_t oem_id_from_name_android(const char* name);
id_t app_id_from_name_android(const char* name, int is_group);
void get_name_by_uid_android(uid_t uid, char *name_u);
void get_name_by_gid_android(gid_t gid, char *name_g);
struct passwd * get_passwd_android(char* name, uid_t uid);
struct group * get_group_android(char* name, gid_t gid);
struct passwd * get_passwd_android(const char* name, uid_t uid);
struct group * get_group_android(const char* name, gid_t gid);
struct passwd * getpwuid_android(uid_t uid);
struct group * getgrgid_android(gid_t gid);
struct passwd * getpwnam_android(char* name);
struct group * getgrnam_android(char* name);
struct passwd * getpwnam_android(const char* name);
struct group * getgrnam_android(const char* name);

#endif // _ANDROID_PASSWD_GROUP_H
Loading

0 comments on commit cd3421f

Please sign in to comment.