一个关于段异常的有关问题 大神啊
一个关于段错误的问题 大神求助啊~!~!~!~!~!~
本人菜鸟一枚,在对一个工程改动的时候,编译无措,但运行时就提示段错误,确定是自己改动的地方有问题 ,但不知具体何因,我把相关代码取出来单独编译,依然是编译无措,运行有段错误,大神帮帮忙,菜鸟不甚感激,代码如下
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
struct ofp_action_output {
uint16_t type; /* OFPAT_OUTPUT. */
uint16_t len; /* Length is 8. */
uint16_t port; /* Output port. */
uint16_t max_len; /* Max length to send to controller. */
};
struct list
{
struct list *prev; /* Previous list element. */
struct list *next; /* Next list element. */
};
struct ofp_action_header {
uint16_t type; /* One of OFPAT_*. */
uint16_t len; /* Length of action, including this
header. This is the length of action,
including any padding to make it
64-bit aligned. */
uint8_t pad[4];
};
struct sine_sw_flow_actions {
size_t actions_len;
struct ofp_action_header actions[0];
};
struct sine_flow {
uint16_t in_port;
uint16_t sid[10]; /* sevice identification*/
uint16_t nid_src[8]; /* source network device identification */
uint16_t nid_dst[8]; /* destination network device identification */
};
struct sine_sw_flow_key {
struct sine_flow flow; /* Flow data (in network byte order). */
uint32_t wildcards; /* Wildcard fields (in host byte order). */
};
struct sine_sw_flow {
struct sine_sw_flow_key key;
uint64_t cookie; /* Opaque controller-issued identifier. */
uint16_t priority; /* Only used on entries with wildcards. */
uint16_t idle_timeout; /* Idle time before discarding (seconds). */
uint16_t hard_timeout; /* Hard expiration time (seconds) */
uint64_t used; /* Last used time. */
uint64_t created; /* When the flow was created. */
uint64_t packet_count; /* Number of packets seen. */
uint64_t byte_count; /* Number of bytes seen. */
uint8_t reason; /* Reason flow removed (one of OFPRR_*). */
uint8_t send_flow_rem; /* Send a flow removed to the controller */
uint8_t emerg_flow; /* Emergency flow indicator */
struct sine_sw_flow_actions *sf_acts;
/* Private to table implementations. */
struct list node;
本人菜鸟一枚,在对一个工程改动的时候,编译无措,但运行时就提示段错误,确定是自己改动的地方有问题 ,但不知具体何因,我把相关代码取出来单独编译,依然是编译无措,运行有段错误,大神帮帮忙,菜鸟不甚感激,代码如下
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
struct ofp_action_output {
uint16_t type; /* OFPAT_OUTPUT. */
uint16_t len; /* Length is 8. */
uint16_t port; /* Output port. */
uint16_t max_len; /* Max length to send to controller. */
};
struct list
{
struct list *prev; /* Previous list element. */
struct list *next; /* Next list element. */
};
struct ofp_action_header {
uint16_t type; /* One of OFPAT_*. */
uint16_t len; /* Length of action, including this
header. This is the length of action,
including any padding to make it
64-bit aligned. */
uint8_t pad[4];
};
struct sine_sw_flow_actions {
size_t actions_len;
struct ofp_action_header actions[0];
};
struct sine_flow {
uint16_t in_port;
uint16_t sid[10]; /* sevice identification*/
uint16_t nid_src[8]; /* source network device identification */
uint16_t nid_dst[8]; /* destination network device identification */
};
struct sine_sw_flow_key {
struct sine_flow flow; /* Flow data (in network byte order). */
uint32_t wildcards; /* Wildcard fields (in host byte order). */
};
struct sine_sw_flow {
struct sine_sw_flow_key key;
uint64_t cookie; /* Opaque controller-issued identifier. */
uint16_t priority; /* Only used on entries with wildcards. */
uint16_t idle_timeout; /* Idle time before discarding (seconds). */
uint16_t hard_timeout; /* Hard expiration time (seconds) */
uint64_t used; /* Last used time. */
uint64_t created; /* When the flow was created. */
uint64_t packet_count; /* Number of packets seen. */
uint64_t byte_count; /* Number of bytes seen. */
uint8_t reason; /* Reason flow removed (one of OFPRR_*). */
uint8_t send_flow_rem; /* Send a flow removed to the controller */
uint8_t emerg_flow; /* Emergency flow indicator */
struct sine_sw_flow_actions *sf_acts;
/* Private to table implementations. */
struct list node;