Initial Import from SVN
This commit is contained in:
41
src/cmd/talloc/Makefile
Normal file
41
src/cmd/talloc/Makefile
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# Public Domain. 1995/03/13 - Steven Schultz
|
||||
#
|
||||
TOPSRC = $(shell cd ../../..; pwd)
|
||||
include $(TOPSRC)/target.mk
|
||||
|
||||
CFLAGS += -Werror -I../../../sys/include
|
||||
|
||||
BIN = talloc
|
||||
SRCS = $(BIN).c
|
||||
OBJS = $(BIN).o
|
||||
MAN = $(BIN).0
|
||||
|
||||
all: $(BIN) ${MAN}
|
||||
|
||||
$(BIN): ${OBJS}
|
||||
${CC} ${LDFLAGS} -o $@.elf ${OBJS} ${LIBS}
|
||||
${OBJDUMP} -S $@.elf > $@.dis
|
||||
${SIZE} $@.elf
|
||||
${ELF2AOUT} $@.elf $@
|
||||
|
||||
.SUFFIXES: .0 .1
|
||||
|
||||
.1.0:
|
||||
${MANROFF} $*.1 > $@
|
||||
|
||||
clean:
|
||||
rm -f *.o *.elf ${MAN} *.elf *.dis tags *~ $(BIN)
|
||||
|
||||
depend: ${SRCS}
|
||||
mkdep ${CFLAGS} ${SRCS}
|
||||
|
||||
install: all
|
||||
install -m 755 $(BIN) ${DESTDIR}/sbin
|
||||
install -m 755 $(MAN) ${DESTDIR}/share/man/cat8
|
||||
|
||||
lint: ${SRCS}
|
||||
lint -hax ${SRCS}
|
||||
|
||||
tags: ${SRCS}
|
||||
ctags ${SRCS}
|
||||
0
src/cmd/talloc/talloc.1
Normal file
0
src/cmd/talloc/talloc.1
Normal file
36
src/cmd/talloc/talloc.c
Normal file
36
src/cmd/talloc/talloc.c
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <ioctl.h>
|
||||
#include <sys/swap.h>
|
||||
|
||||
void usage()
|
||||
{
|
||||
printf("Usage: talloc /dev/tempX <size>\n");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int fd;
|
||||
int size;
|
||||
|
||||
if (argc != 3) {
|
||||
usage();
|
||||
return 10;
|
||||
}
|
||||
|
||||
fd = open(argv[1], O_RDONLY);
|
||||
if (!fd) {
|
||||
printf("Unable to open %s\n", argv[0]);
|
||||
return 10;
|
||||
}
|
||||
|
||||
size = atoi(argv[2]);
|
||||
|
||||
ioctl(fd, TFALLOC, &size);
|
||||
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user