[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH 3/3] lib/ukunistd: Add user.h for user related functions declarations



Hi Costin, this looks ok.   

Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>

On 13.10.19, 15:30, "Costin Lupu" <costin.lupu@xxxxxxxxx> wrote:

    We currently declare only those functions that are not declared by newlib. 
Later
    on, we might apply the same solution we did for time related functions:
    providing our own headers for user related functions as well.
    
    Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
    ---
     lib/ukunistd/Makefile.uk       |  2 ++
     lib/ukunistd/include/uk/user.h | 54 ++++++++++++++++++++++++++++++++++
     lib/ukunistd/user.c            |  1 +
     3 files changed, 57 insertions(+)
     create mode 100644 lib/ukunistd/include/uk/user.h
    
    diff --git a/lib/ukunistd/Makefile.uk b/lib/ukunistd/Makefile.uk
    index 3c7a8229..abdbbcd8 100644
    --- a/lib/ukunistd/Makefile.uk
    +++ b/lib/ukunistd/Makefile.uk
    @@ -1,3 +1,5 @@
     $(eval $(call addlib_s,ukunistd,$(CONFIG_UKUNISTD)))
     
    +CINCLUDES-y   += -I$(UKUNISTD_BASE)/include
    +CXXINCLUDES-y += -I$(UKUNISTD_BASE)/include
     UKUNISTD_SRCS-$(CONFIG_UKUNISTD) += $(UKUNISTD_BASE)/user.c
    diff --git a/lib/ukunistd/include/uk/user.h b/lib/ukunistd/include/uk/user.h
    new file mode 100644
    index 00000000..9c72bc0f
    --- /dev/null
    +++ b/lib/ukunistd/include/uk/user.h
    @@ -0,0 +1,54 @@
    +/* SPDX-License-Identifier: BSD-3-Clause */
    +/*
    + * Authors: Costin Lupu <costin.lupu@xxxxxxxxx>
    + *
    + * Copyright (c) 2019, University Politehnica of Bucharest. All rights 
reserved.
    + *
    + * Redistribution and use in source and binary forms, with or without
    + * modification, are permitted provided that the following conditions
    + * are met:
    + *
    + * 1. Redistributions of source code must retain the above copyright
    + *    notice, this list of conditions and the following disclaimer.
    + * 2. Redistributions in binary form must reproduce the above copyright
    + *    notice, this list of conditions and the following disclaimer in the
    + *    documentation and/or other materials provided with the distribution.
    + * 3. Neither the name of the copyright holder nor the names of its
    + *    contributors may be used to endorse or promote products derived from
    + *    this software without specific prior written permission.
    + *
    + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
IS"
    + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
THE
    + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
PURPOSE
    + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 
BE
    + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
THE
    + * POSSIBILITY OF SUCH DAMAGE.
    + *
    + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
    + */
    +
    +#ifndef __UK_USER_H__
    +#define __UK_USER_H__
    +#ifdef __cplusplus
    +extern "C" {
    +#endif
    +
    +#define __NEED_uid_t
    +#define __NEED_gid_t
    +#include <sys/types.h>
    +
    +int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);
    +int setresuid(uid_t ruid, uid_t euid, uid_t suid);
    +
    +int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid);
    +int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
    +
    +#ifdef __cplusplus
    +}
    +#endif
    +#endif /* __UK_USER_H__ */
    diff --git a/lib/ukunistd/user.c b/lib/ukunistd/user.c
    index 428cfcf9..4134d6b7 100644
    --- a/lib/ukunistd/user.c
    +++ b/lib/ukunistd/user.c
    @@ -39,6 +39,7 @@
     #include <sys/types.h>
     #include <uk/essentials.h>
     #include <uk/list.h>
    +#include <uk/user.h>
     
     static struct passwd_entry {
        struct passwd *passwd;
    -- 
    2.20.1
    
    

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.