* [uml-devel] [PATCH v2 0/3] musl compatibility patches
@ 2015-06-11 9:29 Hans-Werner Hilse
2015-06-11 9:29 ` [uml-devel] [PATCH v2 1/3] um: Do not use __ptr_t type for stack_t's .ss pointer Hans-Werner Hilse
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Hans-Werner Hilse @ 2015-06-11 9:29 UTC (permalink / raw)
To: User-mode-linux-devel
This set of patches facilitate compilation with the musl libc,
either linked to shared libraries or static.
Hans-Werner Hilse (3):
um: Do not use __ptr_t type for stack_t's .ss pointer
um: Do not use stdin and stdout identifiers for struct members
um: Include sys/types.h for makedev(), major(), minor()
arch/um/drivers/harddog_user.c | 18 +++++++++---------
arch/um/drivers/net_user.c | 6 +++---
arch/um/drivers/slip_user.c | 14 +++++++-------
arch/um/drivers/slirp_user.c | 16 ++++++++--------
arch/um/os-Linux/drivers/tuntap_user.c | 6 +++---
arch/um/os-Linux/file.c | 1 +
arch/um/os-Linux/signal.c | 8 +++++---
7 files changed, 36 insertions(+), 33 deletions(-)
--
2.4.2
------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [uml-devel] [PATCH v2 1/3] um: Do not use __ptr_t type for stack_t's .ss pointer
2015-06-11 9:29 [uml-devel] [PATCH v2 0/3] musl compatibility patches Hans-Werner Hilse
@ 2015-06-11 9:29 ` Hans-Werner Hilse
2015-06-11 9:29 ` [uml-devel] [PATCH v2 2/3] um: Do not use stdin and stdout identifiers for struct members Hans-Werner Hilse
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Hans-Werner Hilse @ 2015-06-11 9:29 UTC (permalink / raw)
To: User-mode-linux-devel
__ptr_t type is a glibc-specific type, while the generally
documented type is a void*. That's what other C libraries use,
too.
Signed-off-by: Hans-Werner Hilse <hwhilse@gmail.com>
---
arch/um/os-Linux/signal.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 7b605e4..036d0db 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -112,9 +112,11 @@ void timer_init(void)
void set_sigstack(void *sig_stack, int size)
{
- stack_t stack = ((stack_t) { .ss_flags = 0,
- .ss_sp = (__ptr_t) sig_stack,
- .ss_size = size - sizeof(void *) });
+ stack_t stack = {
+ .ss_flags = 0,
+ .ss_sp = sig_stack,
+ .ss_size = size - sizeof(void *)
+ };
if (sigaltstack(&stack, NULL) != 0)
panic("enabling signal stack failed, errno = %d\n", errno);
--
2.4.2
------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [uml-devel] [PATCH v2 2/3] um: Do not use stdin and stdout identifiers for struct members
2015-06-11 9:29 [uml-devel] [PATCH v2 0/3] musl compatibility patches Hans-Werner Hilse
2015-06-11 9:29 ` [uml-devel] [PATCH v2 1/3] um: Do not use __ptr_t type for stack_t's .ss pointer Hans-Werner Hilse
@ 2015-06-11 9:29 ` Hans-Werner Hilse
2015-06-11 9:29 ` [uml-devel] [PATCH v2 3/3] um: Include sys/types.h for makedev(), major(), minor() Hans-Werner Hilse
2015-06-25 20:42 ` [uml-devel] [PATCH v2 0/3] musl compatibility patches Richard Weinberger
3 siblings, 0 replies; 5+ messages in thread
From: Hans-Werner Hilse @ 2015-06-11 9:29 UTC (permalink / raw)
To: User-mode-linux-devel
stdin, stdout and stderr are macros according to C89/C99.
Thus do not use them as struct member identifiers to avoid
bad results from macro expansion.
Signed-off-by: Hans-Werner Hilse <hwhilse@gmail.com>
---
arch/um/drivers/harddog_user.c | 18 +++++++++---------
arch/um/drivers/net_user.c | 6 +++---
arch/um/drivers/slip_user.c | 14 +++++++-------
arch/um/drivers/slirp_user.c | 16 ++++++++--------
arch/um/os-Linux/drivers/tuntap_user.c | 6 +++---
5 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/arch/um/drivers/harddog_user.c b/arch/um/drivers/harddog_user.c
index f99b32a..3aa8b0d 100644
--- a/arch/um/drivers/harddog_user.c
+++ b/arch/um/drivers/harddog_user.c
@@ -9,8 +9,8 @@
#include <os.h>
struct dog_data {
- int stdin;
- int stdout;
+ int stdin_fd;
+ int stdout_fd;
int close_me[2];
};
@@ -18,11 +18,11 @@ static void pre_exec(void *d)
{
struct dog_data *data = d;
- dup2(data->stdin, 0);
- dup2(data->stdout, 1);
- dup2(data->stdout, 2);
- close(data->stdin);
- close(data->stdout);
+ dup2(data->stdin_fd, 0);
+ dup2(data->stdout_fd, 1);
+ dup2(data->stdout_fd, 2);
+ close(data->stdin_fd);
+ close(data->stdout_fd);
close(data->close_me[0]);
close(data->close_me[1]);
}
@@ -49,8 +49,8 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
goto out_close_in;
}
- data.stdin = out_fds[0];
- data.stdout = in_fds[1];
+ data.stdin_fd = out_fds[0];
+ data.stdout_fd = in_fds[1];
data.close_me[0] = out_fds[1];
data.close_me[1] = in_fds[0];
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index cd14157..e697a41 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -166,7 +166,7 @@ int net_sendto(int fd, void *buf, int len, void *to, int sock_len)
struct change_pre_exec_data {
int close_me;
- int stdout;
+ int stdout_fd;
};
static void change_pre_exec(void *arg)
@@ -174,7 +174,7 @@ static void change_pre_exec(void *arg)
struct change_pre_exec_data *data = arg;
close(data->close_me);
- dup2(data->stdout, 1);
+ dup2(data->stdout_fd, 1);
}
static int change_tramp(char **argv, char *output, int output_len)
@@ -189,7 +189,7 @@ static int change_tramp(char **argv, char *output, int output_len)
return err;
}
pe_data.close_me = fds[0];
- pe_data.stdout = fds[1];
+ pe_data.stdout_fd = fds[1];
pid = run_helper(change_pre_exec, &pe_data, argv);
if (pid > 0) /* Avoid hang as we won't get data in failure case. */
diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c
index 55c290d..0d6b66c 100644
--- a/arch/um/drivers/slip_user.c
+++ b/arch/um/drivers/slip_user.c
@@ -55,8 +55,8 @@ static int set_up_tty(int fd)
}
struct slip_pre_exec_data {
- int stdin;
- int stdout;
+ int stdin_fd;
+ int stdout_fd;
int close_me;
};
@@ -64,9 +64,9 @@ static void slip_pre_exec(void *arg)
{
struct slip_pre_exec_data *data = arg;
- if (data->stdin >= 0)
- dup2(data->stdin, 0);
- dup2(data->stdout, 1);
+ if (data->stdin_fd >= 0)
+ dup2(data->stdin_fd, 0);
+ dup2(data->stdout_fd, 1);
if (data->close_me >= 0)
close(data->close_me);
}
@@ -85,8 +85,8 @@ static int slip_tramp(char **argv, int fd)
}
err = 0;
- pe_data.stdin = fd;
- pe_data.stdout = fds[1];
+ pe_data.stdin_fd = fd;
+ pe_data.stdout_fd = fds[1];
pe_data.close_me = fds[0];
err = run_helper(slip_pre_exec, &pe_data, argv);
if (err < 0)
diff --git a/arch/um/drivers/slirp_user.c b/arch/um/drivers/slirp_user.c
index c999d18..98b6a41 100644
--- a/arch/um/drivers/slirp_user.c
+++ b/arch/um/drivers/slirp_user.c
@@ -20,18 +20,18 @@ static int slirp_user_init(void *data, void *dev)
}
struct slirp_pre_exec_data {
- int stdin;
- int stdout;
+ int stdin_fd;
+ int stdout_fd;
};
static void slirp_pre_exec(void *arg)
{
struct slirp_pre_exec_data *data = arg;
- if (data->stdin != -1)
- dup2(data->stdin, 0);
- if (data->stdout != -1)
- dup2(data->stdout, 1);
+ if (data->stdin_fd != -1)
+ dup2(data->stdin_fd, 0);
+ if (data->stdout_fd != -1)
+ dup2(data->stdout_fd, 1);
}
static int slirp_tramp(char **argv, int fd)
@@ -39,8 +39,8 @@ static int slirp_tramp(char **argv, int fd)
struct slirp_pre_exec_data pe_data;
int pid;
- pe_data.stdin = fd;
- pe_data.stdout = fd;
+ pe_data.stdin_fd = fd;
+ pe_data.stdout_fd = fd;
pid = run_helper(slirp_pre_exec, &pe_data, argv);
return pid;
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c
index 14126d9..c2e6e1d 100644
--- a/arch/um/os-Linux/drivers/tuntap_user.c
+++ b/arch/um/os-Linux/drivers/tuntap_user.c
@@ -47,7 +47,7 @@ static void tuntap_del_addr(unsigned char *addr, unsigned char *netmask,
}
struct tuntap_pre_exec_data {
- int stdout;
+ int stdout_fd;
int close_me;
};
@@ -55,7 +55,7 @@ static void tuntap_pre_exec(void *arg)
{
struct tuntap_pre_exec_data *data = arg;
- dup2(data->stdout, 1);
+ dup2(data->stdout_fd, 1);
close(data->close_me);
}
@@ -74,7 +74,7 @@ static int tuntap_open_tramp(char *gate, int *fd_out, int me, int remote,
sprintf(version_buf, "%d", UML_NET_VERSION);
- data.stdout = remote;
+ data.stdout_fd = remote;
data.close_me = me;
pid = run_helper(tuntap_pre_exec, &data, argv);
--
2.4.2
------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [uml-devel] [PATCH v2 3/3] um: Include sys/types.h for makedev(), major(), minor()
2015-06-11 9:29 [uml-devel] [PATCH v2 0/3] musl compatibility patches Hans-Werner Hilse
2015-06-11 9:29 ` [uml-devel] [PATCH v2 1/3] um: Do not use __ptr_t type for stack_t's .ss pointer Hans-Werner Hilse
2015-06-11 9:29 ` [uml-devel] [PATCH v2 2/3] um: Do not use stdin and stdout identifiers for struct members Hans-Werner Hilse
@ 2015-06-11 9:29 ` Hans-Werner Hilse
2015-06-25 20:42 ` [uml-devel] [PATCH v2 0/3] musl compatibility patches Richard Weinberger
3 siblings, 0 replies; 5+ messages in thread
From: Hans-Werner Hilse @ 2015-06-11 9:29 UTC (permalink / raw)
To: User-mode-linux-devel
The functions in question are not part of the POSIX standard,
documentation however hints that the corresponding header shall
be sys/types.h. C libraries other than glibc, namely musl, did
not include that header via other ways and complained.
Signed-off-by: Hans-Werner Hilse <hwhilse@gmail.com>
---
arch/um/os-Linux/file.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index 08d90fb..26e0164 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -13,6 +13,7 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
+#include <sys/types.h>
#include <os.h>
static void copy_stat(struct uml_stat *dst, const struct stat64 *src)
--
2.4.2
------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [uml-devel] [PATCH v2 0/3] musl compatibility patches
2015-06-11 9:29 [uml-devel] [PATCH v2 0/3] musl compatibility patches Hans-Werner Hilse
` (2 preceding siblings ...)
2015-06-11 9:29 ` [uml-devel] [PATCH v2 3/3] um: Include sys/types.h for makedev(), major(), minor() Hans-Werner Hilse
@ 2015-06-25 20:42 ` Richard Weinberger
3 siblings, 0 replies; 5+ messages in thread
From: Richard Weinberger @ 2015-06-25 20:42 UTC (permalink / raw)
To: Hans-Werner Hilse; +Cc: user-mode-linux-devel@lists.sourceforge.net
On Thu, Jun 11, 2015 at 11:29 AM, Hans-Werner Hilse <hwhilse@gmail.com> wrote:
> This set of patches facilitate compilation with the musl libc,
> either linked to shared libraries or static.
>
> Hans-Werner Hilse (3):
> um: Do not use __ptr_t type for stack_t's .ss pointer
> um: Do not use stdin and stdout identifiers for struct members
> um: Include sys/types.h for makedev(), major(), minor()
All three patches applied. :-)
--
Thanks,
//richard
------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors
network devices and physical & virtual servers, alerts via email & sms
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-06-25 20:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-11 9:29 [uml-devel] [PATCH v2 0/3] musl compatibility patches Hans-Werner Hilse
2015-06-11 9:29 ` [uml-devel] [PATCH v2 1/3] um: Do not use __ptr_t type for stack_t's .ss pointer Hans-Werner Hilse
2015-06-11 9:29 ` [uml-devel] [PATCH v2 2/3] um: Do not use stdin and stdout identifiers for struct members Hans-Werner Hilse
2015-06-11 9:29 ` [uml-devel] [PATCH v2 3/3] um: Include sys/types.h for makedev(), major(), minor() Hans-Werner Hilse
2015-06-25 20:42 ` [uml-devel] [PATCH v2 0/3] musl compatibility patches Richard Weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox