tests: use LDFLAGS instead of CFLAGS for libraries
[lttng-tools.git] / src / common / compat / socket.h
CommitLineData
b17231c6
DG
1/*
2 * Copyright (C) 2011 - David Goulet <dgoulet@efficios.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; only version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307, USA.
16 */
17
18#ifndef _COMPAT_SOCKET_H
19#define _COMPAT_SOCKET_H
20
21#include <sys/socket.h>
22#include <sys/un.h>
23
24#include <common/macros.h>
25
26#ifdef __linux__
27
28#define LTTNG_SOCK_CREDS SCM_CREDENTIALS
29#define LTTNG_SOCK_FDS SCM_RIGHTS
30
31typedef struct ucred lttng_sock_cred;
32
1268b9d6
DG
33#define LTTNG_SOCK_SET_UID_CRED(c, u) LTTNG_REF(c)->uid = u
34#define LTTNG_SOCK_SET_GID_CRED(c, g) LTTNG_REF(c)->gid = g
35#define LTTNG_SOCK_SET_PID_CRED(c, p) LTTNG_REF(c)->pid = p
36
37#define LTTNG_SOCK_GET_UID_CRED(c) LTTNG_REF(c)->uid
38#define LTTNG_SOCK_GET_GID_CRED(c) LTTNG_REF(c)->gid
39#define LTTNG_SOCK_GET_PID_CRED(c) LTTNG_REF(c)->pid
b17231c6 40
7657ae75 41#elif defined(__FreeBSD__)
b17231c6
DG
42
43#undef SO_PASSCRED
44#define SO_PASSCRED 0
45
46#define LTTNG_SOCK_CREDS SCM_CREDS
47#define LTTNG_SOCK_FDS SCM_RIGHTS
48
49typedef struct cmsgcred lttng_sock_cred;
50
1268b9d6
DG
51#define LTTNG_SOCK_SET_UID_CRED(c, uid) LTTNG_REF(c)->cmcred_uid = uid
52#define LTTNG_SOCK_SET_GID_CRED(c, gid) LTTNG_REF(c)->cmcred_gid = gid
53#define LTTNG_SOCK_SET_PID_CRED(c, pid) LTTNG_REF(c)->cmcred_pid = pid
54
55#define LTTNG_SOCK_GET_UID_CRED(c) LTTNG_REF(c)->cmcred_uid
56#define LTTNG_SOCK_GET_GID_CRED(c) LTTNG_REF(c)->cmcred_gid
57#define LTTNG_SOCK_GET_PID_CRED(c) LTTNG_REF(c)->cmcred_pid
b17231c6
DG
58
59#else
7657ae75 60#error "Please add support for your OS."
b17231c6
DG
61#endif /* __linux__ , __FreeBSD__ */
62
63#endif /* _COMPAT_SOCKET_H */
This page took 0.026961 seconds and 5 git commands to generate.