mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-02-22 01:40:49 -05:00
Merge branch 'netbsd' into 'main'
Initial NetBSD support See merge request wayland/wayland!258
This commit is contained in:
commit
60c198be6c
4 changed files with 32 additions and 7 deletions
|
|
@ -16,7 +16,7 @@ config_h.set_quoted('PACKAGE', meson.project_name())
|
|||
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
|
||||
|
||||
cc_args = []
|
||||
if host_machine.system() != 'freebsd'
|
||||
if host_machine.system() == 'linux'
|
||||
cc_args += ['-D_POSIX_C_SOURCE=200809L']
|
||||
endif
|
||||
add_project_arguments(cc_args, language: 'c')
|
||||
|
|
@ -69,8 +69,8 @@ endif
|
|||
config_h.set10('HAVE_BROKEN_MSG_CMSG_CLOEXEC', have_broken_msg_cmsg_cloexec)
|
||||
|
||||
if get_option('libraries')
|
||||
if host_machine.system() == 'freebsd'
|
||||
# When building for FreeBSD, epoll(7) is provided by a userspace
|
||||
if cc.has_function('kqueue', prefix: '#include <sys/event.h>')
|
||||
# When building for BSD, epoll(7) is provided by a userspace
|
||||
# wrapper around kqueue(2).
|
||||
epoll_dep = dependency('epoll-shim')
|
||||
else
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ uppercase_dup(const char *src)
|
|||
|
||||
u = xstrdup(src);
|
||||
for (i = 0; u[i]; i++)
|
||||
u[i] = toupper(u[i]);
|
||||
u[i] = toupper((unsigned char) u[i]);
|
||||
u[i] = '\0';
|
||||
|
||||
return u;
|
||||
|
|
@ -354,7 +354,7 @@ desc_dump(char *desc, const char *fmt, ...)
|
|||
for (i = 0; desc[i]; ) {
|
||||
k = i;
|
||||
newlines = 0;
|
||||
while (desc[i] && isspace(desc[i])) {
|
||||
while (desc[i] && isspace((unsigned char) desc[i])) {
|
||||
if (desc[i] == '\n')
|
||||
newlines++;
|
||||
i++;
|
||||
|
|
@ -363,7 +363,7 @@ desc_dump(char *desc, const char *fmt, ...)
|
|||
break;
|
||||
|
||||
j = i;
|
||||
while (desc[i] && !isspace(desc[i]))
|
||||
while (desc[i] && !isspace((unsigned char) desc[i]))
|
||||
i++;
|
||||
|
||||
if (newlines > 1)
|
||||
|
|
|
|||
|
|
@ -106,7 +106,25 @@ wl_os_socket_peercred(int sockfd, uid_t *uid, gid_t *gid, pid_t *pid)
|
|||
#endif
|
||||
return 0;
|
||||
}
|
||||
#elif defined(SO_PEERCRED)
|
||||
#elif defined(LOCAL_CREDS) /* NetBSD */
|
||||
#ifndef SOL_LOCAL /* Before NetBSD 10.0, SOL_LOCAL isn't defined */
|
||||
#define SOL_LOCAL (0)
|
||||
#endif
|
||||
int
|
||||
wl_os_socket_peercred(int sockfd, uid_t *uid, gid_t *gid, pid_t *pid)
|
||||
{
|
||||
socklen_t len;
|
||||
struct sockcred ucred;
|
||||
|
||||
len = sizeof(ucred);
|
||||
if (getsockopt(sockfd, SOL_LOCAL, LOCAL_CREDS, &ucred, &len) < 0)
|
||||
return -1;
|
||||
*uid = ucred.sc_uid;
|
||||
*gid = ucred.sc_gid;
|
||||
*pid = ucred.sc_pid;
|
||||
return 0;
|
||||
}
|
||||
#elif defined(SO_PEERCRED) /* Linux */
|
||||
int
|
||||
wl_os_socket_peercred(int sockfd, uid_t *uid, gid_t *gid, pid_t *pid)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -308,6 +308,13 @@ is_debugger_attached(void)
|
|||
|
||||
return rc;
|
||||
}
|
||||
#else
|
||||
static int
|
||||
is_debugger_attached(void)
|
||||
{
|
||||
/* 0=debugger can't be determined */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue