bsd and macosx compatibility

master
leitner 24 years ago
parent 3683655654
commit 8ecb47a608

@ -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*

@ -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

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

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

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

@ -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,3 +1,4 @@
#include <sys/types.h>
#include <sys/socket.h>
#include "socket.h"

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

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

@ -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)

@ -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
}

@ -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
}

@ -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)
{

@ -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)

@ -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,3 +1,4 @@
#include <sys/types.h>
#include <sys/socket.h>
#include "socket.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);

@ -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