SYNOPSIS

       cc [ flag ... ] file ...  -lrmt -lsocket -lnsl [ library ... ]

       #include <librmt.h>
       #include <rmtio.h>

       int rmtopen(int remfd, char *pathname, int fmode);

       int rmtclose(int remfd);

       int rmtread(int remfd, char *buf, int count);

       int rmtwrite(int remfd, char *buf, int count);

       int rmtseek(int remfd, off_t offset, int whence);

       int rmtioctl(int remfd, int cmd, int count);


DESCRIPTION

       rmtopen()
              sends an open request to the remote  server,  remfd  is  a  file
              descriptor  previously  obtained  from  a  call to rmtgetconn(),
              pathname is a path to be opened on the server side and fmode  is
              the  same  as  the  third  argument  for open(2).  If the remote
              server does not support the GNU open flag enhancements, only the
              lowest  two  bits  in  the  open flags can be send to the remote
              server.

              If the open requests succeeds, rmtopen() takes care  of  telling
              the remote side to switch to RMT protocol VERSION 1

       rmtclose()
              sends  a  close  request  to  the remote server, remfd is a file
              descriptor previously obtained from a call to rmtgetconn().

       rmtread()
              sends a read request to the  remote  server,  remfd  is  a  file
              descriptor previously obtained from a call to rmtgetconn().  The
              other parameters are the same  as  for  a  local  read(2)  call.
              rmtread()   will  fail  if  there  was  no  previous  successful
              rmtopen() before.

       rmtwrite()
              sends a write request to the remote  server,  remfd  is  a  file
              descriptor previously obtained from a call to rmtgetconn().  The
              other parameters are the same as  for  a  local  write(2)  call.
              rmtwrite()  will  fail  if  there  was  no  previous  successful
              rmtopen() before.

       rmtseek()
              sends a seek request to the  remote  server,  remfd  is  a  file

       rmtclose()
              returns a value >= 0 if the remote close succeeds.

       rmtread()
              returns the return value obtained the remote read(2) request.

       rmtwrite()
              returns the return value obtained the remote write(2) request.

       rmtseek()
              returns the return value obtained the remote lseek(2) request.

       rmtioctl()
              returns the return value obtained the remote ioctl(f,  MTIOCTOP,
              struct mtop *) call.



ERRORS

       All  functions  return  -1  on  error  and set errno to the errno value
       retrieved from the remote server.


EXAMPLES


       int  remfd;
       char *remfn;
       char host[256];

       if ((remfn = rmtfilename(filename)) != NULL) {
            rmthostname(host, sizeof (host), filename);

            if ((remfd = rmtgetconn(host, iosize, 0)) < 0)
                 comerrno(EX_BAD, "Cannot get connection to '%s'.\n",
                      /* errno not valid !! */      host);
       }

       if (rmtopen(remfd, remfn, mode) < 0)
            comerr("Cannot open '%s'.\n", remfn);

       if (rmtread(remfd, buf, sizeof(buf)) < 0)
            comerr("Read error on '%s'.\n", remfn);

       rmtclose(remfd);



ENVIRONMENT


SEE ALSO

       rmt(1), rsh(1),  ssh(1),  rcmd(3),  rmtinit(3),  rmtdebug(3),  rmthost-
       name(3),  rmtfilename(3),  rmtgetconn(3), rmtopen(3), rmtioctl(3), rmt-
       close(3), rmtread(3), rmtwrite(3), rmtseek(3),  rmtxstatus(3),  rmtsta-
       tus(3), _mtg2rmtg(3), _rmtg2mtg(3), errmsgno(3), mtio(7)



       If you like to use long file names, make sure that  you  also  use  the
       schily rmt server.


BUGS

       If  local  and  remote errno values do not match, programs may get con-
       fused.


AUTHOR

       Joerg Schilling
       Seestr. 110
       D-13353 Berlin
       Germany

       Mail bugs and suggestions to:

       schilling@fokus.fhg.de or js@cs.tu-berlin.de



Joerg Schilling                    04/02/28                        RMTOPEN(3L)

Man(1) output converted with man2html