/* * This file is part of ixemul.library for the Amiga. * Copyright (C) 1991, 1992 Markus M. Wild * Portions Copyright (C) 1994 Rafael W. Luebbert * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: getcrap.c,v 1.2 1994/06/19 14:04:21 rluebbert Exp $ * * $Log: getcrap.c,v $ * Revision 1.2 1994/06/19 14:04:21 rluebbert * Appeasing HWGRCS * * Revision 1.1 1994/06/19 14:02:22 rluebbert * Initial revision * * */ /* stubs for group-file access functions */ #define KERNEL #include "ixemul.h" #include "kprintf.h" int getpid() { return (int) FindTask (0); } int getpgrp(int pid) { /* this could change later.. but we'll see .. */ return pid ? pid : (int) FindTask(0); } int getgroups(int gidsetlen, int *gidset) { /* we return 1 group, group 0 (you really ARE root on the amiga:-)) */ if (gidsetlen >= 1) { *gidset = 0; return 1; } errno = EINVAL; KPRINTF (("&errno = %lx, errno = %ld\n", &errno, errno)); return -1; } int getrusage (int who, struct rusage *rusage) { if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN) { errno = EINVAL; KPRINTF (("&errno = %lx, errno = %ld\n", &errno, errno)); return -1; } *rusage = (who == RUSAGE_SELF) ? u.u_ru : u.u_cru; return 0; } #include struct group * getgrgid (gid_t gid) { static char *end = 0; static struct group grp = { "amiga", "*", 0, & end }; return &grp; } struct group * getgrnam (const char *name) { static char *end = 0; static struct group grp = { "amiga", "*", 0, & end }; return &grp; } #include struct passwd * getpwuid (uid_t uid) { static struct passwd pw = { "amiga", /* pw_name */ "*", /* pw_passwd */ 0, /* pw_uid */ 0, /* pw_gid */ 0, /* pw_change */ 0, /* pw_class */ "amiga user", /* pw_gecos */ "sys:", /* pw_dir */ "c:execute", /* pw_shell */ 0}; /* pw_expire */ /* see getpwnam() */ pw.pw_uid = uid; return &pw; } struct passwd * getpwnam (const char *name) { static struct passwd pw = { 0, /* pw_name */ "*", /* pw_passwd */ 0, /* pw_uid */ 0, /* pw_gid */ 0, /* pw_change */ 0, /* pw_class */ "amiga user", /* pw_gecos */ "sys:", /* pw_dir */ "c:execute", /* pw_shell */ 0}; /* pw_expire */ /* this is not quite safe, since this library function could be called * in parallel with different names.. well, I don't consider this worth * doing `right', it's here to be able to link some programs ;-) */ pw.pw_name = (char *) name; return &pw; } static char hostname[255] = "amiga"; int gethostname (char *name, int namelen) { strncpy (name, hostname, namelen); return 0; } int sethostname (char *name, int namelen) { int len = namelen < sizeof (hostname) - 1 ? namelen : sizeof (hostname) - 1; strncpy (hostname, name, len); hostname[len] = 0; return 0; }