7

My /usr/include contains several files with the .x file extension, such as /usr/include/rpcsvc/rquota.x.

They seem like C sources (running file /usr/include/rpcsvc/rquota.x results in C source, ASCII text), but they are not valid C (e.g. program and version seem keywords).

What are they exactly? It's hard to google given the short extension, and some websites are just wrong/incomplete (e.g. Wikipedia says "old DirectX files").

13

They are descriptions of SunRPC-based protocols (RPC standing for Remote Procedure Call). Each file typically describes data structures which are used by these RPCs, and programs which implement them; for example, yppasswd.x describes the Yellow Pages password update protocol and is relatively easy to understand:

program YPPASSWDPROG {
        version YPPASSWDVERS {
                /*
                 * Update my passwd entry
                 */
                int
                YPPASSWDPROC_UPDATE(yppasswd) = 1;
        } = 1;
} = 100009;


struct passwd {
        string pw_name<>;       /* username */
        string pw_passwd<>;     /* encrypted password */
        int pw_uid;             /* user id */
        int pw_gid;             /* group id */
        string pw_gecos<>;      /* in real life name */
        string pw_dir<>;        /* home directory */
        string pw_shell<>;      /* default shell */
};

struct yppasswd {
        string oldpass<>;       /* unencrypted old password */
        passwd newpw;           /* new passwd entry */
};

This declares an RPC YP password update procedure, which takes a yppasswd structure as argument and returns an int. The file also describes the yppasswd structure itself, along with the passwd structure which it uses.

These files are generally used with rpcgen which will generate stub server and client code, which can then be used to implement an RPC server for the protocol and/or an RPC client. It can even generate example client and server code.

As indicated by Kusalananda, the rpcgen(1) manpage has more information.

6

Snippet from the rpcgen manual on a Linux system:

   rpcgen is a tool that generates C code to implement an RPC protocol.  The
   input to rpcgen is a language similar to C known as RPC Language  (Remote
   Procedure Call Language).

   rpcgen  is normally used as in the first synopsis where it takes an input
   file and generates up to four output  files.   If  the  infile  is  named
   proto.x, then rpcgen will generate a header file in proto.h, XDR routines
   in proto_xdr.c, server-side stubs in proto_svc.c, and  client-side  stubs
   in  proto_clnt.c.

See man rpcgen.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.