termux-packages/packages/util-linux/sys-utils-ipcutils.c.patch

176 lines
Diff
Raw Normal View History

2018-11-09 13:29:02 +01:00
diff -uNr util-linux-2.33/sys-utils/ipcutils.c util-linux-2.33.mod/sys-utils/ipcutils.c
--- util-linux-2.33/sys-utils/ipcutils.c 2018-09-20 15:38:55.955404280 +0300
+++ util-linux-2.33.mod/sys-utils/ipcutils.c 2018-11-09 14:26:56.564588140 +0200
2018-05-19 03:18:52 +02:00
@@ -18,6 +18,9 @@
2016-06-23 22:25:17 +02:00
int ipc_msg_get_limits(struct ipc_limits *lim)
{
2018-05-19 03:18:52 +02:00
+#ifdef __ANDROID__
2018-11-09 13:29:02 +01:00
+ return -1;
2018-05-19 03:18:52 +02:00
+#else
2018-11-09 13:29:02 +01:00
if (access(_PATH_PROC_IPC_MSGMNI, F_OK) == 0 &&
access(_PATH_PROC_IPC_MSGMNB, F_OK) == 0 &&
access(_PATH_PROC_IPC_MSGMAX, F_OK) == 0) {
2018-05-19 03:18:52 +02:00
@@ -36,10 +39,14 @@
}
return 0;
+#endif
2016-06-23 22:25:17 +02:00
}
int ipc_sem_get_limits(struct ipc_limits *lim)
{
2018-05-19 03:18:52 +02:00
+#ifdef __ANDROID__
2016-06-23 22:25:17 +02:00
+ return -1;
2018-05-19 03:18:52 +02:00
+#else
FILE *f;
int rc = 0;
2018-11-09 13:29:02 +01:00
@@ -65,10 +72,14 @@
2018-05-19 03:18:52 +02:00
}
return 0;
+#endif
2016-06-23 22:25:17 +02:00
}
int ipc_shm_get_limits(struct ipc_limits *lim)
{
2018-05-19 03:18:52 +02:00
+#ifdef __ANDROID__
2016-06-23 22:25:17 +02:00
+ return -1;
2018-05-19 03:18:52 +02:00
+#else
lim->shmmin = SHMMIN;
2018-11-09 13:29:02 +01:00
if (access(_PATH_PROC_IPC_SHMALL, F_OK) == 0 &&
@@ -92,10 +103,14 @@
2018-05-19 03:18:52 +02:00
}
return 0;
+#endif
2016-06-23 22:25:17 +02:00
}
int ipc_shm_get_info(int id, struct shm_data **shmds)
{
2018-05-19 03:18:52 +02:00
+#ifdef __ANDROID__
2016-06-23 22:25:17 +02:00
+ return -1;
2018-05-19 03:18:52 +02:00
+#else
FILE *f;
int i = 0, maxid;
char buf[BUFSIZ];
2018-11-09 13:29:02 +01:00
@@ -200,17 +215,23 @@
2018-05-19 03:18:52 +02:00
if (i == 0)
free(*shmds);
return i;
+#endif
2016-06-23 22:25:17 +02:00
}
void ipc_shm_free_info(struct shm_data *shmds)
{
2018-05-19 03:18:52 +02:00
+#ifdef __ANDROID__
2016-06-23 22:25:17 +02:00
+ return;
2018-05-19 03:18:52 +02:00
+#else
while (shmds) {
struct shm_data *next = shmds->next;
free(shmds);
shmds = next;
}
+#endif
2016-06-23 22:25:17 +02:00
}
2018-05-19 03:18:52 +02:00
+#ifndef __ANDROID__
static void get_sem_elements(struct sem_data *p)
{
size_t i;
2018-11-09 13:29:02 +01:00
@@ -241,9 +262,13 @@
2018-05-19 03:18:52 +02:00
err(EXIT_FAILURE, _("%s failed"), "semctl(GETPID)");
}
}
+#endif
2016-06-23 22:25:17 +02:00
int ipc_sem_get_info(int id, struct sem_data **semds)
{
2018-05-19 03:18:52 +02:00
+#ifdef __ANDROID__
2016-06-23 22:25:17 +02:00
+ return -1;
2018-05-19 03:18:52 +02:00
+#else
FILE *f;
int i = 0, maxid;
struct sem_data *p;
2018-11-09 13:29:02 +01:00
@@ -338,20 +363,28 @@
2018-05-19 03:18:52 +02:00
if (i == 0)
free(*semds);
return i;
+#endif
2016-06-23 22:25:17 +02:00
}
void ipc_sem_free_info(struct sem_data *semds)
{
2018-05-19 03:18:52 +02:00
+#ifdef __ANDROID__
2016-06-23 22:25:17 +02:00
+ return;
2018-05-19 03:18:52 +02:00
+#else
while (semds) {
struct sem_data *next = semds->next;
free(semds->elements);
free(semds);
semds = next;
}
+#endif
2016-06-23 22:25:17 +02:00
}
int ipc_msg_get_info(int id, struct msg_data **msgds)
{
2018-05-19 03:18:52 +02:00
+#ifdef __ANDROID__
2016-06-23 22:25:17 +02:00
+ return -1;
2018-05-19 03:18:52 +02:00
+#else
FILE *f;
int i = 0, maxid;
struct msg_data *p;
2018-11-09 13:29:02 +01:00
@@ -450,19 +483,27 @@
2018-05-19 03:18:52 +02:00
if (i == 0)
free(*msgds);
return i;
+#endif
2016-06-23 22:25:17 +02:00
}
void ipc_msg_free_info(struct msg_data *msgds)
{
2018-05-19 03:18:52 +02:00
+#ifdef __ANDROID__
2016-06-23 22:25:17 +02:00
+ return;
2018-05-19 03:18:52 +02:00
+#else
while (msgds) {
struct msg_data *next = msgds->next;
free(msgds);
msgds = next;
}
+#endif
2016-06-23 22:25:17 +02:00
}
void ipc_print_perms(FILE *f, struct ipc_stat *is)
{
2018-05-19 03:18:52 +02:00
+#ifdef __ANDROID__
2016-06-23 22:25:17 +02:00
+ return;
2018-05-19 03:18:52 +02:00
+#else
struct passwd *pw;
struct group *gr;
2018-11-09 13:29:02 +01:00
@@ -487,11 +528,15 @@
2018-05-19 03:18:52 +02:00
fprintf(f, " %-10s\n", gr->gr_name);
else
fprintf(f, " %-10u\n", is->gid);
+#endif
2016-06-23 22:25:17 +02:00
}
void ipc_print_size(int unit, char *msg, uint64_t size, const char *end,
int width)
{
2018-05-19 03:18:52 +02:00
+#ifdef __ANDROID__
2016-06-23 22:25:17 +02:00
+ return;
2018-05-19 03:18:52 +02:00
+#else
char format[32];
if (!msg)
2018-11-09 13:29:02 +01:00
@@ -530,4 +575,5 @@
2018-05-19 03:18:52 +02:00
if (end)
printf("%s", end);
+#endif
2016-06-23 22:25:17 +02:00
}