{
    "mode": "man",
    "parameter": "nfs4_uid_to_name",
    "section": "3",
    "url": "https://www.chedong.com/phpMan.php/man/nfs4_uid_to_name/3/json",
    "generated": "2026-10-04T15:44:43Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "nfs4uidtoname,  nfs4gidtoname,  nfs4nametouid, nfs4nametogid, nfs4initnamemap‐\nping,    nfs4getdefaultdomain,     nfs4gssprinctoids,     nfs4gssprinctogrouplist,\nnfs4gssprinctoidsex,  nfs4gssprinctogrouplistex,  nfs4setdebug  - ID mapping rou‐\ntines used for NFSv4\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "#include <nfs4_idmap.h>",
                    "content": "int nfs4initnamemapping(char *conffile);\n\nint nfs4getdefaultdomain(char *server, char *domain, sizet len);\n\nint nfs4uidtoname(uidt uid, char *domain, char *name, sizet len);\n\nint nfs4uidtoowner(uidt uid, char *domain, char *name, sizet len);\n\nint nfs4gidtoname(gidt gid, char *domain, char *name, sizet len);\n\nint nfs4gidtoowner(gidt gid, char *domain, char *name, sizet len);\n\nint nfs4nametouid(char *name, uidt *uid);\n\nint nfs4nametogid(char *name, gidt *gid);\n\nint nfs4ownertouid(char *name, uidt *uid);\n\nint nfs4ownertogid(char *name, gidt *gid);\n\nint nfs4gssprinctoids(char *secname, char *princ, uidt *uid, gidt *gid);\n\nint nfs4gssprinctogrouplist(char *secname, char *princ, gidt *groups, int *ngroups);\n\nint nfs4gssprinctoidsex(char *secname, char *princ, uidt *uid, gidt  *gid,  extramap‐\npingparams ex);\n\nint  nfs4gssprinctogrouplistex(char  *secname, char *princ, gidt *groups, int *ngroups,\nextramappingparams ex);\n\nvoid nfs4setdebug(int dbglevel, void (*logger)(const char *, ...));\n\n"
                }
            ]
        },
        "DESCRIPTION": {
            "content": "NFSv4 uses names of the form user@domain.  To write code that helps the kernel map uid's  (as\nrpc.idmapd  does)  or that processes NFSv4 ACLs, you need to be able to convert between NFSv4\nnames and local uids and gids.\n\nThe nfs4uidtoname() and nfs4gidtoname() functions, given uid or gid and  domain  (as  a\nnull-terminated string), write the corresponding nfsv4 name into the buffer provided in name,\nwhich must be of length at least len.\n\nThe  nfs4uidtoowner() and nfs4gidtogroupowner() functions, given uid or gid and domain\n(as a null-terminated string), write the corresponding nfsv4 name into the buffer provided in\nname, which must be of length at least len.  If there is no valid mapping from uid or gid  to\nname, then the numerical string representing uid or gid is returned instead.\n\nThe  nfs4nametouid()  and  nfs4nametogid()  functions, given name (as a null-terminated\nstring), return the corresponding uid or gid in the second parameter.\n\nThe nfs4ownertouid() and nfs4groupownertogid() functions, given name (as a null-termi‐\nnated string), return the corresponding uid or gid in the second parameter.  If there  is  no\nvalid  mapping  from  name to uid or gid the value for the user or group \"nobody\" will be re‐\nturned instead.\n\nThe nfs4initnamemapping() function must be called before using any of these functions.  It\nreads defaults from the configuration file at the provided path, usually \"etc/idmapd.conf\".\n\nThe domain argument to the id-to-name functions is there to provide a hint to the name mapper\nin the case where an id might be mapped to names in multiple domains.  In  most  cases,  this\nargument should just be the name returned in the domain argument to nfs4getdefaultdomain()\nwhich should be called with server set to NULL.  The domain should be a buffer of length len.\nThe constant NFS4MAXDOMAINLEN may be used to determine a reasonable value for that length.\n\nThe  function  nfs4getgrouplist(), given a name, fills the provided array groups with up to\n*ngroups group IDs corresponding to which the user name belongs to, setting *ngroups  to  the\nactual  number of such groups.  If the user belongs to more than *ngroups groups, then an er‐\nror is returned and the actual number of groups is stored in *ngroups.\n\nFunctions nfs4gssprinctoids(), nfs4gssprinctogrouplist(), nfs4gssprinctoidsex(),\nand nfs4gssprinctogrouplistex() are used to convert from a gss principal  name  (as  re‐\nturned by gssdisplayname()) to a uid and gid, or list of gids.\n\nFinally,  nfs4setdebug()  allows  the application to set a debugging level to produce extra\ndebugging information from within the library.  The optional logger function specifies an al‐\nternative logging function to call for the debug messages rather than  the  default  internal\nfunction within the library.\n",
            "subsections": []
        },
        "RETURN VALUE": {
            "content": "All functions return 0 or, in the case of error, -ERRNO.\n\n2004-08-05                          nfs4uidtoname(3)",
            "subsections": []
        }
    },
    "summary": "nfs4uidtoname,  nfs4gidtoname,  nfs4nametouid, nfs4nametogid, nfs4initnamemap‐ ping,    nfs4getdefaultdomain,     nfs4gssprinctoids,     nfs4gssprinctogrouplist, nfs4gssprinctoidsex,  nfs4gssprinctogrouplistex,  nfs4setdebug  - ID mapping rou‐ tines used for NFSv4",
    "flags": [],
    "examples": [],
    "see_also": []
}