X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Flib%2Fgetprocentry-legacy.c;fp=util-vserver%2Flib%2Fgetprocentry-legacy.c;h=0000000000000000000000000000000000000000;hb=9c78378bebc1a9f3d400f422df8ede9efea57dea;hp=f88fa9501786f1290636577650bd692225c1d4ae;hpb=faa778968d1a7dfeaebc9fe4b847e691dc62fd15;p=util-vserver.git diff --git a/util-vserver/lib/getprocentry-legacy.c b/util-vserver/lib/getprocentry-legacy.c deleted file mode 100644 index f88fa95..0000000 --- a/util-vserver/lib/getprocentry-legacy.c +++ /dev/null @@ -1,84 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 Enrico Scholz -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program 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 General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "utils-legacy.h" -#include "internal.h" -#include "vserver-internal.h" - -#include -#include -#include -#include -#include - -static volatile size_t proc_bufsize = 4097; - -size_t -utilvserver_getProcEntryBufsize() -{ - return proc_bufsize; -} - -char * -utilvserver_getProcEntry(pid_t pid, - char *str, - char *buf, size_t bufsize) -{ - char status_name[ sizeof("/proc//status") + sizeof(unsigned int)*3 + 1 ]; - int fd; - size_t len; - char * res = 0; - - if (pid<0 || (uint32_t)(pid)>99999) { - errno = EBADR; - return 0; - } - - if (pid==0) strcpy(status_name, "/proc/self/status"); - else { - strcpy(status_name, "/proc/"); - len = utilvserver_fmt_uint(status_name+sizeof("/proc/")-1, pid); - strcpy(status_name+sizeof("/proc/")+len-1, "/status"); - } - - fd = open(status_name, O_RDONLY); - if (fd==-1) return 0; - - len = read(fd, buf, bufsize); - close(fd); - - if (len