Skip to content

Commit 8ed90cb

Browse files
committed
fix(mosq): Use sock_utils instead of func stubs
1 parent cead67d commit 8ed90cb

File tree

7 files changed

+24
-59
lines changed

7 files changed

+24
-59
lines changed

components/mosquitto/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,15 @@ idf_component_register(SRCS ${m_srcs}
7474
port/callbacks.c
7575
port/config.c
7676
port/signals.c
77-
port/ifaddrs.c
7877
port/broker.c
7978
port/files.c
8079
port/net__esp_tls.c
80+
port/sysconf.c
8181
PRIV_INCLUDE_DIRS port/priv_include port/priv_include/sys ${m_dir} ${m_src_dir}
8282
${m_incl_dir} ${m_lib_dir} ${m_deps_dir}
8383
INCLUDE_DIRS ${m_incl_dir} port/include
8484
REQUIRES esp-tls
85-
PRIV_REQUIRES newlib
86-
)
85+
PRIV_REQUIRES newlib sock_utils)
8786

8887
target_compile_definitions(${COMPONENT_LIB} PRIVATE "WITH_BROKER")
8988
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

components/mosquitto/idf_component.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ url: https://github.com/espressif/esp-protocols/tree/master/components/mosquitto
33
description: The component provides a simple ESP32 port of mosquitto broker
44
dependencies:
55
idf: '>=5.1'
6+
espressif/sock_utils:
7+
version: '^0.2'

components/mosquitto/port/ifaddrs.c

Lines changed: 0 additions & 20 deletions
This file was deleted.

components/mosquitto/port/priv_include/config.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,11 @@
55
*/
66
#pragma once
77
#include <ctype.h>
8+
#include "net/if.h"
89

910
#undef isspace
1011
#define isspace(__c) (__ctype_lookup((int)__c)&_S)
1112

1213
#include_next "config.h"
13-
#define VERSION "v2.0.18~0"
1414

15-
#define _SC_OPEN_MAX_OVERRIDE 4
16-
17-
// used to override syscall for obtaining max open fds
18-
static inline long sysconf(int arg)
19-
{
20-
if (arg == _SC_OPEN_MAX_OVERRIDE) {
21-
return 64;
22-
}
23-
return -1;
24-
}
15+
#define VERSION "v2.0.20~1"

components/mosquitto/port/priv_include/ifaddrs.h

Lines changed: 0 additions & 17 deletions
This file was deleted.

components/mosquitto/port/priv_include/poll.h

Lines changed: 0 additions & 8 deletions
This file was deleted.

components/mosquitto/port/sysconf.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#include <ctype.h>
7+
#include <unistd.h>
8+
9+
#define _SC_OPEN_MAX_OVERRIDE 4
10+
11+
// used to override syscall for obtaining max open fds
12+
long sysconf(int arg)
13+
{
14+
if (arg == _SC_OPEN_MAX_OVERRIDE) {
15+
return 64;
16+
}
17+
return -1;
18+
}

0 commit comments

Comments
 (0)