mars_nwe-0.98.pl11

This commit is contained in:
Mario Fetka
2011-11-13 00:38:58 +01:00
parent 3b6ddaabdf
commit 70cf9be941
50 changed files with 2239 additions and 1034 deletions

17
examples/README.important Normal file
View File

@@ -0,0 +1,17 @@
This is an important kernel ipx patch for all known kernels.
In linux/net/ipx/af_ipx.c routine ipx_create one line is missing.
static int ipx_create(struct socket *sock, int protocol)
{
...
sk->rcvbuf=SK_RMEM_MAX;
sk->sndbuf=SK_WMEM_MAX;
sk->allocation=GFP_KERNEL;
.......^^^^^^^^^^^^^^^^^^^^^^^^^^^
After applying this patch you can disable the sendmsg() workaround code
in mars_nwe/emutli.c by setting DO_IPX_SEND_TEST to 0.
#define DO_IPX_SEND_TEST 0

View File

@@ -1,29 +0,0 @@
!! this kernelpatch is _not_ needed for kernel >= 1.3.60 :) !!
this kernelpatch for clean kernels 1.3.56,57,58, pur 59 makes 3 things.
- removes the ipx-send bug. BIG THANKS to Volker Lendecke.
the problem was that sometimes the sendto function hung.
- ipx rip/sap packets comming from internal net must change
there source address from internal net/node to the
device net/node.
The problem was:
By configuring mars_nwe at the internal network, the rip/sap
socket gets the network and node address of the internal
net. Then, by sending rip/sap packets over this socket to the
several devices the rip/sap packets don't have the device net/node,
but the internal net/node.
- an existing route should never be overwritten by an route
over the internal net.
The problem was:
By running dosemu at the same workstation as mars_nwe the
dosemu automaticly changes the route to a nearby server
to route over the internal network and this destroyed
the real route over a device to this server.
You must be supervisor and then you must start './patchme' .
Martin Stover

View File

@@ -1,14 +0,0 @@
The kernelpatch kpatch1.3.72 you can use directly for kernels 1.3.72 .. 1.3.77
The kernelpatch kpatch1.3.78 you can use directly for kernels 1.3.78,79 .. ??
but it should be easy to apply this patch to all kernels.
By older kernels 'sk->protinfo.af_ipx.' must become 'sk->' .
After applying this patch please rebuild mars_nwe (make clean)
for getting notice of new ioctl call 'SIOCIPXNCPCONN'.
This patch is only necessary to speed up mars_nwe. (ca. 30 .. 50 % )
Perhaps this patch will get a place in the kerneldistribution one day. :)
This kernelpatch was originally designed by Volker Lendecke.
Martin

View File

@@ -1,4 +1,4 @@
/* config.h: 29-Jan-97 */
/* config.h: 02-Jun-97 */
/* some of this config is needed by make, others by cc */
#define DO_DEBUG 1 /* compile in debug code */
@@ -31,14 +31,24 @@
#define MAX_CONNECTIONS 5 /* max. number of simultaneous */
/* connections handled by mars_nwe */
/* !! NOTE !! */
/* If set > 255 some NCP calls will probably not work, try it with caution */
/* and you should apply examples/kpatch2.0.29 */
#define IPX_DATA_GR_546 1 /* 0 = max. IPX Packets = 546 +30 Byte ( 512 Byte RWBuff) */
/* 1 = max. IPX packets = 1058 +30 Byte (1024 Byte RWBuff) */
/* 2 = max. IPX packets = 1470 +30 Byte (1444 Byte RWBuff) */
/* 3 = max. IPX packets = 4130 +30 Byte (4096 Byte RWBuff) */
#define ENABLE_BURSTMODE 0 /* 0 = disable burstmode, 1 = enable burstmode */
/* in 0.98.pl11 still NOT working !! */
/* to get Burstmode really enabled, section '6' in conf-file */
/* must be set to a value > 1 (3.12 Server) */
/* and kernel-patch examples/kpatch2.0.29 should be used */
#define USE_MMAP 1 /* use mmap systen call */
#define USE_MMAP 1 /* use mmap systen call, not always best choice */
#if 0
#define SOCK_EXTERN 0x8005 /* creat socket for external access */
@@ -59,21 +69,18 @@
/* entry '6' in ini file should be set*/
/* to > '0', too. */
/* <--------------------------------------------------------------------> */
#define MAX_NW_SERVERS 40 /* max. number of nw-servers on your */
/* network */
#define HANDLE_ALL_SAP_TYPS 0 /* if set to 0 only SAP-Typ 4 Servers */
/* will be put into routing table and */
/* if set to 1 all SAP Typs will be */
/* used. */
#define PERSISTENT_SYMLINKS 0 /* change to '1' for persistent symlinks */
/* main idea from Victor Khimenko */
/* in 0.98.pl11 still NOT working !! */
/* <--------------- next is for linux only ----------------------------> */
#define INTERNAL_RIP_SAP 1 /* use internal/own rip/sap routines */
/* -------------------- */
#define MAX_NET_DEVICES 5 /* max. Netdevices, frames */
#define MAX_NW_ROUTES 50 /* max. nw-networks on your network */
/* (internal + external) */
#define MAX_RIP_ENTRIES 50 /* max. rip responses */
/* -------------------- */
#define SHADOW_PWD 0 /* change to '1' for shadow passwds */
#define QUOTA_SUPPORT 0 /* change to '1' for quota support */

Binary file not shown.

View File

@@ -1,56 +0,0 @@
--- af_ipx.c Sat Jan 6 13:54:59 1996
+++ af_ipx.c Sun Jan 21 20:36:36 1996
@@ -507,8 +507,10 @@
/*
* Don't charge sender
*/
- if(skb->sk)
+ if(skb->sk) {
skb->sk->wmem_alloc-=skb->truesize;
+ skb->sk = NULL;
+ }
/*
* Will charge receiver
*/
@@ -519,8 +521,10 @@
*/
if (memcmp(ipx_broadcast_node, node, IPX_NODE_LEN) == 0)
{
- if (!send_to_wire && skb->sk)
+ if (!send_to_wire && skb->sk) {
skb->sk->wmem_alloc-=skb->truesize;
+ skb->sk = NULL;
+ }
ipxitf_demux_socket(intrfc, skb, send_to_wire);
if (!send_to_wire)
return 0;
@@ -994,7 +998,9 @@
return -EAGAIN;
rt->ir_next=ipx_routes;
ipx_routes=rt;
- }
+ } else if (intrfc == ipx_internal_net)
+ /* don't change an existing route to internal net (mars_nwe) */
+ return(0);
rt->ir_net = network;
rt->ir_intrfc = intrfc;
@@ -1108,9 +1114,15 @@
ipx->ipx_tctrl=0;
ipx->ipx_type=usipx->sipx_type;
skb->h.raw = (unsigned char *)ipx;
-
- ipx->ipx_source.net = sk->ipx_intrfc->if_netnum;
- memcpy(ipx->ipx_source.node, sk->ipx_intrfc->if_node, IPX_NODE_LEN);
+
+ if ((err = ntohs(sk->ipx_port)) == 0x453 || err == 0x452) {
+ /* RIP/SAP special handling for mars_nwe */
+ ipx->ipx_source.net = intrfc->if_netnum;
+ memcpy(ipx->ipx_source.node, intrfc->if_node, IPX_NODE_LEN);
+ } else {
+ ipx->ipx_source.net = sk->ipx_intrfc->if_netnum;
+ memcpy(ipx->ipx_source.node, sk->ipx_intrfc->if_node, IPX_NODE_LEN);
+ }
ipx->ipx_source.sock = sk->ipx_port;
ipx->ipx_dest.net=usipx->sipx_network;
memcpy(ipx->ipx_dest.node,usipx->sipx_node,IPX_NODE_LEN);

View File

@@ -1,72 +0,0 @@
Index: include/linux/ipx.h
--- linux.org/include/linux/ipx.h Mon Dec 11 19:55:58 1995
+++ linux/include/linux/ipx.h Thu Mar 21 17:14:49 1996
@@ -74,5 +74,6 @@
#define SIOCAIPXITFCRT (SIOCPROTOPRIVATE)
#define SIOCAIPXPRISLT (SIOCPROTOPRIVATE+1)
#define SIOCIPXCFGDATA (SIOCPROTOPRIVATE+2)
+#define SIOCIPXNCPCONN (SIOCPROTOPRIVATE+3)
#endif
Index: include/net/sock.h
Prereq: 1.0.4
--- linux.org/include/net/sock.h Mon Mar 11 02:08:59 1996
+++ linux/include/net/sock.h Thu Mar 21 02:36:23 1996
@@ -96,6 +96,7 @@
ipx_address dest_addr;
ipx_interface *intrfc;
unsigned short port;
+ unsigned short ipx_ncp_conn;
#ifdef CONFIG_IPX_INTERN
unsigned char node[IPX_NODE_LEN];
#endif
Index: net/ipx/af_ipx.c
--- linux.org/net/ipx/af_ipx.c Sun Mar 10 22:51:28 1996
+++ linux/net/ipx/af_ipx.c Thu Mar 21 17:26:54 1996
@@ -438,6 +438,20 @@
ipx_socket *sock1 = NULL, *sock2 = NULL;
struct sk_buff *skb1 = NULL, *skb2 = NULL;
+ if (intrfc == ipx_primary_net
+ && ntohs(ipx->ipx_dest.sock) == 0x451
+ && *((char*)(ipx+1)) == 0x22
+ && *((char*)(ipx+1)+1) == 0x22) {
+ int connection = (int) *((char*)(ipx+1)+3);
+ /* 255 connections are enough ;) */
+ if (connection) {
+ for (sock1=intrfc->if_sklist;
+ (sock1 != NULL) &&
+ (sock1->protinfo.af_ipx.ipx_ncp_conn != connection);
+ sock1=sock1->next);;
+ }
+ }
+ if (sock1 == NULL)
sock1 = ipxitf_find_socket(intrfc, ipx->ipx_dest.sock);
/*
@@ -1628,6 +1642,7 @@
sizeof(sk->protinfo.af_ipx.dest_addr));
sk->protinfo.af_ipx.port = 0;
sk->protinfo.af_ipx.ncp_server = 0;
+ sk->protinfo.af_ipx.ipx_ncp_conn = 0; /* no ncp socket yet */
sk->mtu=IPX_MTU;
if(sock!=NULL)
@@ -2128,6 +2143,17 @@
if(err) return err;
return(ipxcfg_get_config_data((void *)arg));
}
+
+ case SIOCIPXNCPCONN:
+ {
+ if (!suser()) return(-EPERM);
+ err = verify_area(VERIFY_READ, (void *)arg,
+ sizeof(unsigned short));
+ if (err) return err;
+ sk->protinfo.af_ipx.ipx_ncp_conn = get_fs_word(arg);
+ return 0;
+ }
+
case SIOCGSTAMP:
if (sk)
{

View File

@@ -1,74 +0,0 @@
diff -rub linux.org/include/linux/ipx.h linux/include/linux/ipx.h
--- linux.org/include/linux/ipx.h Wed Mar 27 18:43:19 1996
+++ linux/include/linux/ipx.h Thu Mar 28 11:15:31 1996
@@ -74,5 +74,6 @@
#define SIOCAIPXITFCRT (SIOCPROTOPRIVATE)
#define SIOCAIPXPRISLT (SIOCPROTOPRIVATE+1)
#define SIOCIPXCFGDATA (SIOCPROTOPRIVATE+2)
+#define SIOCIPXNCPCONN (SIOCPROTOPRIVATE+3)
#endif
diff -rub linux.org/include/net/sock.h linux/include/net/sock.h
--- linux.org/include/net/sock.h Wed Mar 27 23:05:18 1996
+++ linux/include/net/sock.h Thu Mar 28 11:15:31 1996
@@ -112,6 +112,10 @@
* know the connection this socket belongs to.
*/
struct ncp_server *ncp_server;
+/*
+ * To handle special NCP-Sockets for mars_nwe
+ */
+ unsigned short ipx_ncp_conn;
};
#endif
diff -rub linux.org/net/ipx/af_ipx.c linux/net/ipx/af_ipx.c
--- linux.org/net/ipx/af_ipx.c Wed Mar 27 17:50:39 1996
+++ linux/net/ipx/af_ipx.c Thu Mar 28 11:15:31 1996
@@ -448,6 +448,20 @@
ipx_socket *sock1 = NULL, *sock2 = NULL;
struct sk_buff *skb1 = NULL, *skb2 = NULL;
+ if (intrfc == ipx_primary_net
+ && ntohs(ipx->ipx_dest.sock) == 0x451
+ && *((char*)(ipx+1)) == 0x22
+ && *((char*)(ipx+1)+1) == 0x22) {
+ int connection = (int) *((char*)(ipx+1)+3);
+ /* 255 connections are enough ;) */
+ if (connection) {
+ for (sock1=intrfc->if_sklist;
+ (sock1 != NULL) &&
+ (sock1->protinfo.af_ipx.ipx_ncp_conn != connection);
+ sock1=sock1->next);;
+ }
+ }
+ if (sock1 == NULL)
sock1 = ipxitf_find_socket(intrfc, ipx->ipx_dest.sock);
/*
@@ -1639,6 +1653,7 @@
sizeof(sk->protinfo.af_ipx.dest_addr));
sk->protinfo.af_ipx.port = 0;
sk->protinfo.af_ipx.ncp_server = 0;
+ sk->protinfo.af_ipx.ipx_ncp_conn = 0; /* no ncp socket yet */
sk->mtu=IPX_MTU;
if(sock!=NULL)
@@ -2142,6 +2157,17 @@
if(err) return err;
return(ipxcfg_get_config_data((void *)arg));
}
+
+ case SIOCIPXNCPCONN:
+ {
+ if (!suser()) return(-EPERM);
+ err = verify_area(VERIFY_READ, (void *)arg,
+ sizeof(unsigned short));
+ if (err) return err;
+ sk->protinfo.af_ipx.ipx_ncp_conn = get_fs_word(arg);
+ return 0;
+ }
+
case SIOCGSTAMP:
if (sk)
{

112
examples/kpatch2.0.29 Normal file
View File

@@ -0,0 +1,112 @@
diff -ubr 2.0.29/include/linux/ipx.h linux/include/linux/ipx.h
--- 2.0.29/include/linux/ipx.h Mon May 13 22:39:28 1996
+++ linux/include/linux/ipx.h Tue May 27 02:50:48 1997
@@ -75,5 +75,6 @@
#define SIOCAIPXITFCRT (SIOCPROTOPRIVATE)
#define SIOCAIPXPRISLT (SIOCPROTOPRIVATE+1)
#define SIOCIPXCFGDATA (SIOCPROTOPRIVATE+2)
+#define SIOCIPXNCPCONN (SIOCPROTOPRIVATE+3)
#endif
diff -ubr 2.0.29/include/net/sock.h linux/include/net/sock.h
--- 2.0.29/include/net/sock.h Tue Dec 10 18:35:21 1996
+++ linux/include/net/sock.h Tue May 27 02:50:48 1997
@@ -112,7 +112,11 @@
* know the connection this socket belongs to.
*/
struct ncp_server *ncp_server;
-
+/*
+ * To handle special ncp connection-handling sockets for mars_nwe,
+ * the connection number must be stored in the socket.
+ */
+ unsigned short ipx_ncp_conn;
};
#endif
diff -ubr 2.0.29/net/ipx/af_ipx.c linux/net/ipx/af_ipx.c
--- 2.0.29/net/ipx/af_ipx.c Tue Dec 10 18:35:35 1996
+++ linux/net/ipx/af_ipx.c Tue May 27 02:50:48 1997
@@ -468,7 +468,60 @@
ipx_socket *sock1 = NULL, *sock2 = NULL;
struct sk_buff *skb1 = NULL, *skb2 = NULL;
+ if (intrfc == ipx_primary_net
+ && ntohs(ipx->ipx_dest.sock) == 0x451)
+ {
+ /*
+ * The packet's target is a NCP connection handler. We want to
+ * hand it to the correct socket directly within the kernel,
+ * so that the mars_nwe packet distribution process
+ * does not have to do it. Here we only care about NCP and
+ * BURST packets.
+ * You might call this a hack, but believe me, you do not
+ * want a complete NCP layer in the kernel, and this is
+ * VERY fast as well.
+ */
+ int connection = 0;
+
+ if ( *((char*)(ipx+1)) == 0x22
+ && *((char*)(ipx+1)+1) == 0x22)
+ {
+ /*
+ * The packet is a NCP request
+ */
+ connection = ( ((int) *((char*)(ipx+1)+5)) << 8 )
+ | (int) *((char*)(ipx+1)+3);
+ }
+ else if ( *((char*)(ipx+1)) == 0x77
+ && *((char*)(ipx+1)+1) == 0x77)
+ {
+ /*
+ * The packet is a BURST packet
+ */
+ connection = ( ((int) *((char*)(ipx+1)+9)) << 8 )
+ | (int) *((char*)(ipx+1)+8);
+ }
+
+ if (connection)
+ {
+ /*
+ * Now we have to look for a special NCP connection handling
+ * socket. Only these sockets have ipx_ncp_conn != 0, set
+ * by SIOCIPXNCPCONN.
+ */
+ for (sock1=intrfc->if_sklist;
+ (sock1 != NULL) &&
+ (sock1->protinfo.af_ipx.ipx_ncp_conn != connection);
+ sock1=sock1->next);;
+ }
+ }
+ if (sock1 == NULL)
+ {
+ /* No special socket found, forward the packet the
+ * normal way.
+ */
sock1 = ipxitf_find_socket(intrfc, ipx->ipx_dest.sock);
+ }
/*
* We need to check if there is a primary net and if
@@ -2242,6 +2295,21 @@
if(err) return err;
return(ipxcfg_get_config_data((void *)arg));
}
+
+ case SIOCIPXNCPCONN:
+ {
+ /*
+ * This socket wants to take care of the NCP connection
+ * handed to us in arg.
+ */
+ if (!suser()) return(-EPERM);
+ err = verify_area(VERIFY_READ, (void *)arg,
+ sizeof(unsigned short));
+ if (err) return err;
+ sk->protinfo.af_ipx.ipx_ncp_conn = get_fs_word(arg);
+ return 0;
+ }
+
case SIOCGSTAMP:
if (sk)
{

View File

@@ -2,9 +2,14 @@
# This is the configuration-file for "mars_nwe", a free netware-emulator
# for Linux.
#
# last changed: 10-Apr-97
# last changed: 07-Jul-97
# !! section 4 : automatic creation of ipx-interfaces changed in 0.98.pl9 !!
#
# since version 0.98.pl11:
# the most important options in config.h can now be altered in
# this file begin at section 60.
# This file specifies which Linux-resources (printers, users, directories)
# should be accessible to the DOS-clients via "mars_nwe". Furthermore
# some general parameters are configured here.
@@ -42,8 +47,8 @@
# /var/local/nwe/SYS -------> SYS -------------> W:
#
# More than one entry is allowed in this section.
# The maximum number of volumes is a compile-time option that must be
# specified in `config.h' before compiling mars_nwe.
# The maximum number of volumes must be specified in `config.h'
# or in section 61 in this file.
#
# Please note that at least the volume "SYS" must be defined and it must
# contain the following sub-directories: LOGIN, PUBLIC, SYSTEM, MAIL.
@@ -70,7 +75,6 @@
# should only be used if you really need it.
# k use lowercase-filenames (if you don't set this,
# and you don't set 'i' all files _must_ be upper-case)
#
# m removable volume (e.g. cd-roms) or volumes, which
# should be remountable when mars_nwe is running.
# Should also be used for 'HOME' volumes.
@@ -86,8 +90,9 @@
# See `doc/PIPE-FS'.
#
# additional Namespaces
# O + OS/2 namespace (useful for Win95 clients, see doc/FAQS).
# N + NFS namespace.
# O (uppercase o)
# + OS/2 namespace (useful for Win95 clients, see doc/FAQS).
# N + NFS namespace (not really tested).
# -------------------------------------------------------------------------
#
# Examples:
@@ -204,13 +209,14 @@
#
# FRAME: the frame-type of the data-packets on your local network.
# Possible values are:
# ethernet_ii
# 802.2
# 802.3 (default)
# snap
# token
# auto automatic detection of the frame-type used
# in your ipx-environment
#
# ethernet_ii :best for mixed(ipx, ip) environments
# 802.2 :Novell uses this as default since 3.12
# 802.3 :older frame typ, some boot proms use it
# snap :normally not used
# token :for token ring cards
# auto :automatic detection of the frame-type used
# in your ipx-environment
#
# TICKS: the time data-packets need to get delivered over a
# certain interface. If your connection goes through several
@@ -271,8 +277,11 @@
# 2 Version 3.12 (burst mode is not implemented yet)
#
# If you want to use longfilenamesupport and/or namespace routines
# you should set this section to '1'.
# you should set this section to '1' or '2'
# And you should read doc/FAQS.
# If you want to test Burst mode this section must be set to '2'
# and in config.h you must set ENABLE_BURSTMODE to 1.
#
# -------------------------------------------------------------------------
#
@@ -448,6 +457,8 @@
# See section 12 for a description of the syntax.
#
# Unlike in section 12, you can define users with no password.
# If you explizit want to set 'no password' here then use
# a '-' sign as password.
# -------------------------------------------------------------------------
# Syntax:
# 13 NW_LOGIN LINUX_LOGIN [PASSWORD] [FLAGS]
@@ -459,6 +470,7 @@
# 13 MARTIN martin
# 13 DAREK martin
# 13 COMMON common gast 0x1 # no password change by user.
# 13 COMMON common 0x1 # syntax is allowed too.
# Section 14: currently not used
@@ -558,6 +570,46 @@
# -------------------------------------------------------------------------
# =========================================================================
# Section 30: Burst mode values (optional)
#
# -------------------------------------------------------------------------
# Syntax:
# 30 MAX_BURST_READ_BUF MAX_BURST_WRITE_BUF
# default is 0x2000 0x2000
# Examples:
# 30 0x2000 0x2000
# =========================================================================
# Section 50: Conversion tables by Victor Khimenko <khim@mccme.ru>
# Tables for DOS->Unix names translation & upper/lowercase translations
# For more information see doc/README.NLS
# some examples files exist in the examples directory.
# Conversation file must include 4 tables a 256 byte.
# 0 = dos2unix
# 1 = unix2dos
# 2 = down2up 'dosname'
# 3 = up2down 'dosname'
# -------------------------------------------------------------------------
# Syntax:
# 50 Filename of conversation file.
#
# Examples:
# 50 /etc/nwserv.cnv
# Changing defaults from config.h
# more information in config.h
# 60 10 # MAX_CONNECTIONS
# 61 10 # MAX_NW_VOLS
# 68 1 # USE_MMAP (use mmap=1, no mmap=0)
# 69 0 # HANDLE_ALL_SAP_TYPS (all sap typs=1, only typ 4=0)
# 70 0x44444444 # NETWORK_SERIAL_NMBR (4 byte)
# 71 0x2222 # NETWORK_APPL_NMBR (2 byte)
# --------------------------------------------------------
# You usally don't want to change anything below this line
@@ -584,7 +636,15 @@
200 1 # 0 = no logfile and dont daemonize nwserv/nwrouted
# 1 = daemonize nwserv/nwrouted and use logfile
201 /tmp/nw.log # filename of logfile
202 1 # 1=creat new logfile, 0=append to logfile
#201 syslog # if filename == syslog then syslogd will be used for
# all messages
202 0x1 # flag in hex notation
# 0x0=append all messages to logfile.
# & 0x1=creat new logfile instead of appending.
#202 0x3 # & 0x2=use syslogd for error messages instead of logfile.
# Sections 210,211: timing

BIN
examples/nw.ini.cnv.437 Normal file

Binary file not shown.

BIN
examples/nw.ini.cnv.cyr Normal file

Binary file not shown.

BIN
examples/nw.ini.cnv.min Normal file

Binary file not shown.

View File

@@ -1,20 +0,0 @@
#!/bin/sh
### !!!!!!! this is only for kernel 1.3.56 !!!!!!!!
ACT_DIR=`pwd`
PATCHFILE=kpatch1.3.56
LINUXDIR=/usr/src/linux
IPXDIR=$LINUXDIR/net/ipx
IPXFILE=af_ipx.c
if [ -r $IPXDIR/$IPXFILE ] ; then
if [ -r $IPXDIR/P1 ] ; then
echo "patch was allready made: $IPXDIR/P1 exist"
else
cd $IPXDIR && cp -a $IPXFILE $IPXFILE.org && \
patch < $ACT_DIR/$PATCHFILE && echo "$PATCHFILE" > $IPXDIR/P1
echo "please rebuild the kernel"
fi
else
echo "linuxdir $LINUXDIR perhaps wrong ?"
fi

View File

@@ -1,6 +1,6 @@
/* unxcomm.c 24-Oct-96 */
/* unxcomm.c 08-Jun-97 */
/* simple UNX program to work together with 'comm' */
/* to domonstrate usage of pipefilesystem */
/* to demonstrate usage of pipefilesystem */
#include <stdio.h>
#include <fcntl.h>
@@ -51,8 +51,8 @@ int bl_read(int fd, void *buf, int size)
int result;
FD_ZERO(&fdin);
FD_SET(fd, &fdin);
t.tv_sec = 1; /* 1 sec should be enough */
t.tv_usec = 0;
t.tv_sec = 0;
t.tv_usec = 100; /* 100 msec should be enough */
result = select(fd+1, &fdin, NULL, NULL, &t);
if (result > 0)
result=read(fd, buf, size);
@@ -61,11 +61,16 @@ int bl_read(int fd, void *buf, int size)
int main(int argc, char *argv[])
{
int size;
int size=0;
int l;
char buf[MAXARGLEN+1024];
close(2);
dup2(1,2);
if (0 < (size=bl_read(0, buf, MAXARGLEN))){
while (0 < (l=bl_read(0, buf+size, MAXARGLEN-size)))
size+=l;
if ( 0 < size) {
char **argvv=build_argv(sizeof(buf), buf, size);
if (argvv) {
char path[300];

72
examples/xsockrt.c Normal file
View File

@@ -0,0 +1,72 @@
/* (C)opyright (C) 1997 Martin Stover, Marburg, Germany
* simple program for adding/deleting ipx-routes for special sockets
* e.g. for playing doom around ipx-networks.
* needs special linux/net/ipx/af_ipx.c patch !!
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <strings.h>
#include <linux/ipx.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
static int usage(char *prog)
{
char *p=strrchr(prog, '/');
if (p==NULL)p=prog;
else p++;
fprintf(stderr, "usage:\t%s add|del [socknr] \n", p);
fprintf(stderr, "\tsocknr defaults to 0x869b (doom)\n");
fprintf(stderr, "\tother known sockets are:\n");
fprintf(stderr, "\t-0x8813 virgin games, Red Alert\n");
fprintf(stderr, "\tdel 0 removes all socknr !!\n");
return(1);
}
static int handle_ioctl(int mode, int socknr)
{
int fd = socket(AF_IPX, SOCK_DGRAM, AF_IPX);
int result=0;
if (fd > -1) {
if (mode == 1 || !mode) {
result = ioctl(fd, (mode==1) ? SIOCPROTOPRIVATE+4
: SIOCPROTOPRIVATE+5,
&socknr);
} else result++;
if (result==-1) {
perror("ioctl");
result=2;
}
close(fd);
} else {
result++;
perror("open socket");
}
return(result);
}
int main(int argc, char *argv[])
{
int socknr=0x869b;
if (argc < 2)
return(usage(argv[0]));
if (argc > 2 && 1 != sscanf(argv[2],"%i", &socknr))
return(usage(argv[0]));
if (!strncasecmp(argv[1], "add", 3)) {
if (!socknr)
return(usage(argv[0]));
return(handle_ioctl(1, socknr));
} else if (!strncasecmp(argv[1], "del", 3)) {
return(handle_ioctl(0, socknr));
} else
return(usage(argv[0]));
}