IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C Discussion :

fichiers systeme UNIx et Linux


Sujet :

C

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    104
    Détails du profil
    Informations personnelles :
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Juin 2007
    Messages : 104
    Par défaut fichiers systeme UNIx et Linux
    Bonjour a tous
    Je suis en train de porter un code Unix (Solaris 8) vers du Linux (RedHat 5). A la compilation, certaines erreurs apparaissent et notamment une qui me laisse pantois !
    Voici l'erreur :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ../src/tli.c:433: error: invalid application of ‘sizeof’ to incomplete type ‘struct opt
    et la ligne incriminée du code tli.c :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    st_opt_req.opt.len = OPTLEN(sizeof(struct opthdr) + sizeof(long)) ;
    En regardant de plus pres, la structure opthdr est definie dans le fichier systeme (/usr/include/sys/socket.h) du monde Unix.
    Quand je regarde le fichier (/usr/include/sys/socket.h) du monde Linux, il n'a pas grand chose à voir et biensur, cette structure opthdr n'y apparait pas.

    En faisant la diff. des socket.h Unix et linux, bp de differences. Mais aussi, qq points communs. J'avais dans l'idee de placer le socket.h du monde unix avec tous les .h que mon code utilise, mais je ne sais pas si c'est la bonne stratégie car il risque d'y avoir redondance de déclarations avec le socket.h du monde Linux.
    Je ne sais pas par quel bout prendre ce probleme ...
    Voici mes deux sockets (en premier, le socket.h de linux; en second, celui d'unix utilisé par mon code):

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    #ifndef	_SYS_SOCKET_H
    #define	_SYS_SOCKET_H	1
     
    #include <features.h>
     
    __BEGIN_DECLS
     
    #include <sys/uio.h>
    #define	__need_size_t
    #include <stddef.h>
     
     
    /* This operating system-specific header file defines the SOCK_*, PF_*,
       AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr',
       `struct msghdr', and `struct linger' types.  */
    #include <bits/socket.h>
     
    #ifdef __USE_BSD
    /* This is the 4.3 BSD `struct sockaddr' format, which is used as wire
       format in the grotty old 4.3 `talk' protocol.  */
    struct osockaddr
      {
        unsigned short int sa_family;
        unsigned char sa_data[14];
      };
    #endif
     
    /* The following constants should be used for the second parameter of
       `shutdown'.  */
    enum
    {
      SHUT_RD = 0,		/* No more receptions.  */
    #define SHUT_RD		SHUT_RD
      SHUT_WR,		/* No more transmissions.  */
    #define SHUT_WR		SHUT_WR
      SHUT_RDWR		/* No more receptions or transmissions.  */
    #define SHUT_RDWR	SHUT_RDWR
    };
     
    /* This is the type we use for generic socket address arguments.
     
       With GCC 2.7 and later, the funky union causes redeclarations or
       uses with any of the listed types to be allowed without complaint.
       G++ 2.7 does not support transparent unions so there we want the
       old-style declaration, too.  */
    #if defined __cplusplus || !__GNUC_PREREQ (2, 7) || !defined __USE_GNU
    # define __SOCKADDR_ARG		struct sockaddr *__restrict
    # define __CONST_SOCKADDR_ARG	__const struct sockaddr *
    #else
    /* Add more `struct sockaddr_AF' types here as necessary.
       These are all the ones I found on NetBSD and Linux.  */
    # define __SOCKADDR_ALLTYPES \
      __SOCKADDR_ONETYPE (sockaddr) \
      __SOCKADDR_ONETYPE (sockaddr_at) \
      __SOCKADDR_ONETYPE (sockaddr_ax25) \
      __SOCKADDR_ONETYPE (sockaddr_dl) \
      __SOCKADDR_ONETYPE (sockaddr_eon) \
      __SOCKADDR_ONETYPE (sockaddr_in) \
      __SOCKADDR_ONETYPE (sockaddr_in6) \
      __SOCKADDR_ONETYPE (sockaddr_inarp) \
      __SOCKADDR_ONETYPE (sockaddr_ipx) \
      __SOCKADDR_ONETYPE (sockaddr_iso) \
      __SOCKADDR_ONETYPE (sockaddr_ns) \
      __SOCKADDR_ONETYPE (sockaddr_un) \
      __SOCKADDR_ONETYPE (sockaddr_x25)
     
    # define __SOCKADDR_ONETYPE(type) struct type *__restrict __##type##__;
    typedef union { __SOCKADDR_ALLTYPES
    	      } __SOCKADDR_ARG __attribute__ ((__transparent_union__));
    # undef __SOCKADDR_ONETYPE
    # define __SOCKADDR_ONETYPE(type) __const struct type *__restrict __##type##__;
    typedef union { __SOCKADDR_ALLTYPES
    	      } __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__));
    # undef __SOCKADDR_ONETYPE
    #endif
     
     
    /* Create a new socket of type TYPE in domain DOMAIN, using
       protocol PROTOCOL.  If PROTOCOL is zero, one is chosen automatically.
       Returns a file descriptor for the new socket, or -1 for errors.  */
    extern int socket (int __domain, int __type, int __protocol) __THROW;
     
    /* Create two new sockets, of type TYPE in domain DOMAIN and using
       protocol PROTOCOL, which are connected to each other, and put file
       descriptors for them in FDS[0] and FDS[1].  If PROTOCOL is zero,
       one will be chosen automatically.  Returns 0 on success, -1 for errors.  */
    extern int socketpair (int __domain, int __type, int __protocol,
    		       int __fds[2]) __THROW;
     
    /* Give the socket FD the local address ADDR (which is LEN bytes long).  */
    extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len)
         __THROW;
     
    /* Put the local address of FD into *ADDR and its length in *LEN.  */
    extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
    			socklen_t *__restrict __len) __THROW;
     
    /* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
       For connectionless socket types, just set the default address to send to
       and the only address from which to accept transmissions.
       Return 0 on success, -1 for errors.
     
       This function is a cancellation point and therefore not marked with
       __THROW.  */
    extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len);
     
    /* Put the address of the peer connected to socket FD into *ADDR
       (which is *LEN bytes long), and its actual length into *LEN.  */
    extern int getpeername (int __fd, __SOCKADDR_ARG __addr,
    			socklen_t *__restrict __len) __THROW;
     
     
    /* Send N bytes of BUF to socket FD.  Returns the number sent or -1.
     
       This function is a cancellation point and therefore not marked with
       __THROW.  */
    extern ssize_t send (int __fd, __const void *__buf, size_t __n, int __flags);
     
    /* Read N bytes into BUF from socket FD.
       Returns the number read or -1 for errors.
     
       This function is a cancellation point and therefore not marked with
       __THROW.  */
    extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags);
     
    /* Send N bytes of BUF on socket FD to peer at address ADDR (which is
       ADDR_LEN bytes long).  Returns the number sent, or -1 for errors.
     
       This function is a cancellation point and therefore not marked with
       __THROW.  */
    extern ssize_t sendto (int __fd, __const void *__buf, size_t __n,
    		       int __flags, __CONST_SOCKADDR_ARG __addr,
    		       socklen_t __addr_len);
     
    /* Read N bytes into BUF through socket FD.
       If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
       the sender, and store the actual size of the address in *ADDR_LEN.
       Returns the number of bytes read or -1 for errors.
     
       This function is a cancellation point and therefore not marked with
       __THROW.  */
    extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
    			 int __flags, __SOCKADDR_ARG __addr,
    			 socklen_t *__restrict __addr_len);
     
     
    /* Send a message described MESSAGE on socket FD.
       Returns the number of bytes sent, or -1 for errors.
     
       This function is a cancellation point and therefore not marked with
       __THROW.  */
    extern ssize_t sendmsg (int __fd, __const struct msghdr *__message,
    			int __flags);
     
    /* Receive a message as described by MESSAGE from socket FD.
       Returns the number of bytes read or -1 for errors.
     
       This function is a cancellation point and therefore not marked with
       __THROW.  */
    extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags);
     
     
    /* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
       into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
       actual length.  Returns 0 on success, -1 for errors.  */
    extern int getsockopt (int __fd, int __level, int __optname,
    		       void *__restrict __optval,
    		       socklen_t *__restrict __optlen) __THROW;
     
    /* Set socket FD's option OPTNAME at protocol level LEVEL
       to *OPTVAL (which is OPTLEN bytes long).
       Returns 0 on success, -1 for errors.  */
    extern int setsockopt (int __fd, int __level, int __optname,
    		       __const void *__optval, socklen_t __optlen) __THROW;
     
     
    /* Prepare to accept connections on socket FD.
       N connection requests will be queued before further requests are refused.
       Returns 0 on success, -1 for errors.  */
    extern int listen (int __fd, int __n) __THROW;
     
    /* Await a connection on socket FD.
       When a connection arrives, open a new socket to communicate with it,
       set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
       peer and *ADDR_LEN to the address's actual length, and return the
       new socket's descriptor, or -1 for errors.
     
       This function is a cancellation point and therefore not marked with
       __THROW.  */
    extern int accept (int __fd, __SOCKADDR_ARG __addr,
    		   socklen_t *__restrict __addr_len);
     
    /* Shut down all or part of the connection open on socket FD.
       HOW determines what to shut down:
         SHUT_RD   = No more receptions;
         SHUT_WR   = No more transmissions;
         SHUT_RDWR = No more receptions or transmissions.
       Returns 0 on success, -1 for errors.  */
    extern int shutdown (int __fd, int __how) __THROW;
     
     
    #ifdef __USE_XOPEN2K
    /* Determine wheter socket is at a out-of-band mark.  */
    extern int sockatmark (int __fd) __THROW;
    #endif
     
     
    #ifdef __USE_MISC
    /* FDTYPE is S_IFSOCK or another S_IF* macro defined in <sys/stat.h>;
       returns 1 if FD is open on an object of the indicated type, 0 if not,
       or -1 for errors (setting errno).  */
    extern int isfdtype (int __fd, int __fdtype) __THROW;
    #endif
     
     
    /* Define some macros helping to catch buffer overflows.  */
    #if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
    # include <bits/socket2.h>
    #endif
     
    __END_DECLS
     
    #endif /* sys/socket.h */

    socket.h (sous Unix) utilisé par mon code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    #ifndef	_SYS_SOCKET_H
    #define	_SYS_SOCKET_H
     
    #pragma ident	"@(#)socket.h	1.30	97/01/20 SMI"	/* SVr4.0 1.10	*/
     
    /*
     * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     *		PROPRIETARY NOTICE (Combined)
     *
     * This source code is unpublished proprietary information
     * constituting, or derived under license from AT&T's UNIX(r) System V.
     * In addition, portions of such source code were derived from Berkeley
     * 4.3 BSD under license from the Regents of the University of
     * California.
     *
     *
     *
     *		Copyright Notice
     *
     * Notice of copyright on this source code product does not indicate
     * publication.
     *
     *	(c) 1986,1987,1988,1989  Sun Microsystems, Inc
     *	(c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
     *		All rights reserved.
     *
     */
     
    #include <sys/types.h>
    #include <sys/uio.h>
    #include <sys/feature_tests.h>
    #ifndef	_KERNEL
    #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
    #include <sys/netconfig.h>
    #endif	/* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
    #endif	/* !_KERNEL */
     
    #ifdef	__cplusplus
    extern "C" {
    #endif
     
    #ifndef	_SA_FAMILY_T
    #define	_SA_FAMILY_T
    typedef unsigned short	sa_family_t;
    #endif
     
    /*
     * Definitions related to sockets: types, address families, options.
     */
     
    #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
    #ifndef	NC_TPI_CLTS
    #define	NC_TPI_CLTS	1		/* must agree with netconfig.h */
    #define	NC_TPI_COTS	2		/* must agree with netconfig.h */
    #define	NC_TPI_COTS_ORD	3		/* must agree with netconfig.h */
    #define	NC_TPI_RAW	4		/* must agree with netconfig.h */
    #endif	/* !NC_TPI_CLTS */
    #endif	/* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
     
    /*
     * Types
     */
    #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
    #define	SOCK_STREAM	NC_TPI_COTS	/* stream socket */
    #define	SOCK_DGRAM	NC_TPI_CLTS	/* datagram socket */
    #define	SOCK_RAW	NC_TPI_RAW	/* raw-protocol interface */
    #else
    #define	SOCK_STREAM	2		/* stream socket */
    #define	SOCK_DGRAM	1		/* datagram socket */
    #define	SOCK_RAW	4		/* raw-protocol interface */
    #endif	/* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
    #define	SOCK_RDM	5		/* reliably-delivered message */
    #define	SOCK_SEQPACKET	6		/* sequenced packet stream */
     
    /*
     * Option flags per-socket.
     */
    #define	SO_DEBUG	0x0001		/* turn on debugging info recording */
    #define	SO_ACCEPTCONN	0x0002		/* socket has had listen() */
    #define	SO_REUSEADDR	0x0004		/* allow local address reuse */
    #define	SO_KEEPALIVE	0x0008		/* keep connections alive */
    #define	SO_DONTROUTE	0x0010		/* just use interface addresses */
    #define	SO_BROADCAST	0x0020		/* permit sending of broadcast msgs */
    #define	SO_USELOOPBACK	0x0040		/* bypass hardware when possible */
    #define	SO_LINGER	0x0080		/* linger on close if data present */
    #define	SO_OOBINLINE	0x0100		/* leave received OOB data in line */
    #define	SO_DGRAM_ERRIND	0x0200		/* Application wants delayed error */
     
    /*
     * N.B.: The following definition is present only for compatibility
     * with release 3.0.  It will disappear in later releases.
     */
    #define	SO_DONTLINGER	(~SO_LINGER)	/* ~SO_LINGER */
     
    /*
     * Additional options, not kept in so_options.
     */
    #define	SO_SNDBUF	0x1001		/* send buffer size */
    #define	SO_RCVBUF	0x1002		/* receive buffer size */
    #define	SO_SNDLOWAT	0x1003		/* send low-water mark */
    #define	SO_RCVLOWAT	0x1004		/* receive low-water mark */
    #define	SO_SNDTIMEO	0x1005		/* send timeout */
    #define	SO_RCVTIMEO	0x1006		/* receive timeout */
    #define	SO_ERROR	0x1007		/* get error status and clear */
    #define	SO_TYPE		0x1008		/* get socket type */
    #define	SO_PROTOTYPE	0x1009		/* get/set protocol type */
     
    /* "Socket"-level control message types: */
    #define	SCM_RIGHTS	0x1010		/* access rights (array of int) */
     
    #define	SO_STATE	0x2000		/* Internal: get so_state */
    #ifdef	_KERNEL
    #define	SO_SRCADDR	0x2001		/* Internal: AF_UNIX source address */
    #define	SO_FILEP	0x2002		/* Internal: AF_UNIX file pointer */
    #define	SO_UNIX_CLOSE	0x2003		/* Internal: AF_UNIX peer closed */
    #endif	/* _KERNEL */
     
    /*
     * Structure used for manipulating linger option.
     */
    struct	linger {
    	int	l_onoff;		/* option on/off */
    	int	l_linger;		/* linger time */
    };
     
    /*
     * Level number for (get/set)sockopt() to apply to socket itself.
     */
    #define	SOL_SOCKET	0xffff		/* options for socket level */
     
    /*
     * Address families.
     */
    #define	AF_UNSPEC	0		/* unspecified */
    #define	AF_UNIX		1		/* local to host (pipes, portals) */
    #define	AF_INET		2		/* internetwork: UDP, TCP, etc. */
    #define	AF_IMPLINK	3		/* arpanet imp addresses */
    #define	AF_PUP		4		/* pup protocols: e.g. BSP */
    #define	AF_CHAOS	5		/* mit CHAOS protocols */
    #define	AF_NS		6		/* XEROX NS protocols */
    #define	AF_NBS		7		/* nbs protocols */
    #define	AF_ECMA		8		/* european computer manufacturers */
    #define	AF_DATAKIT	9		/* datakit protocols */
    #define	AF_CCITT	10		/* CCITT protocols, X.25 etc */
    #define	AF_SNA		11		/* IBM SNA */
    #define	AF_DECnet	12		/* DECnet */
    #define	AF_DLI		13		/* Direct data link interface */
    #define	AF_LAT		14		/* LAT */
    #define	AF_HYLINK	15		/* NSC Hyperchannel */
    #define	AF_APPLETALK	16		/* Apple Talk */
    #define	AF_NIT		17		/* Network Interface Tap */
    #define	AF_802		18		/* IEEE 802.2, also ISO 8802 */
    #define	AF_OSI		19		/* umbrella for all families used */
    #define	AF_X25		20		/* CCITT X.25 in particular */
    #define	AF_OSINET	21		/* AFI = 47, IDI = 4 */
    #define	AF_GOSIP	22		/* U.S. Government OSI */
    #define	AF_IPX		23		/* Novell Internet Protocol */
    #define	AF_ROUTE	24		/* Internal Routing Protocol */
    #define	AF_LINK		25		/* Link-layer interface */
     
    #define	AF_MAX		25
     
    /*
     * Structure used by kernel to store most
     * addresses.
     */
    struct sockaddr {
    	sa_family_t	sa_family;	/* address family */
    	char		sa_data[14];	/* up to 14 bytes of direct address */
    };
     
    /*
     * Protocol families, same as address families for now.
     */
    #define	PF_UNSPEC	AF_UNSPEC
    #define	PF_UNIX		AF_UNIX
    #define	PF_INET		AF_INET
    #define	PF_IMPLINK	AF_IMPLINK
    #define	PF_PUP		AF_PUP
    #define	PF_CHAOS	AF_CHAOS
    #define	PF_NS		AF_NS
    #define	PF_NBS		AF_NBS
    #define	PF_ECMA		AF_ECMA
    #define	PF_DATAKIT	AF_DATAKIT
    #define	PF_CCITT	AF_CCITT
    #define	PF_SNA		AF_SNA
    #define	PF_DECnet	AF_DECnet
    #define	PF_DLI		AF_DLI
    #define	PF_LAT		AF_LAT
    #define	PF_HYLINK	AF_HYLINK
    #define	PF_APPLETALK	AF_APPLETALK
    #define	PF_NIT		AF_NIT
    #define	PF_802		AF_802
    #define	PF_OSI		AF_OSI
    #define	PF_X25		AF_X25
    #define	PF_OSINET	AF_OSINET
    #define	PF_GOSIP	AF_GOSIP
    #define	PF_IPX		AF_IPX
    #define	PF_ROUTE	AF_ROUTE
    #define	PF_LINK		AF_LINK
     
    #define	PF_MAX		AF_MAX
     
    /*
     * Maximum queue length specifiable by listen.
     */
    #define	SOMAXCONN	5
     
    /*
     * Message header for recvmsg and sendmsg calls.
     */
    #if !defined(_XPG4_2)
    struct msghdr {
    	caddr_t	msg_name;		/* optional address */
    	int	msg_namelen;		/* size of address */
    	struct	iovec *msg_iov;		/* scatter/gather array */
    	int	msg_iovlen;		/* # elements in msg_iov */
    	caddr_t	msg_accrights;		/* access rights sent/received */
    	int	msg_accrightslen;
    };
    #else
    struct msghdr {
    	void	*msg_name;		/* optional address */
    	size_t	msg_namelen;		/* size of address */
    	struct	iovec *msg_iov;		/* scatter/gather array */
    	int	msg_iovlen;		/* # elements in msg_iov */
    	void	*msg_control;		/* ancillary data */
    	size_t	msg_controllen;		/* ancillary data buffer len */
    	int	msg_flags;		/* flags on received message */
    };
    #endif	/* !defined(_XPG4_2) */
     
    #ifdef	_KERNEL
    /*
     *	N.B.:  we assume that omsghdr and nmsghdr are isomorphic, with
     *	the sole exception that nmsghdr has the additional msg_flags
     *	field at the end.
     */
    struct omsghdr {
    	caddr_t	msg_name;		/* optional address */
    	int	msg_namelen;		/* size of address */
    	struct	iovec *msg_iov;		/* scatter/gather array */
    	int	msg_iovlen;		/* # elements in msg_iov */
    	caddr_t	msg_accrights;		/* access rights sent/received */
    	int	msg_accrightslen;
    };
     
    struct nmsghdr {
    	void	*msg_name;		/* optional address */
    	size_t	msg_namelen;		/* size of address */
    	struct	iovec *msg_iov;		/* scatter/gather array */
    	int	msg_iovlen;		/* # elements in msg_iov */
    	void	*msg_control;		/* ancillary data */
    	size_t	msg_controllen;		/* ancillary data buffer len */
    	int	msg_flags;		/* flags on received message */
    };
    #endif	/* _KERNEL */
     
    #define	MSG_OOB		0x1		/* process out-of-band data */
    #define	MSG_PEEK	0x2		/* peek at incoming message */
    #define	MSG_DONTROUTE	0x4		/* send without using routing tables */
    /* Added for XPGv2 compliance */
    #define	MSG_EOR		0x8		/* Terminates a record */
    #define	MSG_CTRUNC	0x10		/* Control data truncated */
    #define	MSG_TRUNC	0x20		/* Normal data truncated */
    #define	MSG_WAITALL	0x40		/* Wait for complete recv or error */
    /* End of XPGv2 compliance */
    #define	MSG_DONTWAIT	0x80		/* Don't block for this recv */
    #define	MSG_XPG4_2	0x8000		/* Private: XPG4.2 flag */
     
    #define	MSG_MAXIOVLEN	16
     
    /* Added for XPGv2 compliance */
    #define	SHUT_RD		0
    #define	SHUT_WR		1
    #define	SHUT_RDWR	2
     
    struct cmsghdr {
    	size_t	cmsg_len;	/* data byte count, including hdr */
    	int	cmsg_level;	/* originating protocol */
    	int	cmsg_type;	/* protocol-specific type */
    };
    #if defined(_XPG4_2)
    #define	_CMSG_ALIGN(x)		(((x) + _MAX_ALIGNMENT - 1) & \
    				    ~(_MAX_ALIGNMENT - 1))
    #define	CMSG_DATA(c)		((unsigned char *) (((struct cmsghdr *) c) + 1))
    #define	CMSG_FIRSTHDR(m)	((struct cmsghdr *) ((m)->msg_control))
    #define	CMSG_NXTHDR(m, c)						\
    	((((uint_t) c) + ((struct cmsghdr *) c)->cmsg_len +		\
    	    sizeof (struct cmsghdr)) >					\
    	    (((uint_t) ((struct msghdr *) (m))->msg_control) +		\
    	    ((uint_t) ((struct msghdr *) (m))->msg_controllen)) ?	\
    	    ((struct cmsghdr *) 0) :					\
    	    ((struct cmsghdr *) (((char *) c) +				\
    	    _CMSG_ALIGN((((struct cmsghdr *) c)->cmsg_len)))))
    #endif	/* _XPG4_2 */
     
    /*
     * An option specification consists of an opthdr, followed by the value of
     * the option.  An options buffer contains one or more options.  The len
     * field of opthdr specifies the length of the option value in bytes.  This
     * length must be a multiple of sizeof (long) (use OPTLEN macro).
     */
     
    #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
    struct opthdr {
    	long	level;		/* protocol level affected */
    	long	name;		/* option to modify */
    	long	len;		/* length of option value */
    };
     
    #define	OPTLEN(x) ((((x) + sizeof (long) - 1) / sizeof (long)) * sizeof (long))
    #define	OPTVAL(opt) ((char *)(opt + 1))
    #endif	/* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
     
    #ifndef	_KERNEL
    #ifdef	__STDC__
    #ifdef	_XPG4_2
    extern int accept(int, struct sockaddr *, size_t *);
    extern int bind(int, const struct sockaddr *, size_t);
    extern int connect(int, const struct sockaddr *, size_t);
    extern int getpeername(int, struct sockaddr *, size_t *);
    extern int getsockname(int, struct sockaddr *, size_t *);
    extern int getsockopt(int, int, int, void *, size_t *);
    #else
    extern int accept(int, struct sockaddr *, int *);
    extern int bind(int, const struct sockaddr *, int);
    extern int connect(int, struct sockaddr *, int);
    extern int getpeername(int, struct sockaddr *, int *);
    extern int getsockname(int, struct sockaddr *, int *);
    extern int getsockopt(int, int, int, char *, int *);
    #endif	/* _XPG4_2 */
    extern int listen(int, int);
    #ifdef	_XPG4_2
    extern ssize_t recv(int, void *, size_t, int);
    extern ssize_t recvfrom(int, void *, size_t, int, struct sockaddr *, size_t *);
    extern ssize_t recvmsg(int, struct msghdr *, int);
    extern ssize_t send(int, const void *, size_t, int);
    extern ssize_t sendmsg(int, const struct msghdr *, int);
    extern ssize_t sendto(int, const void *, size_t, int, const struct sockaddr *,
    		size_t);
    extern int setsockopt(int, int, int, const void *, size_t);
    extern int socketpair(int, int, int, int *);
    #else
    extern int recv(int, char *, int, int);
    extern int recvfrom(int, char *, int, int, struct sockaddr *, int *);
    extern int recvmsg(int, struct msghdr *, int);
    extern int send(int, const char *, int, int);
    extern int sendmsg(int, const struct msghdr *, int);
    extern int sendto(int, const char *, int, int, const struct sockaddr *, int);
    extern int setsockopt(int, int, int, const char *, int);
    extern int socketpair(int, int, int, int *);
    #endif	/* _XPG4_2 */
    extern int shutdown(int, int);
    extern int socket(int, int, int);
    #else	/* __STDC__ */
    extern int accept();
    extern int bind();
    extern int connect();
    extern int getpeername();
    extern int getsockname();
    extern int getsockopt();
    extern int listen();
    extern int recv();
    extern int recvfrom();
    extern int send();
    extern int sendto();
    extern int setsockopt();
    extern int socket();
    extern int recvmsg();
    extern int sendmsg();
    extern int shutdown();
    extern int socketpair();
    #endif	/* __STDC__ */
    #endif	/* _KERNEL */
     
    #ifdef	_XPG4_2
    #ifdef	__PRAGMA_REDEFINE_EXTNAME
    #pragma redefine_extname bind __xnet_bind
    #pragma redefine_extname listen __xnet_listen
    #pragma redefine_extname connect __xnet_connect
    #pragma redefine_extname recvmsg __xnet_recvmsg
    #pragma redefine_extname sendmsg __xnet_sendmsg
    #pragma redefine_extname sendto __xnet_sendto
    #pragma redefine_extname socket __xnet_socket
    #pragma redefine_extname socketpair __xnet_socketpair
    #pragma redefine_extname getsockopt __xnet_getsockopt
    #else	/* __PRAGMA_REDEFINE_EXTNAME */
    #define	bind	__xnet_bind
    #define	listen	__xnet_listen
    #define	connect	__xnet_connect
    #define	recvmsg	__xnet_recvmsg
    #define	sendmsg	__xnet_sendmsg
    #define	sendto	__xnet_sendto
    #define	socket	__xnet_socket
    #define	socketpair	__xnet_socketpair
    #define	getsockopt	__xnet_getsockopt
    #endif	/* __PRAGMA_REDEFINE_EXTNAME */
     
    #endif	/* _XPG4_2 */
     
    #ifdef	__cplusplus
    }
    #endif
     
    #endif	/* _SYS_SOCKET_H */
    La tache semble rude et trop complexe pour moi ! Avez vous des idees sur comment je pourrais traiter le pb ?

    Merci a vous !

  2. #2
    Membre prolifique
    Avatar de Sve@r
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2006
    Messages
    12 830
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Oise (Picardie)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Février 2006
    Messages : 12 830
    Billets dans le blog
    1
    Par défaut
    J'ai déjà eu le problème en prog socket que j'ai voulu porter sous Linux. Effectivement certaines spécificités étant différentes sous Linux, j'ai dû adapter mon code. Toutefois, à la différence de toi, c'est que c'était mon code que je portais donc si qqchose que j'utilisais sous unix ne se retrouvait pas sous Linux, ben je savais où aller pour le retrouver. Ou bien si ce qqchose n'était pas vraiment important, je pouvais le virer sans crainte.

    Déjà il ne faut surtout pas apporter les .h de ton Solaris. Car les .h sont adaptés à ton système. Si la structure opthdr n'existe pas dans le .h Linux, ce n'est pas en amenant le .h Solaris que tu vas la créer. Ou plutôt tu créeras une structure inutilisée. Et tu risques de perdre des outils utilisés mais dont t'auras pas les headers. C'est un peu comme mettre une boite de vitesse de voiture de course sur un autocar quoi. Ce n'est pas pour ça que tu transformeras ton autocar en voiture de course...

    Donc il te faut aller sur Solaris et voir dans les man à quoi sert ce opthdr (opt header ?) et voir ensuite sur Linux si qqchose le remplace ou alors si ça n'aurait pas par hasard été supprimé...
    Mon Tutoriel sur la programmation «Python»
    Mon Tutoriel sur la programmation «Shell»
    Sinon il y en a pleins d'autres. N'oubliez pas non plus les différentes faq disponibles sur ce site
    Et on poste ses codes entre balises [code] et [/code]

Discussions similaires

  1. Comparaisons systemes unix linux
    Par atavir dans le forum Unix
    Réponses: 3
    Dernier message: 09/02/2015, 21h02
  2. Registre Fichiers systemes et barre des tâches
    Par cartonis dans le forum Autres Logiciels
    Réponses: 16
    Dernier message: 21/08/2009, 03h45
  3. Command unix ou linux (fedora): lancer un fichier .exe
    Par corseb-delete dans le forum Shell et commandes GNU
    Réponses: 5
    Dernier message: 06/04/2007, 11h29
  4. Est il possible de faire planter un système Unix
    Par Patrick PETIT dans le forum Administration système
    Réponses: 15
    Dernier message: 15/06/2004, 15h16
  5. Réponses: 2
    Dernier message: 25/10/2002, 22h19

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo