OSDN Git Service

Merge changes Ie1705960,I8b94351f,I661540a9,Id2dbdcab,I1223578c, ...
authorElliott Hughes <enh@google.com>
Tue, 6 Oct 2015 21:46:27 +0000 (21:46 +0000)
committerGerrit Code Review <noreply-gerritcodereview@google.com>
Tue, 6 Oct 2015 21:46:27 +0000 (21:46 +0000)
* changes:
  Merge remote-tracking branch 'toybox/master' into HEAD
  Decode netlink sockets in lsof.
  New command: flock.
  Fix bug in od that screwed up position indicator on arm and mips.
  Fix allnoconfig. (Exporting HOSTCC before HOSTCC?=cc caused a problem.)
  Export makefile variables so you can say "make CROSS_COMPILE=blah-" as well as "CROSS_COMPILE=blah- make".
  Minor cleanup and add "MODALIAS" handler (suggested by Isaac Dunham).
  Back to chipping away at ps...
  Add uClinux analysis to roadmap, and a few other pending changes.
  help_exit() tweak.
  xvfork went away.
  Make defconfig build for nommu.
  Another chunk of nommu support, replacing toys.recursion with toys.stacktop.
  xexec() is noreturn.
  Add xvfork() as a static inline and use it from various places.
  The -o /dev/null trick in probing isn't compatible with elf2flt, so use tempfile.
  Fix a couple things gcc is too dumb to figure out on its own.
  Add find tests.

.config
Android.mk
generated/config.h
generated/flags.h
generated/globals.h
generated/help.h
generated/newtoys.h

diff --git a/.config b/.config
index 5fa63a5..3e13c02 100644 (file)
--- a/.config
+++ b/.config
@@ -203,6 +203,7 @@ CONFIG_UNIX2DOS=y
 # CONFIG_EJECT is not set
 # CONFIG_FACTOR is not set
 CONFIG_FALLOCATE=y
+CONFIG_FLOCK=y
 CONFIG_FREE=y
 CONFIG_FREERAMDISK=y
 CONFIG_FSFREEZE=y
index 4cc49c1..bf722ac 100644 (file)
@@ -86,6 +86,7 @@ LOCAL_SRC_FILES := \
     toys/other/clear.c \
     toys/other/dos2unix.c \
     toys/other/fallocate.c \
+    toys/other/flock.c \
     toys/other/free.c \
     toys/other/freeramdisk.c \
     toys/other/fsfreeze.c \
@@ -261,6 +262,7 @@ ALL_TOOLS := \
     fallocate \
     false \
     find \
+    flock \
     free \
     getenforce \
     getprop \
index 8d3d21b..ae22ece 100644 (file)
 #define USE_FACTOR(...)
 #define CFG_FALLOCATE 1
 #define USE_FALLOCATE(...) __VA_ARGS__
+#define CFG_FLOCK 1
+#define USE_FLOCK(...) __VA_ARGS__
 #define CFG_FREE 1
 #define USE_FREE(...) __VA_ARGS__
 #define CFG_FREERAMDISK 1
index f7559cc..3230b1c 100644 (file)
 #undef FLAG_H
 #endif
 
+// flock <1>1nsux[-sux] <1>1nsux[-sux]
+#undef OPTSTR_flock
+#define OPTSTR_flock "<1>1nsux[-sux]"
+#ifdef CLEANUP_flock
+#undef CLEANUP_flock
+#undef FOR_flock
+#undef FLAG_x
+#undef FLAG_u
+#undef FLAG_s
+#undef FLAG_n
+#endif
+
 // fold   bsuw#<1
 #undef OPTSTR_fold
 #define OPTSTR_fold  0 
 #define FLAG_H (1<<1)
 #endif
 
+#ifdef FOR_flock
+#ifndef TT
+#define TT this.flock
+#endif
+#define FLAG_x (1<<0)
+#define FLAG_u (1<<1)
+#define FLAG_s (1<<2)
+#define FLAG_n (1<<3)
+#endif
+
 #ifdef FOR_fold
 #ifndef TT
 #define TT this.fold
index e641695..1ad4812 100644 (file)
@@ -368,15 +368,9 @@ struct arping_data {
     char *src_ip;
 
     int sockfd;
-    unsigned start;
-    unsigned end;
-    unsigned sent_at;
-    unsigned sent_nr;
-    unsigned rcvd_nr;
-    unsigned brd_sent;
-    unsigned rcvd_req;
-    unsigned brd_rcv;
-    unsigned unicast_flag;
+    unsigned long start, end;
+    unsigned sent_at, sent_nr, rcvd_nr, brd_sent, rcvd_req, brd_rcv,
+             unicast_flag;
 };
 
 // toys/pending/bootchartd.c
index f09b51f..e08ce02 100644 (file)
 
 #define help_tac "usage: tac [FILE...]\n\nOutput lines in reverse order.\n\n"
 
-#define help_sysctl "usage: sysctl [-aAeNnqw] [-p [FILE] | KEY[=VALUE]...]\n\nRead/write system control data (under /proc/sys).\n\n-a,A        Show all values\n-e     Don't warn about unknown keys\n-N       Don't print key values\n-n      Don't print key names\n-p [FILE]        Read values from FILE (default /etc/sysctl.conf)\n-q    Don't show value after write\n-w        Only write values (object to reading)\n\n"
+#define help_sysctl "usage: sysctl [-aAeNnqw] [-p [FILE] | KEY[=VALUE]...]\n\nRead/write system control data (under /proc/sys).\n\n-a,A        Show all values\n-e     Don't warn about unknown keys\n-N       Don't print key values\n-n      Don't print key names\n-p       Read values from FILE (default /etc/sysctl.conf)\n-q    Don't show value after write\n-w        Only write values (object to reading)\n\n"
 
 #define help_switch_root "usage: switch_root [-c /dev/console] NEW_ROOT NEW_INIT...\n\nUse from PID 1 under initramfs to free initramfs, chroot to NEW_ROOT,\nand exec NEW_INIT.\n\n-c Redirect console to device in NEW_ROOT\n-h      Hang instead of exiting on failure (avoids kernel panic)\n\n"
 
 
 #define help_unshare "usage: unshare [-imnpuUr] COMMAND...\n\nCreate new container namespace(s) for this process and its children, so\nsome attribute is not shared with the parent process.\n\n-i     SysV IPC (message queues, semaphores, shared memory)\n-m        Mount/unmount tree\n-n  Network address, sockets, routing, iptables\n-p Process IDs and init\n-r        Become root (map current euid/egid to 0/0, implies -U)\n-u      Host and domain names\n-U       UIDs, GIDs, capabilities\n\nA namespace allows a set of processes to have a different view of the\nsystem than other sets of processes.\n\n"
 
-#define help_netcat "usage: netcat [-tu] [-lL COMMAND...] [-wpq #] [-s addr] {IPADDR PORTNUM|-f FILENAME}\n\n-L        listen for multiple incoming connections (server mode).\n-f     use FILENAME (ala /dev/ttyS0) instead of network\n-l    listen for one incoming connection.\n-p local port number\n-q   SECONDS quit this many seconds after EOF on stdin.\n-s  local ipv4 address\n-t  allocate tty (must come before -l or -L)\n-w    SECONDS timeout for connection\n\nUse \"stty 115200 -F /dev/ttyS0 && stty raw -echo -ctlecho\" with\nnetcat -f to connect to a serial port.\n\nThe command line after -l or -L is executed to handle each incoming\nconnection. If none, the connection is forwarded to stdin/stdout.\n\nFor a quick-and-dirty server, try something like:\nnetcat -s 127.0.0.1 -p 1234 -tL /bin/bash -l\n"
+#define help_netcat_listen_tty "usage: netcat [-t]\n\n-t       allocate tty (must come before -l or -L)\n\n"
+
+#define help_netcat "usage: netcat [-lL COMMAND...] [-u] [-wpq #] [-s addr] {IPADDR PORTNUM|-f FILENAME}\n\n-L listen for multiple incoming connections (server mode).\n-f     use FILENAME (ala /dev/ttyS0) instead of network\n-l    listen for one incoming connection.\n-p local port number\n-q   SECONDS quit this many seconds after EOF on stdin.\n-s  local ipv4 address\n-w  SECONDS timeout for connection\n\nUse \"stty 115200 -F /dev/ttyS0 && stty raw -echo -ctlecho\" with\nnetcat -f to connect to a serial port.\n\nThe command line after -l or -L is executed to handle each incoming\nconnection. If none, the connection is forwarded to stdin/stdout.\n\nFor a quick-and-dirty server, try something like:\nnetcat -s 127.0.0.1 -p 1234 -tL /bin/bash -l\n"
 
 #define help_nbd_client "usage: nbd-client [-ns] HOST PORT DEVICE\n\n-n        Do not fork into background\n-s nbd swap support (lock server into memory)\n\n"
 
 
 #define help_free "usage: free [-bkmgt]\n\nDisplay the total, free and used amount of physical memory and swap space.\n\n-bkmgt        Output units (default is bytes)\n\n"
 
+#define help_flock "usage: flock [-sxun] fd\n\nManage advisory file locks.\n\n-s       Shared lock.\n-x        Exclusive lock (default).\n-u   Unlock.\n-n     Non-blocking: fail rather than wait for the lock.\n\n"
+
 #define help_fallocate "usage: fallocate [-l size] file\n\nTell the filesystem to allocate space for a file.\n\n"
 
 #define help_factor "usage: factor NUMBER...\n\nFactor integers.\n\n"
 
 #define help_mke2fs "usage: mke2fs [-Fnq] [-b ###] [-N|i ###] [-m ###] device\n\nCreate an ext2 filesystem on a block device or filesystem image.\n\n-F         Force to run on a mounted device\n-n         Don't write to device\n-q         Quiet (no output)\n-b size    Block size (1024, 2048, or 4096)\n-N inodes  Allocate this many inodes\n-i bytes   Allocate one inode for every XXX bytes of device\n-m percent Reserve this percent of filesystem space for root user\n\n"
 
-#define help_mdev_conf "The mdev config file (/etc/mdev.conf) contains lines that look like:\nhd[a-z][0-9]* 0:3 660\n\nEach line must contain three whitespace separated fields. The first\nfield is a regular expression matching one or more device names, and\nthe second and third fields are uid:gid and file permissions for\nmatching devies.\n\n"
+#define help_mdev_conf "The mdev config file (/etc/mdev.conf) contains lines that look like:\nhd[a-z][0-9]* 0:3 660\n\nEach line must contain three whitespace separated fields. The first\nfield is a regular expression matching one or more device names,\nthe second and third fields are uid:gid and file permissions for\nmatching devies.\n\n"
 
 #define help_mdev "usage: mdev [-s]\n\nCreate devices in /dev using information from /sys.\n\n-s       Scan all entries in /sys to populate /dev.\n\n"
 
index c295c5d..7fe570a 100644 (file)
@@ -1,4 +1,6 @@
 USE_TOYBOX(NEWTOY(toybox, NULL, TOYFLAG_STAYROOT))
+USE_SH(OLDTOY(-sh, sh, 0))
+USE_SH(OLDTOY(-toysh, sh, 0))
 USE_TRUE(OLDTOY(:, true, TOYFLAG_NOFORK))
 USE_ACPI(NEWTOY(acpi, "abctV", TOYFLAG_USR|TOYFLAG_BIN))
 USE_GROUPADD(OLDTOY(addgroup, groupadd, TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
@@ -62,6 +64,7 @@ USE_FALSE(NEWTOY(false, NULL, TOYFLAG_BIN))
 USE_FDISK(NEWTOY(fdisk, "C#<0H#<0S#<0b#<512ul", TOYFLAG_SBIN))
 USE_FGREP(OLDTOY(fgrep, grep, TOYFLAG_BIN))
 USE_FIND(NEWTOY(find, "?^HL[-HL]", TOYFLAG_USR|TOYFLAG_BIN))
+USE_FLOCK(NEWTOY(flock, "<1>1nsux[-sux]", TOYFLAG_USR|TOYFLAG_BIN))
 USE_FOLD(NEWTOY(fold, "bsuw#<1", TOYFLAG_USR|TOYFLAG_BIN))
 USE_FREE(NEWTOY(free, "tgmkb[!tgmkb]", TOYFLAG_USR|TOYFLAG_BIN))
 USE_FREERAMDISK(NEWTOY(freeramdisk, "<1>1", TOYFLAG_SBIN|TOYFLAG_NEEDROOT))