Apache Mesos
pwd.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __STOUT_INTERNAL_WINDOWS_PWD_HPP__
18 #define __STOUT_INTERNAL_WINDOWS_PWD_HPP__
19 
20 #include <sys/types.h>
21 
22 #include <stout/windows.hpp>
23 
24 
25 // Dummy struct for POSIX compliance.
26 struct passwd
27 {
28  char* pw_name; // User's login name.
29  uid_t pw_uid; // Numerical user ID.
30  gid_t pw_gid; // Numerical group ID.
31  char* pw_dir; // Initial working directory.
32  char* pw_shell; // Program to use as shell.
33 };
34 
35 
36 // Dummy implementation of `getpwuid` for POSIX compliance. Per the POSIX
37 // specification[1], we are to return `nullptr` if an entry matching the UID is
38 // not found. On Windows, we will never find such an entry, so we always return
39 // `nullptr`. Just to be safe, we also set `errno` to `ENOSYS` which indicates
40 // the function is not implemented.
41 //
42 // [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/getgrgid.html
43 inline struct passwd* getpwuid(uid_t)
44 {
45  errno = ENOSYS;
46  return nullptr;
47 }
48 
49 #endif // __STOUT_INTERNAL_WINDOWS_PWD_HPP__
char * pw_shell
Definition: pwd.hpp:32
gid_t pw_gid
Definition: pwd.hpp:30
struct passwd * getpwuid(uid_t)
Definition: pwd.hpp:43
char * pw_name
Definition: pwd.hpp:28
uid_t pw_uid
Definition: pwd.hpp:29
int uid_t
Definition: windows.hpp:189
Definition: pwd.hpp:26
int gid_t
Definition: windows.hpp:190
char * pw_dir
Definition: pwd.hpp:31