Browse Source

bsd and macosx compatibility

master
Felix von Leitner 20 years ago
parent
commit
ce651faa1e
  1. 6
      CHANGES
  2. 4
      mmap.h
  3. 2
      mmap/mmap_shared.c
  4. 1
      socket/socket_accept4.c
  5. 2
      socket/socket_accept6.c
  6. 1
      socket/socket_bind4.c
  7. 1
      socket/socket_bind4_reuse.c
  8. 2
      socket/socket_bind6.c
  9. 1
      socket/socket_bind6_reuse.c
  10. 3
      socket/socket_connect6.c
  11. 1
      socket/socket_connected.c
  12. 1
      socket/socket_listen.c
  13. 1
      socket/socket_local6.c
  14. 2
      socket/socket_mcjoin6.c
  15. 2
      socket/socket_mcleave6.c
  16. 2
      socket/socket_recv6.c
  17. 1
      socket/socket_remote6.c
  18. 4
      socket/socket_send6.c
  19. 1
      socket/socket_tryreservein.c
  20. 4
      uint16.h
  21. 4
      uint32.h

6
CHANGES

@ -1,3 +1,9 @@
0.8:
BSD compatibility.
fix mmap_shared.
ranlib.
s/EPROTO/EPROTONOSUPPORT/.
0.7:
add buffer_putspace
fix b0read prototype in buffer/buffer_0*

4
mmap.h

@ -8,10 +8,10 @@ extern char* mmap_read(const char *filename,unsigned long* filesize);
/* open file for writing, mmap whole file privately (copy on write),
* close file, write length of map in filesize and return pointer to
* map. */
extern int mmap_write(const char *filename,unsigned long* filesize);
extern char* mmap_write(const char *filename,unsigned long* filesize);
/* open file for writing, mmap whole file shared, close file, write
* length of map in filesize and return pointer to map. */
extern int mmap_shared(const char *filename,unsigned long* filesize);
extern char* mmap_shared(const char *filename,unsigned long* filesize);
#endif

2
mmap/mmap_shared.c

@ -4,7 +4,7 @@
#include "open.h"
#include "mmap.h"
extern char* mmap_private(const char* filename,unsigned long* filesize) {
extern char* mmap_shared(const char* filename,unsigned long* filesize) {
int fd=open_read(filename);
char *map;
if (fd>=0) {

1
socket/socket_accept4.c

@ -1,3 +1,4 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "socket.h"

2
socket/socket_accept6.c

@ -1,11 +1,11 @@
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "byte.h"
#include "socket.h"
#include "ip6.h"
#include "haveip6.h"
#include "error.h"
int socket_accept6(int s,char ip[16],uint16 *port,uint32 *scope_id)
{

1
socket/socket_bind4.c

@ -1,3 +1,4 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "byte.h"

1
socket/socket_bind4_reuse.c

@ -1,3 +1,4 @@
#include <sys/types.h>
#include <sys/socket.h>
#include "socket.h"

2
socket/socket_bind6.c

@ -26,7 +26,7 @@ int socket_bind6(int s,const char ip[16],uint16 port,uint32 scope_id)
return bind(s,(struct sockaddr *) &sa,sizeof sa);
#else
errno=EPROTO;
errno=EPROTONOSUPPORT;
return -1;
#endif
}

1
socket/socket_bind6_reuse.c

@ -1,3 +1,4 @@
#include <sys/types.h>
#include <sys/socket.h>
#include "socket.h"

3
socket/socket_connect6.c

@ -7,7 +7,6 @@
#include "socket.h"
#include "ip6.h"
#include "haveip6.h"
#include "error.h"
#include "uint32.h"
#include "ip4.h"
@ -33,7 +32,7 @@ int socket_connect6(int s,const char ip[16],uint16 port,uint32 scope_id)
return connect(s,(struct sockaddr *) &sa,sizeof sa);
#else
errno=EPROTO;
errno=EPROTONOSUPPORT;
return -1;
#endif
}

1
socket/socket_connected.c

@ -1,3 +1,4 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "socket.h"

1
socket/socket_listen.c

@ -1,3 +1,4 @@
#include <sys/types.h>
#include <sys/socket.h>
int socket_listen(int s,unsigned int backlog) {

1
socket/socket_local6.c

@ -6,7 +6,6 @@
#include "socket.h"
#include "ip6.h"
#include "haveip6.h"
#include "error.h"
#include "uint32.h"
int socket_local6(int s,char ip[16],uint16 *port,uint32 *scope_id)

2
socket/socket_mcjoin6.c

@ -28,7 +28,7 @@ int socket_mcjoin6(int s,const char ip[16],int interface)
opt.ipv6mr_interface=interface;
return setsockopt(s,IPPROTO_IPV6,IPV6_ADD_MEMBERSHIP,&opt,sizeof opt);
#else
errno=EPROTO;
errno=EPROTONOSUPPORT;
return -1;
#endif
}

2
socket/socket_mcleave6.c

@ -28,7 +28,7 @@ int socket_mcleave6(int s,const char ip[16])
opt.ipv6mr_interface=0;
return setsockopt(s,IPPROTO_IPV6,IPV6_DROP_MEMBERSHIP,&opt,sizeof opt);
#else
errno=EPROTO;
errno=EPROTONOSUPPORT;
return -1;
#endif
}

2
socket/socket_recv6.c

@ -1,11 +1,11 @@
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "byte.h"
#include "socket.h"
#include "ip6.h"
#include "haveip6.h"
#include "error.h"
int socket_recv6(int s,char *buf,unsigned int len,char ip[16],uint16 *port,uint32 *scope_id)
{

1
socket/socket_remote6.c

@ -6,7 +6,6 @@
#include "socket.h"
#include "ip6.h"
#include "haveip6.h"
#include "error.h"
#include "uint32.h"
int socket_remote6(int s,char ip[16],uint16 *port,uint32 *scope_id)

4
socket/socket_send6.c

@ -26,7 +26,7 @@ int socket_send6(int s,const char *buf,unsigned int len,const char ip[16],uint16
if (byte_equal(ip,16,V6loopback))
return socket_send4(s,buf,len,ip4loopback,port);
#ifdef LIBC_HAS_IP6
errno=EPROTO;
errno=EPROTONOSUPPORT;
return -1;
}
si.sin6_family = AF_INET6;
@ -34,7 +34,7 @@ int socket_send6(int s,const char *buf,unsigned int len,const char ip[16],uint16
byte_copy((char *) &si.sin6_addr,16,ip);
return sendto(s,buf,len,0,(struct sockaddr *) &si,sizeof si);
#else
errno=EPROTO;
errno=EPROTONOSUPPORT;
return -1;
#endif
}

1
socket/socket_tryreservein.c

@ -1,3 +1,4 @@
#include <sys/types.h>
#include <sys/socket.h>
#include "socket.h"

4
uint16.h

@ -5,6 +5,10 @@
typedef unsigned short uint16;
#ifndef __linux__
#define NO_UINT16_MACROS
#endif
#ifdef NO_UINT16_MACROS
extern void uint16_pack(char *out,uint16 in);
extern void uint16_pack_big(char *out,uint16 in);

4
uint32.h

@ -3,6 +3,10 @@
typedef unsigned int uint32;
#ifndef __linux__
#define NO_UINT32_MACROS
#endif
#ifdef NO_UINT32_MACROS
extern void uint32_pack(char *out,uint32 in);
extern void uint32_pack_big(char *out,uint32 in);

Loading…
Cancel
Save