Avoid potential negative array index access to cached text.
[LibreOffice.git] / sal / osl / unx / sockimpl.hxx
blobdc354db94a4293e439589be2d6a5070285e80d99
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SAL_OSL_UNX_SOCKIMPL_HXX
21 #define INCLUDED_SAL_OSL_UNX_SOCKIMPL_HXX
23 #include <osl/interlck.h>
25 #include <sys/socket.h>
26 #include <sys/un.h>
28 #if defined(LINUX) || defined(FREEBSD) || defined(NETBSD)
29 #define CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT 1
30 #endif
32 struct oslSocketImpl {
33 int m_Socket;
34 int m_nLastError;
35 oslInterlockedCount m_nRefCount;
36 #if defined(CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT)
37 bool m_bIsAccepting;
38 bool m_bIsInShutdown;
39 #endif
42 struct oslSocketAddrImpl
44 struct sockaddr m_sockaddr;
47 struct oslPipeImpl {
48 int m_Socket;
49 char m_Name[sizeof sockaddr_un::sun_path];
50 oslInterlockedCount m_nRefCount;
51 bool m_bClosed;
52 #if defined(CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT)
53 bool m_bIsAccepting;
54 bool m_bIsInShutdown;
55 #endif
58 #endif
60 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */