mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-02-15 04:30:35 +01:00
os: simplify win32 uname()
Just define struct utsname and a tiny uname() function instead of
cluttering the code with ifdef's.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1295>
(cherry picked from commit 77f9792911)
This commit is contained in:
parent
bf5b49b2e5
commit
600d53e98f
2 changed files with 11 additions and 12 deletions
12
os/access.c
12
os/access.c
|
|
@ -444,15 +444,7 @@ DefineSelf(int fd)
|
|||
caddr_t addr;
|
||||
int family;
|
||||
register HOST *host;
|
||||
|
||||
#ifndef WIN32
|
||||
struct utsname name;
|
||||
#else
|
||||
struct {
|
||||
char nodename[512];
|
||||
} name;
|
||||
#endif
|
||||
|
||||
register struct hostent *hp;
|
||||
|
||||
union {
|
||||
|
|
@ -478,11 +470,7 @@ DefineSelf(int fd)
|
|||
* uname() lets me access to the whole string (it smashes release, you
|
||||
* see), whereas gethostname() kindly truncates it for me.
|
||||
*/
|
||||
#ifndef WIN32
|
||||
uname(&name);
|
||||
#else
|
||||
gethostname(name.nodename, sizeof(name.nodename));
|
||||
#endif
|
||||
|
||||
hp = _XGethostbyname(name.nodename, hparams);
|
||||
if (hp != NULL) {
|
||||
|
|
|
|||
11
os/osdep.h
11
os/osdep.h
|
|
@ -206,4 +206,15 @@ extern void XdmcpRegisterBroadcastAddress(const struct sockaddr_in *addr);
|
|||
extern void XdmAuthenticationInit(const char *cookie, int cookie_length);
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <X11/Xwinsock.h>
|
||||
struct utsname {
|
||||
char nodename[512];
|
||||
};
|
||||
|
||||
static inline void uname(struct utsname *uts) {
|
||||
gethostname(uts->nodename, sizeof(uts->nodename));
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
||||
#endif /* _OSDEP_H_ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue