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

176 lines
2.8 KiB
Diff
Raw Normal View History

2018-05-19 03:18:52 +02:00
diff -u -r ../util-linux-2.32/sys-utils/ipcutils.c ./sys-utils/ipcutils.c
--- ../util-linux-2.32/sys-utils/ipcutils.c 2017-10-20 10:37:04.297168101 +0000
+++ ./sys-utils/ipcutils.c 2018-05-19 00:56:13.647850483 +0000
@@ -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__
2016-06-23 22:25:17 +02:00
+ return -1;
2018-05-19 03:18:52 +02:00
+#else
if (path_exist(_PATH_PROC_IPC_MSGMNI) &&
path_exist(_PATH_PROC_IPC_MSGMNB) &&
path_exist(_PATH_PROC_IPC_MSGMAX)) {
@@ -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;
@@ -66,10 +73,14 @@
}
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;
if (path_exist(_PATH_PROC_IPC_SHMALL) &&
@@ -93,10 +104,14 @@
}
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];
@@ -201,17 +216,23 @@
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;
@@ -242,9 +263,13 @@
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;
@@ -339,20 +364,28 @@
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;
@@ -451,19 +484,27 @@
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;
@@ -488,11 +529,15 @@
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)
@@ -531,4 +576,5 @@
if (end)
printf("%s", end);
+#endif
2016-06-23 22:25:17 +02:00
}