Commit 7a0afd69 authored by Sam Hocevar's avatar Sam Hocevar

. portage des vlc_threads aux cthreads de Mach pour GNU/Hurd

 . rajout de #ifdef SYS_LINUX autour du code concernant les interfaces
 . suppression de quelques #include <sys/soundcard.h> qui trainaient encore
 . option PPRO dans le Makefile (si vous avez des erreurs
    'Illegal instruction', �a venait probablement de l�)
 . rajout de quelques commentaires pour expliquer en quoi certains #include
    sont n�cessaires, aux endroits o� je ne comprenais pas, et suppression
    de #include qui semblaient inutiles.
parent a5e77c46
...@@ -15,8 +15,9 @@ SHELL=/bin/sh ...@@ -15,8 +15,9 @@ SHELL=/bin/sh
# Audio output settings # Audio output settings
AUDIO = dsp AUDIO = dsp
# Not yet supported
#AUDIO += esd #AUDIO += esd
# Not yet supported
#AUDIO += alsa
# Fallback method that should always work # Fallback method that should always work
AUDIO += dummy AUDIO += dummy
...@@ -38,12 +39,17 @@ ARCH=X86 ...@@ -38,12 +39,17 @@ ARCH=X86
# Target operating system # Target operating system
SYS=LINUX SYS=LINUX
#SYS=GNU
#SYS=BSD #SYS=BSD
#SYS=BEOS #SYS=BEOS
# For x86 architecture, choose MMX support # For x86 architecture, choose MMX support
MMX=YES MMX=YES
#MMX=NO #MMX=NO
# For x86 architecture, optimize for Pentium Pro
# (choose NO if you get `Invalid instruction' errors)
PPRO=YES
#PPRO=NO
# Decoder choice - ?? old decoder will be removed soon # Decoder choice - ?? old decoder will be removed soon
#DECODER=old #DECODER=old
...@@ -124,8 +130,14 @@ CCFLAGS += -fomit-frame-pointer ...@@ -124,8 +130,14 @@ CCFLAGS += -fomit-frame-pointer
# Optimizations for x86 familiy # Optimizations for x86 familiy
ifeq ($(ARCH),X86) ifeq ($(ARCH),X86)
CCFLAGS += -malign-double CCFLAGS += -malign-double
CCFLAGS += -march=pentiumpro
#CCFLAGS += -march=pentium #CCFLAGS += -march=pentium
ifeq ($(PPRO), YES)
CCFLAGS += -march=pentiumpro
endif
# Eventual MMX optimizations for x86
ifeq ($(MMX), YES)
CFLAGS += -DHAVE_MMX
endif
endif endif
# Optimizations for PowerPC # Optimizations for PowerPC
...@@ -151,17 +163,6 @@ LCFLAGS += $(LIB) ...@@ -151,17 +163,6 @@ LCFLAGS += $(LIB)
LCFLAGS += -Wall LCFLAGS += -Wall
#LCFLAGS += -s #LCFLAGS += -s
#
# C compiler flags: common flags
#
# Eventual MMX optimizations for x86
ifeq ($(ARCH),X86)
ifeq ($(MMX), YES)
CFLAGS += -DHAVE_MMX
endif
endif
# #
# Additionnal debugging flags # Additionnal debugging flags
# #
...@@ -285,9 +286,7 @@ interface_plugin = $(video:%=interface/intf_%.so) ...@@ -285,9 +286,7 @@ interface_plugin = $(video:%=interface/intf_%.so)
audio_plugin = $(audio:%=audio_output/aout_%.so) audio_plugin = $(audio:%=audio_output/aout_%.so)
video_plugin = $(video:%=video_output/vout_%.so) video_plugin = $(video:%=video_output/vout_%.so)
PLUGIN_OBJ = $(interface_plugin) \ PLUGIN_OBJ = $(interface_plugin) $(audio_plugin) $(video_plugin)
$(audio_plugin) \
$(video_plugin) \
# #
# Other lists of files # Other lists of files
...@@ -351,8 +350,7 @@ $(PLUGIN_OBJ): %.so: Makefile.dep ...@@ -351,8 +350,7 @@ $(PLUGIN_OBJ): %.so: Makefile.dep
$(PLUGIN_OBJ): %.so: dep/%.d $(PLUGIN_OBJ): %.so: dep/%.d
# audio plugins # audio plugins
audio_output/aout_dummy.so \ audio_output/aout_dummy.so audio_output/aout_dsp.so: %.so: %.c
audio_output/aout_dsp.so: %.so: %.c
@echo "compiling $*.so from $*.c" @echo "compiling $*.so from $*.c"
@$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $< @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
...@@ -361,25 +359,20 @@ audio_output/aout_esd.so: %.so: %.c ...@@ -361,25 +359,20 @@ audio_output/aout_esd.so: %.so: %.c
@$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $< @$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
# video plugins # video plugins
interface/intf_dummy.so \ interface/intf_dummy.so video_output/vout_dummy.so \
video_output/vout_dummy.so \ interface/intf_fb.so video_output/vout_fb.so: %.so: %.c
interface/intf_fb.so \
video_output/vout_fb.so: %.so: %.c
@echo "compiling $*.so from $*.c" @echo "compiling $*.so from $*.c"
@$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $< @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
interface/intf_x11.so \ interface/intf_x11.so video_output/vout_x11.so: %.so: %.c
video_output/vout_x11.so: %.so: %.c
@echo "compiling $*.so from $*.c" @echo "compiling $*.so from $*.c"
@$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $< @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
interface/intf_glide.so \ interface/intf_glide.so video_output/vout_glide.so: %.so: %.c
video_output/vout_glide.so: %.so: %.c
@echo "compiling $*.so from $*.c" @echo "compiling $*.so from $*.c"
@$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $< @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
interface/intf_ggi.so \ interface/intf_ggi.so video_output/vout_ggi.so: %.so: %.c
video_output/vout_ggi.so: %.so: %.c
@echo "compiling $*.so from $*.c" @echo "compiling $*.so from $*.c"
@$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $< @$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
......
...@@ -18,6 +18,9 @@ typedef u8 byte_t; ...@@ -18,6 +18,9 @@ typedef u8 byte_t;
/* Boolean type */ /* Boolean type */
typedef int boolean_t; typedef int boolean_t;
#ifdef SYS_GNU
#define _MACH_I386_BOOLEAN_H_
#endif
/* Counter for statistics and profiling */ /* Counter for statistics and profiling */
typedef unsigned long count_t; typedef unsigned long count_t;
......
...@@ -3,9 +3,14 @@ ...@@ -3,9 +3,14 @@
* (c)1999 VideoLAN * (c)1999 VideoLAN
***************************************************************************** *****************************************************************************
* This header is supposed to provide a portable threads implementation. * This header is supposed to provide a portable threads implementation.
* Currently, it is a wrapper to the POSIX pthreads library. * Currently, it is a wrapper to either the POSIX pthreads library, or
* the Mach cthreads (for the GNU/Hurd).
*****************************************************************************/ *****************************************************************************/
#ifdef SYS_GNU
#include <cthreads.h>
#else
#include <pthread.h> #include <pthread.h>
#endif
/***************************************************************************** /*****************************************************************************
* Constants * Constants
...@@ -36,10 +41,35 @@ ...@@ -36,10 +41,35 @@
/***************************************************************************** /*****************************************************************************
* Types definition * Types definition
*****************************************************************************/ *****************************************************************************/
#ifdef SYS_GNU
typedef cthread_t vlc_thread_t;
/* those structs are the ones defined in /include/cthreads.h but we need
* * to handle *foo where foo is a mutex_t */
typedef struct s_mutex {
spin_lock_t held;
spin_lock_t lock;
char *name;
struct cthread_queue queue;
} vlc_mutex_t;
typedef struct s_condition {
spin_lock_t lock;
struct cthread_queue queue;
char *name;
struct cond_imp *implications;
} vlc_cond_t;
#else /* SYS_GNU */
typedef pthread_t vlc_thread_t; typedef pthread_t vlc_thread_t;
typedef pthread_mutex_t vlc_mutex_t; typedef pthread_mutex_t vlc_mutex_t;
typedef pthread_cond_t vlc_cond_t; typedef pthread_cond_t vlc_cond_t;
#endif /* SYS_GNU */
typedef void *(*vlc_thread_func_t)(void *p_data); typedef void *(*vlc_thread_func_t)(void *p_data);
/***************************************************************************** /*****************************************************************************
...@@ -71,7 +101,12 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread, ...@@ -71,7 +101,12 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
char *psz_name, vlc_thread_func_t func, char *psz_name, vlc_thread_func_t func,
void *p_data) void *p_data)
{ {
#ifdef SYS_GNU
*p_thread = cthread_fork( (cthread_fn_t)func, (any_t)p_data );
return( 0 );
#else
return pthread_create( p_thread, NULL, func, p_data ); return pthread_create( p_thread, NULL, func, p_data );
#endif
} }
/***************************************************************************** /*****************************************************************************
...@@ -79,7 +114,12 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread, ...@@ -79,7 +114,12 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
*****************************************************************************/ *****************************************************************************/
static __inline__ void vlc_thread_exit( void ) static __inline__ void vlc_thread_exit( void )
{ {
#ifdef SYS_GNU
int result;
cthread_exit( &result );
#else
pthread_exit( 0 ); pthread_exit( 0 );
#endif
} }
/***************************************************************************** /*****************************************************************************
...@@ -87,7 +127,11 @@ static __inline__ void vlc_thread_exit( void ) ...@@ -87,7 +127,11 @@ static __inline__ void vlc_thread_exit( void )
*****************************************************************************/ *****************************************************************************/
static __inline__ void vlc_thread_join( vlc_thread_t thread ) static __inline__ void vlc_thread_join( vlc_thread_t thread )
{ {
#ifdef SYS_GNU
cthread_join( thread );
#else
pthread_join( thread, NULL ); pthread_join( thread, NULL );
#endif
} }
/***************************************************************************** /*****************************************************************************
...@@ -95,7 +139,12 @@ static __inline__ void vlc_thread_join( vlc_thread_t thread ) ...@@ -95,7 +139,12 @@ static __inline__ void vlc_thread_join( vlc_thread_t thread )
*****************************************************************************/ *****************************************************************************/
static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
{ {
#ifdef SYS_GNU
mutex_init( p_mutex );
return( 0 );
#else
return pthread_mutex_init( p_mutex, NULL ); return pthread_mutex_init( p_mutex, NULL );
#endif
} }
/***************************************************************************** /*****************************************************************************
...@@ -103,7 +152,12 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) ...@@ -103,7 +152,12 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
*****************************************************************************/ *****************************************************************************/
static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex ) static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex )
{ {
#ifdef SYS_GNU
mutex_lock( p_mutex );
return( 0 );
#else
return pthread_mutex_lock( p_mutex ); return pthread_mutex_lock( p_mutex );
#endif
} }
/***************************************************************************** /*****************************************************************************
...@@ -111,7 +165,12 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex ) ...@@ -111,7 +165,12 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex )
*****************************************************************************/ *****************************************************************************/
static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex ) static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
{ {
#ifdef SYS_GNU
mutex_unlock( p_mutex );
return( 0 );
#else
return pthread_mutex_unlock( p_mutex ); return pthread_mutex_unlock( p_mutex );
#endif
} }
/***************************************************************************** /*****************************************************************************
...@@ -119,7 +178,17 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex ) ...@@ -119,7 +178,17 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
*****************************************************************************/ *****************************************************************************/
static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar ) static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar )
{ {
#ifdef SYS_GNU
/* condition_init() */
spin_lock_init( &p_condvar->lock );
cthread_queue_init( &p_condvar->queue );
p_condvar->name = 0;
p_condvar->implications = 0;
return( 0 );
#else
return pthread_cond_init( p_condvar, NULL ); return pthread_cond_init( p_condvar, NULL );
#endif
} }
/***************************************************************************** /*****************************************************************************
...@@ -127,7 +196,16 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar ) ...@@ -127,7 +196,16 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar )
*****************************************************************************/ *****************************************************************************/
static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar )
{ {
#ifdef SYS_GNU
/* condition_signal() */
if ( p_condvar->queue.head || p_condvar->implications )
{
cond_signal( (condition_t)p_condvar );
}
return( 0 );
#else
return pthread_cond_signal( p_condvar ); return pthread_cond_signal( p_condvar );
#endif
} }
/***************************************************************************** /*****************************************************************************
...@@ -135,5 +213,11 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) ...@@ -135,5 +213,11 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar )
*****************************************************************************/ *****************************************************************************/
static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex ) static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex )
{ {
#ifdef SYS_GNU
condition_wait( (condition_t)p_condvar, (mutex_t)p_mutex );
return( 0 );
#else
return pthread_cond_wait( p_condvar, p_mutex ); return pthread_cond_wait( p_condvar, p_mutex );
#endif
} }
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <stdio.h> /* "intf_msg.h" */ #include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#include <sys/soundcard.h> /* "audio_output.h" */
#include <sys/uio.h> /* "input.h" */ #include <sys/uio.h> /* "input.h" */
#include "common.h" #include "common.h"
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> /* ntohl() */ #include <netinet/in.h> /* ntohl() */
#include <sys/soundcard.h> /* "audio_output.h" */
#include <sys/uio.h> /* "input.h" */ #include <sys/uio.h> /* "input.h" */
#include "common.h" #include "common.h"
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> /* ntohl() */ #include <netinet/in.h> /* ntohl() */
#include <sys/soundcard.h> /* "audio_output.h" */
#include <sys/uio.h> #include <sys/uio.h>
#include "config.h" #include "config.h"
......
...@@ -9,15 +9,12 @@ ...@@ -9,15 +9,12 @@
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include <errno.h> #include <errno.h> /* errno */
#include <sys/uio.h> #include <sys/uio.h> /* required */
#include <string.h> #include <string.h> /* strerror() */
#include <stdlib.h> #include <stdlib.h> /* free() */
#include <stdio.h> #include <netinet/in.h> /* ntohs() */
#include <sys/ioctl.h>
#include <net/if.h>
#include <netinet/in.h>
#include "common.h" #include "common.h"
#include "config.h" #include "config.h"
...@@ -34,22 +31,23 @@ ...@@ -34,22 +31,23 @@
#include "input_file.h" #include "input_file.h"
#include "input_network.h" #include "input_network.h"
#include "audio_output.h" #include "audio_output.h" /* aout_thread_t */
#include "audio_decoder.h" #include "audio_decoder.h" /* adec_thread_t */
#include "video.h" #include "video.h" /* picture_t (for video_output.h) */
#include "video_output.h" #include "video_output.h" /* vout_thread_t */
#include "vdec_idct.h"
#include "vdec_motion.h" #include "vdec_idct.h" /* dctelem_t (for video_parser.h) */
#include "video_decoder.h" #include "vdec_motion.h" /* f_motion_t (for video_parser.h) */
#include "vpar_blocks.h" #include "vpar_blocks.h" /* macroblock_t (for video_parser.h) */
#include "vpar_headers.h" #include "vpar_headers.h" /* sequence_t (for video_parser.h) */
#include "vpar_synchro.h" #include "vpar_synchro.h" /* video_synchro_t (for video_parser.h) */
#include "video_parser.h" #include "video_parser.h" /* vpar_thread_t */
#include "ac3_decoder.h" #include "ac3_decoder.h" /* ac3dec_t (for ac3_decoder_thread.h) */
#include "ac3_decoder_thread.h" #include "ac3_decoder_thread.h" /* ac3dec_thread_t */
#include "spu_decoder.h"
#include "spu_decoder.h" /* spudec_thread_t */
#include "main.h" #include "main.h"
......
...@@ -9,15 +9,10 @@ ...@@ -9,15 +9,10 @@
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include <errno.h>
#include <pthread.h>
#include <errno.h>
#include <stdio.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <stdlib.h> #include <stdlib.h> /* free(), realloc() */
#include <string.h> #include <string.h> /* bzero() */
#include <netinet/in.h> #include <netinet/in.h> /* ntohs() */
#include <sys/soundcard.h>
#include "common.h" #include "common.h"
#include "config.h" #include "config.h"
...@@ -29,12 +24,6 @@ ...@@ -29,12 +24,6 @@
#include "input.h" #include "input.h"
#include "input_ctrl.h" #include "input_ctrl.h"
#include "input_psi.h" #include "input_psi.h"
#include "input_vlan.h"
#include "audio_output.h"
#include "video.h"
#include "video_output.h"
#include "interface.h"
#include "main.h" #include "main.h"
......
...@@ -6,18 +6,18 @@ ...@@ -6,18 +6,18 @@
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include <errno.h> #include <errno.h> /* ENOMEM */
#include <stdio.h> #include <stdio.h> /* sprintf() */
#include <unistd.h> #include <unistd.h> /* close() */
#include <string.h> #include <string.h> /* strerror(), bzero() */
#include <stdlib.h> #include <stdlib.h> /* free() */
#include <sys/types.h> #include <arpa/inet.h> /* inet_ntoa(), inet_aton() */
#include <sys/socket.h> #include <sys/ioctl.h> /* ioctl() */
#include <netinet/in.h>
#include <arpa/inet.h> #ifdef SYS_LINUX
#include <net/if.h> #include <net/if.h> /* interface (arch-dependent) */
#include <sys/ioctl.h> #endif
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
...@@ -128,6 +128,7 @@ void input_VlanLeave( int i_vlan_id ) ...@@ -128,6 +128,7 @@ void input_VlanLeave( int i_vlan_id )
static int ZeTrucMucheFunction( int Channel) static int ZeTrucMucheFunction( int Channel)
{ {
#ifdef SYS_LINUX
int i_socket; int i_socket;
char * ipaddr; char * ipaddr;
struct ifreq interface; struct ifreq interface;
...@@ -207,6 +208,7 @@ static int ZeTrucMucheFunction( int Channel) ...@@ -207,6 +208,7 @@ static int ZeTrucMucheFunction( int Channel)
/*Close the socket */ /*Close the socket */
close( i_socket ); close( i_socket );
#endif
return 0; return 0;
} }
...@@ -3,25 +3,21 @@ ...@@ -3,25 +3,21 @@
* (c)1999 VideoLAN * (c)1999 VideoLAN
***************************************************************************** *****************************************************************************
* XXX?? * XXX??
*****************************************************************************
* Required headers:
* <netinet/in.h>
*****************************************************************************/ *****************************************************************************/
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include <netdb.h> #include <netdb.h> /* gethostbyname() */
#include <stdlib.h> #include <stdlib.h> /* free(), realloc(), atoi() */
#include <stdio.h> #include <errno.h> /* errno() */
#include <errno.h> #include <string.h> /* bzero(), bcopy() */
#include <string.h> #include <sys/ioctl.h> /* ioctl() */
#include <sys/ioctl.h> #include <arpa/inet.h> /* htons(), htonl() */
#include <sys/types.h>
#include <sys/socket.h> #ifdef SYS_LINUX
#include <netinet/in.h> #include <net/if.h> /* interface (arch-dependent) */
#include <arpa/inet.h> #endif
#include <net/if.h>
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
...@@ -107,8 +103,9 @@ int ServerPort( char *psz_addr ) ...@@ -107,8 +103,9 @@ int ServerPort( char *psz_addr )
*****************************************************************************/ *****************************************************************************/
int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name) int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name)
{ {
struct ifreq ifr_config;
int i_rc = 0; int i_rc = 0;
#ifdef SYS_LINUX
struct ifreq ifr_config;
ASSERT(p_ifdescr); ASSERT(p_ifdescr);
ASSERT(psz_name); ASSERT(psz_name);
...@@ -188,6 +185,7 @@ int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name) ...@@ -188,6 +185,7 @@ int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name)
psz_name, strerror(errno)); psz_name, strerror(errno));
return -1; return -1;
} }
#endif /* SYS_LINUX */
return i_rc; return i_rc;
} }
...@@ -202,14 +200,17 @@ int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name) ...@@ -202,14 +200,17 @@ int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name)
*****************************************************************************/ *****************************************************************************/
int ReadNetConf(int i_sockfd, net_descr_t* p_net_descr) int ReadNetConf(int i_sockfd, net_descr_t* p_net_descr)
{ {
#ifdef SYS_LINUX
struct ifreq* a_ifr_ifconf = NULL; struct ifreq* a_ifr_ifconf = NULL;
struct ifreq* p_ifr_current_if; struct ifreq* p_ifr_current_if;
struct ifconf ifc_netconf; struct ifconf ifc_netconf;
int i_if_number; int i_if_number;
int i_remaining; int i_remaining;
#endif /* SYS_LINUX */
int i_rc = 0; int i_rc = 0;
#ifdef SYS_LINUX
ASSERT(p_net_descr); ASSERT(p_net_descr);
/* Start by assuming we have few than 3 interfaces (i_if_number will /* Start by assuming we have few than 3 interfaces (i_if_number will
...@@ -284,6 +285,8 @@ int ReadNetConf(int i_sockfd, net_descr_t* p_net_descr) ...@@ -284,6 +285,8 @@ int ReadNetConf(int i_sockfd, net_descr_t* p_net_descr)
/* Don't need the a_ifr_ifconf anymore */ /* Don't need the a_ifr_ifconf anymore */
free( a_ifr_ifconf ); free( a_ifr_ifconf );
#endif /* SYS_LINUX */
return i_rc; return i_rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment